Can constants loaded by ldc and ldc_w ever be null?

John Rose John.Rose at Sun.COM
Fri Mar 13 15:54:04 PDT 2009


On Mar 13, 2009, at 6:22 AM, Gary Benson wrote:

> Keith McGuigan wrote:
>> Gary Benson wrote:
>>> This is hopefully a quick question.  Is it ever possible for
>>> an ldc or ldc_w instruction to return a null result?
>>
>> No.  It gets the value out of the constant pool (index > 0),
>> which, as far as I can tell, can't encode null.
>
> Cool.  Do you know if it would be possible for a user to override
> it, in a debugger for example?

The anonymous classes feature (internal to hotspot, from the Da Vinci  
Machine project) allows anonymous classes to be loaded with 'String'  
CP entries edited to arbitrary non-null references.  But it doesn't  
allow null.

-- John



More information about the hotspot-dev mailing list