diff options
author | Björn Gustavsson <[email protected]> | 2012-05-16 10:50:30 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2014-01-28 15:56:25 +0100 |
commit | 64ee859fc4c17259ab95192abf7493fed8f2b0ac (patch) | |
tree | 8506892a03635fa44f523f4daf470c4845e63e77 /lib/compiler/src/beam_validator.erl | |
parent | d3ece60d52880fb273da3c4aa07655a0eeddeafb (diff) | |
download | otp-64ee859fc4c17259ab95192abf7493fed8f2b0ac.tar.gz otp-64ee859fc4c17259ab95192abf7493fed8f2b0ac.tar.bz2 otp-64ee859fc4c17259ab95192abf7493fed8f2b0ac.zip |
Implement support for maps in the compiler
To make it possible to build the entire OTP system, also define
dummys for the instructions in ops.tab.
Diffstat (limited to 'lib/compiler/src/beam_validator.erl')
-rw-r--r-- | lib/compiler/src/beam_validator.erl | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/compiler/src/beam_validator.erl b/lib/compiler/src/beam_validator.erl index 48f5135aca..37b08f43d3 100644 --- a/lib/compiler/src/beam_validator.erl +++ b/lib/compiler/src/beam_validator.erl @@ -865,6 +865,21 @@ valfun_4({bs_final,{f,Fail},Dst}, Vst0) -> valfun_4({bs_final2,Src,Dst}, Vst0) -> assert_term(Src, Vst0), set_type_reg(binary, Dst, Vst0); +%% Map instructions. +valfun_4({put_map,{f,Fail},Src,Dst,Live,{list,List}}, Vst0) -> + verify_live(Live, Vst0), + verify_y_init(Vst0), + [assert_term(Term, Vst0) || Term <- List], + assert_term(Src, Vst0), + Vst1 = heap_alloc(0, Vst0), + Vst2 = branch_state(Fail, Vst1), + Vst = prune_x_regs(Live, Vst2), + set_type_reg(term, Dst, Vst); +valfun_4({get_map_element,{f,Fail},Src,Key,Dst}, Vst0) -> + assert_term(Src, Vst0), + assert_term(Key, Vst0), + Vst = branch_state(Fail, Vst0), + set_type_reg(term, Dst, Vst); valfun_4(_, _) -> error(unknown_instruction). |