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: display the source code for inlined functions in ssa.html #25904

Closed
ysmolski opened this issue Jun 15, 2018 · 7 comments
Closed
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@ysmolski
Copy link
Member

ysmolski commented Jun 15, 2018

CL 119035 added displaying the source code of target function as the first column in ssa.html table.

It would be great to handle inlined function correctly too, e.g. display their sources as well.

@ysmolski ysmolski added the NeedsFix The path to resolution is known, but the work has not been done. label Jun 15, 2018
@ysmolski ysmolski added this to the Unplanned milestone Jun 15, 2018
@ysmolski
Copy link
Member Author

ssa.html should contain declarations of all inlined functions in the sources column.
When GOSSAFUNC=f for the following program

package main

import "encoding/binary"

var x uint16
var b [2]byte

func f() {
	x = g(x)
	binary.BigEndian.PutUint16(b[:], x)
}

func g(i uint16) uint16 {
	return i + 1
}

it should include sources for both g() and binary.BigEndian.PutUint16() functions.

@ysmolski
Copy link
Member Author

@randall77 @dr2chase @josharian

Does the screenshot below look right?
Can you spot any problems with following representation of sources for inlined functions?

screen shot 2018-07-25 at 19 56 42

Any feedback is very welcome!

@josharian
Copy link
Contributor

On my phone, but my initial response is “Hooray! This is going to be super helpful!”

It might be nice to toposort, that is, put the main function at the top and inlined functions below (and functions inlined by the inlined functions below that, etc.).

@dr2chase
Copy link
Contributor

This is quite nice. Thank you for working on this.

@ysmolski
Copy link
Member Author

Fixed the order of functions in sources column per Josh request + cosmetics:

screen shot 2018-07-28 at 10 46 14

@gopherbot
Copy link

Change https://golang.org/cl/126606 mentions this issue: cmd/compile: include sources for all inlined functions into ssa.html

@gopherbot
Copy link

Change https://golang.org/cl/126605 mentions this issue: cmd/compile: export Func.Endlineno

gopherbot pushed a commit that referenced this issue Aug 23, 2018
This CL exports the Func.Endlineno value for inlineable functions.
It is needed to grab the source code of an imported function
inlined into the function specified in $GOSSAFUNC.

See CL 126606 for details.

Updates #25904

Change-Id: I1e259e20445e4109b4621a95abb5bde1be457af1
Reviewed-on: https://go-review.googlesource.com/126605
Run-TryBot: Yury Smolsky <yury@smolsky.by>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
@golang golang locked and limited conversation to collaborators Aug 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants