什么是汇编例程,以及如何在Go中使用它?

什么是汇编例程,以及如何在Go中使用它?

问题描述:

I am reading a Go tutorial (The Way To Go), and it mentions something about assembly routine, can somebody please explain what is that? It also states about implemented 'outside' Go, and also no body... may I know what is the purpose?

Quote as follow:

To declarer[sic] a function implemented outside Go, such as an assembly routine, you simply give the name and signature, and no body:

func flushICache(begin, end uintptr) // implemented externally

I tried to search online, but it seems hard to find any tutorial regarding assembly routine, what is that alien? And, what is the meaning of implemented outside Go?

我正在阅读 Go em>教程(前进的方式),其中提到了有关汇编例程 strong>的内容,有人可以解释一下吗 就是它? 它还说明了已实施的“外部”执行 em>,并且还没有主体 em> ...我可以知道目的是什么吗? p>

引用如下: p>

要声明 [sic] i>在Go外部实现的函数(例如汇编例程),只需给出名称和 签名,没有主体: p>

func flushICache(begin,end uintptr)//外部实现 code> p> blockquote>

我尝试在线搜索,但是似乎很难找到有关汇编例程 strong>的任何教程,那是什么外星人? 而且,在Go之外实现 strong>是什么意思? p> div>

Please read this and follow the links there.

To cite it

Machine code or machine language is a set of instructions executed directly by a computer's central processing unit (CPU). Each instruction performs a very specific task, such as a load, a jump, or an ALU operation on a unit of data in a CPU register or memory.

<…>

All practical programs today are written in higher-level languages or assembly language.

The Go's own reference doc on its support for assembler is this.