On May 23, 2011, at 3:44 PM, Tom Rodriguez wrote:

>> I'd *love* for intermediate static Java snippits like this to inline
>> straight through, even if invokeExact would be megamorphic under
>> normal circumstances...but I don't think that's the case right now,
>> right?
> 
> I haven't been following 292 that closely but it used to be a piece of code 
> that did precisely that.
> 
> +        private Object invoke_L0() throws Throwable {
> +            if ((boolean) test.invokeExact())
> +                return target.invokeExact();
> +            return fallback.invokeExact();
> +        }
> 
> It looks like it was reworked at some point to use selectAlternative but the 
> optimizer was never updated to deal with it properly.  It's not particularly 
> hard, we just need to generate code like we would for a bimorphic call site.  
> The current code expects to either get a constant or something else and 
> doesn't inline if it's something else.  In this case we have a Phi of two 
> constants which we just need to split.

Yes, it would be a quasi-bimorphic call site keyed from a phi of two constants, 
instead of a profile of two receiver classes.

> I'm still unclear why you couldn't write your own variant of guardWithTest 
> and have it work but my knowledge of what's really allowed is somewhat 
> limited.

Those snippets will inline (I think), but at some point Charlie will want to 
fetch a bit of constant stuff out of an instance variable.  That will look 
non-constant to the optimizer, even if the instance variable is final and the 
enclosing object is a constant reference.  We made sure this happens for 
java.lang.invoke classes, but we haven't extended it yet to user code, in part 
because it would have its own bug tail to work through.

-- John
_______________________________________________
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

Reply via email to