RFR JDK-8193325: StackFrameInfo::getByteCodeIndex returns wrong value if bci > 32767

David Holmes david.holmes at oracle.com
Mon Aug 12 23:30:43 UTC 2019


On 13/08/2019 8:55 am, Mandy Chung wrote:
> On 8/12/19 3:28 PM, David Holmes wrote:
>> Hi Mandy,
>>
>> On 13/08/2019 6:24 am, Mandy Chung wrote:
>>> Having a second thought, I'm keeping @Stable bci field while zero 
>>> indicates an invalid BCI that makes it obvious that this field will 
>>> be updated.  VM will set StackFrameInfo::bci to value+1.
>>
>> I don't know this code but why have the VM set the value one too many 
>> and then have the Java code subtract one again. ???
> 
> I keep it as @Stable field be initialized once by VM and it means that 0 
> indicates an invalid bci.   It could be made as final field but 
> initialized in the constructor to -1 and then set by VM.  I opt for 
> webrev.03 to make it clear it's initialized later by the VM once.

I see, so the zero is a constraint of it being @Stable. So we offset by 
1 at both ends so that we return -1 when not set. Otherwise we'd need to 
special-case for zero.

Okay I get it. Thanks. Not a review though as I do not know this code.

David

> Mandy


More information about the core-libs-dev mailing list