Erlang JIT and loaded code
Tue Apr 26 09:57:09 CEST 2022
On Tue, Apr 26, 2022 at 7:36 AM Vitor Rocha <vitor.vrs@REDACTED> wrote:
> I managed to get the code size (I suppose) from internal structures:
> - erl_module_instance->code_length (for emulator and asm)
> - erl_module_instance->hipe_code->text_segment_size (for HiPE and
> Does that make sense or are those values unrelated?
I think those values make sense to compare.
Looking through the code I actually found a way to get the size of the
modules. If you do Ctrl+C to enter break mode and then type `l` you will
get a listing of all modules and their size in bytes. Not sure if that
functionality works for hipe code or not.
> Em seg., 25 de abr. de 2022 às 06:13, Lukas Larsson <lukas@REDACTED>
>> On Tue, Apr 19, 2022 at 7:17 AM Vitor Rocha <vitor.vrs@REDACTED> wrote:
>>> (1) how do I know if my code is actually being executed as interpreted
>>> or native?
>> All code loaded from .beam files are run natively if the VM supports JIT
>>> (2) If I compile a module inside Erlang's shell, using the `c:c/1`
>>> function, is the module going to be compiled to native too? Will its
>>> execution be switched to native?
>> There is no difference in how it is compiled, it will always be
>> translated into native code when loaded.
>>> (3) Where is stored the generated beamasm native code? I would like to
>>> get its size in bytes?
>> It is stored in memory of the VM. You can get a file dump of the native
>> code by passing `+JDdump true` when starting `erl`. There is no way to get
>> the loaded memory size of a single module, but you can get a relatively
>> close value by checking what `erlang:memory(code)` returns before and after
>> the module is loaded.
>>> Vitor Rocha da Silva
> Vitor Rocha da Silva
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions