diff options
author | Björn Gustavsson <[email protected]> | 2018-04-16 12:39:37 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2018-04-16 12:39:37 +0200 |
commit | 33f89162d9d0dc4ff2b4ccf9319fbf04889879f7 (patch) | |
tree | 228ded917bb4fd50aab839448414ef58ffedc933 | |
parent | faa093b0887ba931a86cc94246ce8ab47aa76aa4 (diff) | |
parent | 7441d0fd274c02969f5af79048c44d647e3be9e9 (diff) | |
download | otp-33f89162d9d0dc4ff2b4ccf9319fbf04889879f7.tar.gz otp-33f89162d9d0dc4ff2b4ccf9319fbf04889879f7.tar.bz2 otp-33f89162d9d0dc4ff2b4ccf9319fbf04889879f7.zip |
Merge branch 'bjorn/compiler/beam_validator'
* bjorn/compiler/beam_validator:
beam_validator: Remove repeated "this"
beam_validator: Remove unnecessary inclusion of beam_disasm.hrl
beam_validator: Strengthen validation of remaining GC instructions
-rw-r--r-- | lib/compiler/src/Makefile | 1 | ||||
-rw-r--r-- | lib/compiler/src/beam_validator.erl | 8 |
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/compiler/src/Makefile b/lib/compiler/src/Makefile index 9e96147787..c81b81e82b 100644 --- a/lib/compiler/src/Makefile +++ b/lib/compiler/src/Makefile @@ -186,7 +186,6 @@ release_docs_spec: $(EBIN)/beam_disasm.beam: $(EGEN)/beam_opcodes.hrl beam_disasm.hrl $(EBIN)/beam_listing.beam: core_parse.hrl v3_kernel.hrl -$(EBIN)/beam_validator.beam: beam_disasm.hrl $(EBIN)/cerl.beam: core_parse.hrl $(EBIN)/compile.beam: core_parse.hrl ../../stdlib/include/erl_compile.hrl $(EBIN)/core_lib.beam: core_parse.hrl diff --git a/lib/compiler/src/beam_validator.erl b/lib/compiler/src/beam_validator.erl index ee0011d397..d5aef51dfa 100644 --- a/lib/compiler/src/beam_validator.erl +++ b/lib/compiler/src/beam_validator.erl @@ -27,8 +27,6 @@ %% Interface for compiler. -export([module/2, format_error/1]). --include("beam_disasm.hrl"). - -import(lists, [any/2,dropwhile/2,foldl/3,foreach/2,reverse/1]). %% To be called by the compiler. @@ -569,7 +567,7 @@ valfun_4({loop_rec,{f,Fail},Dst}, Vst0) -> Vst = branch_state(Fail, Vst0), %% This term may not be part of the root set until %% remove_message/0 is executed. If control transfers - %% to the loop_rec_end/1 instruction, no part of this + %% to the loop_rec_end/1 instruction, no part of %% this term must be stored in a Y register. set_type_reg({fragile,term}, Dst, Vst); valfun_4({wait,_}, Vst) -> @@ -618,6 +616,7 @@ valfun_4({test,bs_start_match2,{f,Fail},Live,[Ctx,NeedSlots],Ctx}, Vst0) -> %% is OK as input. CtxType = get_move_term_type(Ctx, Vst0), verify_live(Live, Vst0), + verify_y_init(Vst0), Vst1 = prune_x_regs(Live, Vst0), BranchVst = case CtxType of #ms{} -> @@ -634,6 +633,7 @@ valfun_4({test,bs_start_match2,{f,Fail},Live,[Ctx,NeedSlots],Ctx}, Vst0) -> valfun_4({test,bs_start_match2,{f,Fail},Live,[Src,Slots],Dst}, Vst0) -> assert_term(Src, Vst0), verify_live(Live, Vst0), + verify_y_init(Vst0), Vst1 = prune_x_regs(Live, Vst0), Vst = branch_state(Fail, Vst1), set_type_reg(bsm_match_state(Slots), Src, Dst, Vst); @@ -836,6 +836,7 @@ verify_put_map(Fail, Src, Dst, Live, List, Vst0) -> validate_bs_get(Fail, Ctx, Live, Type, Dst, Vst0) -> bsm_validate_context(Ctx, Vst0), verify_live(Live, Vst0), + verify_y_init(Vst0), Vst1 = prune_x_regs(Live, Vst0), Vst = branch_state(Fail, Vst1), set_type_reg(Type, Dst, Vst). @@ -845,6 +846,7 @@ validate_bs_get(Fail, Ctx, Live, Type, Dst, Vst0) -> %% validate_bs_skip_utf(Fail, Ctx, Live, Vst0) -> bsm_validate_context(Ctx, Vst0), + verify_y_init(Vst0), verify_live(Live, Vst0), Vst = prune_x_regs(Live, Vst0), branch_state(Fail, Vst). |