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: pass values to some convT2Exxx #20263

Closed
josharian opened this issue May 5, 2017 · 1 comment
Closed

cmd/compile: pass values to some convT2Exxx #20263

josharian opened this issue May 5, 2017 · 1 comment

Comments

@josharian
Copy link
Contributor

For example, the signature of convT2Estring is:

func convT2Estring(t *_type, elem unsafe.Pointer) (e eface)

We could change it to:

func convT2Estring(t *_type, s string) (e eface)

This would increase the size of the call site, but it would also means that the argument doesn't have to be made addressable and might not have its address taken, which probably increases other optimization opportunities (e.g. can be SSA'd and registerized). And there'd be a call site size decrease for (say) convT2E16.

We should try this out and see whether the impact makes it worth doing.

@josharian josharian added this to the Go1.10 milestone May 5, 2017
@bradfitz bradfitz modified the milestones: Go1.10, Go1.11 Nov 28, 2017
@bradfitz bradfitz modified the milestones: Go1.11, Unplanned May 18, 2018
@randall77
Copy link
Contributor

I think we've done this.

func f(s string) interface{} {
	return s
}

Compiles to:

	0x001d 00029 (/usr/local/google/home/khr/gowork/issue20263.go:4)	MOVQ	"".s+40(SP), AX
	0x0022 00034 (/usr/local/google/home/khr/gowork/issue20263.go:4)	MOVQ	AX, (SP)
	0x0026 00038 (/usr/local/google/home/khr/gowork/issue20263.go:4)	MOVQ	"".s+48(SP), AX
	0x002b 00043 (/usr/local/google/home/khr/gowork/issue20263.go:4)	MOVQ	AX, 8(SP)
	0x0030 00048 (/usr/local/google/home/khr/gowork/issue20263.go:4)	CALL	runtime.convTstring(SB)
	0x0035 00053 (/usr/local/google/home/khr/gowork/issue20263.go:4)	MOVQ	16(SP), AX
	0x003a 00058 (/usr/local/google/home/khr/gowork/issue20263.go:4)	LEAQ	type.string(SB), CX
	0x0041 00065 (/usr/local/google/home/khr/gowork/issue20263.go:4)	MOVQ	CX, "".~r1+56(SP)
	0x0046 00070 (/usr/local/google/home/khr/gowork/issue20263.go:4)	MOVQ	AX, "".~r1+64(SP)
	0x004b 00075 (/usr/local/google/home/khr/gowork/issue20263.go:4)	MOVQ	24(SP), BP
	0x0050 00080 (/usr/local/google/home/khr/gowork/issue20263.go:4)	ADDQ	$32, SP
	0x0054 00084 (/usr/local/google/home/khr/gowork/issue20263.go:4)	RET
	0x0055 00085 (/usr/local/google/home/khr/gowork/issue20263.go:4)	NOP

@golang golang locked and limited conversation to collaborators Apr 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants