aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_node_tables.c
diff options
context:
space:
mode:
authorPatrik Nyblom <[email protected]>2010-01-20 16:26:14 +0100
committerBjörn Gustavsson <[email protected]>2010-03-10 14:24:45 +0100
commitfb94cd974dc03baf149264ca4f4d50c6d1f80f21 (patch)
treeab913eae685670165acd3a5f2b3f39c0d085292d /erts/emulator/beam/erl_node_tables.c
parent775191a1e033b4b93a4615c629d90fdb82f39a98 (diff)
downloadotp-fb94cd974dc03baf149264ca4f4d50c6d1f80f21.tar.gz
otp-fb94cd974dc03baf149264ca4f4d50c6d1f80f21.tar.bz2
otp-fb94cd974dc03baf149264ca4f4d50c6d1f80f21.zip
Store pointers to heap data in 32-bit words
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.
Diffstat (limited to 'erts/emulator/beam/erl_node_tables.c')
-rw-r--r--erts/emulator/beam/erl_node_tables.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_node_tables.c b/erts/emulator/beam/erl_node_tables.c
index f3f10201b5..6960844e99 100644
--- a/erts/emulator/beam/erl_node_tables.c
+++ b/erts/emulator/beam/erl_node_tables.c
@@ -1109,11 +1109,21 @@ insert_offheap(ErlOffHeap *oh, int type, Eterm id)
break;
}
if (insert_bin) {
+#if HALFWORD_HEAP
+ UWord val = (UWord) pb->val;
+ DeclareTmpHeapNoproc(id_heap,BIG_UINT_HEAP_SIZE*2); /* extra place allocated */
+#else
DeclareTmpHeapNoproc(id_heap,BIG_UINT_HEAP_SIZE);
+#endif
Uint *hp = &id_heap[0];
InsertedBin *nib;
+#if HALFWORD_HEAP
+ UseTmpHeapNoproc(BIG_UWORD_HEAP_SIZE(val));
+ a.id = erts_bld_uword(&hp, NULL, (UWord) val);
+#else
UseTmpHeapNoproc(BIG_UINT_HEAP_SIZE);
a.id = erts_bld_uint(&hp, NULL, (Uint) pb->val);
+#endif
erts_match_prog_foreach_offheap(pb->val,
insert_offheap2,
(void *) &a);
@@ -1121,7 +1131,11 @@ insert_offheap(ErlOffHeap *oh, int type, Eterm id)
nib->bin_val = pb->val;
nib->next = inserted_bins;
inserted_bins = nib;
+#if HALFWORD_HEAP
+ UnUseTmpHeapNoproc(BIG_UINT_HEAP_SIZE*2);
+#else
UnUseTmpHeapNoproc(BIG_UINT_HEAP_SIZE);
+#endif
}
}
}