<div dir="ltr">Yes Dmytro I've also enjoy reading your BEAM Wisdom series and Erik Stenman's BEAM book. I think you guy's work are very good resource out there for explaining BEAM, along with of course, the source code.<br><br>Mikael thanks for fixing those <font face="monospace, monospace">hipe_bifs:show_*</font> functions, that would really delight 64-bits Erlang users :)<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">2017-11-06 4:34 GMT-08:00 Mikael Pettersson <span dir="ltr"><<a href="mailto:mikpelinux@gmail.com" target="_blank">mikpelinux@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">My PR should fix both issues with show_heap/1. I wasn't aware the other show_* BIFs had issues, I may take a look at them soonish.<div><br></div><div>There is no updated document for the tag scheme AFAIK, but reading erts/emulator/beam/erl_term.h should, if you can decipher all #ifdefs and macros, provide the current details. The general principles remain the same, but new types and alternatives have appeared, and existing ones may have been reassigned.</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 6, 2017 at 4:55 AM, Boshan Sun <span dir="ltr"><<a href="mailto:sunboshan@gmail.com" target="_blank">sunboshan@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Does your fix also fix the variable alignment issue as well? The variable is in the beginning of the next row now, and should be in the end of same row. Also can you fix <font face="monospace, monospace">hipe_bifs:show_estack/1, hipe_bifs:show_nstack/1, hipe_bifs:show_pcb/1</font>? They all suffer the "off" issue.<br><br>BTW, I just read your paper <i>A Staged Tag Scheme for Erlang</i> and it explains Erlang's tag scheme pretty well. Thanks for that. The paper was written in 2000 for R6B/R7A, just wondering do you guys have some updated paper regarding for current state of Erlang/OTP's tag scheme?<div><br></div><div>Thanks!</div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-11-05 1:34 GMT-08:00 Mikael Pettersson <span dir="ltr"><<a href="mailto:mikpelinux@gmail.com" target="_blank">mikpelinux@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>The "off" table is due to a glitch in the output routine. The too short "H E A P" banner is indeed a 32-vs-64 bit bug. I fixed both in <a href="https://github.com/erlang/otp/pull/1619" target="_blank">https://github.com/erlang/otp/<wbr>pull/1619</a>.<br></div><br></div>WRT accessing the current "struct process", I haven't looked in detail, but in general the NIF interface wants to abstract away representational details and replace them function calls (actual runtime function calls, not just function-like macros). I don't see direct accesses to "struct process" fitting into that.<br></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="m_-8665566000163006194m_-5042019951600727592h5">On Sun, Nov 5, 2017 at 4:39 AM, Boshan Sun <span dir="ltr"><<a href="mailto:sunboshan@gmail.com" target="_blank">sunboshan@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_-8665566000163006194m_-5042019951600727592h5"><div dir="ltr">Hi all, <div><br></div><div>In Erlang, you can use `hipe_bifs:show_heap(self()).` to debug the process's heap.<br><br><div><font face="monospace, monospace">From: 0x000000001ee5c6e0 to 0x000000001ee5c748</font></div><div><font face="monospace, monospace"> | H E A P |</font></div><div><font face="monospace, monospace"> | Address | Contents |</font></div><div><font face="monospace, monospace"> |--------------------|-------<wbr>-------------|</font></div><div><font face="monospace, monospace">4 | 0x000000001ee5c6e0 | 0x000000000000004f |</font></div><div><font face="monospace, monospace">[] | 0x000000001ee5c6e8 | 0xfffffffffffffffb |</font></div><div><font face="monospace, monospace">3 | 0x000000001ee5c6f0 | 0x000000000000003f |</font></div><div><font face="monospace, monospace">[4] | 0x000000001ee5c6f8 | 0x000000001ee5c6e1 |</font></div><div><font face="monospace, monospace"> |--------------------|-------<wbr>-------------|</font></div></div><div><font face="monospace, monospace"><br></font></div><div><font face="arial, helvetica, sans-serif">However the implementation is for 32-bits machine, and the table is kind of off for a 64-bits erlang.</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">I want to write a C NIF to print similar heap information. What I need is the address of `</font><font face="monospace, monospace">process -> heap</font><font face="arial, helvetica, sans-serif">` and the heap size so I can get the heap's information. <br><br>My question is, is there a way to get a pointer to the given process via pid in C NIF?</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">In NIF doc there's <a href="http://erlang.org/doc/man/erl_nif.html#enif_get_local_pid" target="_blank">enif_get_local_pid</a> , how does this pid translate to the process pointer?</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Thanks!</font></div><span class="m_-8665566000163006194m_-5042019951600727592m_-5561235315284356174HOEnZb"><font color="#888888"><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Boshan</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div></font></span></div>
<br></div></div>______________________________<wbr>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" rel="noreferrer" target="_blank">http://erlang.org/mailman/list<wbr>info/erlang-questions</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>