Age | Commit message (Collapse) | Author |
|
|
|
The new_binary() function takes a size argument that is an
int. In the 64-bit emulator (sizeof(int) == 4, sizeof(Uint) == 8),
any sizes >= 0x8000000 become 0xffffffff80000000 and above and
triggers a memory allocation failure.
Change the type of the size argument to Uint, and change any
callers that cast the argument to an int.
Correction-by: Jon Meredith
|
|
The compressed format is using a slighty modified variant of the extern format
(term_to_binary). To not worsen key lookup's too much, the top tuple itself
and the key element are not compressed. Table objects with only immediate
non-key elements will therefor not gain anything (but actually consume one
extra word for "alloc_size").
|
|
Alignment of trailing data in messages has been adjusted.
This in order to be able to pass data of any type as
trailing data in the future.
|
|
Merging the three off-heap lists (binaries, funs and externals) into
one list. This reduces memory consumption by two words (pointers) per
ETS object.
|
|
Earlier, external format INTEGER_EXT was only produced for 28-bit
signed integers. Now full 32-bit signed integers are produced as
INTEGER_EXT to avoid the more costly SMALL_BIG_EXT format. Both old
and new code can read 32-bit INTEGER_EXT.
Also fixed integer encoding bugs in erl_interface erl_encode/erl_decode.
(Thanks to Alexander Demidenko for reporting)
|
|
Fix safe_mul in the loader, which caused failures in the bit
syntax test cases.
Fix yet another Uint in erl_alloc.h (ERTS_CACHE_LINE_SIZE) causing
segmentation fault when we have many schedulers (why only in that
situation?).
Clean up erl_mseg (remove old code for the Linux 32-bit mmap flag).
While at it, also remove compilation warnings.
|
|
The following test suites now work:
send_term_SUITE
trace_nif_SUITE
binary_SUITE
match_spec_SUITE
node_container_SUITE
beam_literals_SUITE
Also add a testcases for system_info({wordsize,internal|external}).
|
|
Rewrite trace code and external coding. Also slightly correct
the interface to the match-spec engine to make tracing work.
That will make the test suites runnable.
|
|
|
|
Store Erlang terms in 32-bit entities on the heap, expanding the
pointers to 64-bit when needed. This works because all terms are stored
on addresses in the 32-bit address range (the 32 most significant bits
of pointers to term data are always 0).
Introduce a new datatype called UWord (along with its companion SWord),
which is an integer having the exact same size as the machine word
(a void *), but might be larger than Eterm/Uint.
Store code as machine words, as the instructions are pointers to
executable code which might reside outside the 32-bit address range.
Continuation pointers are stored on the 32-bit stack and hence must
point to addresses in the low range, which means that loaded beam code
much be placed in the low 32-bit address range (but, as said earlier,
the instructions themselves are full words).
No Erlang term data can be stored on C stacks (enforced by an
earlier commit).
This version gives a prompt, but test cases still fail (and dump core).
The loader (and emulator loop) has instruction packing disabled.
The main issues has been in rewriting loader and actual virtual
machine. Subsystems (like distribution) does not work yet.
|
|
This is the first step in the implementation of the half-word emulator,
a 64-bit emulator where all pointers to heap data will be stored
in 32-bit words. Code specific for this emulator variant is
conditionally compiled when the HALFWORD_HEAP define has
a non-zero value.
First force all pointers to heap data to fall into a single 32-bit range,
but still store them in 64-bit words.
Temporary term data stored on C stack is moved into scheduler specific
storage (allocated as heaps) and macros are added to make this
happen only in emulators where this is needed. For a vanilla VM the
temporary terms are still stored on the C stack.
|
|
|
|
It is now possible to increase or decrease the maximum number of atoms
the VM can handle. The default value is 1048576 (1024*1024).
|
|
fragments was created. This will mainly benefit NIFs that return
large compound terms.
|
|
* jv/binary_to_term-opts:
document ErtsExternalDist flags and CON_ID mask
add options to binary_to_term
OTP-8367 There is new erlang:binary_to_binary/2 BIF that takes an option
list. The option safe can be used to prevent creation of
resources that are not garbage collected (such as atoms). (Thanks
to Jayson Vantuyl.)
|
|
term_to_binary and binary_to_term are powerful tools that can be used easily in
lieu of a custom binary network protocol. Unfortunately, carefully crafted
data can be used to exhaust the memory in an Erlang node by merely attempting
to decode binaries. This makes it unsafe to receive data from untrusted
sources.
This is possible because binary_to_term/1 will allocate new atoms and new
external function references. These data structures are not garbage collected.
This patch implements the new form of binary_to_term that takes a list of
options, and a simple option called 'safe'. If specified, this option will
cause decoding to fail with a badarg error if an atom or external function
reference would be allocated.
In the general case, it will happily decode any Erlang term other than those
containing new atoms or new external function references. However, fun, pid,
and ref data types can embed atoms. They might fail to decode if one of these
embedded atoms is new to the node. This may be an issue if encoded binaries
are transferred between nodes or persisted between invocations of Erlang.
|
|
|