Skip to content
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: switch to a register-based calling convention for Go functions #40724

Open
aclements opened this issue Aug 12, 2020 · 279 comments
Open
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. Proposal Proposal-Accepted
Milestone

Comments

@aclements
Copy link
Member

aclements commented Aug 12, 2020

I propose that we switch the Go internal ABI (used between Go functions) from stack-based to register-based argument and result passing for Go 1.16 1.17.

I lay out the details of our proposal and the work required in this document.

The ABI specification can be found here.

This was previously proposed in #18597, where @dr2chase did some excellent prototyping work that our new proposal builds on. With multiple ABI support, we’re now in a much better position to execute on this without breaking compatibility with the existing body of Go assembly code. I’ve opened this new issue to focus on discussion of our new proposal.

/cc @dr2chase @danscales @thanm @cherrymui @mknyszek @prattmic @randall77

An incomplete and evolving list of tasks:

  • Define ABI specification (CL, @aclements)
  • Add GOEXPERIMENT=regabi and asm macro (CL)
  • cmd/compile: late call lowering (CLs)
  • cmd/compile: implement register arguments (@dr2chase)
    • spill around morestack call (CL)
    • add temporary ABI pragma for testing (CL)
    • add abstract argument registers (WIP CL)
    • implement ABI rules (CL)
    • use abstract argument registers
  • cmd/compile: implement register returns
  • cmd/compile: ABI wrappers (CL, old CL)
    • cmd/link: mangle wrapper names for ELF (CL)
    • cmd/link: mangle wrapper names for PE (CL)
    • implement zeroing of X15 in ABI0->ABIInternal wrappers (CL)
  • cmd/asm: add syntax for runtime packages to reference ABIInternal symbols (CL)
    • Mark runtime.{goexit,asyncPreempt}, reflect.{makeFuncStub,methodValueCall} definitions ABIInternal (CL)
    • Mark reference to runtime.callbackWrap in sys_windows_amd64.s as ABIInternal (CL)
  • runtime: fix assembly closure calls (mcall) (@aclements, CL)
  • reflect: support calling ABIInternal (CL)
  • reflect: support MakeFunc and method value calls (CL)
  • go and defer statements
    • cmd/compile: desugar go/defer to zero-argument (@thanm, CL)
    • cmd/compile: fix defer recover() (@cherrymui, CL)
    • cmd/compile: desugar go/defer with results (@cherrymui, CL)
  • cmd/cgo: decouple cgo callbacks from ABI (CL)
  • runtime: finalizer support (CL)
  • runtime: Windows callback support (CL)
  • cmd/internal/obj: introduce and use RegEntryTmp registers in prologue (@mknyszek, CL)
  • cmd/compile: generate correct ABI0 argument maps for body-less functions (see WriteFuncMap) (@dr2chase, CL)
  • cmd/compile: make cgo_unsafe_args generate an ABI0 function (or an ABIInternal-with-no-registers function) (@cherrymui, CL)
  • runtime: update debug call protocol (CL)
  • Fix ABI0/ABIInternal confusion in cgo (CL)
  • Run signature fuzzer and fix bugs (everyone)
  • Get all.bash to pass on Linux, Windows, and Darwin (everyone)

