aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_load.c
diff options
context:
space:
mode:
authorPatrik Nyblom <[email protected]>2010-02-05 11:03:51 +0100
committerBjörn Gustavsson <[email protected]>2010-03-10 14:25:14 +0100
commit64415f09de0691c2ccdf65df169a211b7917728b (patch)
treebf852ce9dcdec87b240906b733fc6fd5b831069f /erts/emulator/beam/beam_load.c
parent20ba5ed3c281d3f0be587395fa66182873d229f0 (diff)
downloadotp-64415f09de0691c2ccdf65df169a211b7917728b.tar.gz
otp-64415f09de0691c2ccdf65df169a211b7917728b.tar.bz2
otp-64415f09de0691c2ccdf65df169a211b7917728b.zip
Turn on instruction packing in the loader and virtual machine
Diffstat (limited to 'erts/emulator/beam/beam_load.c')
-rw-r--r--erts/emulator/beam/beam_load.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c
index 5b56002d3b..22c6c39cf5 100644
--- a/erts/emulator/beam/beam_load.c
+++ b/erts/emulator/beam/beam_load.c
@@ -591,6 +591,7 @@ erts_load_module(Process *c_p,
}
return result;
}
+/* #define LOAD_MEMORY_HARD_DEBUG 1*/
#if defined(LOAD_MEMORY_HARD_DEBUG) && defined(DEBUG)
/* Requires allocators ERTS_ALLOC_UTIL_HARD_DEBUG also set in erl_alloc_util.h */
@@ -731,6 +732,12 @@ bin_load(Process *c_p, ErtsProcLocks c_p_locks,
* Loading succeded.
*/
CHKBLK(ERTS_ALC_T_CODE,state.code);
+#if defined(LOAD_MEMORY_HARD_DEBUG) && defined(DEBUG)
+ erts_fprintf(stderr,"Loaded %T\n",*modp);
+#if 0
+ debug_dump_code(state.code,state.ci);
+#endif
+#endif
rval = 0;
state.code = NULL; /* Prevent code from being freed. */
*modp = state.module;
@@ -786,9 +793,6 @@ bin_load(Process *c_p, ErtsProcLocks c_p_locks,
erts_free(ERTS_ALC_T_LOADER_TMP, (void *) state.genop_blocks);
state.genop_blocks = next;
}
-#if defined(LOAD_MEMORY_HARD_DEBUG) && defined(DEBUG)
- erts_fprintf(stderr,"Loaded %T\n",*modp);
-#endif
return rval;
}
@@ -2031,16 +2035,16 @@ load_code(LoaderState* stp)
tag_to_letter[tmp_op->a[arg].type]);
}
}
-#if !HALFWORD_HEAP /* XXX:PaN - just disabled during development */
+
/*
* The packing engine.
*/
if (opc[stp->specific_op].pack[0]) {
char* prog; /* Program for packing engine. */
- Uint stack[8]; /* Stack. */
- Uint* sp = stack; /* Points to next free position. */
- Uint packed = 0; /* Accumulator for packed operations. */
- ASSERT(0); /* XXX:PaN - just to check that this does not happen when packing is disabled... */
+ BeamInstr stack[8]; /* Stack. */
+ BeamInstr* sp = stack; /* Points to next free position. */
+ BeamInstr packed = 0; /* Accumulator for packed operations. */
+
for (prog = opc[stp->specific_op].pack; *prog; prog++) {
switch (*prog) {
case 'g': /* Get instruction; push on stack. */
@@ -2053,7 +2057,7 @@ load_code(LoaderState* stp)
packed = (packed << BEAM_TIGHT_SHIFT) | code[--ci];
break;
case '6': /* Shift 16 steps */
- packed = (packed << 16) | code[--ci];
+ packed = (packed << BEAM_LOOSE_SHIFT) | code[--ci];
break;
case 'p': /* Put instruction (from stack). */
code[ci++] = *--sp;
@@ -2068,7 +2072,7 @@ load_code(LoaderState* stp)
}
ASSERT(sp == stack); /* Incorrect program? */
}
-#endif /* !HALFWORD_HEAP */
+
/*
* Handle a few special cases.
*/