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

@typeless
Copy link

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
Copy link
Contributor

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

/cc @ianlancetaylor

@typeless
Copy link
Author

typeless 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
Copy link
Contributor

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
Copy link
Author

@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.

@minux
Copy link
Member

minux commented Nov 15, 2016 via email

@mwhudson
Copy link
Contributor

mwhudson commented Nov 15, 2016 via email

@minux
Copy link
Member

minux commented Nov 15, 2016 via email

@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.
Projects
None yet
Development

No branches or pull requests

6 participants