Hello. I'd like to study the code generated by golang, do you have any good debuggers on windows for that?
Or alternatively, can you describe how interfaces and first class functions work like in go, internally?
About first class functions, I created a function that is running recursively, and uses two variables from it's "parent functions". Do they get copied at the time of function creation, and this first class function keeps these two as it's internal state?
About interfaces, how different they are from vtables and COM? When you pass something into a function that expects interface, you actually pass two values (actual object and object's type, or maybe actual object and object's vtable?)?
评论:
Smt923:
qu33ksilver:A tool that's pretty useful for playing with various snippets of code and showing ASM is Godbolt which has Go support
I don't know much about more advanced, offline stuff but there seems to be some useful info with https://golang.org/doc/asm and https://golang.org/cmd/asm/, plus of course I'm sure you can find a "objdump for windows" type thing and look at it that way but I like I said don't know much about that kinda thing with Go
go tool compile -S file.go
gives you the assembly generated by Go. Its not the actual processor assembly mind you .. there is a very thin abstraction layer. But its as close to what you get if you want to see what is the actual code generated.
