How can I change the Erlang VM to use a random 128 bit value for one of it's pid values?
It seems the largest value at this time that I can set is:
32> pid(1, 32767, 8191).
** exception error: bad argument
in function list_to_pid/1
called as list_to_pid("<1.32767.8191>")
in call from c:pid/3 (c.erl, line 419)
33> pid(0, 32767, 8191).
<0.32767.8191>
It looks like the generation of pid comes down to something like this in erts/emulator/beam/erl_ptab.h:283
:
ERTS_GLB_INLINE Eterm
erts_ptab_make_id(ErtsPTab *ptab, Eterm data, Eterm tag)
{
HUint huint;
Uint32 low_data = (Uint32) data;
low_data &= (1 << ERTS_PTAB_ID_DATA_SIZE) - 1;
low_data <<= ERTS_PTAB_ID_DATA_SHIFT;
huint.hval[ERTS_HUINT_HVAL_HIGH] = erts_ptab_data2pix(ptab, data);
huint.hval[ERTS_HUINT_HVAL_LOW] = low_data | ((Uint32) tag);
return (Eterm) huint.val;
}