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
cmd/compile: compiler cannot handle large / complex structs #44155
Comments
Thank you for the reproduction. |
We have a hardcoded limit of 65535 bytes for a type name. Unnamed struct types can get really long names. (As a workaround for now, it may help to pull out some of those structs into separate type declarations. That gives them names so they can be encoded in smaller strings.) |
It would probably be moderately safe to use a 65536 byte hash for symbol names that would otherwise be longer. |
I've never worked on the compiler before so I'm not sure how hard or easy this would be, but I'd like to give it a shot! Is the idea of using a hash of the symbol name an acceptable solution? (I suppose the part of the hash being 65536 bytes long was the joke, right? 😅) |
I think the easiest fix is just to allow longer names. |
Sorry for the belated answer. I removed the size check altogether and strangely enough, ./all.bash passed! Now I'm trying to figure out just how longer the names should be (eg. allow 8 more bits), or if the limit can be completely abolished? What's your view? As I'm reading through how the static name encoding works, and I think that to avoid making other changes, the returned |
Yes, as long as the offset fits in 32 bits we should be fine. A few things go in that entry, so I don't think we can go to a full 32 bits for just the name. 24 is the next obvious threshold. |
Change https://golang.org/cl/318249 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I wrote script to generate a struct that matched the input/output from an API (EdgeOS). The resulting struct is rather large, the code example below is only a portion. Running
go build
fails.What did you expect to see?
I expected
go build
to complete.What did you see instead?
truncated
Thanks to @davecheney who recommended I open a new issue, and not simply tag onto #18920.
Go Playground cannot handle the code for sharing either. Here is a complete example :
Example Code
The text was updated successfully, but these errors were encountered: