Tradeoffs around Node::Opcode()?

Vladimir Kozlov Vladimir.Kozlov at Sun.COM
Tue Mar 10 11:14:34 PDT 2009


Peter,

There is already such functionality exactly for such purpose.
The field is jushort _class_id; which use enum NodeClasses
and initializer in the constructors init_class_id().

Vladimir

Peter B. Kessler wrote:
> A lot of things in class Node are organized around having a dense 
> integer range to identify the Node.  That's Node::Opcode().
> 
> I'm wondering about the engineering around that method.  Node::Opcode() 
> is a virtual call, to get from a Node instance to a piece of data on the 
> Node subclass of the instance.  An alternative would be to add a data 
> field in Node to hold the opcode, and replace the virtual Node::Opcode() 
> calls with an inline method to return the contents of that slot.  That 
> trades the virtual dispatch cost for each call with a space cost in each 
> instance.
> 
> Does anyone have any feeling about whether that's a good tradeoff?  How 
> often is Node::Opcode() called?  What effect would it have to make it 
> run faster?  How important is it to minimize the size of Node 
> instances?  (There are other places where effort is expended to keep 
> Node's small.)
> 
> Thanks for any opinions on this.
> 
>             ... peter



More information about the hotspot-compiler-dev mailing list