aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_load.c
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2010-09-29 12:16:56 +0200
committerBjörn Gustavsson <[email protected]>2011-01-17 15:23:38 +0100
commitec325cc785916c6a4991fe2e03747a97b7e1ae75 (patch)
treef6edcc29d40637dfa270b6bf5b4e7c97fc0ce1cc /erts/emulator/beam/beam_load.c
parent7738e604909c52ebac606eed5f6314291747e938 (diff)
downloadotp-ec325cc785916c6a4991fe2e03747a97b7e1ae75.tar.gz
otp-ec325cc785916c6a4991fe2e03747a97b7e1ae75.tar.bz2
otp-ec325cc785916c6a4991fe2e03747a97b7e1ae75.zip
BEAM loader: Combine is_type/1 and is_eq/1 instructions
In the transformation engine in the loader, an is_eq/1 instruction is currently always preceded by an is_type/1 instruction. Therefore, save a word and slight amount of time by combining those instructions into an is_type_eq/2 instruction.
Diffstat (limited to 'erts/emulator/beam/beam_load.c')
-rw-r--r--erts/emulator/beam/beam_load.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c
index feac89784b..73644ecfd6 100644
--- a/erts/emulator/beam/beam_load.c
+++ b/erts/emulator/beam/beam_load.c
@@ -3867,11 +3867,23 @@ transform_engine(LoaderState* st)
if (i == 0)
goto restart;
break;
+#if defined(TOP_is_eq)
case TOP_is_eq:
ASSERT(ap < instr->arity);
if (*pc++ != instr->a[ap].val)
goto restart;
break;
+#endif
+ case TOP_is_type_eq:
+ mask = *pc++;
+
+ ASSERT(ap < instr->arity);
+ ASSERT(instr->a[ap].type < BEAM_NUM_TAGS);
+ if (((1 << instr->a[ap].type) & mask) == 0)
+ goto restart;
+ if (*pc++ != instr->a[ap].val)
+ goto restart;
+ break;
case TOP_is_same_var:
ASSERT(ap < instr->arity);
i = *pc++;