-
Notifications
You must be signed in to change notification settings - Fork 906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
runtime should pass layout info to alloc() when possible #4479
Comments
Tried a quick POC below
but got an interp panic:
Seems like we'll either need to get the compiler to inject the pointer to the appropriate type layout, or figure out a way to get access to the existing symbol. I'm concerned that fixing interp will actually move more of those string computations away from the interp phase and into runtime, which is sadly backwards from what we want. |
Other requirements: we probably also need the ability to get a layout ptr given a reflect type, and possibly at compile time too (using some sort of compiler lowering pass from a fake method call). |
Realized where I went wrong here; I should be able to create constant layouts for |
Correct, you can also look at what the compiler generates in an equivalent case: tinygo/compiler/testdata/gc.ll Line 105 in ef4f46f
So for |
Right now we only have layout info for allocations created via the compiler. We should make it possible for the runtime to pass layout info for common types at least ([]byte, []string, etc).
The text was updated successfully, but these errors were encountered: