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

runtime: add a comment which briefly mentions where (or how) `g_stackguard0` is defined #17915

Closed
typeless opened this issue Nov 14, 2016 · 7 comments

Comments

Projects
None yet
6 participants
@typeless
Copy link

commented Nov 14, 2016

Am I missing something obvious? I attempted but failed to locate the definition of the symbol with grep and ack.

A brief comment will certainly save time for people who are trying to learn the runtime's internal.

@bradfitz

This comment has been minimized.

Copy link
Member

commented Nov 15, 2016

It looks like it's just a local variable name.

/cc @ianlancetaylor

@typeless

This comment has been minimized.

Copy link
Author

commented Nov 15, 2016

@bradfitz It looks like the symbol is generated by dumpasmhdr (/cmd/compile/internal/gc/export.go), which is equivalent to offsetof(g, stackguard0).

dumpasmhdr will generate go_asm.h which is included by the asm_{GOARCH}.s files.

@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Nov 15, 2016

You are asking where the assembler constant g_stackguard0 is defined? As you say, it's defined in go_asm.h, which is a generated file. It's not just g_stackguard0; it's all the TYPE_FIELD symbols used by the assembler files--g_sched, gobuf_sp, g_m, etc., etc. I just checked, and go_asm.h defines 1634 constants. I'm not sure how to make a comment for that that will help people looking for a specific symbol.

@typeless

This comment has been minimized.

Copy link
Author

commented Nov 15, 2016

@ianlancetaylor @bradfitz Indeed, adding a comment does not help much as I thought (as I brought up the issue before I found out the answer). Maybe the assembler deserves a more capable language which won't need such kind of cleverness in the future.

Thanks for your responses and feel free to close the issue.

@bradfitz bradfitz closed this Nov 15, 2016

@minux

This comment has been minimized.

Copy link
Member

commented Nov 15, 2016

@mwhudson

This comment has been minimized.

Copy link
Contributor

commented Nov 15, 2016

@minux

This comment has been minimized.

Copy link
Member

commented Nov 15, 2016

@golang golang locked and limited conversation to collaborators Nov 15, 2017

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