aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/io.c
diff options
context:
space:
mode:
authorPatrik Nyblom <[email protected]>2009-12-07 15:25:32 +0100
committerBjörn Gustavsson <[email protected]>2010-03-10 14:23:54 +0100
commit5a8e6c4183a30f3b10de22fa5ba80950dfb2adea (patch)
tree1b1830bf144427531d7be5aa968e02bb2e67539e /erts/emulator/beam/io.c
parent356c33b6063de632f9c98c66260603e6edbc3ee5 (diff)
downloadotp-5a8e6c4183a30f3b10de22fa5ba80950dfb2adea.tar.gz
otp-5a8e6c4183a30f3b10de22fa5ba80950dfb2adea.tar.bz2
otp-5a8e6c4183a30f3b10de22fa5ba80950dfb2adea.zip
Fit all heap data into the 32-bit address range
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.
Diffstat (limited to 'erts/emulator/beam/io.c')
-rw-r--r--erts/emulator/beam/io.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/erts/emulator/beam/io.c b/erts/emulator/beam/io.c
index 3309b77086..ac25eb9d5c 100644
--- a/erts/emulator/beam/io.c
+++ b/erts/emulator/beam/io.c
@@ -4079,7 +4079,8 @@ int driver_monitor_process(ErlDrvPort port,
Port *prt = erts_drvport2port(port);
Process *rp;
Eterm ref;
- Eterm buf[REF_THING_SIZE];
+ DeclareTmpHeapNoproc(buf,REF_THING_SIZE);
+
if (prt->drv_ptr->process_exit == NULL) {
return -1;
}
@@ -4089,12 +4090,14 @@ int driver_monitor_process(ErlDrvPort port,
if (!rp) {
return 1;
}
+ UseTmpHeapNoproc(REF_THING_SIZE);
ref = erts_make_ref_in_buffer(buf);
erts_add_monitor(&(prt->monitors), MON_ORIGIN, ref, rp->id, NIL);
erts_add_monitor(&(rp->monitors), MON_TARGET, ref, prt->id, NIL);
erts_smp_proc_unlock(rp, ERTS_PROC_LOCK_LINK);
ref_to_driver_monitor(ref,monitor);
+ UnUseTmpHeapNoproc(REF_THING_SIZE);
return 0;
}
@@ -4104,10 +4107,12 @@ int driver_demonitor_process(ErlDrvPort port,
Port *prt = erts_drvport2port(port);
Process *rp;
Eterm ref;
- Eterm buf[REF_THING_SIZE];
+ DeclareTmpHeapNoproc(buf,REF_THING_SIZE);
ErtsMonitor *mon;
Eterm to;
+
+ UseTmpHeapNoproc(REF_THING_SIZE);
memcpy(buf,monitor,sizeof(Eterm)*REF_THING_SIZE);
ref = make_internal_ref(buf);
mon = erts_lookup_monitor(prt->monitors, ref);
@@ -4134,6 +4139,7 @@ int driver_demonitor_process(ErlDrvPort port,
erts_destroy_monitor(rmon);
}
}
+ UnUseTmpHeapNoproc(REF_THING_SIZE);
return 0;
}
@@ -4142,10 +4148,11 @@ ErlDrvTermData driver_get_monitored_process(ErlDrvPort port,
{
Port *prt = erts_drvport2port(port);
Eterm ref;
- Eterm buf[REF_THING_SIZE];
+ DeclareTmpHeapNoproc(buf,REF_THING_SIZE);
ErtsMonitor *mon;
Eterm to;
+ UseTmpHeapNoproc(REF_THING_SIZE);
memcpy(buf,monitor,sizeof(Eterm)*REF_THING_SIZE);
ref = make_internal_ref(buf);
mon = erts_lookup_monitor(prt->monitors, ref);
@@ -4155,6 +4162,7 @@ ErlDrvTermData driver_get_monitored_process(ErlDrvPort port,
ASSERT(mon->type == MON_ORIGIN);
to = mon->pid;
ASSERT(is_internal_pid(to));
+ UnUseTmpHeapNoproc(REF_THING_SIZE);
return (ErlDrvTermData) to;
}