58

Go语言将C重写运行时环境

 5 years ago
source link: https://www.linuxprobe.com/go-and-c.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Google推出的编程语言Go 1.4 最主要的变化是将使用 Go 语言本身来重写 Go 的运行时,而之前是采用 C 语言开发。这也是为什么 Go 的发行版中包含一个 C 编译器的原因。

使用 Go 重写的好处是:

当前如果在 Goroutine 的调用堆栈中发现 C 代码,runtime 将在需要增长堆栈时回滚到老的堆栈方法。如果使用 Go 来重写 runtime,那么堆栈拷贝的方法就会更加高效

目前转换工作只计划转 Go 编译器 (5g, 6g, 8g), 而不是 C 编译器,降低运行时中的 C 代码行数,甚至可能完全清除。

Go 1.4 的合并窗口在 9 月份将关闭,从现在开始到12月份发布 Go 1.4 之前将只接受 bug 修复和小调整。

注意:

这是 golang.org 分发版,也就是 gc ,而不是 gccgo。

这是不同的 C 编译器,gc 工具链将使用你系统的 C 编译器来编译,gc 运行时则使用它的 C 编译器来编译。

8月20日后增加的转换行可能跟 this request 有关。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK