[lworld] Handling of missing ValueTypes attributes

Ioi Lam ioi.lam at oracle.com
Mon Jul 9 22:44:24 UTC 2018


In lworld, how are we suppose to handle cases where the ValueTypes 
attribute should have been there for a classfile, but is missing?

E.g.,

   class MyHack {
       Point getPoint() {
           if (onceInAWhile) {
               return Point.makePoint(1, 2);
           } else {
               return null;
           }
       }
   }

Normally, Point will be included in MyHack's ValueTypes attribute, and 
the Point class will be aggressively loaded. So we'd know for sure that 
getPoint returns a ValueType.

However, someone can write this class by hand and omit the ValueTypes 
attribute. In that case, I think the program's output should be the same 
as if the ValueTypes attribute had been present, although performance 
may differ (slower, more heap allocations, etc).

Is this understanding correct?


Thanks
- Ioi



More information about the valhalla-dev mailing list