High-priority non-critical path

  • Export ABI information across package boundaries to eliminate more wrappers (@aclements, CL)
  • Make funcPC always return the "native" PC of a function (maybe also introduce ABIOther) (@cherrymui, CL)
  • Strip unnecessary ABIInternal annotations once funcPC is in
  • Tracebacks
    • Define extended argument metadata format (in progress, @cherrymui)
    • cmd/compile: produce extended argument metadata (@cherrymui, CL)
    • runtime: consume extended argument metadata (@cherrymui, CL)
    • cmd/compile,runtime: traceback metadata for spill slot liveness
  • DWARF
    • cmd/compile: ensure arguments have appropriate DWARF locations
    • Ensure GDB and Delve can find register arguments
    • [ ] cmd/compile: add a DWARF vendor attribute with function argument frame size (context)
  • Wrapper mangling for non-critical arches
    • cmd/link: mangle wrapper names for Mach-O (CL)
    • cmd/link: mangle wrapper names for xcoff
    • cmd/link: mangle wrapper names for Plan 9
  • runtime: simplify go/defer call paths
    • assert that go/defer frames are zero sized (CL)
    • replace defer reflectcall with a direct closure call (CL)
  • cmd/internal/obj: reject splittable ABIInternal functions without morestack spill info (e.g., asm functions) because we can't generate a correct morestack path (CL)
  • cmd/asm: don't reference args_stackmap in ABIInternal functions (because it's for ABI0) (CL)
  • Port performance-critical assembly to ABIInternal (see CL 296372 for valuable functions) (CL 308931, CL 310184)
  • math: fix overhead of assembly->Go calls CL 310331
  • Release notes
    • Mention undocumented behavior we've observed applications depending on that may have changed.
      • Using reflect.ValueOf(fn).Pointer() to get the PC of an assembly function will now return the PC of the ABI wrapper
    • Performance surprise: calling from assembly to Go is slightly more expensive.
    • Performance surprise: calling an assembly function via a closure is slightly more expensive.
    • Traceback format is much improved

Enabling steps

  • Enable regabiwrappers by default on amd64 (Linux, Windows, and Darwin)
  • Enable regabidefer
  • Enable regabireflect
  • Enable regabig
  • Enable regabiargs

Testing

  • Function signature fuzzer (ongoing)
    • Static call, closure call, method call, interface call, reflect.{ValueOf(target),MakeFunc(x, target),Method(x)}.{Call,Interface}, called from defer, called from go, called as a finalizer
    • {Big,Small} {argument,result} in {memory,registers} and {not addressed,addressed and not leaked to heap,addressed and leaked to heap}
    • Use defer in a test function (check arguments, modify results)
    • Pass pointers-to-stack and pointers-to-heap
    • Cause result to move to heap
    • runtime: add MoveStackOnNextCall, assertions for pointer-to-stack/pointer-to-heap, assertions for live/dead (@aclements, CL)
    • Integrate runtime testing hook
    • Clean up fuzzer, and get into tools repo.
  • cmd/compile: revive clobberdead (CL)
  • cmd/compile: add clobberdeadreg (CL)

