Review Request JDK-8193325: StackFrameInfo::getByteCodeIndex returns wrong value if bci > 32767
mandy.chung at oracle.com
Thu Dec 14 19:29:28 UTC 2017
On 12/12/17 5:29 PM, John Rose wrote:
> On Dec 12, 2017, at 5:24 PM, David Holmes <david.holmes at oracle.com
> <mailto:david.holmes at oracle.com>> wrote:
>> as per getByteCodeIndex() it needs to be able to store "-1" to
>> indicate no-bci?
> Yes, that's the essential requirement, to encode a "none" value.
> FWIW, one natural way to do that here would be to make the int field
> @Stable and have the accessor return one less than the stored field value.
> Then, by the rules of @Stable, the field starts out at the logical value
> of -1, and can transition to a valid BCI if patched to a non-zero value
> in the range 1..(2^16).
Thanks for suggesting @Stable that would help this case. I can't
understand why the field has to be patched with non-zero value. Is this
something special requirement for @Stable?
> Making it "final" and initialized to -1 is not too terrible either,
> that creates some tech. debt we need to discharge when upgrading
> finals to be trustable.
More information about the core-libs-dev