aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/v3_codegen.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-03-09 09:41:42 +0100
committerBjörn Gustavsson <[email protected]>2015-03-09 09:41:42 +0100
commita7a7f22f315cb0b9d607709cdfca11805758da3c (patch)
treea148089efb350218b7c3c08c879c209c655d89b5 /lib/compiler/src/v3_codegen.erl
parentf2d39216e0587db58b5a79c78bfe94b00334cd0d (diff)
parent0d3be61f3a4b5aa3437d08603ea7565432e3a07b (diff)
downloadotp-a7a7f22f315cb0b9d607709cdfca11805758da3c.tar.gz
otp-a7a7f22f315cb0b9d607709cdfca11805758da3c.tar.bz2
otp-a7a7f22f315cb0b9d607709cdfca11805758da3c.zip
Merge branch 'bjorn/compiler/maps'
* bjorn/compiler/maps: v3_codegen: Teach the put_map_* instructions to reuse source registers beam_validator: Tighten tests of maps v3_core: Eliminate the sloppiness-encouraging get_ianno/1 function v3_core: Add is_map tests before map instructions beam_type: Use the complete register map when calculating liveness Introduce '%live' annotations with a complete register map beam_validator: Teach bif_type/3 and is_bif_safe/2 about is_map/1 v3_core: Simplify conversion of map patterns
Diffstat (limited to 'lib/compiler/src/v3_codegen.erl')
-rw-r--r--lib/compiler/src/v3_codegen.erl16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/compiler/src/v3_codegen.erl b/lib/compiler/src/v3_codegen.erl
index 8c1a0c08ac..cbe50b93b0 100644
--- a/lib/compiler/src/v3_codegen.erl
+++ b/lib/compiler/src/v3_codegen.erl
@@ -1523,9 +1523,11 @@ set_cg([{var,R}], {map,Op,Map,[{map_pair,{var,_}=K,V}]}, Le, Vdb, Bef,
List = [cg_reg_arg(K,Int0),cg_reg_arg(V,Int0)],
Live = max_reg(Bef#sr.reg),
- Int1 = Int0#sr{reg=put_reg(R, Int0#sr.reg)},
- Aft = clear_dead(Int1, Le#l.i, Vdb),
- Target = fetch_reg(R, Int1#sr.reg),
+
+ %% The target register can reuse one of the source registers.
+ Aft0 = clear_dead(Int0, Le#l.i, Vdb),
+ Aft = Aft0#sr{reg=put_reg(R, Aft0#sr.reg)},
+ Target = fetch_reg(R, Aft#sr.reg),
I = case Op of
assoc -> put_map_assoc;
@@ -1557,9 +1559,11 @@ set_cg([{var,R}], {map,Op,Map,Es}, Le, Vdb, Bef,
List = flatmap(fun({K,V}) -> [K,cg_reg_arg(V,Int0)] end, Pairs),
Live = max_reg(Bef#sr.reg),
- Int1 = Int0#sr{reg=put_reg(R, Int0#sr.reg)},
- Aft = clear_dead(Int1, Le#l.i, Vdb),
- Target = fetch_reg(R, Int1#sr.reg),
+
+ %% The target register can reuse one of the source registers.
+ Aft0 = clear_dead(Int0, Le#l.i, Vdb),
+ Aft = Aft0#sr{reg=put_reg(R, Aft0#sr.reg)},
+ Target = fetch_reg(R, Aft#sr.reg),
I = case Op of
assoc -> put_map_assoc;