[erlang-questions] Question about the VM

Björn-Egil Dahlberg wallentin.dahlberg@REDACTED
Thu Sep 25 21:40:38 CEST 2014


2014-09-25 21:17 GMT+02:00 Samuel Barney <samjbarney@REDACTED>:
>
> 3. It shouldn't hang the VM any since, if I understand correctly, the
> thread can yield after any instruction is called.
>

no

Try this: file t.S

{module, t}.  %% version = 0

{exports, [{go,0},{module_info,0},{module_info,1}]}.

{attributes, []}.

{labels, 3}.

{function, go, 0, 2}.
  {label,1}.
    {line,[{location,"t.erl",14}]}.
    {func_info,{atom,t},{atom,go},0}.
  {label,2}.
    {jump,{f,2}}.

Compile with erlc +no_postopt t.S

And spawn some processes in the shell like this:
spawn(fun() -> t:go() end).

Let me know how far you get.

It's not necessarily a bad idea to target beam-assembler but the assembler
is highly tuned for the Erlang language .. or rather the Core language.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140925/52a76528/attachment.htm>


More information about the erlang-questions mailing list