How does the assembly for the code I write looks like?

polaris · · 223 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>Hello. I&#39;d like to study the code generated by golang, do you have any good debuggers on windows for that?</p> <p>Or alternatively, can you describe how interfaces and first class functions work like in go, internally?</p> <p>About first class functions, I created a function that is running recursively, and uses two variables from it&#39;s &#34;parent functions&#34;. Do they get copied at the time of function creation, and this first class function keeps these two as it&#39;s internal state?</p> <p>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&#39;s type, or maybe actual object and object&#39;s vtable?)?</p> <hr/>**评论:**<br/><br/>Smt923: <pre><p>A tool that&#39;s pretty useful for playing with various snippets of code and showing ASM is <a href="https://go.godbolt.org/" rel="nofollow">Godbolt</a> which has Go support</p> <p>I don&#39;t know much about more advanced, offline stuff but there seems to be some useful info with <a href="https://golang.org/doc/asm" rel="nofollow">https://golang.org/doc/asm</a> and <a href="https://golang.org/cmd/asm/" rel="nofollow">https://golang.org/cmd/asm/</a>, plus of course I&#39;m sure you can find a &#34;objdump for windows&#34; type thing and look at it that way but I like I said don&#39;t know much about that kinda thing with Go</p></pre>qu33ksilver: <pre><p><code>go tool compile -S file.go</code></p> <p>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.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:701969077

223 次点击  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传