RFR(S): 8209702: [lworld] C2 compilation fails with "assert(argument(0)->bottom_type()->isa_ptr()) failed: must be"

Tobias Hartmann tobias.hartmann at oracle.com
Wed Aug 22 12:16:35 UTC 2018


Hi Roland,

thanks for the review!

On 20.08.2018 17:55, Roland Westrelin wrote:
> I wonder if it's sufficient to:
> 
> 4373           assert(!obj->is_ValueType(), "value types don't support cloning");
> 
> i.e. if that's really impossible. Profile data could be inaccurate for
> that code path I suppose.

It took me a while and I've found a bug in mainline while trying to come up with a test for this
(8209833) but it's possible. Since Object.clone() is protected, it can usually only be called from
within a method of a deriving class (see test1). In this case the receiver is statically known to be
a value type and we will bail out of the intrinsic code before reaching the assert (and value types
cannot inherit from anything other than interfaces).

However, we can call Object.clone() on a value type receiver by making it accessible through
reflection. C2 will still try to predict the call and speculate on the receiver type but we can
disable that via -XX:-UseTypeProfile.

Here's the new webrev:
http://cr.openjdk.java.net/~thartmann/8209702/webrev.01/

I changed the implementation such that we now always take the slow path instead of bailing out if
the receiver is a value type.

Thanks,
Tobias



More information about the valhalla-dev mailing list