-
Notifications
You must be signed in to change notification settings - Fork 253
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
refactor reflect.SliceHeader uses to allow tinygo cross-compilation #2161
Conversation
Signed-off-by: gram <git@orsinium.dev>
Signed-off-by: gram <git@orsinium.dev>
Do we need this now that we floor on 1.20? |
Signed-off-by: gram <git@orsinium.dev>
What does it mean? Do you ask me? Sorry, I'm out of the loop. I build my changes on top of the latest
It would be great to get rid of it eventually since it is deprecated but I'd be glad if we can get Wazero compiling to TinyGo without blocking it with refactoring. The fork we have for TinyGo is already far behind the upstream, and keeping it up-to-date is hard. |
wazero has a policy of supporting current Go version minus 2. Today, that means Go 1.20.
Does TinyGo support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK… so, I'm sorry.
I see that in most places were using the deprecated reflect.SliceHeader
to skirt around a go vet
warning: possible misuse of unsafe.Pointer.
So we need to pick our poison. If we do stick with reflect.SliceHeader
, we should remove the TODOs for updating to unsafe.Slice
.
I'm still pretty sure this is skirting around the rules, not fixing anything, otherwise this would be a fine way to avoid the "you're reviving a uintptr
which might break the GC and you really shouldn't" problems we were having.
Anyway, this is a longer, hairier, discussion which shouldn't block this PR.
Signed-off-by: gram <git@orsinium.dev>
@ncruces applied code suggestions ✅ |
since |
Signed-off-by: gram <git@orsinium.dev>
Applied suggestion ✅ |
merging this, but I am not sure why tinygo is reaching this sub-package at all. It would be worth investigating if it's possible to drop the entire surface of the compiler. |
The
Len
andCap
fields ofreflect.SliceHeader
areint
in Go anduintptr
in TinyGo. The PR adjusts all places that set these fields to be compatible with both Go and TinyGo.Related issue: #1854