草庐IT

go - 如何在golang MPG模型中获得g

我正在阅读golang(go1.6.2linux/amd64)的一些运行时代码,有人可以帮助我理解runtime/stubs.go文件中getg()函数的底层机制吗?//getgreturnsthepointertothecurrentg.//Thecompilerrewritescallstothisfunctionintoinstructions//thatfetchthegdirectly(fromTLSorfromthededicatedregister).funcgetg()*g这里的getg()函数是怎么操作的?这个函数的主体是什么? 最佳答案

go - 如何在golang MPG模型中获得g

我正在阅读golang(go1.6.2linux/amd64)的一些运行时代码,有人可以帮助我理解runtime/stubs.go文件中getg()函数的底层机制吗?//getgreturnsthepointertothecurrentg.//Thecompilerrewritescallstothisfunctionintoinstructions//thatfetchthegdirectly(fromTLSorfromthededicatedregister).funcgetg()*g这里的getg()函数是怎么操作的?这个函数的主体是什么? 最佳答案