Issue 13404 - heap-allocating a struct passes TypeInfo_Pointer to the GC, not TypeInfo_struct #941
Conversation
LGTM. |
LGTM |
Why do it here instead of change the compiler to pass the correct typeid? |
Depends on the definition of "correct" ;-) Maybe the passed type info contains some more info like shared or immutable which might be used later? |
I would assume the correct type is the type being new'd. And why would it matter what the tail type of the pointer is? |
I mean the head type, I think. |
If modifiers are not stripped from the type, removing the pointer type should be fine. But I'd say it should be in another PR (both in dmd and druntime). This just wants to fix the call to the GC. |
…o to the runtime, but the struct type info. The fix also provides a small performance improvement as it no longer calls the virtual function TypeInfo.next() multiple times
Ok, I made the respective changes here and to dmd: dlang/dmd#3935 |
Here goes... |
Issue 13404 - heap-allocating a struct passes TypeInfo_Pointer to the GC, not TypeInfo_struct
Thanks. I cannot wait for the result of the auto-tester now, so in case I blew it, please revert. |
It's all good. |
When allocating a struct with "new", do not pass the pointer type info to the GC, but the struct type info.
The fix also provides a small performance improvement as it no longer calls the virtual function TypeInfo.next() multiple times.
https://issues.dlang.org/show_bug.cgi?id=13404
This PR depends on dlang/dmd#3935