Skip to content

cmd/compile: transform environment variable GOSSAFUNC into the option that is passed to compiler #25942

Closed
@ysmolski

Description

@ysmolski

Right now GOSSAFUNC is a magical environment variable that allows to peek under the hood of SSA generation. It is an indispensable tool, and we need to think about converting it from magical hidden environment variable into command line option supplied to go tool compile.

I propose this option: -ssafunc=<function>

My plan is read this option to the global variable and use that in place of GOSSAFUNC.
And in inlining phase I want to record to which functions calls were inlined from *n if ssafunc==n.funcname(). It is to display the sources of all inlined functions in ssa.html.

Also the comment by @rsc in src/cmd/go/internal/work/exec.go motivated me:

 	// TODO(rsc): Convince compiler team not to add more magic environment variables,
	// or perhaps restrict the environment variables passed to subprocesses.
	magic := []string{
		"GOCLOBBERDEADHASH",
		"GOSSAFUNC",
		"GO_SSA_PHI_LOC_CUTOFF",
		"GOSSAHASH",
	}

CC: @josharian @randall77

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions