Conversation
Codecov Report
@@ Coverage Diff @@
## master #232 +/- ##
=======================================
Coverage 81.13% 81.14%
=======================================
Files 182 182
Lines 11938 11968 +30
=======================================
+ Hits 9686 9711 +25
- Misses 2252 2257 +5
Continue to review full report at Codecov.
|
| %init = insertvalue %Num undef, i64 %0, 0 | ||
| %new_ptr = load i8** (i8*, i8*)*, i8** (i8*, i8*)** getelementptr inbounds (%DispatchTable, %DispatchTable* @dispatchTable, i32 0, i32 0) | ||
| %Num_ptr = load %struct.MunTypeInfo*, %struct.MunTypeInfo** getelementptr inbounds ([5 x %struct.MunTypeInfo*], [5 x %struct.MunTypeInfo*]* @global_type_table, i32 0, i32 2) | ||
| %type_info_ptr_to_i8_ptr = bitcast %struct.MunTypeInfo* %Num_ptr to i8* | ||
| %allocator_handle = load i8*, i8** @allocatorHandle | ||
| %new = call i8** %new_ptr(i8* %type_info_ptr_to_i8_ptr, i8* %allocator_handle) | ||
| %Num_ptr_ptr = bitcast i8** %new to %Num** | ||
| %Num_mem_ptr = load %Num*, %Num** %Num_ptr_ptr | ||
| store %Num %init, %Num* %Num_mem_ptr | ||
| %mem_ptr = load %Num*, %Num** %Num_ptr_ptr |
There was a problem hiding this comment.
Future Work
This is a great example of where we can optimise a lot by using a struct(value) instead of a struct(gc). For temporaries (or scoped struct instances) it doesn't really make sense to allocate them on the heap.
There was a problem hiding this comment.
That would be great! But the use case is quite small, it's only when you construct a GC struct that doesn't leave the scope of the function at all (otherwise you can't make guarantees). Nonethess, if we can catch that in the compiler and turn it into a stack allocation, that would be great!
40d113f to
6e3688a
Compare
6e3688a to
77b5590
Compare
77b5590 to
8470812
Compare
8470812 to
8078734
Compare
Fixes an issue where taking the field of a temporary crashed the compiler. This was caused by a field expression always expecting a "place" expression which is actually not always the case (in the case of a temporary for example).
Closes #225