RFR: 8200113: Make Access load proxys smarter (original) (raw)

Erik Ă–sterlund erik.osterlund at oracle.com
Thu Mar 22 16:03:58 UTC 2018


Looping in hotspot-dev.

/Erik

On 2018-03-22 15:19, Erik Ă–sterlund wrote:

Hi,

Access returns the result of loads through load proxy objects that implicity convert themselves to a template inferred type. This is a metaprogramming technique used to infer return types in C++. However, I have heard requests that it would be great if it could be a bit smarter and do more than just be assigned to a type. Example use cases that do not work today without workarounds: oop val = ...; narrowOop narrow = 0u; oop *oopval = &val; narrowOop *narrowval = &narrow; HeapWord *heapwordval = reinterpretcast<HeapWord*>(oopval); if (val == HeapAccess<>::ooploadat(val, 16)) {} if (HeapAccess<>::ooploadat(val, 16) == val) {} if (val != HeapAccess<>::ooploadat(val, 16)) {} if (HeapAccess<>::ooploadat(val, 16) != val) {} if (HeapAccess<>::oopload(oopval) != val) {} if (HeapAccess<>::oopload(heapwordval) != val) {} if (RawAccess<>::oopload(narrowval) != narrow) {} if (HeapAccess<>::oopload(oopval) == val) {} if (HeapAccess<>::oopload(heapwordval) == val) {} if (RawAccess<>::oopload(narrowval) == narrow) {} if (val != HeapAccess<>::oopload(oopval)) {} if (val != HeapAccess<>::oopload(heapwordval)) {} if (narrow != RawAccess<>::oopload(narrowval)) {} if (val == HeapAccess<>::oopload(oopval)) {} if (val == HeapAccess<>::oopload(heapwordval)) {} if (narrow == RawAccess<>::oopload(narrowval)) {} if ((oop)HeapAccess<>::oopload(oopval) == NULL) {} oop tmp = true ? HeapAccess<>::oopload(oopval) : val; Here is a patch that solves this: http://cr.openjdk.java.net/~eosterlund/8200113/webrev.00/ ...and here is the bug ID: https://bugs.openjdk.java.net/browse/JDK-8200113 Thanks, /Erik



More information about the hotspot-dev mailing list