NPE when rewriting stack trace
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Wed Nov 27 13:12:20 UTC 2019
Hi,
I was experimenting with the Panama memory access API in jshell and I
got this:
jshell> arr_elem_h.set(segment.baseAddress(), 4, 3);
| Exception java.lang.IndexOutOfBoundsException: Out of bound access on
segment MemorySegment{ id=0x60ec3cd3 limit: 40 }; new offset = 40; new
length = 8
| at MemorySegmentImpl.checkBounds (MemorySegmentImpl.java:201)
| at MemorySegmentImpl.checkRange (MemorySegmentImpl.java:180)
| at MemoryAddressImpl.checkAccess (MemoryAddressImpl.java:86)
| at VarHandleMemoryAddressAsDoubles.checkAddress
(VarHandleMemoryAddressAsDoubles.java:55)
| at VarHandleMemoryAddressAsDoubles.set0
(VarHandleMemoryAddressAsDoubles.java:80)
| at VarHandleMemoryAddressAsDoubles1/0x0000000800b9f440.set
(Unknown Source)
| at VarHandleGuards.guard_LII_V (VarHandleGuards.java:719)
| at (#9:1)
The following patch (discussed with Jan) fixes it:
http://cr.openjdk.java.net/~mcimadamore/panama/8234814_v3/src/jdk.jshell/share/classes/jdk/jshell/Eval.java.udiff.html
For now I've refrained from fixing this in Panama directly - as it will
probably be better to fix it more generally in the upstream JDK (after
all, we can have VarHandle or MethodHandle throwing exceptions w/o
Panama as well).
If you want I can go ahead an file a bug for this
Maurizio
More information about the kulla-dev
mailing list