JuliaLang/julia — pull request #8827 by simonster (2014-10-27 19:55:39+00:00)
Title: Avoid undefined checks for types that are always fully initialized

The approach is as follows:

- Types get an `undeffree` field that specifies whether they may contain undefined references.
- The front-end checks for calls to `new` in the type block where the number of arguments is not equal to the number of fields. (Not sure I did this right, since I don't really know Scheme.) If no such cases exist (or the type is a bits type), `undeffree` is set to true.
- In the codegen, `getfield` skips the undefined check for pointer fields if `undeffree` is true.

Another option would be to count the minimum number of arguments passed to `new` and skip undefined checks for fields at indices <= the minimum the type can be initialized with. I could probably do that (as long as the rest of this approach seems reasonable).

Ref #3440