gpt4 book ai didi

performance - 阅读 GHC 核心

转载 作者:行者123 更新时间:2023-12-03 04:12:16 29 4
gpt4 key购买 nike

Core是GHC的中间语言。阅读Core可以帮助你更好地了解程序的性能。有人向我索要有关阅读 Core 的文档或教程,但我找不到太多。

有哪些文档可用于阅读 GHC Core?

这是我迄今为止发现的内容:

最佳答案

GHC 核心是 System FC所有 Haskell 都被翻译成的语言。 Core 的(近似)语法由以下公式给出:

enter image description here

核心与更简单、更广为人知的 System F 密切相关。 。全部transformations GHC does on the Core level是此 Core 表示的类型保留重构,以提高性能。而且,不太为人所知的是,您可以直接在 Core 中编写 GHC 程序。

GHC Core 适合编译器管道(就像 2002 年那样,没有 LLVM 和 CMM):

enter image description here

了解 GHC Core 的主要文档是:

有助于理解的相关 Material :

核心又被翻译成 STG 代码,如下所示:

enter image description here

Core 中有趣的名字是用“Z 编码”编码的:

enter image description here

GHC Core 的类型和种类(来自 Tolmach 的论文):

enter image description here

最后,GHC 的 primops当您将 Haskell 优化为 GHC 所了解的基本指令时,会定期出现在 GHC Core 输出中。 primop 集作为 a pre-processed file. 中的一组核心函数给出。

关于performance - 阅读 GHC 核心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6121146/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com