~clint-fewbar/ubuntu/precise/erlang/merge-15b

« back to all changes in this revision

Viewing changes to lib/compiler/src/beam_validator.erl

  • Committer: Package Import Robot
  • Author(s): Sergei Golovan
  • Date: 2011-12-15 19:20:10 UTC
  • mfrom: (1.1.18) (3.5.15 sid)
  • mto: (3.5.16 sid)
  • mto: This revision was merged to the branch mainline in revision 33.
  • Revision ID: package-import@ubuntu.com-20111215192010-jnxcfe3tbrpp0big
Tags: 1:15.b-dfsg-1
* New upstream release.
* Upload to experimental because this release breaks external drivers
  API along with ABI, so several applications are to be fixed.
* Removed SSL patch because the old SSL implementation is removed from
  the upstream distribution.
* Removed never used patch which added native code to erlang beam files.
* Removed the erlang-docbuilder binary package because the docbuilder
  application was dropped by upstream.
* Documented dropping ${erlang-docbuilder:Depends} substvar in
  erlang-depends(1) manpage.
* Made erlang-base and erlang-base-hipe provide virtual package
  erlang-abi-15.b (the number means the first erlang version, which
  provides current ABI).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
%%
2
2
%% %CopyrightBegin%
3
3
%%
4
 
%% Copyright Ericsson AB 2004-2010. All Rights Reserved.
 
4
%% Copyright Ericsson AB 2004-2011. All Rights Reserved.
5
5
%%
6
6
%% The contents of this file are subject to the Erlang Public License,
7
7
%% Version 1.1, (the "License"); you may not use this file except in
166
166
    Ft = index_bs_start_match(Fs, []),
167
167
    validate_0(Module, Fs, Ft).
168
168
 
169
 
index_bs_start_match([{function,_,_,Entry,Code}|Fs], Acc0) ->
 
169
index_bs_start_match([{function,_,_,Entry,Code0}|Fs], Acc0) ->
 
170
    Code = dropwhile(fun({label,L}) when L =:= Entry -> false;
 
171
                        (_) -> true
 
172
                     end, Code0),
170
173
    case Code of
171
 
        [_,_,{label,Entry}|Is] ->
 
174
        [{label,Entry}|Is] ->
172
175
            Acc = index_bs_start_match_1(Is, Entry, Acc0),
173
176
            index_bs_start_match(Fs, Acc);
174
177
        _ ->
 
178
            %% Something serious is wrong. Ignore it for now.
 
179
            %% It will be detected and diagnosed later.
175
180
            index_bs_start_match(Fs, Acc0)
176
181
    end;
177
182
index_bs_start_match([], Acc) ->
292
297
 
293
298
labels_1([{label,L}|Is], R) ->
294
299
    labels_1(Is, [L|R]);
 
300
labels_1([{line,_}|Is], R) ->
 
301
    labels_1(Is, R);
295
302
labels_1(Is, R) ->
296
303
    {lists:reverse(R),Is}.
297
304
 
433
440
    Vst;
434
441
valfun_1({'%',_}, Vst) ->
435
442
    Vst;
 
443
valfun_1({line,_}, Vst) ->
 
444
    Vst;
436
445
%% Exception generating calls
437
446
valfun_1({call_ext,Live,Func}=I, Vst) ->
438
447
    case return_type(Func, Vst) of
661
670
valfun_4({test,bs_start_match2,{f,Fail},Live,[Ctx,NeedSlots],Ctx}, Vst0) ->
662
671
    %% If source and destination registers are the same, match state
663
672
    %% is OK as input.
664
 
    _ = get_move_term_type(Ctx, Vst0),
 
673
    CtxType = get_move_term_type(Ctx, Vst0),
665
674
    verify_live(Live, Vst0),
666
675
    Vst1 = prune_x_regs(Live, Vst0),
667
 
    Vst = branch_state(Fail, Vst1),
 
676
    BranchVst = case CtxType of
 
677
                    {match_context,_,_} ->
 
678
                        %% The failure branch will never be taken when Ctx
 
679
                        %% is a match context. Therefore, the type for Ctx
 
680
                        %% at the failure label must not be match_context
 
681
                        %% (or we could reject legal code).
 
682
                        set_type_reg(term, Ctx, Vst1);
 
683
                    _ ->
 
684
                        Vst1
 
685
                end,
 
686
    Vst = branch_state(Fail, BranchVst),
668
687
    set_type_reg(bsm_match_state(NeedSlots), Ctx, Vst);
669
688
valfun_4({test,bs_start_match2,{f,Fail},Live,[Src,Slots],Dst}, Vst0) ->
670
689
    assert_term(Src, Vst0),
870
889
    error(illegal_context_for_set_tuple_element);
871
890
val_dsetel({set_tuple_element,_,_,_}, #vst{current=#st{setelem=true}}=Vst) ->
872
891
    Vst;
 
892
val_dsetel({line,_}, Vst) ->
 
893
    Vst;
873
894
val_dsetel(_, #vst{current=#st{setelem=true}=St}=Vst) ->
874
895
    Vst#vst{current=St#st{setelem=false}};
875
896
val_dsetel(_, Vst) -> Vst.