Reference-default style

Dan Smith daniel.smith at oracle.com
Mon Feb 10 18:08:13 UTC 2020


> On Feb 8, 2020, at 10:08 PM, Dan Smith <daniel.smith at oracle.com> wrote:
> 
>> Actually
>> in HotSpot it does something:  For a class with a finalizer it registers something
>> somewhere.  But that’s precisely irrelevant to inlines.
> 
> Oh, yeah, if we need to make sure that code gets executed (for identity classes), that will affect the design.

In terms of actual code execution, it looks like there's nothing for the Object constructor to do:

  public java.lang.Object();
    descriptor: ()V
    flags: (0x0001) ACC_PUBLIC
    Code:
      stack=0, locals=1, args_size=1
         0: return
      LineNumberTable:
        line 50: 0
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0       1     0  this   Ljava/lang/Object;
    RuntimeVisibleAnnotations:
      0: #65()
        jdk.internal.HotSpotIntrinsicCandidate

If Hotspot wants to do some internal bookkeeping whenever a new instance gets created (either with the 'new' instruction or when, morally, Object.<init> would execute), of course it's free to do so.

So I'm tentatively proposing changing this bytecode to use ACC_ABSTRACT:

  public java.lang.Object();
    descriptor: ()V
    flags: (0x0001) ACC_PUBLIC, ACC_ABSTRACT

(How we actually achieve this in src/java.base/share/classes/java/lang/Object.java is TBD.)



More information about the valhalla-spec-observers mailing list