| Age | Commit message (Collapse) | Author |
|
|
|
|
|
This makes the difference between `decl.getOwnedFunction` and
`decl.val.getFunction` more clear when reading the code.
|
|
|
|
|
|
|
|
|
|
|
|
I'm not sure if this is the right place for this to happen, and
it should become obsolete when comptime mutation is rewritten
and the remaining legacy value tags are remove, so keeping this
as a separate revertable commit.
|
|
Some uses have been moved to their own tag, the rest use interned.
Also, finish porting comptime mutation to be more InternPool aware.
|
|
|
|
Reinstate some tags that will be needed for comptime init.
|
|
|
|
|
|
|
|
|
|
|
|
Now, all types are migrated to use `InternPool`. The `Type.Tag` enum is
deleted in this commit.
|
|
This allows some code (like struct initializers) to use interned types
while other code (such as comptime mutation) continues to use legacy
types.
With these changes, an `zig build-obj empty.zig` gets to a crash on
missing interned error union types.
|
|
One change worth noting in this commit is that `module.global_error_set`
is no longer kept strictly up-to-date. The previous code reserved
integer error values when dealing with error set types, but this is no
longer needed because the integer values are not needed for semantic
analysis unless `@errorToInt` or `@intToError` are used and therefore
may be assigned lazily.
|
|
Now pointer types are stored only in InternPool.
|
|
|
|
|
|
I'm seeing a new assertion trip: the call to `enumTagFieldIndex` in the
implementation of `@Type` is attempting to query the field index of an
union's enum tag, but the type of the enum tag value provided is not the
same as the union's tag type. Most likely this is a problem with type
coercion, since values are now typed.
Another problem is that I added some hacks in std.builtin because I
didn't see any convenient way to access them from Sema. That should
definitely be cleaned up before merging this branch.
|
|
These are now handled by the InternPool.
|
|
|
|
Unlike unions and structs, enums are actually *encoded* into the
InternPool directly, rather than using the SegmentedList trick. This
results in them being quite compact, and greatly improved the ergonomics
of using enum types throughout the compiler.
It did however require introducing a new concept to the InternPool which
is an "incomplete" item - something that is added to gain a permanent
Index, but which is then mutated in place. This was necessary because
enum tag values and tag types may reference the namespaces created by
the enum itself, which required constructing the namespace, decl, and
calling analyzeDecl on the decl, which required the decl value, which
required the enum type, which required an InternPool index to be
assigned and for it to be meaningful.
The API for updating enums in place turned out to be quite slick and
efficient - the methods directly populate pre-allocated arrays and
return the information necessary to output the same compilation errors
as before.
|
|
|
|
|
|
|
|
|
|
This commit changes a lot of `*const Module` to `*Module` to make it
work, since accessing the integer tag type of an enum might need to
mutate the InternPool by adding a new integer type into it.
An alternate strategy would be to pre-heat the InternPool with the
integer tag type when creating an enum type, which would make it so that
intTagType could accept a const Module instead of a mutable one,
asserting that the InternPool already had the integer tag type.
|
|
|
|
This is a bit nasty, mainly because Type.onePossibleValue is now
errorable, which is a quite viral change.
|
|
|
|
|
|
|
|
This uses the data field to reference its pointer field type, which
allows for efficient and infallible access of a slice type's pointer
type.
|
|
|
|
|
|
Notably, `vector`.
Additionally, all alternate encodings of `pointer`, `optional`, and
`array`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This required additionally passing the `InternPool` into some AIR
methods.
Also, implement `Type.isNoReturn` for interned types.
|
|
Instead of doing everything at once which is a hopelessly large task,
this introduces a piecemeal transition that can be done in small
increments at a time.
This is a minimal changeset that keeps the compiler compiling. It only
uses the InternPool for a small set of types.
Behavior tests are not passing.
Air.Inst.Ref and Zir.Inst.Ref are separated into different enums but
compile-time verified to have the same fields in the same order.
The large set of changes is mainly to deal with the fact that most Type
and Value methods now require a Module to be passed in, so that the
InternPool object can be accessed.
|