Erlang源代码指南

发布于 2024-09-24 16:41:54 字数 157 浏览 1 评论 0 原文

我有兴趣深入研究 Erlang 的 C 源代码 并尝试了解什么是正在幕后进行。在哪里可以找到有关代码设计和结构的信息?

I am interested in delving into Erlang's C source code and try to understand what is going on under the hood. Where can I find info on the design and structure of the code?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

烟花肆意 2024-10-01 16:41:54

首先,您可能想看看乔·阿姆斯特朗的论文,高层次地介绍了 Erlang。了解该语言背后的想法将很有用。然后,您可以关注 Erlang 运行时系统 (erts)。 erlang.erl 模块可能是一个好的开始。然后,我将重点关注构成所谓的最小版本内核stdlib的应用程序。在 stdlib 中,查看行为是如何实现的。我可以建议从 gen_server.erl 模块开始吗?

First of all, you might want to have a look to Joe Armstrong's thesis, introducing Erlang at a high level. It will be useful to get an idea of what was the idea behind the language. Then, you could focus on the Erlang Run Time System (erts). The erlang.erl module could be a good start. Then, I would focus on the applications who constitutes the so-called minimal release, kernel and stdlib. Within the stdlib, have a look on how behaviours are implemented. May I suggest the gen_server.erl module as a start?

小…楫夜泊 2024-10-01 16:41:54

简而言之,没有好的指南。而且代码没有很好的文档记录。

我建议在你的邻居中找到一个对代码相当了解的人,并请他们吃晚饭以换取一点闲聊。

如果您无法做到这一点,那么我建议从加载程序开始。

./erts/emulator/beam/beam_load.c

通过漂亮地打印光束表示也可以找到一些有用的信息。我不知道 OTP 是否提供了任何方法可以做到这一点,但 HiPE 项目有一些作弊。

hipe:c(MODULE, [pp_beam]).

应该让你开始。

(我还推荐乔的书。)

The short answer is that there is no good guide. And the code is not very well documented.

I recommend finding someone in your neighbourhood that knows the code reasonably well, and buy them dinner in exchange for a little chat.

If you don't have the possibility to do that, then I recommend starting with the loader.

./erts/emulator/beam/beam_load.c

Some useful information can also be found by pretty printing the beam representation. I don't know whether there is any way to do so supplied by OTP, but the HiPE project has some cheats.

hipe:c(MODULE, [pp_beam]).

Should get you started.

(And I also recommend Joe's book.)

攒眉千度 2024-10-01 16:41:54

漂亮的beam打印机可以通过'erlc -S'来完成,相当于Daniel提到的hipe:c(M, [pp_beam])。

我还使用 erts_debug:df(Module). 来反汇编加载的梁代码,这些代码实际上是由虚拟机解释的指令。

有时我会使用调试器。 OTP 提供了很好地支持 gdb 的工具。请参阅示例用法 http://www.erlang.org/pipermail /erlang-questions/2008-September/037793.html

Pretty printer of beam can be done by 'erlc -S', which is equivalent with hipe:c(M, [pp_beam]) mentioned by Daniel.

I also use erts_debug:df(Module). to disassemble the loaded beam code, which are instructions actually been interpreted by the VM.

Sometimes I use a debugger. OTP delivers tools supporting gdb very well. See example usage at http://www.erlang.org/pipermail/erlang-questions/2008-September/037793.html

疯到世界奔溃 2024-10-01 16:41:54

这里的聚会有点晚了。如果您只是从 GitHub 下载源代码,则内部文档是真的很好。您必须使用 make 生成其中的一些内容。

构建文档,大部分相关源位于 /erts (Erlang 运行时系统)下

编辑:BEAM Wisdoms 也是一个非常好的指南,但它可能是也可能不是您所追求的。

A little late to the party here. If you just download the source from GitHub the internal documentation is really good. You have to generate some of it using make.

Get the documentation built and most of the relevant source is under /erts (Erlang Run Time System)

Edit: BEAM Wisdoms is also a really good guide but it may or may not be what you're after.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文