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
ysmolsky opened this issue Jun 15, 2018 · 7 comments

Comments

Projects
None yet
4 participants
@ysmolsky
Copy link
Member

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.

@ysmolsky ysmolsky added the NeedsFix label Jun 15, 2018

@ysmolsky ysmolsky added this to the Unplanned milestone Jun 15, 2018

@ysmolsky

This comment has been minimized.

Copy link
Member Author

commented Jun 16, 2018

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.

@ysmolsky

This comment has been minimized.

Copy link
Member Author

commented Jul 25, 2018

@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

This comment has been minimized.

Copy link
Contributor

commented Jul 25, 2018

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

This comment has been minimized.

Copy link
Contributor

commented Jul 25, 2018

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

@ysmolsky

This comment has been minimized.

Copy link
Member Author

commented Jul 28, 2018

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

screen shot 2018-07-28 at 10 46 14

@gopherbot

This comment has been minimized.

Copy link

commented Jul 28, 2018

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

@gopherbot

This comment has been minimized.

Copy link

commented Jul 28, 2018

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

cmd/compile: export the Func.Endlineno field
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>

@gopherbot gopherbot closed this in 9e2a04d Aug 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.