From 5b8872c37f63b35e13464109e986ef3727588040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 25 Mar 2015 09:47:42 +0100 Subject: Optimize use of i_get_map_element/4 In the i_get_map_element/4 instruction, for literal keys other than atoms, the key would be put into x[0] instead of used directly in the instruction. The reason is that the original implementation of maps only supported atom keys. --- erts/emulator/beam/ops.tab | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/erts/emulator/beam/ops.tab b/erts/emulator/beam/ops.tab index 92d9ccb5eb..23f5b75b7a 100644 --- a/erts/emulator/beam/ops.tab +++ b/erts/emulator/beam/ops.tab @@ -1521,21 +1521,21 @@ get_map_elements Fail Src Size Rest=* | map_key_sort(Size, Rest) => \ i_get_map_elements f s I -get_map_element Fail Src=rxy Key=ax Dst => i_get_map_element Fail Src Key Dst -get_map_element Fail Src=rxy Key=rycq Dst => \ +get_map_element Fail Src=rxy Key=cx Dst => i_get_map_element Fail Src Key Dst +get_map_element Fail Src=rxy Key=ry Dst => \ move Key x | i_get_map_element Fail Src x Dst get_map_element Fail Src Key Dst => jump Fail %macro: i_get_map_element GetMapElement -fail_action -i_get_map_element f r a r -i_get_map_element f x a r -i_get_map_element f y a r -i_get_map_element f r a x -i_get_map_element f x a x -i_get_map_element f y a x -i_get_map_element f r a y -i_get_map_element f x a y -i_get_map_element f y a y +i_get_map_element f r c r +i_get_map_element f x c r +i_get_map_element f y c r +i_get_map_element f r c x +i_get_map_element f x c x +i_get_map_element f y c x +i_get_map_element f r c y +i_get_map_element f x c y +i_get_map_element f y c y i_get_map_element f r x r i_get_map_element f x x r i_get_map_element f y x r -- cgit v1.2.3