aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_emu.c
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-03-25 13:10:30 +0100
committerBjörn Gustavsson <[email protected]>2015-04-13 12:37:55 +0200
commit9b940b12210500e615ea05b447b0e1be34e70d39 (patch)
tree2592ce44da307877a30d2ff0ea2e13c368aa83b8 /erts/emulator/beam/beam_emu.c
parent5f1e301dfec48fccbf865a8b54af5908bebb77c4 (diff)
downloadotp-9b940b12210500e615ea05b447b0e1be34e70d39.tar.gz
otp-9b940b12210500e615ea05b447b0e1be34e70d39.tar.bz2
otp-9b940b12210500e615ea05b447b0e1be34e70d39.zip
Pre-compute hash values for the general get_map_elements instruction
See the previous commit for justification and use cases.
Diffstat (limited to 'erts/emulator/beam/beam_emu.c')
-rw-r--r--erts/emulator/beam/beam_emu.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c
index 5f49032e23..6fde14bc8d 100644
--- a/erts/emulator/beam/beam_emu.c
+++ b/erts/emulator/beam/beam_emu.c
@@ -2427,7 +2427,7 @@ do { \
* i.e. that it follows a test is_map if needed.
*/
- n = (Uint)Arg(2) / 2;
+ n = (Uint)Arg(2) / 3;
fs = &Arg(3); /* pattern fields and target registers */
if (is_flatmap(map)) {
@@ -2450,12 +2450,11 @@ do { \
if (EQ((Eterm)*fs,*ks)) {
PUT_TERM_REG(*vs, fs[1]);
n--;
- fs += 2;
+ fs += 3;
/* no more values to fetch, we are done */
if (n == 0) break;
}
- ks++; sz--;
- vs++;
+ ks++, sz--, vs++;
}
if (n) {
@@ -2467,13 +2466,14 @@ do { \
Uint32 hx;
ASSERT(is_hashmap(map));
while(n--) {
- hx = hashmap_make_hash((Eterm)*fs);
- if ((v = erts_hashmap_get(hx,(Eterm)*fs, map)) == NULL) {
+ hx = fs[2];
+ ASSERT(hx == hashmap_make_hash((Eterm)fs[0]));
+ if ((v = erts_hashmap_get(hx, (Eterm)fs[0], map)) == NULL) {
SET_I((BeamInstr *) Arg(0));
goto get_map_elements_fail;
}
PUT_TERM_REG(*v, fs[1]);
- fs += 2;
+ fs += 3;
}
}