A bug.

Pierpaolo BERNARDI bernardp@REDACTED
Thu Apr 17 11:15:57 CEST 2003


From: "Pierpaolo BERNARDI" <bernardp@REDACTED>

> this looks like a serious bug.

A followup.  

The compiled code for my function uses 1034 registers:

....
   {put_list,{atom,field_A},{x,1033},{x,1033}}.
    {put_list,{atom,field_D},{x,1033},{x,1033}}.
    {put_tuple,6,{x,1034}}.
    {put,{atom,vxor}}.
...

while the vm has a hard limit of 1024, from erl_vm.h:

#define MAX_REG 1024            /* Max number of x(N) registers used */

If there must be a hard limit on the number of registers,
the solution looks simple: the compiler must check 
that this limit is not violated, and issue an appropriate 
diagnostic if it is.

BTW, it seems to me that the function can be compiled using 
only a handful of registers, interleaving the creation of the list 
elements with the creation of the list spine.  Alas, I'm not 
familiar with the compiler and cannot estimate how difficult 
would be this change.

Cheers
P.




More information about the erlang-questions mailing list