For the tokenization, I have switched from a hand-written tokenizer to re2c. It provided a nice boost to the compilation speed almost for free. I have also implemented caching for common number literals (0-9) and identifier names for another small boost.
With encoding, once I decided to ignore possible machine code size improvements from a relaxation step, I have realized that I could eagerly turn assembly instructions into bytes which save a whole lot of memory and some compilation speed. You can see me working on it in a YouTube video.
The big thing with functions is the basic support for generic arguments. Right now there is no way to constrain the type when matching overload, but even this basic functionality allowed moving type definitions of some of the compiler intrinsics into the user land:
1 2 | type_of :: @fn(x) -> (Type) PRELUDE_MASS.type_of size_of :: @fn(x) -> (Number_Literal) PRELUDE_MASS.size_of |
Generic function support also tightened up internals quite a bit allowing to move allowing to move some of the previously intrinsics to the user land. The main example of this is the fixed-size array type function:
1 2 3 4 5 6 7 8 9 10 11 12 | Array :: fn(item : Type, length : u64) -> (Type) { mass :: PRELUDE_MASS byte_size :: mass.Descriptor.bit_size.as_u64 * 8 byte_alignment :: mass.Descriptor.bit_alignment.as_u64 * 8 t : Type = mass.allocator_allocate_bytes(mass.allocator, byte_size, byte_alignment) t.tag = mass.Descriptor_Tag.Fixed_Size_Array t.bit_size.as_u64 = item.bit_size.as_u64 * length t.bit_alignment = item.bit_alignment t.Fixed_Size_Array.item = item t.Fixed_Size_Array.length = length t } |
There were also a bunch of smaller notable changes:
- Linux Syscall Support
- Basic Tuple Support
- Support specifying output path for the CLI
- Moved arithmetic operator definitions to the user land
- Support bulding with Clang-CL on Windows
- Significantly simplify and speed up `using` implementation