aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/export.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/export.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/export.c')
-rw-r--r--erts/emulator/beam/export.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/erts/emulator/beam/export.c b/erts/emulator/beam/export.c
index 271b40cf0f..c39f610924 100644
--- a/erts/emulator/beam/export.c
+++ b/erts/emulator/beam/export.c
@@ -46,8 +46,8 @@ static erts_smp_rwmtx_t export_table_lock; /* Locks the secondary export table.
#define export_init_lock() erts_smp_rwmtx_init(&export_table_lock, \
"export_tab")
-extern Eterm* em_call_error_handler;
-extern Uint* em_call_traced_function;
+extern UWord* em_call_error_handler;
+extern UWord* em_call_traced_function;
void
export_info(int to, void *to_arg)
@@ -93,7 +93,7 @@ export_alloc(Export* tmpl)
obj->code[2] = tmpl->code[2];
obj->slot.index = -1;
obj->address = obj->code+3;
- obj->code[3] = (Eterm) em_call_error_handler;
+ obj->code[3] = (UWord) em_call_error_handler;
obj->code[4] = 0;
obj->match_prog_set = NULL;
return obj;
@@ -140,7 +140,7 @@ init_export_table(void)
Export*
erts_find_export_entry(Eterm m, Eterm f, unsigned int a)
{
- HashValue hval = EXPORT_HASH(m, f, a);
+ HashValue hval = EXPORT_HASH((UWord) m, (UWord) f, (UWord) a);
int ix;
HashBucket* b;
@@ -185,7 +185,7 @@ erts_find_function(Eterm m, Eterm f, unsigned int a)
ep = hash_get(&export_table.htable, (void*) &e);
if (ep != NULL && ep->address == ep->code+3 &&
- ep->code[3] != (Uint) em_call_traced_function) {
+ ep->code[3] != (UWord) em_call_traced_function) {
ep = NULL;
}
return ep;