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: field tracking is broken #20014

Closed
heschi opened this issue Apr 17, 2017 · 4 comments
Closed

cmd/compile: field tracking is broken #20014

heschi opened this issue Apr 17, 2017 · 4 comments
Milestone

Comments

@heschi
Copy link
Contributor

heschi commented Apr 17, 2017

https://go-review.googlesource.com/38409 broke field tracking somehow. Field tracking has no test and the only documentation I can find is internal to Google, so here's repro instructions.

First, build a toolchain with GOEXPERIMENT=fieldtrack. This is important and easy to miss. Then compile the following:

package main

import “fmt”

type T struct {
	X int `go:”track”`
	Y int `go:”track”`
}

func (t *T) String() string {
	return fmt.Sprintf(“T(X=%d)”, t.X)
}

func (t *T) Sum() int {
	return t.X + t.Y
}

func Run() {
	t := new(T)
	fmt.Println(t)
}

func main() {
	Run()
}

The resulting object should have undefined symbols:

         U go.track.%22%22.T.X
         U go.track.%22%22.T.Y

which would then be used by the linker to build the used field list. After https://go-review.googlesource.com/38409, they aren't there.

If it's useful, the full command I used for bisecting was

(cd src; GOEXPERIMENT=fieldtrack ./make.bash); bin/go tool compile -o fieldtrack.o fieldtrack.go; bin/go tool nm fieldtrack.o | grep go.track || exit 1

CC @josharian @mdempsky

@heschi heschi changed the title Field tracking is broken cmd/compile: field tracking is broken Apr 17, 2017
@bradfitz bradfitz added this to the Go1.9 milestone Apr 17, 2017
@bradfitz
Copy link
Contributor

Issue #12174 had proposed adding a builder for this, but it deemed not important at the time, largely because this was a mostly Google-internal optimization/hack for one large logs processing job, and it shouldn't pollute the open source world. But it's kinda weird that it exists in open source anyway (as an experiment) but can't be tested. I'd still support adding tests + builder for it.

@josharian
Copy link
Contributor

Yeah. Without tests and a builder, it's just going to keep breaking.

Or if it was a one-time hack, is it still needed?

@bradfitz
Copy link
Contributor

It's still needed. See http://www.unofficialgoogledatascience.com/2015/12/replacing-sawzall-case-study-in-domain.html and search for the world "field".

@mdempsky
Copy link
Member

FWIW, @rsc uploaded code for testing fieldtrack: https://godoc.org/rsc.io/tmp/fieldtrack

@golang golang locked and limited conversation to collaborators Apr 19, 2018
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

5 participants