【Hacker News搬运】显示HN:Go Plan9备忘录
-
Title: Show HN: Go Plan9 Memo
显示HN:Go Plan9备忘录
Text: A quick dive into the Plan9 assembly I picked up while developing my SIMD package for Go, and how it led to a 450% performance boost in calculations.
快速了解我在为Go开发SIMD包时学到的Plan9组件,以及它如何使计算性能提高450%。
Url: https://pehringer.info/go_plan9_memo.html
由于我无法直接访问网络链接,因此无法直接使用JinaReader或其他工具来抓取和分析该网页的内容。不过,我可以提供一个基于文本的假设性分析,如果你将网页内容粘贴给我,我可以帮你进行类似的分析。 如果你希望我模拟这个过程,请提供网页的文本内容或者简要描述其主要内容。然后,我可以尝试以下步骤: 1. **抓取内容**:模拟从网页中提取文本信息。 2. **分析内容**:分析提取的文本,这可能包括提取关键词、摘要、主题等。 3. **翻译内容**:如果内容不是中文,将其翻译成中文。 4. **总结内容**:基于分析结果,给出内容的总结。 请提供网页内容或描述,以便我能够进行模拟分析。
Post by: pehringer
Comments:
sedatk: > 4 represents “NOSPLIT” which we need for some reason<p>For those who are curious: "In the general case, the frame size [the parameter after NOSPLIT] is followed by an argument size, separated by a minus sign. (It's not a subtraction, just idiosyncratic syntax.) The frame size $24-8 states that the function has a 24-byte frame and is called with 8 bytes of argument, which live on the caller's frame. If NOSPLIT is not specified for the TEXT, the argument size must be provided. For assembly functions with Go prototypes, go vet will check that the argument size is correct."<p>Source: <a href="https://go.dev/doc/asm" rel="nofollow">https://go.dev/doc/asm</a>
sedatk: >;4代表“NOSPLIT”,出于某种原因,我们需要它<p>对于那些好奇的人:";在一般情况下,帧大小[NOSPLIT之后的参数]后面是一个参数大小,用减号分隔。(它不是减法,只是特殊的语法。)帧大小$24-8表示该函数有一个24字节的帧,并使用8字节的参数调用,这些参数存在于调用者身上;s帧。如果没有为TEXT指定NOSPLIT,则必须提供参数大小。对于带有Go原型的汇编函数,Go-vet将检查参数大小是否正确&“<p> 来源:<a href=“https:/;go.dev.doc&asm”rel=“nofollow”>https:/;go.dev;doc/;asm</a>
mxey: > After doing some preliminary research I discovered that Go uses its own internal assembly language called Plan9.<p>Is the language actually called that?
mxey: >;在做了一些初步研究后,我发现Go使用自己的内部汇编语言Plan9。<p>这种语言真的叫Plan9吗?
joeegan2202: A couple points on Go assembly:<p>1. On amd64 those ints are actually 64bit. If you used int32 then they would be be word aligned in the parameter list. However, there is a gotcha with that. The return values will always start at a dword aligned offset on 64bit system.<p>2. NOSPLIT is defined in "textflag.h" which Go's compiler automatically provides. However, NOSPLIT is, from everything I've read, only respected on runtime.XX functions, so it's not doing anything there, and it's also not necessary. NOSPLIT tells the compiler not to insert code to check if the stack needs to split because it's going to overflow, which is technically unnecessary if the function doesn't need any stack space. It's basically only there on the function that checks for stack splits, to prevent that code from being injected into itself.
joeegan2202: Go程序集上的几个要点:<p>1。在amd64上,这些int实际上是64位的。如果你使用int32,那么它们将在参数列表中进行单词对齐。然而,这有一个陷阱。返回值将始终从64位系统上的dword对齐偏移开始<p> 2。NOSPLIT的定义见";textflag.h”;哪个Go;s编译器自动提供。然而,NOSPLIT是,从一切我;我读过,只在运行时受尊重。XX功能正常,因此它;它在那里什么也没做,而且;这也是不必要的。NOSPLIT告诉编译器不要插入代码来检查堆栈是否需要拆分,因为它;s将溢出,如果函数不溢出,从技术上讲这是不必要的;不需要任何堆叠空间。它;s基本上只存在于检查堆栈拆分的函数中,以防止代码被注入到自身中。
saclark11: > Overall, pretty weird stuff. I am not sure why the Go team went down this route. Maybe it simplifies the compiler by having this bespoke assembly format?<p>Rob Pike spoke on the design of Go's assembler at a talk in 2016 [1][2]. I think it basically came down to the observation that most assembly language is roughly the same, so why not build a common assembly language that "lets you talk to the machine at the lowest level and yet not have to learn a new syntax." It also enables them to automatically generate a working assembler given an instruction manual PDF for a new architecture as input.<p>[1]: <a href="https://www.youtube.com/watch?v=KINIAgRpkDA" rel="nofollow">https://www.youtube.com/watch?v=KINIAgRpkDA</a>
[2]: <a href="https://go.dev/talks/2016/asm.slide#1" rel="nofollow">https://go.dev/talks/2016/asm.slide#1</a>saclark11: >;总的来说,相当奇怪的东西。我不知道围棋队为什么走这条路。也许它通过使用这种定制的汇编格式简化了编译器<p> Rob Pike谈到了Go的设计;在2016年的一次演讲中[1][2]。我认为这基本上归结为这样一种观察,即大多数汇编语言大致相同,那么为什么不构建一种通用的汇编语言,";让您在最底层与机器对话,而不必学习新的语法&“;它还使他们能够在给定新架构的指令手册PDF作为输入的情况下自动生成一个可工作的汇编程序<p> [1]:<a href=“https:”www.youtube.com“watch?v=KINIAgRpkDA”rel=“nofollow”>https:”/;www.youtube.com;看?v=KINIAgRpkDA</a>[2] :<a href=“https:#x2F;go.dev#x2F会谈#x2F 2016#x2F asm.slide#1”rel=“nofollow”>https:/;go.dev;会谈;2016年;asm.幻灯片#1</a>
kristianp: Relevant to which processors go supports, is this section (1). Base x64 support includes SSE and SSE2. I don't know if the go compiler produces it, though. Unlike extremely complex compilers like gcc, where performance is the top priority, the go compiler favours simplicity in a Wirthian(2) fashion favouring a simple, fast compiler.<p>(1) <a href="https://go.dev/wiki/MinimumRequirements#amd64" rel="nofollow">https://go.dev/wiki/MinimumRequirements#amd64</a><p>(2) <a href="https://irreal.org/blog/?p=7075" rel="nofollow">https://irreal.org/blog/?p=7075</a><p><a href="https://smartgo.blog/2024/01/06/niklaus-wirth/" rel="nofollow">https://smartgo.blog/2024/01/06/niklaus-wirth/</a>
kristianp: 与支持哪些处理器相关的是本节(1)。基本x64支持包括SSE和SSE2。我不知道;不过,我不知道go编译器是否会生成它。与gcc等极其复杂的编译器不同,在gcc中,性能是首要任务,go编译器以Wirthian(2)的方式支持简单性,支持简单、快速的编译器<p> (1)<a href=“https:/;go.devG;wikiM;最低要求#amd64”rel=“nofollow”>https:/;go.dev;维基;最低要求#amd64</a><p>(2)<a href=“https:/;irreal.orgH;blogM;p=7075”rel=“nofollow”>https:/;irreal.org;博客/;?p=7075</a><p><a href=“https:智能博客2024年01月06日niklaus wirth”rel=“nofollow”>https:/;smartgo.blog;2024年;01■;06;niklaus wirth</一