Null pointer check elimination

Per Bothner per@bothner.com
Sat Nov 12 21:14:00 GMT 2005


Tom Tromey wrote:
>>>>>>"Per" == Per Bothner <per@bothner.com> writes:
>>> Per> A type attribute is much more useful. For example it allows:
> Per> String x = shared ? "x" : new String("x");
> Per> // The type of x [in a single-assignment-world] is non-null.
>> I think we will need extra code to recognize that String references
> via the constant pool will never be null.
>> Since we make direct references to the constant pool (i.e., we don't
> emit a function call), a purely function-call-based approach to
> handling non-nullity won't be sufficient.

Right - the "type-variant" approach handles that smoothly.
I.e. in Java a string literal would have type
"never-null pointer to java.lang.String".
-- 
	--Per Bothner
per@bothner.com http://per.bothner.com/


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /