Should be able to be used on all riscv64 platforms we support (Linux/riscv64) to implement JavaThread's "currentFrameGuess()" functionality. Input is an RISCV64ThreadContext; output is SP, FP, and PC for an RISCV64Frame. Instantiation of the RISCV64Frame is left to the caller, since we may need to subclass RISCV64Frame to support signal handler frames on Unix platforms.
Algorithm is to walk up the stack within a given range (say, 512K at most) looking for a plausible PC and SP for a Java frame, also considering those coming in from the context. If we find a PC that belongs to the VM (i.e., in generated code like the interpreter or CodeCache) then we try to find an associated FP. We repeat this until we either find a complete frame or run out of stack to look at.
| Modifier and Type | Field and Description |
|---|---|
| private RISCV64ThreadContext | |
| private static final boolean | |
| private Address | |
| private Address | |
| private Address | |
| private JavaThread |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Address | |
| public Address | getPC()
May be null if getting values from thread-local storage; take care to call the correct RISCV64Frame constructor to recover this if necessary |
| public Address | |
| public boolean | |
| private void |
| context | back to summary |
|---|---|
| private RISCV64ThreadContext context | |
| DEBUG | back to summary |
|---|---|
| private static final boolean DEBUG | |
| fpFound | back to summary |
|---|---|
| private Address fpFound | |
| pcFound | back to summary |
|---|---|
| private Address pcFound | |
| spFound | back to summary |
|---|---|
| private Address spFound | |
| thread | back to summary |
|---|---|
| private JavaThread thread | |
| RISCV64CurrentFrameGuess | back to summary |
|---|---|
| public RISCV64CurrentFrameGuess(RISCV64ThreadContext context, JavaThread thread) | |
| getFP | back to summary |
|---|---|
| public Address getFP() | |
| getPC | back to summary |
|---|---|
| public Address getPC() May be null if getting values from thread-local storage; take care to call the correct RISCV64Frame constructor to recover this if necessary | |
| getSP | back to summary |
|---|---|
| public Address getSP() | |
| run | back to summary |
|---|---|
| public boolean run(long regionInBytesToSearch) Returns false if not able to find a frame within a reasonable range. | |
| setValues | back to summary |
|---|---|
| private void setValues(Address sp, Address fp, Address pc) | |