aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_debug.c
diff options
context:
space:
mode:
authorMichal Muskala <[email protected]>2017-07-01 17:19:52 +0200
committerMichal Muskala <[email protected]>2017-07-06 11:42:52 +0200
commit245aa4ed9b41aa601784598b0b3286d29b6d0085 (patch)
treede5448198979b0ccdc610883d4bcaafab326f0de /erts/emulator/beam/beam_debug.c
parente8a2cae09282b25a8eda9b6f04876e23a854336b (diff)
downloadotp-245aa4ed9b41aa601784598b0b3286d29b6d0085.tar.gz
otp-245aa4ed9b41aa601784598b0b3286d29b6d0085.tar.bz2
otp-245aa4ed9b41aa601784598b0b3286d29b6d0085.zip
Introduce new_small_map_lit op
Take advantage of the fact that small maps have a tuple for keys. When new map is constructed and all keys are literals, we can construct the entire keys tuple as a literal. This should reduce the memory of maps created with literal keys almost by half, since they all can share the same keys tuple.
Diffstat (limited to 'erts/emulator/beam/beam_debug.c')
-rw-r--r--erts/emulator/beam/beam_debug.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/erts/emulator/beam/beam_debug.c b/erts/emulator/beam/beam_debug.c
index a2060c80de..74e6ab8bc5 100644
--- a/erts/emulator/beam/beam_debug.c
+++ b/erts/emulator/beam/beam_debug.c
@@ -718,6 +718,27 @@ print_op(fmtfn_t to, void *to_arg, int op, int size, BeamInstr* addr)
}
}
break;
+ case op_i_new_small_map_lit_dIq:
+ {
+ Eterm *tp = tuple_val(unpacked[-1]);
+ int n = arityval(*tp);
+
+ while (n > 0) {
+ switch (loader_tag(ap[0])) {
+ case LOADER_X_REG:
+ erts_print(to, to_arg, " x(%d)", loader_x_reg_index(ap[0]));
+ break;
+ case LOADER_Y_REG:
+ erts_print(to, to_arg, " x(%d)", loader_y_reg_index(ap[0]));
+ break;
+ default:
+ erts_print(to, to_arg, " %T", (Eterm) ap[0]);
+ break;
+ }
+ ap++, size++, n--;
+ }
+ }
+ break;
case op_i_get_map_elements_fsI:
{
int n = unpacked[-1];