aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_bif_load.c
AgeCommit message (Collapse)Author
2011-03-16erts: Remove unused variablesTuncer Ayaz
2010-08-27fix native code crash when calling unloaded module with on_load functionMikael Pettersson
As reported in erlang-bugs, the following sequence of events crashes the VM: 1. Module M1 is loaded and in native mode. 2. Module M2 is not loaded, in emulated mode, and has an on_load function. 3. M1 calls some function in M2. This works. 4. M1 again calls some function in M2. This segfaults. The reason for the crash is that when the beam loader fixes up export entries after a successful on_load function call, it erroneously clears the ->code[3] field in that module's export entries. This is redundant (no code in beam relies on ->code[3] being NULL), inconsistent with modules without on_load functions (there ->code[3] remains a valid beam instruction after the module is loaded), and breaks native code which needs the old ->address value in an export entry to remain valid after a module load step (before the load ->address points to ->code[3], after the load ->address points to the real code but uses of the old ->address value remain so ->code[3] must remain valid). Thus the fix for the crash is to simply not clear ->code[3]. This patch fixes R14A and should also fix R13B04. (There does exist a performance bug in this area, but it is unrelated to the on_load feature so will be fixed separately.)
2010-07-20One off-heap list, to eliminate two words per ETS object.Sverker Eriksson
Merging the three off-heap lists (binaries, funs and externals) into one list. This reduces memory consumption by two words (pointers) per ETS object.
2010-06-03Remove trailing character in beam_bif_loadBjörn-Egil Dahlberg
2010-03-10Add the BeamInstr data type for loaded BEAM codePatrik Nyblom
For cleanliness, use BeamInstr instead of the UWord data type to any machine-sized words that are used for BEAM instructions. Only use UWord for untyped words in general.
2010-03-10Store pointers to heap data in 32-bit wordsPatrik Nyblom
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.
2010-02-11OTP-8335 Even more NIF featuresSverker Eriksson
2009-11-20The R13B03 release.OTP_R13B03Erlang/OTP