主要对 Golangv1.13 版本的 runtime 进行源码分析,本项目参考了一些书籍和其他源码分析的项目:
- golang-notes
- 浅谈 Go 语言实现原理
- 深入解析 Go 内核实现
- Go 1.5 源码剖析
- Go 学习笔记
本项目目录:
主要对 Golangv1.13 版本的 runtime 进行源码分析,本项目参考了一些书籍和其他源码分析的项目:
本项目目录:
“Gsyscall:当前G正在被系统调用“
此处应该是:正在进行系统调用
// _Gsyscall means this goroutine is executing a system call.
// It is not executing user code. The stack is owned by this
// goroutine. It is not on a run queue. It is assigned an M.
_Gsyscall // 3
var a string
var done bool
func setup() {
a = "hello, world"
done = true
}
func Test(t *testing.T) {
go setup()
for !done {
}
print(a)
}
在Ubuntu操作系统:
go1.13 会陷入死循环
go1.14及以上,可以正常运行,输出hello world
在MacOS操作系统:
go1.13及以上均可以正常运行,输出helloworld
作者知道什么原因吗?
get_tls(CX)
MOVQ g(CX), BX; BX存器里面现在放的是当前g结构体对象的地址
#ifdef GOARCH_amd64
#define get_tls(r) MOVQ TLS, r
#define g(r) 0(r)(TLS*1)
#endif
0(r)(TLS1),这个表达式的执行逻辑是:(0+TLS+TLS)吗,这样取到的地址不是错的吗,请教下大佬这个问题
接着上面的问题,为啥g(BX)取到的是m0.tls[0]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.