[erlang-questions] Arrays and setelement

Mikael Pettersson mikpe@REDACTED
Fri Dec 29 14:29:23 CET 2006


On Fri, 29 Dec 2006 11:10:33 +0000, Joel Reymont wrote:
>> The deep, dark secret practices of the HiPE team may come
>> in handy, provided you don't tell anyone :
>>
>> http://www.erlang.org/ml-archive/erlang-questions/200604/msg00228.html
>
>This is great. There are also generic "array" functions in hipe_bifs  
>like array/2, array_sub/2 and array_update/3.

They are not "generic". For starters, you can only store
"immediate" values in them. Immediates include fixnums, atoms,
[], and a few other types of objects, and fixnums are small
integers with about 4 fewer bits than the machine's word size.

The reason for restricting the values to immediates is a direct
consequence of that missing runtime system support I mentioned
(no write barriers or remembered sets for wrong-way pointers).

There are also no guarantees as to what happens if a HiPE array
is passed in a message to another process. The sender and
receiver may share the array's state, or the receiver may get
a copy, and this may depend on the array's size and the runtime
system's heap model (private, shared, hybrid). So don't do that.

/Mikael



More information about the erlang-questions mailing list