Post-MVP

  • Move g from TLS to register (CL)
    • Use g register on non-Linux OSes (see CL)
  • Reserve and use X15 as zero register (CL)
    • [ ] Should this be X0 for more compact instruction encoding?
  • Port to other platforms
    • amd64
    • arm64
    • mips
    • ppc
    • s390x
    • risc-v
    • [ ] porting guide
  • Eliminate legacy ABI paths for all platforms, even if they're using ABIInternal with 0 registers
  • Eliminate spill slots?
  • Pass pointer-shaped method receiver in context register (cmd/compile: pass pointer-shaped receivers using context register #44827)
  • runtime: simplify go/defer call paths
    • simplify go/defer paths to assume zero args/results
    • simplify special _defer allocator and remove special _defer cases from mallocgc (because _defer records will be fixed size).
  • cmd/vet: add syntax and checks for register arguments and results in assembly like x+0(FP)
  • cmd/vet: check argument size for ABIInternal functions and fix runtime asm declarations

Cleanup (can be done later)

  • runtime: port all assembly -> Go calls to ABIInternal?
  • Eliminate ABIAlias support from cmd/compile, cmd/link, and object format
  • remove now-redundant fields from ssa.AuxCall
  • rationalize use of LocalsOffset/FrameOffset (for registers that use a link register, e.g. arm64, powerppc).
  • cmd/compile: revisit abiutils.go and clean up the API (also reduce ABIConfig copying)
  • cmd/internal/obj: generate stack maps in obj so we can better compact the morestack/body maps and reduce subtlety?
  • cmd/compile,runtime: re-enable passing arguments to go in runtime (context)
  • cmd/compile: always attach ir.Func to function ir.Names (context)
  • cmd/compile: support ABIInternal for tail calls (context)
  • cmd/compile: once wrapping of defers is on for all arch/OS combinations, it should be possible to simplify or remove some of the openDefer processing in ssagen (notablly we could get rid of openDeferSave()
  • [ ] runtime: think about an ABI-insensitive debugCall Delve uses DWARF information
  • Fix up named slots & value association
  • fix firstpos in ssa.go – sometimes it's late.
@aclements aclements added this to the Go1.16 milestone Aug 12, 2020
@seebs
Copy link
Contributor

seebs commented Aug 12, 2020

Once upon a time, I was one of several people whose primary work activity for I think two days was tracking down a weird kernel crash, which was ultimately caused by callee-saved registers. Well, the crash was caused by a [FOO_MAX] array being overrun. But the thing where the result of that overrun was to overwrite a single automatic variable, which never had its address taken, five call frames away? That was caused by callee-saved registers.

Which is to say:

Platform ABIs typically define callee-save registers, which place substantial additional requirements on a garbage collector. There are alternatives to callee-save registers that share many of their benefits, while being much better suited to Go.

+1 +1 +1 +1 +1 +1 [...]

@ncw
Copy link
Contributor

ncw commented Aug 13, 2020

If I'm understanding the proposal correctly, assembler code will continue to be written with the current stack based calling conventions.

I understand the excellent reasoning behind doing this, I'll just note that this is surely going to frustrate assembly code writers not being able to pass and receive args in registers as often assembly code fragments are tiny and the overhead of calling them is massive.

@mknyszek
Copy link
Contributor

@ncw This restriction to ABI0 for assembly writers isn't necessarily permanent. See https://go.googlesource.com/proposal/+/master/design/27539-internal-abi.md#proposal.

@laboger
Copy link
Contributor

laboger commented Aug 13, 2020

Right now writeBarrier is a special builtin that allows arguments to be passed in registers. Couldn't that same concept be extended to others like memmove and memcpy to avoid call overhead even though they are asm?

@aclements
Copy link
Member Author

@laboger , yes, we're considering special-casing just a few assembly functions. The hottest ones by far are memmove, memclrNoHeapPointers, and possibly syscall.Syscall. The write barrier calling convention is very specialized because its context is so unusual and performance-sensitive. We'll probably just switch the others to use the register ABI rather than anything more specialized (and teach the toolchain that those are special even though they're assembly).

@mknyszek
Copy link
Contributor

A comment on the "stack growth" section of the doc, specifically about spilling register state for morestack into the guard space for a goroutine (copied from Gerrit):

I worry a little bit about cases where functions marked nosplit eventually call into a non-nosplit function. If the nosplit frames are large (but don't exceed the guard space) we might find out that we don't have any space left. What should we do in this case? Throwing doesn't seem quite right since this works just fine today (though, you have to be careful). Should we have "guard space" and a subset of that as "no, really, this is very guarded" space? That would require extending the guard space a bit further which isn't great...

One alternative is to manage per-goroutine space for this, but that's not great either, since its more memory used per goroutine.

@cherrymui
Copy link
Member

Good point. This is especially true for architectures that have a lot registers. Maybe we could decide that some registers are never live across a call?

@aclements
Copy link
Member Author

That's an excellent point. A few possible solutions come to mind:

  1. It would be really sad if we had to make more per-goroutine space for this since you almost always have space on the stack. One possibility is to spill to the stack if there's room, and otherwise we keep a pool of allocated "spill space" objects. For that, we could keep just one pre-allocated per P and if the goroutine needs it, it can pull it off the P, spill into it, and then once it's entered the runtime it can allocate a new one (probably getting it from a global allocation pool) and attach it to the P. On return, it can return it to the allocation pool.

  2. A similar option would be to have just one spill space per P. Again, use the stack if you can, otherwise spill into the P, enter the runtime, grow the stack even if it's just a preemption, and then dump the spilled registers back onto the stack in the right place.

  3. We could revisit the nosplit rules. It's often (though not always) a mistake to call from a nosplit function to a non-nosplit function. I'm not sure exactly what this would look like. Maybe a non-nosplit function called from a nosplit function has to have a special prologue? Related: cmd/compile, runtime: add and use go:nosplitrec compilation directive #21314 (comment). I think the only cases I enumerated in that comment that intentionally call from a nosplit to a non-nosplit function aren't running on a user G stack and thus can't grow it anyway.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/252258 mentions this issue: cmd/asm: define a macro for GOEXPERIMENT=regabi

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/252257 mentions this issue: cmd/internal/objabi: add regabi GOEXPERIMENT

gopherbot pushed a commit that referenced this issue Sep 3, 2020
This is the "feature flag" for the register calling convention work
(though since this work is expected to extend over a few releases,
it's not version-prefixed). This will let us develop the register
calling convention on the main branch while maintaining an easy toggle
between the old and new ABIs.

Updates #40724.

Change-Id: I129c8d87d34e6fa0910b6fa43efb35b706021637
Reviewed-on: https://go-review.googlesource.com/c/go/+/252257
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
gopherbot pushed a commit that referenced this issue Sep 3, 2020
This defines a macro for the regabi GOEXPERIMENT when assembling
runtime assembly code.

In general, assembly code will be shielded from the calling convention
change, but there is a small amount of runtime assembly that is going
to have to change. By defining a macro, we can easily make the small
necessary changes. The other option is to use build tags, but that
would require duplicating nontrivial amounts of unaffected code,
leading to potential divergence issues. (And unlike Go code, assembly
code can't depend on the compiler optimizing away branches on a
feature constant.) We consider the macro preferable, especially since
this is expected to be temporary as we transition to the new calling
convention.

Updates #40724.

Change-Id: I73984065123968337ec10b47bb12c4a1cbc07dc5
Reviewed-on: https://go-review.googlesource.com/c/go/+/252258
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/258938 mentions this issue: runtime,cmd/cgo: simplify C -> Go call path

@aclements
Copy link
Member Author

@alexbrainman , I just ran into a bit of a snag on Windows that maybe you can better inform me on. It looks like syscall.NewCallback is going to also need an implementation of the Go internal ABI rules and I'm trying to figure out exactly what that needs to look like. (I pinged you because it looks like you last substantially touched that code, but feel free to pass the ping.)

The documentation says "The argument is expected to be a function with one uintptr-sized result. The function must not have arguments with size larger than the size of uintptr." Does this actually mean the arguments (and result) must be an integral, floating-point, or pointer type? Or does it mean, say, struct { x, y uint16 } or struct { x [4]byte } is allowed, since those are technically no larger than the size of a uintptr? The current implementation permits the latter, though I don't know if it actually works.

If they must be int/float/pointer, then mapping from the Windows ABI to the Go register ABI is relatively straightforward. If compounds are allowed, then this gets much harder.

@networkimprov
Copy link

cc @jstarks re the ABI question.

@alexbrainman
Copy link
Member

@aclements I reckon there are very few instances of syscall.NewCallback usage. But they are used a lot.

If you want to build Windows GUI, you have to use syscall.NewCallback, because Windows GUI API requires syscall.NewCallback.

Similarly, if you want to build Windows service, you have to use syscall.NewCallback.

These two pretty much cover syscall.NewCallback usage.

For Windows service, you can look in golang.org/x/sys/windows/svc. It uses this RegisterServiceCtrlHandlerEx WIndows API

https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nf-winsvc-registerservicectrlhandlerexw

which requires LPHANDLER_FUNCTION_EX

https://docs.microsoft.com/en-us/windows/win32/api/winsvc/nc-winsvc-lphandler_function_ex

so LPHANDLER_FUNCTION_EX returns DWORD (uint32).

For GUI grep in golang.org/x/exp/shiny - it uses RegisterClass

https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-registerclassw

which uses WNDCLASSW.lpfnWndProc

https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-wndclassw

which is WNDPROC

https://docs.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ms633573(v=vs.85)

which returns LRESULT which is LONG_PTR or uintptr (in Go)

https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types

Also I recommend you look at github.com/lxn/walk for their syscall.NewCallback usage. This is an ultimate package to create GUI apps. But, I doubt, you will find different usage than golang.org/x/exp/shine. (I did not look myself)

I reckon, that is about it. For Microsoft APIs (maybe google code for syscall.NewCallback or windows.NewCallback).

But some people might use it in their custom / proprietary interface. I am not sure how these are supported by Go. You will be the judge.

Alex

@CAFxX
Copy link
Contributor

CAFxX commented Oct 3, 2020

IIUC this example in the microsoft docs shows that compounds are allowed:

struct Struct2 {
   int j, k;    // Struct2 fits in 64 bits, and meets requirements for return by value.
};
Struct2 func4(int a, double b, int c, float d);
// Caller passes a in RCX, b in XMM1, c in R8, and d in XMM3;
// callee returns Struct2 result by value in RAX.

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/262197 mentions this issue: go/analysis/passes/asmdecl: add support for ABI selector clauses

gopherbot pushed a commit to golang/tools that referenced this issue Oct 14, 2020
Accept ABI selector clauses for function definitions. The assembler
allows these clauses when compiling the runtime, so the checker needs
to be able to digest them as well.

Updates golang/go#40724

Change-Id: I49ea4d87450c498bdfe10a8c441b48fcf70bea7c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/262197
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/262319 mentions this issue: reflect,runtime: use internal ABI for selected ASM routines

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/262317 mentions this issue: cmd/dist,cmd/go: broaden use of asm macro GOEXPERIMENT_REGABI

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/259445 mentions this issue: cmd/compile,cmd/link: initial support for ABI wrappers

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/260477 mentions this issue: cmd/asm: allow def/ref of func ABI when compiling runtime

@gopherbot
Copy link
Contributor

Change https://golang.org/cl/262318 mentions this issue: cmd: go get golang.org/x/tools@d1624618 && go mod vendor

@ianlancetaylor ianlancetaylor added this to Incoming in Proposals (old) Oct 14, 2020
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/262117 mentions this issue: cmd/compile: delay expansion of OpArg until expand_calls

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/521786 mentions this issue: runtime: add regABI support in memclr and memmove functions on loong64

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/521779 mentions this issue: cmd/compile/internal: add register info for loong64 regABI

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/521783 mentions this issue: runtime: support regABI and add spill functions in runtime for loong64

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/521787 mentions this issue: cmd/internal/obj: set morestack arg spilling and regabi prologue on loong64

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/521778 mentions this issue: internal/abi: define loong64 regABI constants

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/521777 mentions this issue: cmd/compile,cmd/internal,runtime: change registers on loong64 to avoid regABI arguments

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/521775 mentions this issue: cmd/compile, cmd/internal, runtime: change the registers used by the duff device for loong64

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/521785 mentions this issue: internal/bytealg: add regABI support in bytealg functions on loong64

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/521782 mentions this issue: runtime: make duff device as ABIInternal for loong64

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/521780 mentions this issue: cmd/compile/internal: add spill support for loong64 regABI

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/521784 mentions this issue: reflect, runtime: add reflect support for regABI on loong64

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/521789 mentions this issue: runtime/internal/syscall: use ABIInternal for Syscall6 on loong64

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/521776 mentions this issue: cmd/compile: add ABI register definations for loong64

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/521790 mentions this issue: cmd/compile, internal/buildcfg: enable regABI on loong64, and add loong64 in test func hasRegisterABI

gopherbot pushed a commit that referenced this issue Nov 21, 2023
…duff device for loong64

Add R21 to the allocatable registers, use R20 and R21 in duff
device. This CL is in preparation for subsequent regABI support.

Updates #40724

Co-authored-by: Xiaolin Zhao <zhaoxiaolin@loongson.cn>
Change-Id: If1661adc0f766925fbe74827a369797f95fa28a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/521775
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopherbot pushed a commit that referenced this issue Nov 21, 2023
Updates #40724

Co-authored-by: Xiaolin Zhao <zhaoxiaolin@loongson.cn>
Change-Id: I56f7382dda58a565b8c3256f1c7845a3031f67de
Reviewed-on: https://go-review.googlesource.com/c/go/+/521776
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: David Chase <drchase@google.com>
Auto-Submit: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
gopherbot pushed a commit that referenced this issue Nov 21, 2023
…d regABI arguments

Update #40724

Co-authored-by: Xiaolin Zhao <zhaoxiaolin@loongson.cn>
Change-Id: Ic7e2e7fb4c1d3670e6abbfb817aa6e4e654e08d3
Reviewed-on: https://go-review.googlesource.com/c/go/+/521777
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Auto-Submit: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: David Chase <drchase@google.com>
gopherbot pushed a commit that referenced this issue Nov 21, 2023
Update #40724

Co-authored-by: Xiaolin Zhao <zhaoxiaolin@loongson.cn>
Change-Id: Id580d9e22a562adee2ae02a467ac38a54949e737
Reviewed-on: https://go-review.googlesource.com/c/go/+/521778
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: David Chase <drchase@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: David Chase <drchase@google.com>
gopherbot pushed a commit that referenced this issue Nov 21, 2023
Update #40724

Co-authored-by: Xiaolin Zhao <zhaoxiaolin@loongson.cn>
Change-Id: Ifd7d94147b01e4fc83978b53dca2bcc0ad1ac4e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/521779
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
gopherbot pushed a commit that referenced this issue Nov 21, 2023
Update #40724

Co-authored-by: Xiaolin Zhao <zhaoxiaolin@loongson.cn>
Change-Id: Ic01d59bd81420b89c6d4b90c5975bf069d08e7cc
Reviewed-on: https://go-review.googlesource.com/c/go/+/521780
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: David Chase <drchase@google.com>
gopherbot pushed a commit that referenced this issue Nov 21, 2023
allow the loong64 CALL* ops to take variable number of args

Update #40724

Co-authored-by: Xiaolin Zhao <zhaoxiaolin@loongson.cn>
Change-Id: I4706d9651fcbf9a0f201af6820c97b1a924f14e3
Reviewed-on: https://go-review.googlesource.com/c/go/+/521781
Auto-Submit: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: David Chase <drchase@google.com>
gopherbot pushed a commit that referenced this issue Nov 21, 2023
Update #40724

Co-authored-by: Xiaolin Zhao <zhaoxiaolin@loongson.cn>
Change-Id: I243e60489dc5fd162ad91d6426bf32cf0e13d9e2
Reviewed-on: https://go-review.googlesource.com/c/go/+/521782
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: David Chase <drchase@google.com>
gopherbot pushed a commit that referenced this issue Nov 21, 2023
Update #40724

Co-authored-by: Xiaolin Zhao <zhaoxiaolin@loongson.cn>
Change-Id: I709b818ef15c33f95251186d749ac13260ad36be
Reviewed-on: https://go-review.googlesource.com/c/go/+/521783
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Run-TryBot: David Chase <drchase@google.com>
Auto-Submit: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopherbot pushed a commit that referenced this issue Nov 21, 2023
Update #40724

Co-authored-by: Xiaolin Zhao <zhaoxiaolin@loongson.cn>
Change-Id: I0549fd1a2192ffb041034ff41bf0cc4be0b1662c
Reviewed-on: https://go-review.googlesource.com/c/go/+/521784
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopherbot pushed a commit that referenced this issue Nov 21, 2023
Update #40724

Co-authored-by: Xiaolin Zhao <zhaoxiaolin@loongson.cn>
Change-Id: I4a7392afd7238d44e7d09aaca7e0d733649926ac
Reviewed-on: https://go-review.googlesource.com/c/go/+/521785
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: David Chase <drchase@google.com>
gopherbot pushed a commit that referenced this issue Nov 21, 2023
Update #40724

Co-authored-by: Xiaolin Zhao <zhaoxiaolin@loongson.cn>
Change-Id: I55c78bab5c697ea6c30f9d81f5f8fb75abb3987c
Reviewed-on: https://go-review.googlesource.com/c/go/+/521786
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Run-TryBot: David Chase <drchase@google.com>
Auto-Submit: David Chase <drchase@google.com>
Reviewed-by: David Chase <drchase@google.com>
gopherbot pushed a commit that referenced this issue Nov 21, 2023
…oong64

Update #40724

Co-authored-by: Xiaolin Zhao <zhaoxiaolin@loongson.cn>
Change-Id: Ie92da57e29bae0e5cccb2a49a7cbeaf02cbf3a8d
Reviewed-on: https://go-review.googlesource.com/c/go/+/521787
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: David Chase <drchase@google.com>
gopherbot pushed a commit that referenced this issue Nov 21, 2023
Update #40724

Co-authored-by: Xiaolin Zhao <zhaoxiaolin@loongson.cn>
Change-Id: I44477e32db765e0299d8361bd2b8d2c95564ed28
Reviewed-on: https://go-review.googlesource.com/c/go/+/521788
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
gopherbot pushed a commit that referenced this issue Nov 21, 2023
Updates #40724

Co-authored-by: Xiaolin Zhao <zhaoxiaolin@loongson.cn>
Change-Id: Ifcc2de35a797fd987a10f564206b14b54d736d1d
Reviewed-on: https://go-review.googlesource.com/c/go/+/521789
Auto-Submit: David Chase <drchase@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: David Chase <drchase@google.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
gopherbot pushed a commit that referenced this issue Nov 21, 2023
…ng64 in test func hasRegisterABI

goos: linux
goarch: loong64
pkg: test/bench/go1
cpu: Loongson-3A5000 @ 2500.00MHz
                      │    bench.old   │    bench.new                         │
                      │    sec/op      │    sec/op      vs base               │
Template                  116.4m ± 1%     101.3m ± 0%   -12.94% (p=0.000 n=20)
Gzip                      417.2m ± 0%     419.4m ± 0%    +0.53% (p=0.000 n=20)
Gunzip                    87.41m ± 0%     84.61m ± 0%    -3.20% (p=0.000 n=20)
FmtFprintfEmpty           97.87n ± 0%     81.05n ± 0%   -17.19% (p=0.000 n=20)
FmtFprintfString          151.1n ± 0%     140.9n ± 0%    -6.75% (p=0.000 n=20)
FmtFprintfInt             155.6n ± 0%     143.0n ± 0%    -8.10% (p=0.000 n=20)
FmtFprintfIntInt          236.9n ± 0%     225.1n ± 0%    -5.00% (p=0.000 n=20)
FmtFprintfPrefixedInt     316.8n ± 0%     331.9n ± 0%    +4.77% (p=0.000 n=20)
FmtFprintfFloat           401.5n ± 0%     380.0n ± 0%    -5.35% (p=0.000 n=20)
FmtManyArgs               925.3n ± 0%     910.1n ± 0%    -1.64% (p=0.000 n=20)
BinaryTree17               14.04 ± 1%      12.84 ± 0%    -8.52% (p=0.000 n=20)
RegexpMatchEasy0_32       133.1n ± 0%     121.3n ± 0%    -8.87% (p=0.000 n=20)
RegexpMatchEasy0_1K       1.363µ ± 0%     1.337µ ± 0%    -1.91% (p=0.000 n=20)
RegexpMatchEasy1_32       162.7n ± 0%     152.6n ± 0%    -6.24% (p=0.000 n=20)
RegexpMatchEasy1_1K       1.505µ ± 0%     1.740µ ± 0%   +15.61% (p=0.000 n=20)
RegexpMatchMedium_32      1.429µ ± 0%     1.299µ ± 0%    -9.10% (p=0.000 n=20)
RegexpMatchMedium_1K      41.76µ ± 0%     38.16µ ± 0%    -8.61% (p=0.000 n=20)
RegexpMatchHard_32        2.094µ ± 0%     2.157µ ± 0%    +3.01% (p=0.000 n=20)
RegexpMatchHard_1K        63.25µ ± 0%     64.72µ ± 0%    +2.33% (p=0.000 n=20)
JSONEncode                18.00m ± 1%     17.46m ± 1%    -3.05% (p=0.000 n=20)
JSONDecode                79.49m ± 0%     72.42m ± 0%    -8.89% (p=0.000 n=20)
Revcomp                    1.147 ± 0%      1.255 ± 0%    +9.39% (p=0.000 n=20)
Fannkuch11                 3.623 ± 0%      3.410 ± 0%    -5.87% (p=0.000 n=20)
Fannkuch11                 3.623 ± 0%      3.410 ± 0%    -5.87% (p=0.000 n=20)
GobDecode                 14.26m ± 0%     12.92m ± 0%    -9.36% (p=0.000 n=20)
GobEncode                 16.86m ± 1%     14.96m ± 0%   -11.28% (p=0.000 n=20)
GoParse                   8.721m ± 0%     8.125m ± 1%    -6.84% (p=0.000 n=20)
Mandelbrot200             7.203m ± 0%     7.171m ± 0%    -0.44% (p=0.000 n=20)
HTTPClientServer          83.96µ ± 0%     80.83µ ± 0%    -3.72% (p=0.000 n=20)
TimeParse                 415.3n ± 0%     389.1n ± 0%    -6.31% (p=0.000 n=20)
TimeFormat                506.4n ± 0%     495.9n ± 0%    -2.06% (p=0.000 n=20)
geomean                   102.6µ          98.04µ         -4.40%

                      │   bench.old    │   bench.new                          │
                      │      B/s       │     B/s        vs base               │
Template                 15.90Mi ± 1%    18.26Mi ± 0%   +14.88% (p=0.000 n=20)
Gzip                     44.36Mi ± 0%    44.12Mi ± 0%    -0.53% (p=0.000 n=20)
Gunzip                   211.7Mi ± 0%    218.7Mi ± 0%    +3.31% (p=0.000 n=20)
RegexpMatchEasy0_32      229.3Mi ± 0%    251.6Mi ± 0%    +9.72% (p=0.000 n=20)
RegexpMatchEasy0_1K      716.4Mi ± 0%    730.3Mi ± 0%    +1.94% (p=0.000 n=20)
RegexpMatchEasy1_32      187.6Mi ± 0%    200.0Mi ± 0%    +6.64% (p=0.000 n=20)
RegexpMatchEasy1_1K      649.1Mi ± 0%    561.3Mi ± 0%   -13.52% (p=0.000 n=20)
RegexpMatchMedium_32     21.35Mi ± 0%    23.50Mi ± 0%   +10.05% (p=0.000 n=20)
RegexpMatchMedium_1K     23.38Mi ± 0%    25.59Mi ± 0%    +9.42% (p=0.000 n=20)
RegexpMatchHard_32       14.57Mi ± 0%    14.14Mi ± 0%    -2.95% (p=0.000 n=20)
RegexpMatchHard_1K       15.44Mi ± 0%    15.09Mi ± 0%    -2.29% (p=0.000 n=20)
JSONEncode               102.8Mi ± 1%    106.0Mi ± 1%    +3.15% (p=0.000 n=20)
JSONDecode               23.28Mi ± 0%    25.55Mi ± 0%    +9.75% (p=0.000 n=20)
Revcomp                  211.3Mi ± 0%    193.1Mi ± 0%    -8.58% (p=0.000 n=20)
GobDecode                51.34Mi ± 0%    56.64Mi ± 0%   +10.33% (p=0.000 n=20)
GobEncode                43.42Mi ± 1%    48.93Mi ± 0%   +12.71% (p=0.000 n=20)
GoParse                  6.337Mi ± 0%    6.800Mi ± 1%    +7.30% (p=0.000 n=20)
geomean                  61.24Mi         63.63Mi         +3.91%

Update #40724

Co-authored-by: Xiaolin Zhao <zhaoxiaolin@loongson.cn>
Change-Id: I5993460da8c5926c70cb6fbe551b8e4655dea9d0
Reviewed-on: https://go-review.googlesource.com/c/go/+/521790
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. Proposal Proposal-Accepted
Projects
Status: Triage Backlog
Status: Accepted
Development

No branches or pull requests