You could use build tags to write a portable implementation and a (very) version-specific implementation. E.g. //go:build go1.18 && !go1.19 // go1.18-specific and //go:build (go1.8 && !go1.18) || go1.19 // not go1.18
We have ideas about changing the ABI in the future -- possible changes include - use the closure context pointer to pass the receiver to methods - don't reserve stack space for spilling in the prologue - perhaps reserve some registers for generational GC, if we ever do that On Monday, March 7, 2022 at 3:56:43 PM UTC-5 Ian Lance Taylor wrote: > On Mon, Mar 7, 2022 at 12:37 PM Richiise Nugraha <[email protected]> > wrote: > >> Hi i wonder if there's option to use register-based arguments, maybe like >> compiler directive or something? >> >> Expected result: >> But this one wasting r9 as function address. >> [image: unknown.png] >> >> >> What i got so far: >> But this is stack-based :/ >> [image: unknown.png] >> > > > Please always show text as plain text, not as images. Plain text is much > easier to read. I'm not even going to try to read your images; sorry. > > That said, there is no supported way to do this. You can indicate that an > assembly function uses the internal ABI, which is currently the register > ABI, by changing "(SB)" to "<ABInternal>" in the TEXT directive introducing > the function. However, as you can guess from the name, the internal ABI is > subject to change over time. See > https://go.googlesource.com/proposal/+/refs/heads/master/design/27539-internal-abi.md. > > So while it is possible to write such an assembly function today, it may > break in future releases. > > Ian > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/841077ea-cb74-4e0c-b17d-4cc8e61ffa0en%40googlegroups.com.
