Request for reviews (S): 7009359: HS with -XX:+AggressiveOpts optimize new StringBuffer(null) so it does not throw NPE as expected

Vladimir Kozlov vladimir.kozlov at oracle.com
Tue Dec 28 16:53:44 PST 2010


Igor pointed me that null could be passed as argument so its value
will be not known during compilation.

Added null check with uncommon trap but using special Reason_intrinsic.
The test is updated to pass null as argument.

http://cr.openjdk.java.net/~kvn/7009359/webrev.01

Thanks,
Vladimir

Vladimir Kozlov wrote:
> http://cr.openjdk.java.net/~kvn/7009359/webrev
> 
> Fixed 7009359: HS with -XX:+AggressiveOpts optimize new 
> StringBuffer(null) so it does not throw NPE as expected
> 
> StringConcat optimization replace new StringBuffer(null).toString()
> with new String("null") because new StringBuffer.append(null) is
> producing such string. Passing null to StringBuffer constructor
> is a special case which was not checked.
> 
> Bailout StringConcat optimization if null is passed to
> StringBuffer constructor. Added regression test.
> 


More information about the hotspot-compiler-dev mailing list