chapel-lang / chapel

a Productive Parallel Programming Language
https://chapel-lang.org
Other
1.8k stars 421 forks source link

How to / should we preserve old-style runtime nil checking? #13625

Open vasslitvinov opened 5 years ago

vasslitvinov commented 5 years ago

The following code, compiled in the --legacy-nilable-classes mode:

var x: MyClass;
... possibly set x to a non-nil ...
x.myMethod();

upon x.myMethod() at run time invokes the nil check that we have had for a long time, one that is disabled upon --fast.

When switching to --no-legacy-nilable-classes, x has to be given a nilable type and the method call has to be preceded by x!. This is a different kind of check.

This issue inquires whether the old-style runtime nil check will still live in the world where there is no --legacy-nilable-classes, and if so, how to write a test to exercise it.

Right now it is tested with:

test/classes/diten/callNilClassesMethod.chpl
test/classes/diten/nilDynamicDispatch.chpl

Meta: this is applicable only when we remove the legacy-nilable-classes option.

mppf commented 5 years ago

I don't think this question is urgent in any way. The old-style runtime check can be there, even if it is unnecessary, and it will be omitted on --fast compiles so it arguably shouldn't impact performance-oriented compiles. I think we should revisit this after the 1.20 release.