├── .gitignore ├── .travis.yml ├── LICENSE.txt ├── Makefile ├── README.md ├── benchmarks ├── Makefile ├── Makefile.mods ├── bench.erl ├── bench.hrl └── modules │ ├── append3.erl │ ├── append3pp.erl │ ├── flip.erl │ ├── sumsqs.erl │ ├── sumsqs_lc.erl │ ├── sumsqtr.erl │ ├── to_utf8.erl │ ├── vecdot.erl │ └── vecdot_int.erl ├── due_to_arity_0.patch ├── prototype.scm ├── rebar.config ├── rebar.config.script ├── rebar.lock ├── src ├── erl_compile2.erl ├── erlang_supercompiler.erl ├── erlscp.app.src ├── scp.hrl ├── scp_desugar.erl ├── scp_expr.erl ├── scp_generalize.erl ├── scp_main.erl ├── scp_pattern.erl ├── scp_tidy.erl └── superlc.erl └── test ├── asm_data ├── deforestation0.hrl ├── deforestation1.hrl ├── deforestation10.hrl ├── deforestation2.hrl ├── deforestation3.hrl ├── deforestation4.hrl ├── deforestation5.hrl ├── dst │ ├── deforestation0.E │ ├── deforestation0.P │ ├── deforestation0.S │ ├── deforestation1.E │ ├── deforestation1.P │ ├── deforestation1.S │ ├── deforestation10.E │ ├── deforestation10.P │ ├── deforestation10.S │ ├── deforestation2.E │ ├── deforestation2.P │ ├── deforestation2.S │ ├── deforestation3.E │ ├── deforestation3.P │ ├── deforestation3.S │ ├── deforestation4.E │ ├── deforestation4.P │ ├── deforestation4.S │ ├── deforestation5.E │ ├── deforestation5.P │ ├── deforestation5.S │ ├── inline0.E │ ├── inline0.P │ ├── inline0.S │ ├── map1.E │ ├── map1.P │ ├── map1.S │ ├── map2.E │ ├── map2.P │ ├── map2.S │ ├── map3.E │ ├── map3.P │ ├── map3.S │ ├── map4.E │ ├── map4.P │ ├── map4.S │ ├── try0.E │ ├── try0.P │ ├── try0.S │ ├── try1.E │ ├── try1.P │ ├── try1.S │ ├── try2.E │ ├── try2.P │ ├── try2.S │ ├── try3.E │ ├── try3.P │ ├── try3.S │ ├── unfold0.E │ ├── unfold0.P │ ├── unfold0.S │ ├── unfold1.E │ ├── unfold1.P │ ├── unfold1.S │ ├── unfold2.E │ ├── unfold2.P │ ├── unfold2.S │ ├── unfold3.E │ ├── unfold3.P │ ├── unfold3.S │ ├── unfold5.E │ ├── unfold5.P │ └── unfold5.S ├── inline0.hrl ├── map1.hrl ├── map2.hrl ├── map3.hrl ├── map4.hrl ├── src │ ├── deforestation0.E │ ├── deforestation0.P │ ├── deforestation0.S │ ├── deforestation1.E │ ├── deforestation1.P │ ├── deforestation1.S │ ├── deforestation10.E │ ├── deforestation10.P │ ├── deforestation10.S │ ├── deforestation2.E │ ├── deforestation2.P │ ├── deforestation2.S │ ├── deforestation3.E │ ├── deforestation3.P │ ├── deforestation3.S │ ├── deforestation4.E │ ├── deforestation4.P │ ├── deforestation4.S │ ├── deforestation5.E │ ├── deforestation5.P │ ├── deforestation5.S │ ├── inline0.E │ ├── inline0.P │ ├── inline0.S │ ├── map1.E │ ├── map1.P │ ├── map1.S │ ├── map2.E │ ├── map2.P │ ├── map2.S │ ├── map3.E │ ├── map3.P │ ├── map3.S │ ├── map4.E │ ├── map4.P │ ├── map4.S │ ├── try0.E │ ├── try0.P │ ├── try0.S │ ├── try1.E │ ├── try1.P │ ├── try1.S │ ├── try2.E │ ├── try2.P │ ├── try2.S │ ├── try3.E │ ├── try3.P │ ├── try3.S │ ├── unfold0.E │ ├── unfold0.P │ ├── unfold0.S │ ├── unfold1.E │ ├── unfold1.P │ ├── unfold1.S │ ├── unfold2.E │ ├── unfold2.P │ ├── unfold2.S │ ├── unfold3.E │ ├── unfold3.P │ ├── unfold3.S │ ├── unfold4.S │ ├── unfold5.E │ ├── unfold5.P │ └── unfold5.S ├── try0.hrl ├── try1.hrl ├── try2.hrl ├── try3.hrl ├── unfold0.hrl ├── unfold1.hrl ├── unfold2.hrl ├── unfold3.hrl ├── unfold4.hrl └── unfold5.hrl ├── asm_tests.erl └── erlscp_tests.erl /.gitignore: -------------------------------------------------------------------------------- 1 | !ebin/*.S 2 | _build/ 3 | src/otp_flags.hrl 4 | superlc 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | 3 | language: erlang 4 | 5 | otp_release: 6 | - 20.1 7 | - 19.2 8 | - 18.3 9 | - 17.5 10 | - R16B03-1 11 | - R15B03 12 | 13 | matrix: 14 | fast_finish: true 15 | allow_failures: 16 | - otp_release: R15B03 17 | - otp_release: R16B03-1 18 | - otp_release: 17.5 19 | 20 | install: 21 | - wget https://s3.amazonaws.com/rebar3/rebar3 && chmod +x ./rebar3 22 | - export PATH=$PATH:$PWD 23 | 24 | before_script: 25 | - rebar3 --version 26 | - kerl list installations 27 | 28 | script: 29 | - set -e 30 | - make update_erl_compile2 31 | - make 32 | - rebar3 as test coveralls send 33 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | -*- coding: utf-8-with-signature -*- 2 | 3 | Copyright (C) 2012-2013 Göran Weinholt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a 6 | copy of this software and associated documentation files (the "Software"), 7 | to deal in the Software without restriction, including without limitation 8 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 | and/or sell copies of the Software, and to permit persons to whom the 10 | Software is furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 | DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all update_erl_compile2 2 | 3 | all: 4 | rebar3 do escriptize,xref,eunit,cover 5 | 6 | clean: 7 | rebar3 clean 8 | $(if $(wildcard ebin/*.beam), rm ebin/*.beam) 9 | 10 | update_erl_compile2: URL = 'https://raw.githubusercontent.com/erlang/otp/master/lib/stdlib/src/erl_compile.erl' 11 | update_erl_compile2: 12 | curl -o src/erl_compile2.erl $(URL) 13 | git apply due_to_arity_0.patch 14 | 15 | ASM = $(wildcard test/deforestation*.erl test/unfold*.erl test/try*.erl test/map*.erl) 16 | 17 | PA = _build/default/lib/erlscp/ebin/ 18 | ERLC = erlc -o ebin -pa ebin -pa $(PA) 19 | ERL = erl -noshell -pa ebin +A0 -boot start_clean 20 | 21 | old: ebin $(patsubst src/%.erl,ebin/%.beam,$(wildcard src/*.erl)) $(wildcard src/*.hrl) Makefile 22 | ebin: 23 | mkdir $@ 24 | ebin/%.beam: src/%.erl 25 | erlc -pa ebin -o ebin -DLOG $? 26 | test-old: $(patsubst test/%.erl,test.%,$(ASM)) 27 | test.%: old 28 | erlc -pa ebin -o ebin +'{parse_transform, erlang_supercompiler}' test/$*.erl 29 | $(ERL) -eval 'R = $*:a(), R = $*:b().' -s init stop 30 | 31 | test: S $(patsubst test/%.erl,test_%,$(ASM)) 32 | test_%: SUPERC = $(ERLC) +'{parse_transform, erlang_supercompiler}' 33 | test_%: $(OBJECTS) 34 | $(SUPERC) +to_asm test/$*.erl 35 | mv ebin/$*.S ebin/$*_.S 36 | $(ERLC) +to_asm test/$*.erl 37 | git add -A -f ebin/$*.S ebin/$*_.S 38 | git --no-pager diff --cached -- ebin 39 | $(SUPERC) test/$*.erl 40 | $(ERL) -eval 'R = $*:a(), R = $*:b().' -s init stop 41 | bash -c '[[ 0 -eq $$(git status --porcelain ebin/$*.S ebin/$*_.S | wc -l) ]]' 42 | 43 | S: $(patsubst test/%.erl,S_%,$(ASM)) 44 | git --no-pager diff -- ebin 45 | bash -c '[[ 0 -eq $$(git status --porcelain ebin/*.S | wc -l) ]]' 46 | S_%: test/%.erl 47 | erlc -o ebin +to_asm test/$*.erl 48 | erlc -o ebin test/$*.erl 49 | $(ERL) -eval 'R = $*:a(), R = $*:b().' -s init stop 50 | -------------------------------------------------------------------------------- /benchmarks/Makefile: -------------------------------------------------------------------------------- 1 | EBIN=ebin 2 | ERLC_FLAGS=-pa ebin 3 | SOURCES=$(wildcard *.erl) 4 | HEADERS=$(wildcard *.hrl) 5 | OBJECTS=$(SOURCES:%.erl=$(EBIN)/%.beam) 6 | 7 | all: $(OBJECTS) summary 8 | 9 | $(EBIN)/%.beam: %.erl $(HEADERS) Makefile 10 | @mkdir -p $(EBIN) 11 | erlc $(ERLC_FLAGS) -o $(EBIN)/ $< 12 | 13 | scp: 14 | @make -f Makefile.mods EBIN=ebin-scp ERLC_FLAGS="-pa ../ebin -DSUPERCOMPILE" 15 | noscp: 16 | @make -f Makefile.mods EBIN=ebin-noscp ERLC_FLAGS="-pa ../ebin" 17 | hipe_scp: 18 | @make -f Makefile.mods EBIN=ebin-hipe_scp ERLC_FLAGS="-pa ../ebin +native -DSUPERCOMPILE" 19 | hipe_noscp: 20 | @make -f Makefile.mods EBIN=ebin-hipe_noscp ERLC_FLAGS="-pa ../ebin +native" 21 | clean: 22 | @make -f Makefile.mods clean EBIN=ebin-scp 23 | @make -f Makefile.mods clean EBIN=ebin-noscp 24 | @make -f Makefile.mods clean EBIN=ebin-hipe_scp 25 | @make -f Makefile.mods clean EBIN=ebin-hipe_noscp 26 | -rm -f $(OBJECTS) run.txt 27 | 28 | run.txt: scp noscp hipe_scp hipe_noscp 29 | erl -noshell -pa ebin -pa ebin-noscp -eval 'bench:run(noscp)' -s init stop > run.txt 30 | erl -noshell -pa ebin -pa ebin-scp -eval 'bench:run(scp)' -s init stop >> run.txt 31 | erl -noshell -pa ebin -pa ebin-hipe_noscp -eval 'bench:run(hipe_noscp)' -s init stop >> run.txt 32 | erl -noshell -pa ebin -pa ebin-hipe_scp -eval 'bench:run(hipe_scp)' -s init stop >> run.txt 33 | 34 | summary: run.txt 35 | erl -noshell -pa ebin -eval 'bench:summary("run.txt")' -s init stop 36 | -------------------------------------------------------------------------------- /benchmarks/Makefile.mods: -------------------------------------------------------------------------------- 1 | # -*-makefile-*- 2 | #EBIN=ebin-scp 3 | #ERLC_FLAGS=-pa ../ebin -DSUPERCOMPILE 4 | SOURCES=$(wildcard modules/*.erl) 5 | HEADERS=$(wildcard modules/*.hrl) 6 | OBJECTS=$(SOURCES:modules/%.erl=$(EBIN)/%.beam) 7 | PARSED=$(SOURCES:modules/%.erl=$(EBIN)/%.P) 8 | all: $(OBJECTS) $(PARSED) 9 | $(EBIN)/%.beam: modules/%.erl $(HEADERS) Makefile 10 | @mkdir -p $(EBIN) 11 | erlc $(ERLC_FLAGS) -o $(EBIN)/ $< 12 | $(EBIN)/%.P: modules/%.erl $(HEADERS) Makefile 13 | @mkdir -p $(EBIN) 14 | erlc -P $(ERLC_FLAGS) -o $(EBIN)/ $< 15 | clean: 16 | -rm -f $(OBJECTS) $(PARSED) 17 | -------------------------------------------------------------------------------- /benchmarks/bench.hrl: -------------------------------------------------------------------------------- 1 | -ifdef(SUPERCOMPILE). 2 | -compile({parse_transform, erlang_supercompiler}). 3 | -endif. 4 | 5 | -define(MAKE_RUN(F,A), 6 | make_run([A]) -> fun () -> F(A) end). 7 | -define(MAKE_RUN(F,A,B), 8 | make_run([A,B]) -> fun () -> F(A,B) end). 9 | -define(MAKE_RUN(F,A,B,C), 10 | make_run([A,B,C]) -> fun () -> F(A,B,C) end). 11 | -------------------------------------------------------------------------------- /benchmarks/modules/append3.erl: -------------------------------------------------------------------------------- 1 | -module(append3). 2 | -export([input/0, make_run/1, check/2]). 3 | -include("bench.hrl"). 4 | 5 | input() -> 6 | [[1,2,3,4],[5,6,7,8],[9,10,11,12]]. 7 | 8 | check(_, [1,2,3,4,5,6,7,8,9,10,11,12]) -> 9 | true; 10 | check(_, _) -> 11 | false. 12 | 13 | ?MAKE_RUN(ap, Xs, Ys, Zs). 14 | 15 | ap([],Ys) -> Ys; 16 | ap([X|Xs],Ys) -> [X|ap(Xs,Ys)]. 17 | 18 | ap(Xs,Ys,Zs) -> 19 | ap(ap(Xs,Ys),Zs). 20 | -------------------------------------------------------------------------------- /benchmarks/modules/append3pp.erl: -------------------------------------------------------------------------------- 1 | -module(append3pp). 2 | -export([input/0, make_run/1, check/2]). 3 | -include("bench.hrl"). 4 | 5 | input() -> 6 | append3:input(). 7 | 8 | check(Result, Input) -> 9 | append3:check(Result, Input). 10 | 11 | ?MAKE_RUN(ap, Xs, Ys, Zs). 12 | 13 | ap(Xs,Ys,Zs) -> 14 | (Xs++Ys)++Zs. 15 | -------------------------------------------------------------------------------- /benchmarks/modules/flip.erl: -------------------------------------------------------------------------------- 1 | -module(flip). 2 | -export([input/0, make_run/1, check/2]). 3 | -include("bench.hrl"). 4 | 5 | %% Generate a tree of depth N. All the leafs will be at the bottom. 6 | gentree(I,N) when I > N -> 7 | {leaf,N}; 8 | gentree(I,N) -> 9 | {branch,gentree(I+1,N),gentree(I+1,N)}. 10 | 11 | depth({leaf,_}) -> 12 | 0; 13 | depth({branch,L,R}) -> 14 | 1 + max(depth(L),depth(R)). 15 | 16 | input() -> 17 | [gentree(1,12)]. 18 | 19 | check([Tree], S) -> 20 | N = depth(Tree), 21 | S == N * math:pow(2, N). 22 | 23 | ?MAKE_RUN(flipsum, X). 24 | 25 | %% Example used in Jonsson's dissertation, from Wadler. 26 | sumtr({leaf,X}) -> 27 | X; 28 | sumtr({branch,L,R}) -> 29 | sumtr(L) + sumtr(R). 30 | 31 | flip({leaf,X}) -> 32 | {leaf,X}; 33 | flip({branch,L,R}) -> 34 | {branch,flip(R),flip(L)}. 35 | 36 | flipsum(X) -> 37 | sumtr(flip(flip((X)))). 38 | -------------------------------------------------------------------------------- /benchmarks/modules/sumsqs.erl: -------------------------------------------------------------------------------- 1 | -module(sumsqs). 2 | -export([input/0, make_run/1, check/2]). 3 | -include("bench.hrl"). 4 | 5 | input() -> 6 | [lists:seq(1, 300)]. 7 | 8 | check([Xs], S) -> 9 | N=lists:last(Xs), 10 | S == ((2*N*N*N)+(3*N*N)+N)/6. 11 | 12 | ?MAKE_RUN(sumsqs, Xs). 13 | 14 | map(_,[]) -> []; 15 | map(Fun,[X|Xs]) -> [Fun(X)|map(Fun,Xs)]. 16 | 17 | sum([]) -> 0; 18 | sum([X|Xs]) -> X + sum(Xs). 19 | 20 | sumsqs(Xs) -> 21 | sum(map(fun (X) -> X * X end, Xs)). 22 | -------------------------------------------------------------------------------- /benchmarks/modules/sumsqs_lc.erl: -------------------------------------------------------------------------------- 1 | -module(sumsqs_lc). 2 | -export([input/0, make_run/1, check/2]). 3 | -include("bench.hrl"). 4 | 5 | 6 | input() -> sumsqs:input(). 7 | check(Input, Result) -> sumsqs:check(Input, Result). 8 | %% -compile({no_whistle,[make_run/1]}). 9 | ?MAKE_RUN(sumsqs, Xs). 10 | 11 | sum([]) -> 0; 12 | sum([X|Xs]) -> X + sum(Xs). 13 | 14 | sumsqs(Xs) -> 15 | sum([ X * X || X <- Xs ]). 16 | -------------------------------------------------------------------------------- /benchmarks/modules/sumsqtr.erl: -------------------------------------------------------------------------------- 1 | -module(sumsqtr). 2 | -export([input/0, make_run/1, check/2]). 3 | -include("bench.hrl"). 4 | 5 | %% Generate a tree of depth N. All the leafs will be at the bottom. 6 | gentree(I,N) when I > N -> 7 | {leaf,N}; 8 | gentree(I,N) -> 9 | {branch,gentree(I+1,N),gentree(I+1,N)}. 10 | 11 | depth({leaf,_}) -> 12 | 0; 13 | depth({branch,L,R}) -> 14 | 1 + max(depth(L),depth(R)). 15 | 16 | input() -> 17 | [gentree(1,12)]. 18 | 19 | check([Tree], S) -> 20 | N = depth(Tree), 21 | S == N * N * math:pow(2, N). 22 | 23 | ?MAKE_RUN(sumsqtr, X). 24 | 25 | %% Example used in Jonsson's dissertation, from Wadler. 26 | square(X) -> 27 | X * X. 28 | 29 | sumtr({leaf,X}) -> 30 | X; 31 | sumtr({branch,L,R}) -> 32 | sumtr(L) + sumtr(R). 33 | 34 | squaretr({leaf,X}) -> 35 | {leaf,square(X)}; 36 | squaretr({branch,L,R}) -> 37 | {branch,squaretr(L),squaretr(R)}. 38 | 39 | sumsqtr(X) -> 40 | sumtr(squaretr(X)). 41 | -------------------------------------------------------------------------------- /benchmarks/modules/to_utf8.erl: -------------------------------------------------------------------------------- 1 | -module(to_utf8). 2 | -export([input/0, make_run/1, check/2]). 3 | -include("bench.hrl"). 4 | 5 | input() -> 6 | ["Aristoteles Αριστοτέλης Aristotle"]. 7 | 8 | check(Input, Result) -> 9 | Expect = binary:bin_to_list( 10 | unicode:characters_to_binary(Input, unicode, utf8)), 11 | Result == Expect. 12 | 13 | ?MAKE_RUN(string_to_utf8, S). 14 | 15 | map(_,[]) -> []; 16 | map(Fun,[X|Xs]) -> [Fun(X)|map(Fun,Xs)]. 17 | 18 | flatten([]) -> []; 19 | flatten([Xs|Xss]) -> Xs ++ flatten(Xss). 20 | 21 | to_utf8(Code, Len, I, Set, Mask) when Len >= I -> 22 | A = if Len == I -> Code; true -> Code bsr (6 * (Len - I)) end, 23 | B = if Set == 0 -> A; true -> A bor Set end, 24 | [if Mask == 16#FF -> B; true -> B band Mask end]; 25 | to_utf8(_, _, _, _, _) -> 26 | []. 27 | 28 | to_utf8(Code, Len) -> 29 | LengthCodes = {16#00, 16#00, 16#C0, 16#E0, 16#F0}, 30 | flatten( 31 | [to_utf8(Code, Len, 1, element(Len + 1, LengthCodes), 16#FF), 32 | to_utf8(Code, Len, 2, 16#80, 16#BF), 33 | to_utf8(Code, Len, 3, 16#80, 16#BF), 34 | to_utf8(Code, Len, 4, 16#80, 16#BF)]). 35 | 36 | to_utf8(Code) when Code < 16#80 -> to_utf8(Code, 1); 37 | to_utf8(Code) when Code < 16#800 -> to_utf8(Code, 2); 38 | to_utf8(Code) when Code < 16#10000 -> to_utf8(Code, 3); 39 | to_utf8(Code) -> to_utf8(Code, 4). 40 | 41 | string_to_utf8(S) -> 42 | flatten(map(fun to_utf8/1, S)). 43 | -------------------------------------------------------------------------------- /benchmarks/modules/vecdot.erl: -------------------------------------------------------------------------------- 1 | -module(vecdot). 2 | -export([input/0, make_run/1, check/2]). 3 | -include("bench.hrl"). 4 | 5 | input() -> 6 | [[10.0,22.0,33.0,44.0,0.0], 7 | [55.0,66.0,77.0,88.0,0.0]]. 8 | 9 | check(_, N) -> 10 | trunc(N) == 8415. 11 | 12 | ?MAKE_RUN(vecdot, Xs, Ys). 13 | 14 | %% Another example shown in Jonsson's thesis. This cheats a little bit 15 | %% by having the explicit case on Ys0. 16 | zipwith(Fun, [X|Xs], Ys0) -> 17 | case Ys0 of 18 | [] -> Ys0; 19 | [Y|Ys] -> 20 | [Fun(X, Y)|zipwith(Fun, Xs,Ys)] 21 | end; 22 | zipwith(_Fun, _, _) -> []. 23 | 24 | sum([]) -> 0; 25 | sum([X|Xs]) -> X + sum(Xs). 26 | 27 | vecdot(Xs, Ys) -> 28 | sum(zipwith(fun (X, Y) -> X * Y end, Xs, Ys)). 29 | -------------------------------------------------------------------------------- /benchmarks/modules/vecdot_int.erl: -------------------------------------------------------------------------------- 1 | -module(vecdot_int). 2 | -export([input/0, make_run/1, check/2]). 3 | -include("bench.hrl"). 4 | 5 | input() -> 6 | [[10,22,33,44,0], 7 | [55,66,77,88,0]]. 8 | 9 | check(_, N) -> 10 | trunc(N) == 8415. 11 | 12 | ?MAKE_RUN(vecdot, Xs, Ys). 13 | 14 | %% Another example shown in Jonsson's thesis. This cheats a little bit 15 | %% by having the explicit case on Ys0. 16 | zipwith(Fun, [X|Xs], Ys0) -> 17 | case Ys0 of 18 | [] -> Ys0; 19 | [Y|Ys] -> 20 | [Fun(X, Y)|zipwith(Fun, Xs,Ys)] 21 | end; 22 | zipwith(_Fun, _, _) -> []. 23 | 24 | sum([]) -> 0; 25 | sum([X|Xs]) -> X + sum(Xs). 26 | 27 | vecdot(Xs, Ys) -> 28 | sum(zipwith(fun (X, Y) -> X * Y end, Xs, Ys)). 29 | -------------------------------------------------------------------------------- /due_to_arity_0.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/erl_compile2.erl b/src/erl_compile2.erl 2 | index 18d7548..d45c6b0 100644 3 | --- a/src/erl_compile2.erl 4 | +++ b/src/erl_compile2.erl 5 | @@ -17,12 +17,12 @@ 6 | %% 7 | %% %CopyrightEnd% 8 | %% 9 | --module(erl_compile). 10 | +-module(erl_compile2). 11 | 12 | --include("erl_compile.hrl"). 13 | --include("file.hrl"). 14 | +-include_lib("stdlib/include/erl_compile.hrl"). 15 | +-include_lib("kernel/include/file.hrl"). 16 | 17 | --export([compile_cmdline/0]). 18 | +-export([compile_cmdline/1]). 19 | 20 | -export_type([cmd_line_arg/0]). 21 | 22 | @@ -50,10 +50,9 @@ compiler(_) -> no. 23 | 24 | -type cmd_line_arg() :: atom() | string(). 25 | 26 | --spec compile_cmdline() -> no_return(). 27 | +-spec compile_cmdline([cmd_line_arg()]) -> no_return(). 28 | 29 | -compile_cmdline() -> 30 | - List = init:get_plain_arguments(), 31 | +compile_cmdline(List) -> 32 | case compile(List) of 33 | ok -> my_halt(0); 34 | error -> my_halt(1); 35 | -------------------------------------------------------------------------------- /rebar.config: -------------------------------------------------------------------------------- 1 | {erl_first_files, ["src/erlang_supercompiler.erl" 2 | ]}. 3 | 4 | {erl_opts, [debug_info 5 | ,warn_export_all 6 | ,warn_unused_import 7 | ,warn_unused_vars 8 | ,{platform_define, "^20", 'OTP_20'} 9 | ,{platform_define, "^19", 'OTP_19'} 10 | ,{platform_define, "^19|^[2-9]", 'OTP_19_AND_ABOVE'} 11 | ,{platform_define, "^18", 'OTP_18'} 12 | ,{platform_define, "^1[89]|^[2-9]", 'OTP_18_AND_ABOVE'} 13 | ,{platform_define, "^17", 'OTP_17'} 14 | ,{platform_define, "^R16", 'OTP_16'} 15 | ,{platform_define, "^R15", 'OTP_15'} 16 | ]}. 17 | 18 | {xref_warnings, true}. 19 | {xref_checks, [undefined_function_calls 20 | ,undefined_functions 21 | ,locals_not_used 22 | %% ,exports_not_used 23 | ,deprecated_function_calls 24 | ,deprecated_functions 25 | ]}. 26 | 27 | {escript_name, superlc}. 28 | %% From https://github.com/erlang/otp/blob/4b8255e9217c293f84a1e96b3ae8034d089e815b/erts/etc/common/erlc.c#L233-L239 29 | {escript_emu_args, "%%! +sbtu +A0 -noinput -mode minimal -boot no_dot_erlang\n"}. 30 | 31 | {post_hooks, [{escriptize, "cp _build/default/bin/superlc ./superlc"} 32 | ]}. 33 | 34 | {profiles, [{test, [{plugins, [coveralls]} 35 | ]} 36 | ]}. 37 | 38 | {cover_enabled, true}. 39 | {cover_export_enabled, true}. 40 | {cover_opts, [verbose]}. 41 | {cover_excl_mods, [erl_compile2, superlc]}. 42 | 43 | {coveralls_coverdata, "_build/test/cover/eunit.coverdata"}. 44 | {coveralls_service_name, "travis-ci"}. 45 | -------------------------------------------------------------------------------- /rebar.config.script: -------------------------------------------------------------------------------- 1 | case os:getenv("TRAVIS_JOB_ID") of 2 | false -> CONFIG; 3 | Id -> 4 | Key = coveralls_service_job_id, 5 | lists:keystore(Key, 1, CONFIG, {Key,Id}) 6 | end. 7 | -------------------------------------------------------------------------------- /rebar.lock: -------------------------------------------------------------------------------- 1 | []. 2 | -------------------------------------------------------------------------------- /src/erlscp.app.src: -------------------------------------------------------------------------------- 1 | {application, erlscp, 2 | [{description, "Supercompile Erlang code"} 3 | ,{vsn, "0.1.0"} 4 | ,{registered, []} 5 | ,{applications, [kernel 6 | ,stdlib 7 | ]} 8 | ,{env, []} 9 | ]}. 10 | -------------------------------------------------------------------------------- /src/scp.hrl: -------------------------------------------------------------------------------- 1 | %% -*- coding: utf-8; mode: erlang -*- 2 | 3 | %% Copyright (C) 2012-2013, 2017 Göran Weinholt 4 | 5 | %% Permission is hereby granted, free of charge, to any person obtaining a 6 | %% copy of this software and associated documentation files (the "Software"), 7 | %% to deal in the Software without restriction, including without limitation 8 | %% the rights to use, copy, modify, merge, publish, distribute, sublicense, 9 | %% and/or sell copies of the Software, and to permit persons to whom the 10 | %% Software is furnished to do so, subject to the following conditions: 11 | 12 | %% The above copyright notice and this permission notice shall be included in 13 | %% all copies or substantial portions of the Software. 14 | 15 | %% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | %% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | %% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 18 | %% THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | %% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20 | %% FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 21 | %% DEALINGS IN THE SOFTWARE. 22 | 23 | %% Environments. 24 | -record(env, {found = [] 25 | ,w = [] 26 | ,ls = [] 27 | ,memo = [] 28 | %% This contains the variables that were returned in a 29 | %% substitution created by scp_generalize:split/2. 30 | ,split_vars = [] 31 | ,bound = sets:new() 32 | %% Global and local functions. The keys are {Name,Arity} 33 | %% and the values are fun terms. 34 | ,global = dict:new() 35 | ,local = dict:new() 36 | %% seen_vars keeps track of all the variable names which 37 | %% have been seen anywhere. It's used when generating 38 | %% fresh names (gensym). 39 | ,seen_vars = sets:new() 40 | %% The name of the function being supercompiled. 41 | ,name = "" 42 | %% The whistle can be disabled. 43 | ,whistle_enabled = true 44 | ,no_whistling = sets:new() 45 | %% The gensym'd names for stdfuns(). 46 | ,libnames = dict:new() 47 | %% Record definitions 48 | ,records = dict:new() 49 | }). 50 | 51 | -define(IS_CONST_TYPE(T), T =:= atom; 52 | T =:= binary; 53 | T =:= char; 54 | T =:= float; 55 | T =:= integer; 56 | T =:= nil; 57 | T =:= string 58 | ). 59 | 60 | -define(IS_CONST_EXPR(E), 61 | ?IS_CONST_TYPE(element(1,E)); 62 | element(1,E)==tuple, element(3,E)==[]). 63 | 64 | -ifdef(LOG). 65 | -define(DEBUG(P,A), io:fwrite(P,A)). 66 | -else. 67 | -define(DEBUG(P,A), ok). 68 | -endif. 69 | -------------------------------------------------------------------------------- /src/superlc.erl: -------------------------------------------------------------------------------- 1 | %% -*- coding: utf-8; mode: erlang -*- 2 | %% @module Escript entry point. 3 | -module(superlc). 4 | 5 | -export([main/1]). 6 | 7 | main(Args0) -> 8 | Args = ["+{parse_transform, erlang_supercompiler}" | Args0], 9 | erl_compile2:compile_cmdline(Args). 10 | -------------------------------------------------------------------------------- /test/asm_data/deforestation0.hrl: -------------------------------------------------------------------------------- 1 | -module(deforestation0). 2 | -export([a/0, b/0]). 3 | 4 | a() -> hd([get()]). 5 | 6 | b() -> get(). 7 | -------------------------------------------------------------------------------- /test/asm_data/deforestation1.hrl: -------------------------------------------------------------------------------- 1 | -module(deforestation1). 2 | -export([a/0, b/0]). 3 | 4 | a() -> binary_to_list(<<"0.1.0">>). 5 | 6 | b() -> "0.1.0". 7 | -------------------------------------------------------------------------------- /test/asm_data/deforestation10.hrl: -------------------------------------------------------------------------------- 1 | -module(deforestation10). 2 | -export([a/0, b/0, a/1, b/1]). 3 | 4 | a() -> a([blip, blop, 3]). 5 | a(Args) -> 6 | case not lists:member(length(Args), [1,2]) of 7 | true -> io:format("usage: ...\n", []); 8 | false -> do:the_thing(Args) 9 | end. 10 | 11 | b() -> b([bla]). 12 | b([_]) -> io:format("usage: ...\n", []); 13 | b([_,_]) -> io:format("usage: ...\n", []); 14 | b([_|_]=Args) -> do:the_thing(Args). 15 | -------------------------------------------------------------------------------- /test/asm_data/deforestation2.hrl: -------------------------------------------------------------------------------- 1 | -module(deforestation2). 2 | -export([a/0, b/0]). 3 | 4 | -define(APP_VERSION, <<"0.1.0">>). 5 | 6 | a() -> "User Agent/" ++ binary_to_list(?APP_VERSION). 7 | 8 | b() -> "User Agent/0.1.0". 9 | -------------------------------------------------------------------------------- /test/asm_data/deforestation3.hrl: -------------------------------------------------------------------------------- 1 | -module(deforestation3). 2 | -export([a/0, b/0]). 3 | 4 | -define(APP, my_app). 5 | 6 | a() -> atom_to_list(?APP). 7 | 8 | b() -> "my_app". 9 | -------------------------------------------------------------------------------- /test/asm_data/deforestation4.hrl: -------------------------------------------------------------------------------- 1 | -module(deforestation4). 2 | -export([a/0, b/0]). 3 | 4 | -define(APP, my_app). 5 | 6 | a() -> iolist_to_binary(["app [", atom_to_list(?APP), <<"]">>]). 7 | 8 | b() -> <<"app [my_app]">>. 9 | -------------------------------------------------------------------------------- /test/asm_data/deforestation5.hrl: -------------------------------------------------------------------------------- 1 | -module(deforestation5). 2 | -export([a/0, b/0]). 3 | 4 | -define(APP, my_app). 5 | 6 | a() -> atom_to_binary(?APP, utf8). 7 | 8 | b() -> <<"my_app">>. 9 | -------------------------------------------------------------------------------- /test/asm_data/dst/deforestation0.E: -------------------------------------------------------------------------------- 1 | {deforestation0, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/deforestation0.erl",1}}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{call,4,{remote,4,{atom,4,erlang},{atom,4,get}},[]}]}]}, 7 | {function,6,b,0, 8 | [{clause,6,[],[], 9 | [{call,6,{remote,6,{atom,6,erlang},{atom,6,get}},[]}]}]}, 10 | {function,0,module_info,0, 11 | [{clause,0,[],[], 12 | [{call,0, 13 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 14 | [{atom,0,deforestation0}]}]}]}, 15 | {function,0,module_info,1, 16 | [{clause,0, 17 | [{var,0,'X'}], 18 | [], 19 | [{call,0, 20 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 21 | [{atom,0,deforestation0},{var,0,'X'}]}]}]}]} 22 | -------------------------------------------------------------------------------- /test/asm_data/dst/deforestation0.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/deforestation0.erl",1}}, 2 | {attribute,1,module,deforestation0}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,4,a,0,[{clause,4,[],[],[{call,4,{atom,4,get},[]}]}]}, 5 | {function,6,b,0,[{clause,6,[],[],[{call,6,{atom,6,get},[]}]}]}] 6 | -------------------------------------------------------------------------------- /test/asm_data/dst/deforestation0.S: -------------------------------------------------------------------------------- 1 | {deforestation0, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [], 4 | [{function,a,0,2, 5 | [{label,1}, 6 | {line,[{location,"test/asm_data/deforestation0.erl",4}]}, 7 | {func_info,{atom,deforestation0},{atom,a},0}, 8 | {label,2}, 9 | {call_ext_only,0,{extfunc,erlang,get,0}}]}, 10 | {function,b,0,4, 11 | [{label,3}, 12 | {line,[{location,"test/asm_data/deforestation0.erl",6}]}, 13 | {func_info,{atom,deforestation0},{atom,b},0}, 14 | {label,4}, 15 | {call_ext_only,0,{extfunc,erlang,get,0}}]}, 16 | {function,module_info,0,6, 17 | [{label,5}, 18 | {line,[]}, 19 | {func_info,{atom,deforestation0},{atom,module_info},0}, 20 | {label,6}, 21 | {move,{atom,deforestation0},{x,0}}, 22 | {line,[]}, 23 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 24 | {function,module_info,1,8, 25 | [{label,7}, 26 | {line,[]}, 27 | {func_info,{atom,deforestation0},{atom,module_info},1}, 28 | {label,8}, 29 | {move,{x,0},{x,1}}, 30 | {move,{atom,deforestation0},{x,0}}, 31 | {line,[]}, 32 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 33 | 9} 34 | -------------------------------------------------------------------------------- /test/asm_data/dst/deforestation1.E: -------------------------------------------------------------------------------- 1 | {deforestation1, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/deforestation1.erl",1}}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{call,4, 7 | {remote,4,{atom,4,erlang},{atom,4,binary_to_list}}, 8 | [{bin,4, 9 | [{bin_element,4, 10 | {char,4,48}, 11 | {integer,4,8}, 12 | [integer,{unit,1},unsigned,big]}, 13 | {bin_element,4, 14 | {char,4,46}, 15 | {integer,4,8}, 16 | [integer,{unit,1},unsigned,big]}, 17 | {bin_element,4, 18 | {char,4,49}, 19 | {integer,4,8}, 20 | [integer,{unit,1},unsigned,big]}, 21 | {bin_element,4, 22 | {char,4,46}, 23 | {integer,4,8}, 24 | [integer,{unit,1},unsigned,big]}, 25 | {bin_element,4, 26 | {char,4,48}, 27 | {integer,4,8}, 28 | [integer,{unit,1},unsigned,big]}]}]}]}]}, 29 | {function,6,b,0,[{clause,6,[],[],[{string,6,"0.1.0"}]}]}, 30 | {function,0,module_info,0, 31 | [{clause,0,[],[], 32 | [{call,0, 33 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 34 | [{atom,0,deforestation1}]}]}]}, 35 | {function,0,module_info,1, 36 | [{clause,0, 37 | [{var,0,'X'}], 38 | [], 39 | [{call,0, 40 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 41 | [{atom,0,deforestation1},{var,0,'X'}]}]}]}]} 42 | -------------------------------------------------------------------------------- /test/asm_data/dst/deforestation1.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/deforestation1.erl",1}}, 2 | {attribute,1,module,deforestation1}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{call,4, 7 | {atom,4,binary_to_list}, 8 | [{bin,4, 9 | [{bin_element,4, 10 | {string,4,"0.1.0"}, 11 | default,default}]}]}]}]}, 12 | {function,6,b,0,[{clause,6,[],[],[{string,6,"0.1.0"}]}]}] 13 | -------------------------------------------------------------------------------- /test/asm_data/dst/deforestation1.S: -------------------------------------------------------------------------------- 1 | {deforestation1, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [], 4 | [{function,a,0,2, 5 | [{label,1}, 6 | {line,[{location,"test/asm_data/deforestation1.erl",4}]}, 7 | {func_info,{atom,deforestation1},{atom,a},0}, 8 | {label,2}, 9 | {move,{literal,"0.1.0"},{x,0}}, 10 | return]}, 11 | {function,b,0,4, 12 | [{label,3}, 13 | {line,[{location,"test/asm_data/deforestation1.erl",6}]}, 14 | {func_info,{atom,deforestation1},{atom,b},0}, 15 | {label,4}, 16 | {move,{literal,"0.1.0"},{x,0}}, 17 | return]}, 18 | {function,module_info,0,6, 19 | [{label,5}, 20 | {line,[]}, 21 | {func_info,{atom,deforestation1},{atom,module_info},0}, 22 | {label,6}, 23 | {move,{atom,deforestation1},{x,0}}, 24 | {line,[]}, 25 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 26 | {function,module_info,1,8, 27 | [{label,7}, 28 | {line,[]}, 29 | {func_info,{atom,deforestation1},{atom,module_info},1}, 30 | {label,8}, 31 | {move,{x,0},{x,1}}, 32 | {move,{atom,deforestation1},{x,0}}, 33 | {line,[]}, 34 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 35 | 9} 36 | -------------------------------------------------------------------------------- /test/asm_data/dst/deforestation2.E: -------------------------------------------------------------------------------- 1 | {deforestation2, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/deforestation2.erl",1}}, 4 | {function,6,a,0, 5 | [{clause,6,[],[], 6 | [{'case',6, 7 | {string,6,"User Agent/"}, 8 | [{clause,1, 9 | [{nil,1}], 10 | [], 11 | [{call,6, 12 | {remote,6,{atom,6,erlang},{atom,6,binary_to_list}}, 13 | [{bin,6, 14 | [{bin_element,6, 15 | {char,6,48}, 16 | {integer,6,8}, 17 | [integer,{unit,1},unsigned,big]}, 18 | {bin_element,6, 19 | {char,6,46}, 20 | {integer,6,8}, 21 | [integer,{unit,1},unsigned,big]}, 22 | {bin_element,6, 23 | {char,6,49}, 24 | {integer,6,8}, 25 | [integer,{unit,1},unsigned,big]}, 26 | {bin_element,6, 27 | {char,6,46}, 28 | {integer,6,8}, 29 | [integer,{unit,1},unsigned,big]}, 30 | {bin_element,6, 31 | {char,6,48}, 32 | {integer,6,8}, 33 | [integer,{unit,1},unsigned,big]}]}]}]}, 34 | {clause,2, 35 | [{cons,2,{var,2,'X'},{var,2,'Xs'}}], 36 | [], 37 | [{cons,2, 38 | {var,2,'X'}, 39 | {call,2, 40 | {atom,2,a@2049}, 41 | [{var,2,'Xs'}, 42 | {call,6, 43 | {remote,6,{atom,6,erlang},{atom,6,binary_to_list}}, 44 | [{bin,6, 45 | [{bin_element,6, 46 | {char,6,48}, 47 | {integer,6,8}, 48 | [integer,{unit,1},unsigned,big]}, 49 | {bin_element,6, 50 | {char,6,46}, 51 | {integer,6,8}, 52 | [integer,{unit,1},unsigned,big]}, 53 | {bin_element,6, 54 | {char,6,49}, 55 | {integer,6,8}, 56 | [integer,{unit,1},unsigned,big]}, 57 | {bin_element,6, 58 | {char,6,46}, 59 | {integer,6,8}, 60 | [integer,{unit,1},unsigned,big]}, 61 | {bin_element,6, 62 | {char,6,48}, 63 | {integer,6,8}, 64 | [integer,{unit,1},unsigned,big]}]}]}]}}]}]}]}]}, 65 | {function,2,a@2049,2, 66 | [{clause,1,[{nil,1},{var,2,'Tmp'}],[],[{var,1,'Tmp'}]}, 67 | {clause,2, 68 | [{cons,2,{var,2,'X'},{var,2,'Xs'}},{var,2,'Tmp'}], 69 | [], 70 | [{cons,2, 71 | {var,2,'X'}, 72 | {call,2,{atom,2,a@2049},[{var,2,'Xs'},{var,2,'Tmp'}]}}]}]}, 73 | {function,8,b,0,[{clause,8,[],[],[{string,8,"User Agent/0.1.0"}]}]}, 74 | {function,0,module_info,0, 75 | [{clause,0,[],[], 76 | [{call,0, 77 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 78 | [{atom,0,deforestation2}]}]}]}, 79 | {function,0,module_info,1, 80 | [{clause,0, 81 | [{var,0,'X'}], 82 | [], 83 | [{call,0, 84 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 85 | [{atom,0,deforestation2},{var,0,'X'}]}]}]}]} 86 | -------------------------------------------------------------------------------- /test/asm_data/dst/deforestation2.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/deforestation2.erl",1}}, 2 | {attribute,1,module,deforestation2}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,6,a,0, 5 | [{clause,6,[],[], 6 | [{'case',6, 7 | {string,6,"User Agent/"}, 8 | [{clause,1, 9 | [{nil,1}], 10 | [], 11 | [{call,6, 12 | {atom,6,binary_to_list}, 13 | [{bin,6,[{bin_element,6,{string,6,"0.1.0"},default,default}]}]}]}, 14 | {clause,2, 15 | [{cons,2,{var,2,'X'},{var,2,'Xs'}}], 16 | [], 17 | [{cons,2, 18 | {var,2,'X'}, 19 | {call,2, 20 | {atom,2,a@2049}, 21 | [{var,2,'Xs'}, 22 | {call,6, 23 | {atom,6,binary_to_list}, 24 | [{bin,6, 25 | [{bin_element,6, 26 | {string,6,"0.1.0"}, 27 | default,default}]}]}]}}]}]}]}]}, 28 | {function,2,a@2049,2, 29 | [{clause,1,[{nil,1},{var,2,'Tmp'}],[],[{var,1,'Tmp'}]}, 30 | {clause,2, 31 | [{cons,2,{var,2,'X'},{var,2,'Xs'}},{var,2,'Tmp'}], 32 | [], 33 | [{cons,2, 34 | {var,2,'X'}, 35 | {call,2,{atom,2,a@2049},[{var,2,'Xs'},{var,2,'Tmp'}]}}]}]}, 36 | {function,8,b,0,[{clause,8,[],[],[{string,8,"User Agent/0.1.0"}]}]}] 37 | -------------------------------------------------------------------------------- /test/asm_data/dst/deforestation2.S: -------------------------------------------------------------------------------- 1 | {deforestation2, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [], 4 | [{function,a,0,2, 5 | [{label,1}, 6 | {line,[{location,"test/asm_data/deforestation2.erl",6}]}, 7 | {func_info,{atom,deforestation2},{atom,a},0}, 8 | {label,2}, 9 | {allocate,0,0}, 10 | {move,{literal,"0.1.0"},{x,1}}, 11 | {move,{literal,"ser Agent/"},{x,0}}, 12 | {line,[{location,"test/asm_data/deforestation2.erl",2}]}, 13 | {call,2,{f,4}}, 14 | {test_heap,2,1}, 15 | {put_list,{integer,85},{x,0},{x,0}}, 16 | {deallocate,0}, 17 | return]}, 18 | {function,a@2049,2,4, 19 | [{label,3}, 20 | {line,[{location,"test/asm_data/deforestation2.erl",1}]}, 21 | {func_info,{atom,deforestation2},{atom,a@2049},2}, 22 | {label,4}, 23 | {test,is_nonempty_list,{f,5},[{x,0}]}, 24 | {allocate,1,2}, 25 | {get_list,{x,0},{y,0},{x,0}}, 26 | {line,[{location,"test/asm_data/deforestation2.erl",2}]}, 27 | {call,2,{f,4}}, 28 | {test_heap,2,1}, 29 | {put_list,{y,0},{x,0},{x,0}}, 30 | {deallocate,1}, 31 | return, 32 | {label,5}, 33 | {test,is_nil,{f,3},[{x,0}]}, 34 | {move,{x,1},{x,0}}, 35 | return]}, 36 | {function,b,0,7, 37 | [{label,6}, 38 | {line,[{location,"test/asm_data/deforestation2.erl",8}]}, 39 | {func_info,{atom,deforestation2},{atom,b},0}, 40 | {label,7}, 41 | {move,{literal,"User Agent/0.1.0"},{x,0}}, 42 | return]}, 43 | {function,module_info,0,9, 44 | [{label,8}, 45 | {line,[]}, 46 | {func_info,{atom,deforestation2},{atom,module_info},0}, 47 | {label,9}, 48 | {move,{atom,deforestation2},{x,0}}, 49 | {line,[]}, 50 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 51 | {function,module_info,1,11, 52 | [{label,10}, 53 | {line,[]}, 54 | {func_info,{atom,deforestation2},{atom,module_info},1}, 55 | {label,11}, 56 | {move,{x,0},{x,1}}, 57 | {move,{atom,deforestation2},{x,0}}, 58 | {line,[]}, 59 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 60 | 12} 61 | -------------------------------------------------------------------------------- /test/asm_data/dst/deforestation3.E: -------------------------------------------------------------------------------- 1 | {deforestation3, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/deforestation3.erl",1}}, 4 | {function,6,a,0, 5 | [{clause,6,[],[], 6 | [{call,6, 7 | {remote,6,{atom,6,erlang},{atom,6,atom_to_list}}, 8 | [{atom,6,my_app}]}]}]}, 9 | {function,8,b,0,[{clause,8,[],[],[{string,8,"my_app"}]}]}, 10 | {function,0,module_info,0, 11 | [{clause,0,[],[], 12 | [{call,0, 13 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 14 | [{atom,0,deforestation3}]}]}]}, 15 | {function,0,module_info,1, 16 | [{clause,0, 17 | [{var,0,'X'}], 18 | [], 19 | [{call,0, 20 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 21 | [{atom,0,deforestation3},{var,0,'X'}]}]}]}]} 22 | -------------------------------------------------------------------------------- /test/asm_data/dst/deforestation3.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/deforestation3.erl",1}}, 2 | {attribute,1,module,deforestation3}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,6,a,0, 5 | [{clause,6,[],[], 6 | [{call,6,{atom,6,atom_to_list},[{atom,6,my_app}]}]}]}, 7 | {function,8,b,0,[{clause,8,[],[],[{string,8,"my_app"}]}]}] 8 | -------------------------------------------------------------------------------- /test/asm_data/dst/deforestation3.S: -------------------------------------------------------------------------------- 1 | {deforestation3, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [], 4 | [{function,a,0,2, 5 | [{label,1}, 6 | {line,[{location,"test/asm_data/deforestation3.erl",6}]}, 7 | {func_info,{atom,deforestation3},{atom,a},0}, 8 | {label,2}, 9 | {move,{literal,"my_app"},{x,0}}, 10 | return]}, 11 | {function,b,0,4, 12 | [{label,3}, 13 | {line,[{location,"test/asm_data/deforestation3.erl",8}]}, 14 | {func_info,{atom,deforestation3},{atom,b},0}, 15 | {label,4}, 16 | {move,{literal,"my_app"},{x,0}}, 17 | return]}, 18 | {function,module_info,0,6, 19 | [{label,5}, 20 | {line,[]}, 21 | {func_info,{atom,deforestation3},{atom,module_info},0}, 22 | {label,6}, 23 | {move,{atom,deforestation3},{x,0}}, 24 | {line,[]}, 25 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 26 | {function,module_info,1,8, 27 | [{label,7}, 28 | {line,[]}, 29 | {func_info,{atom,deforestation3},{atom,module_info},1}, 30 | {label,8}, 31 | {move,{x,0},{x,1}}, 32 | {move,{atom,deforestation3},{x,0}}, 33 | {line,[]}, 34 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 35 | 9} 36 | -------------------------------------------------------------------------------- /test/asm_data/dst/deforestation4.E: -------------------------------------------------------------------------------- 1 | {deforestation4, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/deforestation4.erl",1}}, 4 | {function,6,a,0, 5 | [{clause,6,[],[], 6 | [{call,6, 7 | {remote,6,{atom,6,erlang},{atom,6,iolist_to_binary}}, 8 | [{cons,6, 9 | {string,6,"app ["}, 10 | {cons,6, 11 | {call,6, 12 | {remote,6,{atom,6,erlang},{atom,6,atom_to_list}}, 13 | [{atom,6,my_app}]}, 14 | {cons,6, 15 | {bin,6, 16 | [{bin_element,6, 17 | {char,6,93}, 18 | {integer,6,8}, 19 | [integer,{unit,1},unsigned,big]}]}, 20 | {nil,6}}}}]}]}]}, 21 | {function,8,b,0, 22 | [{clause,8,[],[], 23 | [{bin,8, 24 | [{bin_element,8, 25 | {char,8,97}, 26 | {integer,8,8}, 27 | [integer,{unit,1},unsigned,big]}, 28 | {bin_element,8, 29 | {char,8,112}, 30 | {integer,8,8}, 31 | [integer,{unit,1},unsigned,big]}, 32 | {bin_element,8, 33 | {char,8,112}, 34 | {integer,8,8}, 35 | [integer,{unit,1},unsigned,big]}, 36 | {bin_element,8, 37 | {char,8,32}, 38 | {integer,8,8}, 39 | [integer,{unit,1},unsigned,big]}, 40 | {bin_element,8, 41 | {char,8,91}, 42 | {integer,8,8}, 43 | [integer,{unit,1},unsigned,big]}, 44 | {bin_element,8, 45 | {char,8,109}, 46 | {integer,8,8}, 47 | [integer,{unit,1},unsigned,big]}, 48 | {bin_element,8, 49 | {char,8,121}, 50 | {integer,8,8}, 51 | [integer,{unit,1},unsigned,big]}, 52 | {bin_element,8, 53 | {char,8,95}, 54 | {integer,8,8}, 55 | [integer,{unit,1},unsigned,big]}, 56 | {bin_element,8, 57 | {char,8,97}, 58 | {integer,8,8}, 59 | [integer,{unit,1},unsigned,big]}, 60 | {bin_element,8, 61 | {char,8,112}, 62 | {integer,8,8}, 63 | [integer,{unit,1},unsigned,big]}, 64 | {bin_element,8, 65 | {char,8,112}, 66 | {integer,8,8}, 67 | [integer,{unit,1},unsigned,big]}, 68 | {bin_element,8, 69 | {char,8,93}, 70 | {integer,8,8}, 71 | [integer,{unit,1},unsigned,big]}]}]}]}, 72 | {function,0,module_info,0, 73 | [{clause,0,[],[], 74 | [{call,0, 75 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 76 | [{atom,0,deforestation4}]}]}]}, 77 | {function,0,module_info,1, 78 | [{clause,0, 79 | [{var,0,'X'}], 80 | [], 81 | [{call,0, 82 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 83 | [{atom,0,deforestation4},{var,0,'X'}]}]}]}]} 84 | -------------------------------------------------------------------------------- /test/asm_data/dst/deforestation4.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/deforestation4.erl",1}}, 2 | {attribute,1,module,deforestation4}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,6,a,0, 5 | [{clause,6,[],[], 6 | [{call,6, 7 | {atom,6,iolist_to_binary}, 8 | [{cons,6, 9 | {string,6,"app ["}, 10 | {cons,6, 11 | {call,6,{atom,6,atom_to_list},[{atom,6,my_app}]}, 12 | {cons,6, 13 | {bin,6, 14 | [{bin_element,6, 15 | {string,6,"]"}, 16 | default,default}]}, 17 | {nil,6}}}}]}]}]}, 18 | {function,8,b,0, 19 | [{clause,8,[],[], 20 | [{bin,8, 21 | [{bin_element,8, 22 | {string,8,"app [my_app]"}, 23 | default,default}]}]}]}] 24 | -------------------------------------------------------------------------------- /test/asm_data/dst/deforestation4.S: -------------------------------------------------------------------------------- 1 | {deforestation4, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [], 4 | [{function,a,0,2, 5 | [{label,1}, 6 | {line,[{location,"test/asm_data/deforestation4.erl",6}]}, 7 | {func_info,{atom,deforestation4},{atom,a},0}, 8 | {label,2}, 9 | {move,{literal,["app [","my_app",<<"]">>]},{x,0}}, 10 | {line,[{location,"test/asm_data/deforestation4.erl",6}]}, 11 | {call_ext_only,1,{extfunc,erlang,iolist_to_binary,1}}]}, 12 | {function,b,0,4, 13 | [{label,3}, 14 | {line,[{location,"test/asm_data/deforestation4.erl",8}]}, 15 | {func_info,{atom,deforestation4},{atom,b},0}, 16 | {label,4}, 17 | {move,{literal,<<"app [my_app]">>},{x,0}}, 18 | return]}, 19 | {function,module_info,0,6, 20 | [{label,5}, 21 | {line,[]}, 22 | {func_info,{atom,deforestation4},{atom,module_info},0}, 23 | {label,6}, 24 | {move,{atom,deforestation4},{x,0}}, 25 | {line,[]}, 26 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 27 | {function,module_info,1,8, 28 | [{label,7}, 29 | {line,[]}, 30 | {func_info,{atom,deforestation4},{atom,module_info},1}, 31 | {label,8}, 32 | {move,{x,0},{x,1}}, 33 | {move,{atom,deforestation4},{x,0}}, 34 | {line,[]}, 35 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 36 | 9} 37 | -------------------------------------------------------------------------------- /test/asm_data/dst/deforestation5.E: -------------------------------------------------------------------------------- 1 | {deforestation5, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/deforestation5.erl",1}}, 4 | {function,6,a,0, 5 | [{clause,6,[],[], 6 | [{call,6, 7 | {remote,6,{atom,6,erlang},{atom,6,atom_to_binary}}, 8 | [{atom,6,my_app},{atom,6,utf8}]}]}]}, 9 | {function,8,b,0, 10 | [{clause,8,[],[], 11 | [{bin,8, 12 | [{bin_element,8, 13 | {char,8,109}, 14 | {integer,8,8}, 15 | [integer,{unit,1},unsigned,big]}, 16 | {bin_element,8, 17 | {char,8,121}, 18 | {integer,8,8}, 19 | [integer,{unit,1},unsigned,big]}, 20 | {bin_element,8, 21 | {char,8,95}, 22 | {integer,8,8}, 23 | [integer,{unit,1},unsigned,big]}, 24 | {bin_element,8, 25 | {char,8,97}, 26 | {integer,8,8}, 27 | [integer,{unit,1},unsigned,big]}, 28 | {bin_element,8, 29 | {char,8,112}, 30 | {integer,8,8}, 31 | [integer,{unit,1},unsigned,big]}, 32 | {bin_element,8, 33 | {char,8,112}, 34 | {integer,8,8}, 35 | [integer,{unit,1},unsigned,big]}]}]}]}, 36 | {function,0,module_info,0, 37 | [{clause,0,[],[], 38 | [{call,0, 39 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 40 | [{atom,0,deforestation5}]}]}]}, 41 | {function,0,module_info,1, 42 | [{clause,0, 43 | [{var,0,'X'}], 44 | [], 45 | [{call,0, 46 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 47 | [{atom,0,deforestation5},{var,0,'X'}]}]}]}]} 48 | -------------------------------------------------------------------------------- /test/asm_data/dst/deforestation5.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/deforestation5.erl",1}}, 2 | {attribute,1,module,deforestation5}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,6,a,0, 5 | [{clause,6,[],[], 6 | [{call,6, 7 | {atom,6,atom_to_binary}, 8 | [{atom,6,my_app},{atom,6,utf8}]}]}]}, 9 | {function,8,b,0, 10 | [{clause,8,[],[], 11 | [{bin,8,[{bin_element,8,{string,8,"my_app"},default,default}]}]}]}] 12 | -------------------------------------------------------------------------------- /test/asm_data/dst/deforestation5.S: -------------------------------------------------------------------------------- 1 | {deforestation5, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [], 4 | [{function,a,0,2, 5 | [{label,1}, 6 | {line,[{location,"test/asm_data/deforestation5.erl",6}]}, 7 | {func_info,{atom,deforestation5},{atom,a},0}, 8 | {label,2}, 9 | {move,{literal,<<"my_app">>},{x,0}}, 10 | return]}, 11 | {function,b,0,4, 12 | [{label,3}, 13 | {line,[{location,"test/asm_data/deforestation5.erl",8}]}, 14 | {func_info,{atom,deforestation5},{atom,b},0}, 15 | {label,4}, 16 | {move,{literal,<<"my_app">>},{x,0}}, 17 | return]}, 18 | {function,module_info,0,6, 19 | [{label,5}, 20 | {line,[]}, 21 | {func_info,{atom,deforestation5},{atom,module_info},0}, 22 | {label,6}, 23 | {move,{atom,deforestation5},{x,0}}, 24 | {line,[]}, 25 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 26 | {function,module_info,1,8, 27 | [{label,7}, 28 | {line,[]}, 29 | {func_info,{atom,deforestation5},{atom,module_info},1}, 30 | {label,8}, 31 | {move,{x,0},{x,1}}, 32 | {move,{atom,deforestation5},{x,0}}, 33 | {line,[]}, 34 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 35 | 9} 36 | -------------------------------------------------------------------------------- /test/asm_data/dst/inline0.E: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/inline0.erl",1}}, 2 | {attribute,2,module,inline0}, 3 | {attribute,3,export,[{a,0},{b,0}]}, 4 | {function,5,a,0,[{clause,5,[],[],[{integer,6,0}]}]}, 5 | {function,9,a1,1, 6 | [{clause,9, 7 | [{var,9,'N'}], 8 | [], 9 | [{tuple,9,[{var,9,'N'},{var,9,'N'}]}]}]}, 10 | {function,11,b,0,[{clause,11,[],[],[{integer,11,0}]}]}] 11 | -------------------------------------------------------------------------------- /test/asm_data/dst/inline0.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/inline0.erl",1}}, 2 | {attribute,2,module,inline0}, 3 | {attribute,3,export,[{a,0},{b,0}]}, 4 | {function,5,a,0,[{clause,5,[],[],[{integer,6,0}]}]}, 5 | {function,9,a1,1, 6 | [{clause,9, 7 | [{var,9,'N'}], 8 | [], 9 | [{tuple,9,[{var,9,'N'},{var,9,'N'}]}]}]}, 10 | {function,11,b,0,[{clause,11,[],[],[{integer,11,0}]}]}] 11 | -------------------------------------------------------------------------------- /test/asm_data/dst/inline0.S: -------------------------------------------------------------------------------- 1 | {inline0,[{a,0},{b,0},{module_info,0},{module_info,1}], 2 | [], 3 | [{function,a,0,2, 4 | [{label,1}, 5 | {line,[{location,"test/asm_data/inline0.erl",5}]}, 6 | {func_info,{atom,inline0},{atom,a},0}, 7 | {label,2}, 8 | {move,{integer,0},{x,0}}, 9 | return]}, 10 | {function,b,0,4, 11 | [{label,3}, 12 | {line,[{location,"test/asm_data/inline0.erl",11}]}, 13 | {func_info,{atom,inline0},{atom,b},0}, 14 | {label,4}, 15 | {move,{integer,0},{x,0}}, 16 | return]}, 17 | {function,module_info,0,6, 18 | [{label,5}, 19 | {line,[]}, 20 | {func_info,{atom,inline0},{atom,module_info},0}, 21 | {label,6}, 22 | {move,{atom,inline0},{x,0}}, 23 | {line,[]}, 24 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 25 | {function,module_info,1,8, 26 | [{label,7}, 27 | {line,[]}, 28 | {func_info,{atom,inline0},{atom,module_info},1}, 29 | {label,8}, 30 | {move,{x,0},{x,1}}, 31 | {move,{atom,inline0},{x,0}}, 32 | {line,[]}, 33 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 34 | 9} 35 | -------------------------------------------------------------------------------- /test/asm_data/dst/map1.E: -------------------------------------------------------------------------------- 1 | {map1, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/map1.erl",1}}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{'case',4, 7 | {map,5,[{map_field_assoc,5,{atom,5,a},{integer,5,1}}]}, 8 | [{clause,5, 9 | [{var,5,'M'}], 10 | [], 11 | [{map,6, 12 | {var,6,'M'}, 13 | [{map_field_assoc,6,{atom,6,a},{integer,6,42}}, 14 | {map_field_assoc,6, 15 | {atom,6,b}, 16 | {integer,6,1}}]}]}]}]}]}, 17 | {function,8,b,0, 18 | [{clause,8,[],[], 19 | [{map,8, 20 | [{map_field_assoc,8,{atom,8,a},{integer,8,42}}, 21 | {map_field_assoc,8,{atom,8,b},{integer,8,1}}]}]}]}, 22 | {function,0,module_info,0, 23 | [{clause,0,[],[], 24 | [{call,0, 25 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 26 | [{atom,0,map1}]}]}]}, 27 | {function,0,module_info,1, 28 | [{clause,0, 29 | [{var,0,'X'}], 30 | [], 31 | [{call,0, 32 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 33 | [{atom,0,map1},{var,0,'X'}]}]}]}]} 34 | -------------------------------------------------------------------------------- /test/asm_data/dst/map1.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/map1.erl",1}}, 2 | {attribute,1,module,map1}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{'case',4, 7 | {map,5,[{map_field_assoc,5,{atom,5,a},{integer,5,1}}]}, 8 | [{clause,5, 9 | [{var,5,'M'}], 10 | [], 11 | [{map,6, 12 | {var,6,'M'}, 13 | [{map_field_assoc,6,{atom,6,a},{integer,6,42}}, 14 | {map_field_assoc,6, 15 | {atom,6,b}, 16 | {integer,6,1}}]}]}]}]}]}, 17 | {function,8,b,0, 18 | [{clause,8,[],[], 19 | [{map,8, 20 | [{map_field_assoc,8,{atom,8,a},{integer,8,42}}, 21 | {map_field_assoc,8,{atom,8,b},{integer,8,1}}]}]}]}] 22 | -------------------------------------------------------------------------------- /test/asm_data/dst/map1.S: -------------------------------------------------------------------------------- 1 | {map1,[{a,0},{b,0},{module_info,0},{module_info,1}], 2 | [], 3 | [{function,a,0,2, 4 | [{label,1}, 5 | {line,[{location,"test/asm_data/map1.erl",4}]}, 6 | {func_info,{atom,map1},{atom,a},0}, 7 | {label,2}, 8 | {move,{literal,#{a => 42,b => 1}},{x,0}}, 9 | return]}, 10 | {function,b,0,4, 11 | [{label,3}, 12 | {line,[{location,"test/asm_data/map1.erl",8}]}, 13 | {func_info,{atom,map1},{atom,b},0}, 14 | {label,4}, 15 | {move,{literal,#{a => 42,b => 1}},{x,0}}, 16 | return]}, 17 | {function,module_info,0,6, 18 | [{label,5}, 19 | {line,[]}, 20 | {func_info,{atom,map1},{atom,module_info},0}, 21 | {label,6}, 22 | {move,{atom,map1},{x,0}}, 23 | {line,[]}, 24 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 25 | {function,module_info,1,8, 26 | [{label,7}, 27 | {line,[]}, 28 | {func_info,{atom,map1},{atom,module_info},1}, 29 | {label,8}, 30 | {move,{x,0},{x,1}}, 31 | {move,{atom,map1},{x,0}}, 32 | {line,[]}, 33 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 34 | 9} 35 | -------------------------------------------------------------------------------- /test/asm_data/dst/map2.E: -------------------------------------------------------------------------------- 1 | {map2, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/map2.erl",1}}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{'case',4, 7 | {map,5,[{map_field_assoc,5,{atom,5,a},{integer,5,1}}]}, 8 | [{clause,5, 9 | [{var,5,'M'}], 10 | [], 11 | [{map,6, 12 | {var,6,'M'}, 13 | [{map_field_assoc,6,{atom,6,a},{integer,6,42}}, 14 | {map_field_assoc,6, 15 | {atom,6,b}, 16 | {integer,6,1}}]}]}]}]}]}, 17 | {function,8,b,0, 18 | [{clause,8,[],[], 19 | [{map,8, 20 | [{map_field_assoc,8,{atom,8,a},{integer,8,42}}, 21 | {map_field_assoc,8,{atom,8,b},{integer,8,1}}]}]}]}, 22 | {function,0,module_info,0, 23 | [{clause,0,[],[], 24 | [{call,0, 25 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 26 | [{atom,0,map2}]}]}]}, 27 | {function,0,module_info,1, 28 | [{clause,0, 29 | [{var,0,'X'}], 30 | [], 31 | [{call,0, 32 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 33 | [{atom,0,map2},{var,0,'X'}]}]}]}]} 34 | -------------------------------------------------------------------------------- /test/asm_data/dst/map2.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/map2.erl",1}}, 2 | {attribute,1,module,map2}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{'case',4, 7 | {map,5,[{map_field_assoc,5,{atom,5,a},{integer,5,1}}]}, 8 | [{clause,5, 9 | [{var,5,'M'}], 10 | [], 11 | [{map,6, 12 | {var,6,'M'}, 13 | [{map_field_assoc,6,{atom,6,a},{integer,6,42}}, 14 | {map_field_assoc,6, 15 | {atom,6,b}, 16 | {integer,6,1}}]}]}]}]}]}, 17 | {function,8,b,0, 18 | [{clause,8,[],[], 19 | [{map,8, 20 | [{map_field_assoc,8,{atom,8,a},{integer,8,42}}, 21 | {map_field_assoc,8,{atom,8,b},{integer,8,1}}]}]}]}] 22 | -------------------------------------------------------------------------------- /test/asm_data/dst/map2.S: -------------------------------------------------------------------------------- 1 | {map2,[{a,0},{b,0},{module_info,0},{module_info,1}], 2 | [], 3 | [{function,a,0,2, 4 | [{label,1}, 5 | {line,[{location,"test/asm_data/map2.erl",4}]}, 6 | {func_info,{atom,map2},{atom,a},0}, 7 | {label,2}, 8 | {move,{literal,#{a => 42,b => 1}},{x,0}}, 9 | return]}, 10 | {function,b,0,4, 11 | [{label,3}, 12 | {line,[{location,"test/asm_data/map2.erl",8}]}, 13 | {func_info,{atom,map2},{atom,b},0}, 14 | {label,4}, 15 | {move,{literal,#{a => 42,b => 1}},{x,0}}, 16 | return]}, 17 | {function,module_info,0,6, 18 | [{label,5}, 19 | {line,[]}, 20 | {func_info,{atom,map2},{atom,module_info},0}, 21 | {label,6}, 22 | {move,{atom,map2},{x,0}}, 23 | {line,[]}, 24 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 25 | {function,module_info,1,8, 26 | [{label,7}, 27 | {line,[]}, 28 | {func_info,{atom,map2},{atom,module_info},1}, 29 | {label,8}, 30 | {move,{x,0},{x,1}}, 31 | {move,{atom,map2},{x,0}}, 32 | {line,[]}, 33 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 34 | 9} 35 | -------------------------------------------------------------------------------- /test/asm_data/dst/map3.E: -------------------------------------------------------------------------------- 1 | {map3, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/map3.erl",1}}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{'case',4, 7 | {atom,5,b}, 8 | [{clause,5, 9 | [{var,5,'Y'}], 10 | [], 11 | [{match,6, 12 | {var,6,'M'}, 13 | {map,6, 14 | [{map_field_assoc,6, 15 | {atom,6,a}, 16 | {var,6,'Y'}}]}}]}]}, 17 | {map,7, 18 | {var,7,'M'}, 19 | [{map_field_assoc,7,{atom,7,a},{integer,7,42}}, 20 | {map_field_assoc,7,{var,7,'Y'},{integer,7,1}}]}]}]}, 21 | {function,9,b,0, 22 | [{clause,9,[],[], 23 | [{map,9, 24 | [{map_field_assoc,9,{atom,9,a},{integer,9,42}}, 25 | {map_field_assoc,9,{atom,9,b},{integer,9,1}}]}]}]}, 26 | {function,0,module_info,0, 27 | [{clause,0,[],[], 28 | [{call,0, 29 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 30 | [{atom,0,map3}]}]}]}, 31 | {function,0,module_info,1, 32 | [{clause,0, 33 | [{var,0,'X'}], 34 | [], 35 | [{call,0, 36 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 37 | [{atom,0,map3},{var,0,'X'}]}]}]}]} 38 | -------------------------------------------------------------------------------- /test/asm_data/dst/map3.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/map3.erl",1}}, 2 | {attribute,1,module,map3}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{'case',4, 7 | {atom,5,b}, 8 | [{clause,5, 9 | [{var,5,'Y'}], 10 | [], 11 | [{match,6, 12 | {var,6,'M'}, 13 | {map,6, 14 | [{map_field_assoc,6, 15 | {atom,6,a}, 16 | {var,6,'Y'}}]}}]}]}, 17 | {map,7, 18 | {var,7,'M'}, 19 | [{map_field_assoc,7,{atom,7,a},{integer,7,42}}, 20 | {map_field_assoc,7,{var,7,'Y'},{integer,7,1}}]}]}]}, 21 | {function,9,b,0, 22 | [{clause,9,[],[], 23 | [{map,9, 24 | [{map_field_assoc,9,{atom,9,a},{integer,9,42}}, 25 | {map_field_assoc,9,{atom,9,b},{integer,9,1}}]}]}]}] 26 | -------------------------------------------------------------------------------- /test/asm_data/dst/map3.S: -------------------------------------------------------------------------------- 1 | {map3,[{a,0},{b,0},{module_info,0},{module_info,1}], 2 | [], 3 | [{function,a,0,2, 4 | [{label,1}, 5 | {line,[{location,"test/asm_data/map3.erl",4}]}, 6 | {func_info,{atom,map3},{atom,a},0}, 7 | {label,2}, 8 | {move,{literal,#{a => 42,b => 1}},{x,0}}, 9 | return]}, 10 | {function,b,0,4, 11 | [{label,3}, 12 | {line,[{location,"test/asm_data/map3.erl",9}]}, 13 | {func_info,{atom,map3},{atom,b},0}, 14 | {label,4}, 15 | {move,{literal,#{a => 42,b => 1}},{x,0}}, 16 | return]}, 17 | {function,module_info,0,6, 18 | [{label,5}, 19 | {line,[]}, 20 | {func_info,{atom,map3},{atom,module_info},0}, 21 | {label,6}, 22 | {move,{atom,map3},{x,0}}, 23 | {line,[]}, 24 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 25 | {function,module_info,1,8, 26 | [{label,7}, 27 | {line,[]}, 28 | {func_info,{atom,map3},{atom,module_info},1}, 29 | {label,8}, 30 | {move,{x,0},{x,1}}, 31 | {move,{atom,map3},{x,0}}, 32 | {line,[]}, 33 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 34 | 9} 35 | -------------------------------------------------------------------------------- /test/asm_data/dst/map4.E: -------------------------------------------------------------------------------- 1 | {map4, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/map4.erl",1}}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{'case',4, 7 | {map,5,[{map_field_assoc,5,{atom,5,key},{atom,5,b}}]}, 8 | [{clause,5, 9 | [{map,5, 10 | [{map_field_exact,5,{atom,5,key},{var,5,'Y'}}]}], 11 | [], 12 | [{match,6, 13 | {var,6,'M'}, 14 | {map,6, 15 | [{map_field_assoc,6, 16 | {atom,6,a}, 17 | {var,6,'Y'}}]}}]}]}, 18 | {map,7, 19 | {var,7,'M'}, 20 | [{map_field_assoc,7,{atom,7,a},{integer,7,42}}, 21 | {map_field_assoc,7,{var,7,'Y'},{integer,7,1}}]}]}]}, 22 | {function,9,b,0, 23 | [{clause,9,[],[], 24 | [{map,9, 25 | [{map_field_assoc,9,{atom,9,a},{integer,9,42}}, 26 | {map_field_assoc,9,{atom,9,b},{integer,9,1}}]}]}]}, 27 | {function,0,module_info,0, 28 | [{clause,0,[],[], 29 | [{call,0, 30 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 31 | [{atom,0,map4}]}]}]}, 32 | {function,0,module_info,1, 33 | [{clause,0, 34 | [{var,0,'X'}], 35 | [], 36 | [{call,0, 37 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 38 | [{atom,0,map4},{var,0,'X'}]}]}]}]} 39 | -------------------------------------------------------------------------------- /test/asm_data/dst/map4.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/map4.erl",1}}, 2 | {attribute,1,module,map4}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{'case',4, 7 | {map,5,[{map_field_assoc,5,{atom,5,key},{atom,5,b}}]}, 8 | [{clause,5, 9 | [{map,5,[{map_field_exact,5,{atom,5,key},{var,5,'Y'}}]}], 10 | [], 11 | [{match,6, 12 | {var,6,'M'}, 13 | {map,6, 14 | [{map_field_assoc,6, 15 | {atom,6,a}, 16 | {var,6,'Y'}}]}}]}]}, 17 | {map,7, 18 | {var,7,'M'}, 19 | [{map_field_assoc,7,{atom,7,a},{integer,7,42}}, 20 | {map_field_assoc,7,{var,7,'Y'},{integer,7,1}}]}]}]}, 21 | {function,9,b,0, 22 | [{clause,9,[],[], 23 | [{map,9, 24 | [{map_field_assoc,9,{atom,9,a},{integer,9,42}}, 25 | {map_field_assoc,9,{atom,9,b},{integer,9,1}}]}]}]}] 26 | -------------------------------------------------------------------------------- /test/asm_data/dst/map4.S: -------------------------------------------------------------------------------- 1 | {map4,[{a,0},{b,0},{module_info,0},{module_info,1}], 2 | [], 3 | [{function,a,0,2, 4 | [{label,1}, 5 | {line,[{location,"test/asm_data/map4.erl",4}]}, 6 | {func_info,{atom,map4},{atom,a},0}, 7 | {label,2}, 8 | {move,{literal,#{key => b}},{x,0}}, 9 | {get_map_elements,{f,4},{x,0},{list,[{atom,key},{x,1}]}}, 10 | {line,[{location,"test/asm_data/map4.erl",6}]}, 11 | {put_map_assoc,{f,0}, 12 | {literal,#{}}, 13 | {x,0}, 14 | 2, 15 | {list,[{atom,a},{x,1}]}}, 16 | {test,is_map,{f,3},[{x,0}]}, 17 | {line,[{location,"test/asm_data/map4.erl",7}]}, 18 | {put_map_assoc,{f,0}, 19 | {x,0}, 20 | {x,0}, 21 | 2, 22 | {list,[{atom,a},{integer,42}]}}, 23 | {line,[{location,"test/asm_data/map4.erl",7}]}, 24 | {put_map_assoc,{f,0}, 25 | {x,0}, 26 | {x,0}, 27 | 2, 28 | {list,[{x,1},{integer,1}]}}, 29 | return, 30 | {label,3}, 31 | {test_heap,3,1}, 32 | {put_tuple,2,{x,1}}, 33 | {put,{atom,badmap}}, 34 | {put,{x,0}}, 35 | {move,{x,1},{x,0}}, 36 | {line,[{location,"test/asm_data/map4.erl",7}]}, 37 | {call_ext,1,{extfunc,erlang,error,1}}, 38 | {label,4}, 39 | {line,[{location,"test/asm_data/map4.erl",4}]}, 40 | {case_end,{x,0}}]}, 41 | {function,b,0,6, 42 | [{label,5}, 43 | {line,[{location,"test/asm_data/map4.erl",9}]}, 44 | {func_info,{atom,map4},{atom,b},0}, 45 | {label,6}, 46 | {move,{literal,#{a => 42,b => 1}},{x,0}}, 47 | return]}, 48 | {function,module_info,0,8, 49 | [{label,7}, 50 | {line,[]}, 51 | {func_info,{atom,map4},{atom,module_info},0}, 52 | {label,8}, 53 | {move,{atom,map4},{x,0}}, 54 | {line,[]}, 55 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 56 | {function,module_info,1,10, 57 | [{label,9}, 58 | {line,[]}, 59 | {func_info,{atom,map4},{atom,module_info},1}, 60 | {label,10}, 61 | {move,{x,0},{x,1}}, 62 | {move,{atom,map4},{x,0}}, 63 | {line,[]}, 64 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 65 | 11} 66 | -------------------------------------------------------------------------------- /test/asm_data/dst/try0.E: -------------------------------------------------------------------------------- 1 | {try0, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/try0.erl",1}}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{'case',4, 7 | {op,5,'!', 8 | {call,5,{remote,5,{atom,5,erlang},{atom,5,self}},[]}, 9 | {integer,5,42}}, 10 | [{clause,5, 11 | [{integer,5,42}], 12 | [], 13 | [{'receive',6, 14 | [{clause,7, 15 | [{bin,7, 16 | [{bin_element,7, 17 | {char,7,116}, 18 | {integer,7,8}, 19 | [integer,{unit,1},unsigned,big]}, 20 | {bin_element,7, 21 | {char,7,104}, 22 | {integer,7,8}, 23 | [integer,{unit,1},unsigned,big]}, 24 | {bin_element,7, 25 | {char,7,105}, 26 | {integer,7,8}, 27 | [integer,{unit,1},unsigned,big]}, 28 | {bin_element,7, 29 | {char,7,115}, 30 | {integer,7,8}, 31 | [integer,{unit,1},unsigned,big]}]}], 32 | [], 33 | [{atom,7,that}]}, 34 | {clause,8, 35 | [{integer,8,42}], 36 | [], 37 | [{call,8, 38 | {remote,8,{atom,8,erlang},{atom,8,length}}, 39 | [{call,8, 40 | {remote,8,{atom,8,lists},{atom,8,seq}}, 41 | [{integer,8,1},{integer,8,5}]}]}]}], 42 | {integer,9,0}, 43 | [{call,10, 44 | {remote,10,{atom,10,erlang},{atom,10,throw}}, 45 | [{atom,10,argh}]}]}]}]}]}]}, 46 | {function,13,b,0,[{clause,13,[],[],[{integer,14,5}]}]}, 47 | {function,0,module_info,0, 48 | [{clause,0,[],[], 49 | [{call,0, 50 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 51 | [{atom,0,try0}]}]}]}, 52 | {function,0,module_info,1, 53 | [{clause,0, 54 | [{var,0,'X'}], 55 | [], 56 | [{call,0, 57 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 58 | [{atom,0,try0},{var,0,'X'}]}]}]}]} 59 | -------------------------------------------------------------------------------- /test/asm_data/dst/try0.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/try0.erl",1}}, 2 | {attribute,1,module,try0}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{'case',4, 7 | {op,5,'!',{call,5,{atom,5,self},[]},{integer,5,42}}, 8 | [{clause,5, 9 | [{integer,5,42}], 10 | [], 11 | [{'receive',6, 12 | [{clause,7, 13 | [{bin,7,[{bin_element,7,{string,7,"this"},default,default}]}], 14 | [], 15 | [{atom,7,that}]}, 16 | {clause,8, 17 | [{integer,8,42}], 18 | [], 19 | [{call,8, 20 | {atom,8,length}, 21 | [{call,8, 22 | {remote,8,{atom,8,lists},{atom,8,seq}}, 23 | [{integer,8,1},{integer,8,5}]}]}]}], 24 | {integer,9,0}, 25 | [{call,10,{atom,10,throw},[{atom,10,argh}]}]}]}]}]}]}, 26 | {function,13,b,0,[{clause,13,[],[],[{integer,14,5}]}]}] 27 | -------------------------------------------------------------------------------- /test/asm_data/dst/try0.S: -------------------------------------------------------------------------------- 1 | {try0,[{a,0},{b,0},{module_info,0},{module_info,1}], 2 | [], 3 | [{function,a,0,2, 4 | [{label,1}, 5 | {line,[{location,"test/asm_data/try0.erl",4}]}, 6 | {func_info,{atom,try0},{atom,a},0}, 7 | {label,2}, 8 | {allocate,0,0}, 9 | {bif,self,{f,0},[],{x,0}}, 10 | {move,{integer,42},{x,1}}, 11 | {line,[{location,"test/asm_data/try0.erl",5}]}, 12 | send, 13 | {test,is_eq_exact,{f,7},[{x,0},{integer,42}]}, 14 | {line,[{location,"test/asm_data/try0.erl",6}]}, 15 | {label,3}, 16 | {loop_rec,{f,6},{x,0}}, 17 | {test,bs_start_match2,{f,4},1,[{x,0},0],{x,1}}, 18 | {test,bs_match_string,{f,5},[{x,1},32,{string,"this"}]}, 19 | {test,bs_test_tail2,{f,5},[{x,1},0]}, 20 | remove_message, 21 | {move,{atom,that},{x,0}}, 22 | {deallocate,0}, 23 | return, 24 | {label,4}, 25 | {test,is_eq_exact,{f,5},[{x,0},{integer,42}]}, 26 | remove_message, 27 | {move,{integer,5},{x,1}}, 28 | {move,{integer,1},{x,0}}, 29 | {line,[{location,"test/asm_data/try0.erl",8}]}, 30 | {call_ext,2,{extfunc,lists,seq,2}}, 31 | {line,[{location,"test/asm_data/try0.erl",8}]}, 32 | {gc_bif,length,{f,0},1,[{x,0}],{x,0}}, 33 | {deallocate,0}, 34 | return, 35 | {label,5}, 36 | {loop_rec_end,{f,3}}, 37 | {label,6}, 38 | timeout, 39 | {move,{atom,argh},{x,0}}, 40 | {line,[{location,"test/asm_data/try0.erl",10}]}, 41 | {call_ext,1,{extfunc,erlang,throw,1}}, 42 | {label,7}, 43 | {line,[{location,"test/asm_data/try0.erl",4}]}, 44 | {case_end,{x,0}}]}, 45 | {function,b,0,9, 46 | [{label,8}, 47 | {line,[{location,"test/asm_data/try0.erl",13}]}, 48 | {func_info,{atom,try0},{atom,b},0}, 49 | {label,9}, 50 | {move,{integer,5},{x,0}}, 51 | return]}, 52 | {function,module_info,0,11, 53 | [{label,10}, 54 | {line,[]}, 55 | {func_info,{atom,try0},{atom,module_info},0}, 56 | {label,11}, 57 | {move,{atom,try0},{x,0}}, 58 | {line,[]}, 59 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 60 | {function,module_info,1,13, 61 | [{label,12}, 62 | {line,[]}, 63 | {func_info,{atom,try0},{atom,module_info},1}, 64 | {label,13}, 65 | {move,{x,0},{x,1}}, 66 | {move,{atom,try0},{x,0}}, 67 | {line,[]}, 68 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 69 | 14} 70 | -------------------------------------------------------------------------------- /test/asm_data/dst/try1.E: -------------------------------------------------------------------------------- 1 | {try1, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/try1.erl",1}}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{'try',5, 7 | [{call,5,{remote,5,{atom,5,erlang},{atom,5,get}},[]}], 8 | [{clause,6, 9 | [{match,6, 10 | {cons,6,{var,6,'_'},{var,6,'_'}}, 11 | {var,6,'PD'}}], 12 | [], 13 | [{var,6,'PD'}]}, 14 | {clause,7,[{nil,7}],[],[{nil,7}]}], 15 | [{clause,9, 16 | [{tuple,9,[{var,9,'_'},{var,9,'_'},{var,9,'_'}]}], 17 | [], 18 | [{atom,9,impossible}]}], 19 | []}]}]}, 20 | {function,12,b,0, 21 | [{clause,12,[],[], 22 | [{call,13,{remote,13,{atom,13,erlang},{atom,13,get}},[]}]}]}, 23 | {function,0,module_info,0, 24 | [{clause,0,[],[], 25 | [{call,0, 26 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 27 | [{atom,0,try1}]}]}]}, 28 | {function,0,module_info,1, 29 | [{clause,0, 30 | [{var,0,'X'}], 31 | [], 32 | [{call,0, 33 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 34 | [{atom,0,try1},{var,0,'X'}]}]}]}]} 35 | -------------------------------------------------------------------------------- /test/asm_data/dst/try1.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/try1.erl",1}}, 2 | {attribute,1,module,try1}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{'try',5, 7 | [{call,5,{atom,5,get},[]}], 8 | [{clause,6, 9 | [{match,6,{cons,6,{var,6,'_'},{var,6,'_'}},{var,6,'PD'}}], 10 | [], 11 | [{var,6,'PD'}]}, 12 | {clause,7,[{nil,7}],[],[{nil,7}]}], 13 | [{clause,9, 14 | [{tuple,9,[{var,9,'_'},{var,9,'_'},{var,9,'_'}]}], 15 | [], 16 | [{atom,9,impossible}]}], 17 | []}]}]}, 18 | {function,12,b,0,[{clause,12,[],[],[{call,13,{atom,13,get},[]}]}]}] 19 | -------------------------------------------------------------------------------- /test/asm_data/dst/try1.S: -------------------------------------------------------------------------------- 1 | {try1,[{a,0},{b,0},{module_info,0},{module_info,1}], 2 | [], 3 | [{function,a,0,2, 4 | [{label,1}, 5 | {line,[{location,"test/asm_data/try1.erl",4}]}, 6 | {func_info,{atom,try1},{atom,a},0}, 7 | {label,2}, 8 | {allocate,1,0}, 9 | {'try',{y,0},{f,4}}, 10 | {line,[{location,"test/asm_data/try1.erl",5}]}, 11 | {call_ext,0,{extfunc,erlang,get,0}}, 12 | {try_end,{y,0}}, 13 | {test,is_nonempty_list,{f,3},[{x,0}]}, 14 | {deallocate,1}, 15 | return, 16 | {label,3}, 17 | {test,is_nil,{f,5},[{x,0}]}, 18 | {deallocate,1}, 19 | return, 20 | {label,4}, 21 | {try_case,{y,0}}, 22 | {move,{atom,impossible},{x,0}}, 23 | {deallocate,1}, 24 | return, 25 | {label,5}, 26 | {line,[{location,"test/asm_data/try1.erl",5}]}, 27 | {try_case_end,{x,0}}]}, 28 | {function,b,0,7, 29 | [{label,6}, 30 | {line,[{location,"test/asm_data/try1.erl",12}]}, 31 | {func_info,{atom,try1},{atom,b},0}, 32 | {label,7}, 33 | {call_ext_only,0,{extfunc,erlang,get,0}}]}, 34 | {function,module_info,0,9, 35 | [{label,8}, 36 | {line,[]}, 37 | {func_info,{atom,try1},{atom,module_info},0}, 38 | {label,9}, 39 | {move,{atom,try1},{x,0}}, 40 | {line,[]}, 41 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 42 | {function,module_info,1,11, 43 | [{label,10}, 44 | {line,[]}, 45 | {func_info,{atom,try1},{atom,module_info},1}, 46 | {label,11}, 47 | {move,{x,0},{x,1}}, 48 | {move,{atom,try1},{x,0}}, 49 | {line,[]}, 50 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 51 | 12} 52 | -------------------------------------------------------------------------------- /test/asm_data/dst/try2.E: -------------------------------------------------------------------------------- 1 | {try2, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/try2.erl",1}}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{'try',5, 7 | [{call,5,{remote,5,{atom,5,erlang},{atom,5,get}},[]}], 8 | [{clause,6, 9 | [{bin,6, 10 | [{bin_element,6, 11 | {char,6,97}, 12 | {integer,6,8}, 13 | [integer,{unit,1},unsigned,big]}, 14 | {bin_element,6, 15 | {char,6,98}, 16 | {integer,6,8}, 17 | [integer,{unit,1},unsigned,big]}, 18 | {bin_element,6, 19 | {char,6,99}, 20 | {integer,6,8}, 21 | [integer,{unit,1},unsigned,big]}]}], 22 | [], 23 | [{bin,6, 24 | [{bin_element,6, 25 | {char,6,100}, 26 | {integer,6,8}, 27 | [integer,{unit,1},unsigned,big]}, 28 | {bin_element,6, 29 | {char,6,101}, 30 | {integer,6,8}, 31 | [integer,{unit,1},unsigned,big]}, 32 | {bin_element,6, 33 | {char,6,102}, 34 | {integer,6,8}, 35 | [integer,{unit,1},unsigned,big]}]}]}, 36 | {clause,7, 37 | [{match,7, 38 | {bin,7, 39 | [{bin_element,7, 40 | {char,7,960}, 41 | {atom,7,undefined}, 42 | [utf8,{unit,undefined},unsigned,big]}]}, 43 | {var,7,'_Pi'}}], 44 | [], 45 | [{float,7,3.14}]}, 46 | {clause,8, 47 | [{var,8,'PD'}], 48 | [[{call,8, 49 | {remote,8,{atom,8,erlang},{atom,8,is_list}}, 50 | [{var,8,'PD'}]}]], 51 | [{var,8,'PD'}]}], 52 | [{clause,10, 53 | [{tuple,10,[{var,10,'_'},{var,10,'_'},{var,10,'_'}]}], 54 | [], 55 | [{atom,10,impossible}]}], 56 | []}]}]}, 57 | {function,13,b,0, 58 | [{clause,13,[],[], 59 | [{call,14,{remote,14,{atom,14,erlang},{atom,14,get}},[]}]}]}, 60 | {function,0,module_info,0, 61 | [{clause,0,[],[], 62 | [{call,0, 63 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 64 | [{atom,0,try2}]}]}]}, 65 | {function,0,module_info,1, 66 | [{clause,0, 67 | [{var,0,'X'}], 68 | [], 69 | [{call,0, 70 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 71 | [{atom,0,try2},{var,0,'X'}]}]}]}]} 72 | -------------------------------------------------------------------------------- /test/asm_data/dst/try2.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/try2.erl",1}}, 2 | {attribute,1,module,try2}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{'try',5, 7 | [{call,5,{atom,5,get},[]}], 8 | [{clause,6, 9 | [{bin,6, 10 | [{bin_element,6,{string,6,"abc"},default,default}]}], 11 | [], 12 | [{bin,6, 13 | [{bin_element,6,{string,6,"def"},default,default}]}]}, 14 | {clause,7, 15 | [{match,7, 16 | {bin,7, 17 | [{bin_element,7, 18 | {string,7,[960]}, 19 | default, 20 | [utf8]}]}, 21 | {var,7,'_Pi'}}], 22 | [], 23 | [{float,7,3.14}]}, 24 | {clause,8, 25 | [{var,8,'PD'}], 26 | [[{call,8,{atom,8,is_list},[{var,8,'PD'}]}]], 27 | [{var,8,'PD'}]}], 28 | [{clause,10, 29 | [{tuple,10,[{var,10,'_'},{var,10,'_'},{var,10,'_'}]}], 30 | [], 31 | [{atom,10,impossible}]}], 32 | []}]}]}, 33 | {function,13,b,0,[{clause,13,[],[],[{call,14,{atom,14,get},[]}]}]}] 34 | -------------------------------------------------------------------------------- /test/asm_data/dst/try2.S: -------------------------------------------------------------------------------- 1 | {try2, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [], 4 | [{function,a,0,2, 5 | [{label,1}, 6 | {line,[{location,"test/asm_data/try2.erl",4}]}, 7 | {func_info,{atom,try2},{atom,a},0}, 8 | {label,2}, 9 | {allocate,1,0}, 10 | {'try',{y,0},{f,6}}, 11 | {line,[{location,"test/asm_data/try2.erl",5}]}, 12 | {call_ext,0,{extfunc,erlang,get,0}}, 13 | {try_end,{y,0}}, 14 | {test,bs_start_match2,{f,5},1,[{x,0},0],{x,1}}, 15 | {test,bs_get_integer2, 16 | {f,4}, 17 | 2, 18 | [{x,1}, 19 | {integer,8}, 20 | 1, 21 | {field_flags, 22 | [{anno,[6,{file,"test/asm_data/try2.erl"}]},unsigned,big]}], 23 | {x,2}}, 24 | {test,is_eq_exact,{f,3},[{x,2},{integer,97}]}, 25 | {test,bs_match_string,{f,3},[{x,1},16,{string,"bc"}]}, 26 | {test,bs_test_tail2,{f,3},[{x,1},0]}, 27 | {move,{literal,<<"def">>},{x,0}}, 28 | {deallocate,1}, 29 | return, 30 | {label,3}, 31 | {bs_restore2,{x,1},{atom,start}}, 32 | {label,4}, 33 | {test,bs_get_utf8, 34 | {f,5}, 35 | 2, 36 | [{x,1}, 37 | {field_flags, 38 | [{anno,[7,{file,"test/asm_data/try2.erl"}]},unsigned,big]}], 39 | {x,2}}, 40 | {test,is_eq_exact,{f,5},[{x,2},{integer,960}]}, 41 | {test,bs_test_tail2,{f,5},[{x,1},0]}, 42 | {move,{float,3.14},{x,0}}, 43 | {deallocate,1}, 44 | return, 45 | {label,5}, 46 | {test,is_list,{f,7},[{x,0}]}, 47 | {deallocate,1}, 48 | return, 49 | {label,6}, 50 | {try_case,{y,0}}, 51 | {move,{atom,impossible},{x,0}}, 52 | {deallocate,1}, 53 | return, 54 | {label,7}, 55 | {line,[{location,"test/asm_data/try2.erl",5}]}, 56 | {try_case_end,{x,0}}]}, 57 | {function,b,0,9, 58 | [{label,8}, 59 | {line,[{location,"test/asm_data/try2.erl",13}]}, 60 | {func_info,{atom,try2},{atom,b},0}, 61 | {label,9}, 62 | {call_ext_only,0,{extfunc,erlang,get,0}}]}, 63 | {function,module_info,0,11, 64 | [{label,10}, 65 | {line,[]}, 66 | {func_info,{atom,try2},{atom,module_info},0}, 67 | {label,11}, 68 | {move,{atom,try2},{x,0}}, 69 | {line,[]}, 70 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 71 | {function,module_info,1,13, 72 | [{label,12}, 73 | {line,[]}, 74 | {func_info,{atom,try2},{atom,module_info},1}, 75 | {label,13}, 76 | {move,{x,0},{x,1}}, 77 | {move,{atom,try2},{x,0}}, 78 | {line,[]}, 79 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 80 | 14} 81 | -------------------------------------------------------------------------------- /test/asm_data/dst/try3.E: -------------------------------------------------------------------------------- 1 | {try3, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/try3.erl",1}}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{'catch',5, 7 | {call,5,{remote,5,{atom,5,erlang},{atom,5,get}},[]}}]}]}, 8 | {function,7,b,0, 9 | [{clause,7,[],[], 10 | [{call,8,{remote,8,{atom,8,erlang},{atom,8,get}},[]}]}]}, 11 | {function,0,module_info,0, 12 | [{clause,0,[],[], 13 | [{call,0, 14 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 15 | [{atom,0,try3}]}]}]}, 16 | {function,0,module_info,1, 17 | [{clause,0, 18 | [{var,0,'X'}], 19 | [], 20 | [{call,0, 21 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 22 | [{atom,0,try3},{var,0,'X'}]}]}]}]} 23 | -------------------------------------------------------------------------------- /test/asm_data/dst/try3.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/try3.erl",1}}, 2 | {attribute,1,module,try3}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,4,a,0,[{clause,4,[],[],[{'catch',5,{call,5,{atom,5,get},[]}}]}]}, 5 | {function,7,b,0,[{clause,7,[],[],[{call,8,{atom,8,get},[]}]}]}] 6 | -------------------------------------------------------------------------------- /test/asm_data/dst/try3.S: -------------------------------------------------------------------------------- 1 | {try3,[{a,0},{b,0},{module_info,0},{module_info,1}], 2 | [], 3 | [{function,a,0,2, 4 | [{label,1}, 5 | {line,[{location,"test/asm_data/try3.erl",4}]}, 6 | {func_info,{atom,try3},{atom,a},0}, 7 | {label,2}, 8 | {allocate,1,0}, 9 | {'catch',{y,0},{f,3}}, 10 | {line,[{location,"test/asm_data/try3.erl",5}]}, 11 | {call_ext,0,{extfunc,erlang,get,0}}, 12 | {label,3}, 13 | {catch_end,{y,0}}, 14 | {deallocate,1}, 15 | return]}, 16 | {function,b,0,5, 17 | [{label,4}, 18 | {line,[{location,"test/asm_data/try3.erl",7}]}, 19 | {func_info,{atom,try3},{atom,b},0}, 20 | {label,5}, 21 | {call_ext_only,0,{extfunc,erlang,get,0}}]}, 22 | {function,module_info,0,7, 23 | [{label,6}, 24 | {line,[]}, 25 | {func_info,{atom,try3},{atom,module_info},0}, 26 | {label,7}, 27 | {move,{atom,try3},{x,0}}, 28 | {line,[]}, 29 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 30 | {function,module_info,1,9, 31 | [{label,8}, 32 | {line,[]}, 33 | {func_info,{atom,try3},{atom,module_info},1}, 34 | {label,9}, 35 | {move,{x,0},{x,1}}, 36 | {move,{atom,try3},{x,0}}, 37 | {line,[]}, 38 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 39 | 10} 40 | -------------------------------------------------------------------------------- /test/asm_data/dst/unfold0.E: -------------------------------------------------------------------------------- 1 | {unfold0, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,4,record, 4 | [{r,[{record_field,4,{atom,4,'1'}}, 5 | {record_field,4,{atom,4,'2'}}, 6 | {record_field,4,{atom,4,'3'}}, 7 | {record_field,4,{atom,4,'4'}}, 8 | {record_field,4,{atom,4,'5'}}]}]}, 9 | {attribute,1,file,{"test/asm_data/unfold0.erl",1}}, 10 | {function,6,a,0, 11 | [{clause,6,[],[], 12 | [{call,10, 13 | {remote,10,{atom,10,erlang},{atom,10,setelement}}, 14 | [{integer,10,3}, 15 | {call,9, 16 | {remote,9,{atom,9,erlang},{atom,9,setelement}}, 17 | [{integer,9,6}, 18 | {call,8, 19 | {remote,8,{atom,8,erlang},{atom,8,setelement}}, 20 | [{integer,8,4}, 21 | {tuple,7, 22 | [{atom,12,r}, 23 | {atom,4,undefined}, 24 | {string,7,"deux"}, 25 | {atom,4,undefined}, 26 | {atom,4,undefined}, 27 | {atom,4,undefined}]}, 28 | {string,8,"trois"}]}, 29 | {string,9,"cinq"}]}, 30 | {string,10,"DEUX"}]}]}]}, 31 | {function,14,b,0, 32 | [{clause,14,[],[], 33 | [{tuple,0, 34 | [{atom,15,r}, 35 | {atom,4,undefined}, 36 | {string,15,"DEUX"}, 37 | {string,16,"trois"}, 38 | {atom,4,undefined}, 39 | {string,17,"cinq"}]}]}]}, 40 | {function,0,module_info,0, 41 | [{clause,0,[],[], 42 | [{call,0, 43 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 44 | [{atom,0,unfold0}]}]}]}, 45 | {function,0,module_info,1, 46 | [{clause,0, 47 | [{var,0,'X'}], 48 | [], 49 | [{call,0, 50 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 51 | [{atom,0,unfold0},{var,0,'X'}]}]}]}]} 52 | -------------------------------------------------------------------------------- /test/asm_data/dst/unfold0.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/unfold0.erl",1}}, 2 | {attribute,1,module,unfold0}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {attribute,4,record, 5 | {r,[{record_field,4,{atom,4,'1'}}, 6 | {record_field,4,{atom,4,'2'}}, 7 | {record_field,4,{atom,4,'3'}}, 8 | {record_field,4,{atom,4,'4'}}, 9 | {record_field,4,{atom,4,'5'}}]}}, 10 | {function,6,a,0, 11 | [{clause,6,[],[], 12 | [{call,10, 13 | {atom,10,setelement}, 14 | [{integer,10,3}, 15 | {call,9, 16 | {atom,9,setelement}, 17 | [{integer,9,6}, 18 | {call,8, 19 | {atom,8,setelement}, 20 | [{record_index,8,r,{atom,8,'3'}}, 21 | {tuple,7, 22 | [{atom,12,r}, 23 | {atom,4,undefined}, 24 | {string,7,"deux"}, 25 | {atom,4,undefined}, 26 | {atom,4,undefined}, 27 | {atom,4,undefined}]}, 28 | {string,8,"trois"}]}, 29 | {string,9,"cinq"}]}, 30 | {string,10,"DEUX"}]}]}]}, 31 | {function,14,b,0, 32 | [{clause,14,[],[], 33 | [{tuple,0, 34 | [{atom,15,r}, 35 | {atom,4,undefined}, 36 | {string,15,"DEUX"}, 37 | {string,16,"trois"}, 38 | {atom,4,undefined}, 39 | {string,17,"cinq"}]}]}]}] 40 | -------------------------------------------------------------------------------- /test/asm_data/dst/unfold0.S: -------------------------------------------------------------------------------- 1 | {unfold0, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [], 4 | [{function,a,0,2, 5 | [{label,1}, 6 | {line,[{location,"test/asm_data/unfold0.erl",6}]}, 7 | {func_info,{atom,unfold0},{atom,a},0}, 8 | {label,2}, 9 | {move,{literal,{r,undefined,"DEUX","trois",undefined,"cinq"}},{x,0}}, 10 | return]}, 11 | {function,b,0,4, 12 | [{label,3}, 13 | {line,[{location,"test/asm_data/unfold0.erl",14}]}, 14 | {func_info,{atom,unfold0},{atom,b},0}, 15 | {label,4}, 16 | {move,{literal,{r,undefined,"DEUX","trois",undefined,"cinq"}},{x,0}}, 17 | return]}, 18 | {function,module_info,0,6, 19 | [{label,5}, 20 | {line,[]}, 21 | {func_info,{atom,unfold0},{atom,module_info},0}, 22 | {label,6}, 23 | {move,{atom,unfold0},{x,0}}, 24 | {line,[]}, 25 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 26 | {function,module_info,1,8, 27 | [{label,7}, 28 | {line,[]}, 29 | {func_info,{atom,unfold0},{atom,module_info},1}, 30 | {label,8}, 31 | {move,{x,0},{x,1}}, 32 | {move,{atom,unfold0},{x,0}}, 33 | {line,[]}, 34 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 35 | 9} 36 | -------------------------------------------------------------------------------- /test/asm_data/dst/unfold1.E: -------------------------------------------------------------------------------- 1 | {unfold1, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,4,record, 4 | [{r, 5 | [{record_field,4,{atom,4,'1'}}, 6 | {record_field,4,{atom,4,'2'}}, 7 | {record_field,4,{atom,4,'3'}}, 8 | {record_field,4,{atom,4,'4'}}, 9 | {record_field,4,{atom,4,'5'}}]}]}, 10 | {attribute,1,file,{"test/asm_data/unfold1.erl",1}}, 11 | {function,6,a,0, 12 | [{clause,6,[],[], 13 | [{'case',6, 14 | {tuple,8, 15 | [{atom,7,r}, 16 | {atom,4,undefined}, 17 | {string,8,"deux"}, 18 | {atom,4,undefined}, 19 | {atom,4,undefined}, 20 | {atom,4,undefined}]}, 21 | [{clause,8, 22 | [{var,8,'R'}], 23 | [], 24 | [{'case',6, 25 | {call,9, 26 | {remote,9,{atom,9,erlang},{atom,9,setelement}}, 27 | [{integer,9,4},{var,9,'R'},{string,9,"trois"}]}, 28 | [{clause,9, 29 | [{var,9,'R0'}], 30 | [], 31 | [{'case',6, 32 | {call,10, 33 | {remote,10,{atom,10,erlang},{atom,10,setelement}}, 34 | [{integer,10,6},{var,10,'R0'},{string,10,"cinq"}]}, 35 | [{clause,10, 36 | [{var,10,'R1'}], 37 | [], 38 | [{match,11, 39 | {var,11,'R2'}, 40 | {call,11, 41 | {remote,11,{atom,11,erlang},{atom,11,setelement}}, 42 | [{integer,11,3}, 43 | {var,11,'R1'}, 44 | {string,11,"DEUX"}]}}]}]}]}]}]}]}, 45 | {var,12,'R2'}]}]}, 46 | {function,14,b,0, 47 | [{clause,14,[],[], 48 | [{tuple,0, 49 | [{atom,15,r}, 50 | {atom,4,undefined}, 51 | {string,15,"DEUX"}, 52 | {string,16,"trois"}, 53 | {atom,4,undefined}, 54 | {string,17,"cinq"}]}]}]}, 55 | {function,0,module_info,0, 56 | [{clause,0,[],[], 57 | [{call,0, 58 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 59 | [{atom,0,unfold1}]}]}]}, 60 | {function,0,module_info,1, 61 | [{clause,0, 62 | [{var,0,'X'}], 63 | [], 64 | [{call,0, 65 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 66 | [{atom,0,unfold1},{var,0,'X'}]}]}]}]} 67 | -------------------------------------------------------------------------------- /test/asm_data/dst/unfold1.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/unfold1.erl",1}}, 2 | {attribute,1,module,unfold1}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {attribute,4,record, 5 | {r, 6 | [{record_field,4,{atom,4,'1'}}, 7 | {record_field,4,{atom,4,'2'}}, 8 | {record_field,4,{atom,4,'3'}}, 9 | {record_field,4,{atom,4,'4'}}, 10 | {record_field,4,{atom,4,'5'}}]}}, 11 | {function,6,a,0, 12 | [{clause,6,[],[], 13 | [{'case',6, 14 | {tuple,8, 15 | [{atom,7,r}, 16 | {atom,4,undefined}, 17 | {string,8,"deux"}, 18 | {atom,4,undefined}, 19 | {atom,4,undefined}, 20 | {atom,4,undefined}]}, 21 | [{clause,8, 22 | [{var,8,'R'}], 23 | [], 24 | [{'case',6, 25 | {call,9, 26 | {atom,9,setelement}, 27 | [{integer,9,4},{var,9,'R'},{string,9,"trois"}]}, 28 | [{clause,9, 29 | [{var,9,'R0'}], 30 | [], 31 | [{'case',6, 32 | {call,10, 33 | {atom,10,setelement}, 34 | [{integer,10,6},{var,10,'R0'},{string,10,"cinq"}]}, 35 | [{clause,10, 36 | [{var,10,'R1'}], 37 | [], 38 | [{match,11, 39 | {var,11,'R2'}, 40 | {call,11, 41 | {atom,11,setelement}, 42 | [{integer,11,3}, 43 | {var,11,'R1'}, 44 | {string,11,"DEUX"}]}}]}]}]}]}]}]}, 45 | {var,12,'R2'}]}]}, 46 | {function,14,b,0, 47 | [{clause,14,[],[], 48 | [{tuple,0, 49 | [{atom,15,r}, 50 | {atom,4,undefined}, 51 | {string,15,"DEUX"}, 52 | {string,16,"trois"}, 53 | {atom,4,undefined}, 54 | {string,17,"cinq"}]}]}]}] 55 | -------------------------------------------------------------------------------- /test/asm_data/dst/unfold1.S: -------------------------------------------------------------------------------- 1 | {unfold1, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [], 4 | [{function,a,0,2, 5 | [{label,1}, 6 | {line,[{location,"test/asm_data/unfold1.erl",6}]}, 7 | {func_info,{atom,unfold1},{atom,a},0}, 8 | {label,2}, 9 | {move,{literal,{r,undefined,"DEUX","trois",undefined,"cinq"}},{x,0}}, 10 | return]}, 11 | {function,b,0,4, 12 | [{label,3}, 13 | {line,[{location,"test/asm_data/unfold1.erl",14}]}, 14 | {func_info,{atom,unfold1},{atom,b},0}, 15 | {label,4}, 16 | {move,{literal,{r,undefined,"DEUX","trois",undefined,"cinq"}},{x,0}}, 17 | return]}, 18 | {function,module_info,0,6, 19 | [{label,5}, 20 | {line,[]}, 21 | {func_info,{atom,unfold1},{atom,module_info},0}, 22 | {label,6}, 23 | {move,{atom,unfold1},{x,0}}, 24 | {line,[]}, 25 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 26 | {function,module_info,1,8, 27 | [{label,7}, 28 | {line,[]}, 29 | {func_info,{atom,unfold1},{atom,module_info},1}, 30 | {label,8}, 31 | {move,{x,0},{x,1}}, 32 | {move,{atom,unfold1},{x,0}}, 33 | {line,[]}, 34 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 35 | 9} 36 | -------------------------------------------------------------------------------- /test/asm_data/dst/unfold2.E: -------------------------------------------------------------------------------- 1 | {unfold2, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,4,record, 4 | [{r,[{record_field,4,{atom,4,'1'}}, 5 | {record_field,4,{atom,4,'2'}}, 6 | {record_field,4,{atom,4,'3'}}, 7 | {record_field,4,{atom,4,'4'}}, 8 | {record_field,4,{atom,4,'5'}}]}]}, 9 | {attribute,1,file,{"test/asm_data/unfold2.erl",1}}, 10 | {function,6,a,0, 11 | [{clause,6,[],[], 12 | [{tuple,15, 13 | [{atom,12,r}, 14 | {atom,4,undefined}, 15 | {string,15,"DEUX"}, 16 | {string,16,"trois"}, 17 | {atom,4,undefined}, 18 | {string,17,"cinq"}]}]}]}, 19 | {function,14,two,1, 20 | [{clause,14, 21 | [{var,14,'R'}], 22 | [], 23 | [{call,14, 24 | {remote,14,{atom,14,erlang},{atom,14,setelement}}, 25 | [{integer,14,3},{var,14,'R'},{string,14,"deux"}]}]}]}, 26 | {function,15,'TWO',1, 27 | [{clause,15, 28 | [{var,15,'R'}], 29 | [], 30 | [{call,15, 31 | {remote,15,{atom,15,erlang},{atom,15,setelement}}, 32 | [{integer,15,3},{var,15,'R'},{string,15,"DEUX"}]}]}]}, 33 | {function,16,three,1, 34 | [{clause,16, 35 | [{var,16,'R'}], 36 | [], 37 | [{call,16, 38 | {remote,16,{atom,16,erlang},{atom,16,setelement}}, 39 | [{integer,16,4},{var,16,'R'},{string,16,"trois"}]}]}]}, 40 | {function,17,five,1, 41 | [{clause,17, 42 | [{var,17,'R'}], 43 | [], 44 | [{call,17, 45 | {remote,17,{atom,17,erlang},{atom,17,setelement}}, 46 | [{integer,17,6},{var,17,'R'},{string,17,"cinq"}]}]}]}, 47 | {function,19,b,0, 48 | [{clause,19,[],[], 49 | [{tuple,0, 50 | [{atom,20,r}, 51 | {atom,4,undefined}, 52 | {string,20,"DEUX"}, 53 | {string,21,"trois"}, 54 | {atom,4,undefined}, 55 | {string,22,"cinq"}]}]}]}, 56 | {function,0,module_info,0, 57 | [{clause,0,[],[], 58 | [{call,0, 59 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 60 | [{atom,0,unfold2}]}]}]}, 61 | {function,0,module_info,1, 62 | [{clause,0, 63 | [{var,0,'X'}], 64 | [], 65 | [{call,0, 66 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 67 | [{atom,0,unfold2},{var,0,'X'}]}]}]}]} 68 | -------------------------------------------------------------------------------- /test/asm_data/dst/unfold2.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/unfold2.erl",1}}, 2 | {attribute,1,module,unfold2}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {attribute,4,record, 5 | {r,[{record_field,4,{atom,4,'1'}}, 6 | {record_field,4,{atom,4,'2'}}, 7 | {record_field,4,{atom,4,'3'}}, 8 | {record_field,4,{atom,4,'4'}}, 9 | {record_field,4,{atom,4,'5'}}]}}, 10 | {function,6,a,0, 11 | [{clause,6,[],[], 12 | [{tuple,15, 13 | [{atom,12,r}, 14 | {atom,4,undefined}, 15 | {string,15,"DEUX"}, 16 | {string,16,"trois"}, 17 | {atom,4,undefined}, 18 | {string,17,"cinq"}]}]}]}, 19 | {function,14,two,1, 20 | [{clause,14, 21 | [{var,14,'R'}], 22 | [], 23 | [{call,14, 24 | {atom,14,setelement}, 25 | [{integer,14,3}, 26 | {var,14,'R'}, 27 | {string,14,"deux"}]}]}]}, 28 | {function,15,'TWO',1, 29 | [{clause,15, 30 | [{var,15,'R'}], 31 | [], 32 | [{call,15, 33 | {atom,15,setelement}, 34 | [{integer,15,3}, 35 | {var,15,'R'}, 36 | {string,15,"DEUX"}]}]}]}, 37 | {function,16,three,1, 38 | [{clause,16, 39 | [{var,16,'R'}], 40 | [], 41 | [{call,16, 42 | {atom,16,setelement}, 43 | [{integer,16,4}, 44 | {var,16,'R'}, 45 | {string,16,"trois"}]}]}]}, 46 | {function,17,five,1, 47 | [{clause,17, 48 | [{var,17,'R'}], 49 | [], 50 | [{call,17, 51 | {atom,17,setelement}, 52 | [{integer,17,6}, 53 | {var,17,'R'}, 54 | {string,17,"cinq"}]}]}]}, 55 | {function,19,b,0, 56 | [{clause,19,[],[], 57 | [{tuple,0, 58 | [{atom,20,r}, 59 | {atom,4,undefined}, 60 | {string,20,"DEUX"}, 61 | {string,21,"trois"}, 62 | {atom,4,undefined}, 63 | {string,22,"cinq"}]}]}]}] 64 | -------------------------------------------------------------------------------- /test/asm_data/dst/unfold2.S: -------------------------------------------------------------------------------- 1 | {unfold2, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [], 4 | [{function,a,0,2, 5 | [{label,1}, 6 | {line,[{location,"test/asm_data/unfold2.erl",6}]}, 7 | {func_info,{atom,unfold2},{atom,a},0}, 8 | {label,2}, 9 | {move,{literal,{r,undefined,"DEUX","trois",undefined,"cinq"}},{x,0}}, 10 | return]}, 11 | {function,b,0,4, 12 | [{label,3}, 13 | {line,[{location,"test/asm_data/unfold2.erl",19}]}, 14 | {func_info,{atom,unfold2},{atom,b},0}, 15 | {label,4}, 16 | {move,{literal,{r,undefined,"DEUX","trois",undefined,"cinq"}},{x,0}}, 17 | return]}, 18 | {function,module_info,0,6, 19 | [{label,5}, 20 | {line,[]}, 21 | {func_info,{atom,unfold2},{atom,module_info},0}, 22 | {label,6}, 23 | {move,{atom,unfold2},{x,0}}, 24 | {line,[]}, 25 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 26 | {function,module_info,1,8, 27 | [{label,7}, 28 | {line,[]}, 29 | {func_info,{atom,unfold2},{atom,module_info},1}, 30 | {label,8}, 31 | {move,{x,0},{x,1}}, 32 | {move,{atom,unfold2},{x,0}}, 33 | {line,[]}, 34 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 35 | 9} 36 | -------------------------------------------------------------------------------- /test/asm_data/dst/unfold3.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/unfold3.erl",1}}, 2 | {attribute,1,module,unfold3}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {attribute,4,record, 5 | {r,[{record_field,4,{atom,4,'1'}}, 6 | {record_field,4,{atom,4,'2'}}, 7 | {record_field,4,{atom,4,'3'}}, 8 | {record_field,4,{atom,4,'4'}}, 9 | {record_field,4,{atom,4,'5'}}]}}, 10 | {function,6,a,0, 11 | [{clause,6,[],[], 12 | [{tuple,18, 13 | [{atom,12,r}, 14 | {atom,4,undefined}, 15 | {string,18,"DEUX"}, 16 | {string,19,"trois"}, 17 | {atom,4,undefined}, 18 | {string,20,"cinq"}]}]}]}, 19 | {function,14,pipe,2, 20 | [{clause,3,[{var,14,'Acc'},{nil,3}],[[{atom,3,true}]],[{var,3,'Acc'}]}, 21 | {clause,4, 22 | [{var,14,'Acc'},{cons,4,{var,4,'Hd'},{var,4,'Tail'}}], 23 | [], 24 | [{call,5, 25 | {atom,5,pipe@2585}, 26 | [{'fun',15, 27 | {clauses, 28 | [{clause,15, 29 | [{var,15,'F'},{var,15,'R'}], 30 | [], 31 | [{call,15,{var,15,'F'},[{var,15,'R'}]}]}]}}, 32 | {call,15,{var,15,'Hd'},[{var,15,'Acc'}]}, 33 | {var,5,'Tail'}]}]}]}, 34 | {function,1,pipe@2585,3, 35 | [{clause,3, 36 | [{var,1,'F'},{var,1,'Acc'},{nil,3}], 37 | [[{call,3,{atom,3,is_function},[{var,3,'F'},{integer,3,2}]}]], 38 | [{var,3,'Acc'}]}, 39 | {clause,4, 40 | [{var,1,'F'},{var,1,'Acc'},{cons,4,{var,4,'Hd'},{var,4,'Tail'}}], 41 | [], 42 | [{call,5, 43 | {atom,5,pipe@2585}, 44 | [{var,5,'F'}, 45 | {call,5,{var,5,'F'},[{var,5,'Hd'},{var,5,'Acc'}]}, 46 | {var,5,'Tail'}]}]}]}, 47 | {function,17,two,1, 48 | [{clause,17, 49 | [{var,17,'R'}], 50 | [], 51 | [{call,17, 52 | {atom,17,setelement}, 53 | [{integer,17,3},{var,17,'R'},{string,17,"deux"}]}]}]}, 54 | {function,18,'TWO',1, 55 | [{clause,18, 56 | [{var,18,'R'}], 57 | [], 58 | [{call,18, 59 | {atom,18,setelement}, 60 | [{integer,18,3},{var,18,'R'},{string,18,"DEUX"}]}]}]}, 61 | {function,19,three,1, 62 | [{clause,19, 63 | [{var,19,'R'}], 64 | [], 65 | [{call,19, 66 | {atom,19,setelement}, 67 | [{integer,19,4},{var,19,'R'},{string,19,"trois"}]}]}]}, 68 | {function,20,five,1, 69 | [{clause,20, 70 | [{var,20,'R'}], 71 | [], 72 | [{call,20, 73 | {atom,20,setelement}, 74 | [{integer,20,6},{var,20,'R'},{string,20,"cinq"}]}]}]}, 75 | {function,22,b,0, 76 | [{clause,22,[],[], 77 | [{tuple,0, 78 | [{atom,23,r}, 79 | {atom,4,undefined}, 80 | {string,23,"DEUX"}, 81 | {string,24,"trois"}, 82 | {atom,4,undefined}, 83 | {string,25,"cinq"}]}]}]}] 84 | -------------------------------------------------------------------------------- /test/asm_data/dst/unfold3.S: -------------------------------------------------------------------------------- 1 | {unfold3, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [], 4 | [{function,a,0,2, 5 | [{label,1}, 6 | {line,[{location,"test/asm_data/unfold3.erl",6}]}, 7 | {func_info,{atom,unfold3},{atom,a},0}, 8 | {label,2}, 9 | {move,{literal,{r,undefined,"DEUX","trois",undefined,"cinq"}},{x,0}}, 10 | return]}, 11 | {function,b,0,4, 12 | [{label,3}, 13 | {line,[{location,"test/asm_data/unfold3.erl",22}]}, 14 | {func_info,{atom,unfold3},{atom,b},0}, 15 | {label,4}, 16 | {move,{literal,{r,undefined,"DEUX","trois",undefined,"cinq"}},{x,0}}, 17 | return]}, 18 | {function,module_info,0,6, 19 | [{label,5}, 20 | {line,[]}, 21 | {func_info,{atom,unfold3},{atom,module_info},0}, 22 | {label,6}, 23 | {move,{atom,unfold3},{x,0}}, 24 | {line,[]}, 25 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 26 | {function,module_info,1,8, 27 | [{label,7}, 28 | {line,[]}, 29 | {func_info,{atom,unfold3},{atom,module_info},1}, 30 | {label,8}, 31 | {move,{x,0},{x,1}}, 32 | {move,{atom,unfold3},{x,0}}, 33 | {line,[]}, 34 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 35 | 9} 36 | -------------------------------------------------------------------------------- /test/asm_data/dst/unfold5.E: -------------------------------------------------------------------------------- 1 | {unfold5, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,4,record, 4 | [{r, 5 | [{record_field,4,{atom,4,'1'}}, 6 | {record_field,4,{atom,4,'2'}}, 7 | {record_field,4,{atom,4,'3'}}, 8 | {record_field,4,{atom,4,'4'}}, 9 | {record_field,4,{atom,4,'5'}}]}]}, 10 | {attribute,1,file,{"test/asm_data/unfold5.erl",1}}, 11 | {function,6,a,0, 12 | [{clause,6,[],[], 13 | [{'case',6, 14 | {tuple,8, 15 | [{atom,7,r}, 16 | {atom,4,undefined}, 17 | {string,8,"deux"}, 18 | {atom,4,undefined}, 19 | {atom,4,undefined}, 20 | {atom,4,undefined}]}, 21 | [{clause,8, 22 | [{var,8,'R'}], 23 | [], 24 | [{'case',6, 25 | {call,9, 26 | {remote,9,{atom,9,erlang},{atom,9,setelement}}, 27 | [{integer,9,4},{var,9,'R'},{string,9,"trois"}]}, 28 | [{clause,9, 29 | [{var,9,'R0'}], 30 | [], 31 | [{'case',6, 32 | {call,10, 33 | {remote,10,{atom,10,erlang},{atom,10,setelement}}, 34 | [{integer,10,6},{var,10,'R0'},{string,10,"cinq"}]}, 35 | [{clause,10, 36 | [{var,10,'R1'}], 37 | [], 38 | [{match,11, 39 | {var,11,'R2'}, 40 | {call,11, 41 | {remote,11,{atom,11,erlang},{atom,11,setelement}}, 42 | [{integer,11,3}, 43 | {var,11,'R1'}, 44 | {string,11,"DEUX"}]}}]}]}]}]}]}]}, 45 | {var,12,'R2'}]}]}, 46 | {function,14,b,0, 47 | [{clause,14,[],[], 48 | [{tuple,0, 49 | [{atom,15,r}, 50 | {atom,4,undefined}, 51 | {string,15,"DEUX"}, 52 | {string,16,"trois"}, 53 | {atom,4,undefined}, 54 | {string,17,"cinq"}]}]}]}, 55 | {function,0,module_info,0, 56 | [{clause,0,[],[], 57 | [{call,0, 58 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 59 | [{atom,0,unfold5}]}]}]}, 60 | {function,0,module_info,1, 61 | [{clause,0, 62 | [{var,0,'X'}], 63 | [], 64 | [{call,0, 65 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 66 | [{atom,0,unfold5},{var,0,'X'}]}]}]}]} 67 | -------------------------------------------------------------------------------- /test/asm_data/dst/unfold5.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/unfold5.erl",1}}, 2 | {attribute,1,module,unfold5}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {attribute,4,record, 5 | {r, 6 | [{record_field,4,{atom,4,'1'}}, 7 | {record_field,4,{atom,4,'2'}}, 8 | {record_field,4,{atom,4,'3'}}, 9 | {record_field,4,{atom,4,'4'}}, 10 | {record_field,4,{atom,4,'5'}}]}}, 11 | {function,6,a,0, 12 | [{clause,6,[],[], 13 | [{'case',6, 14 | {tuple,8, 15 | [{atom,7,r}, 16 | {atom,4,undefined}, 17 | {string,8,"deux"}, 18 | {atom,4,undefined}, 19 | {atom,4,undefined}, 20 | {atom,4,undefined}]}, 21 | [{clause,8, 22 | [{var,8,'R'}], 23 | [], 24 | [{'case',6, 25 | {call,9, 26 | {atom,9,setelement}, 27 | [{integer,9,4},{var,9,'R'},{string,9,"trois"}]}, 28 | [{clause,9, 29 | [{var,9,'R0'}], 30 | [], 31 | [{'case',6, 32 | {call,10, 33 | {atom,10,setelement}, 34 | [{integer,10,6},{var,10,'R0'},{string,10,"cinq"}]}, 35 | [{clause,10, 36 | [{var,10,'R1'}], 37 | [], 38 | [{match,11, 39 | {var,11,'R2'}, 40 | {call,11, 41 | {atom,11,setelement}, 42 | [{integer,11,3}, 43 | {var,11,'R1'}, 44 | {string,11,"DEUX"}]}}]}]}]}]}]}]}, 45 | {var,12,'R2'}]}]}, 46 | {function,14,b,0, 47 | [{clause,14,[],[], 48 | [{tuple,0, 49 | [{atom,15,r}, 50 | {atom,4,undefined}, 51 | {string,15,"DEUX"}, 52 | {string,16,"trois"}, 53 | {atom,4,undefined}, 54 | {string,17,"cinq"}]}]}]}] 55 | -------------------------------------------------------------------------------- /test/asm_data/dst/unfold5.S: -------------------------------------------------------------------------------- 1 | {unfold5, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [], 4 | [{function,a,0,2, 5 | [{label,1}, 6 | {line,[{location,"test/asm_data/unfold5.erl",6}]}, 7 | {func_info,{atom,unfold5},{atom,a},0}, 8 | {label,2}, 9 | {move,{literal,{r,undefined,"DEUX","trois",undefined,"cinq"}},{x,0}}, 10 | return]}, 11 | {function,b,0,4, 12 | [{label,3}, 13 | {line,[{location,"test/asm_data/unfold5.erl",14}]}, 14 | {func_info,{atom,unfold5},{atom,b},0}, 15 | {label,4}, 16 | {move,{literal,{r,undefined,"DEUX","trois",undefined,"cinq"}},{x,0}}, 17 | return]}, 18 | {function,module_info,0,6, 19 | [{label,5}, 20 | {line,[]}, 21 | {func_info,{atom,unfold5},{atom,module_info},0}, 22 | {label,6}, 23 | {move,{atom,unfold5},{x,0}}, 24 | {line,[]}, 25 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 26 | {function,module_info,1,8, 27 | [{label,7}, 28 | {line,[]}, 29 | {func_info,{atom,unfold5},{atom,module_info},1}, 30 | {label,8}, 31 | {move,{x,0},{x,1}}, 32 | {move,{atom,unfold5},{x,0}}, 33 | {line,[]}, 34 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 35 | 9} 36 | -------------------------------------------------------------------------------- /test/asm_data/inline0.hrl: -------------------------------------------------------------------------------- 1 | % -*- coding: utf-8 -*- 2 | -module(inline0). 3 | -export([a/0, b/0]). 4 | 5 | a() -> 6 | {N,_} = a1(0), 7 | N. 8 | 9 | a1(N) -> {N,N}. 10 | 11 | b() -> 0. 12 | -------------------------------------------------------------------------------- /test/asm_data/map1.hrl: -------------------------------------------------------------------------------- 1 | -module(map1). 2 | -export([a/0, b/0]). 3 | 4 | a() -> 5 | M = #{a => 1}, 6 | M#{a => 42, b=> 1}. 7 | 8 | b() -> #{a => 42, b=> 1}. 9 | -------------------------------------------------------------------------------- /test/asm_data/map2.hrl: -------------------------------------------------------------------------------- 1 | -module(map2). 2 | -export([a/0, b/0]). 3 | 4 | a() -> 5 | M = (fun () -> #{a => 1} end)(), 6 | M#{a => 42, b=> 1}. 7 | 8 | b() -> #{a => 42, b=> 1}. 9 | -------------------------------------------------------------------------------- /test/asm_data/map3.hrl: -------------------------------------------------------------------------------- 1 | -module(map3). 2 | -export([a/0, b/0]). 3 | 4 | a() -> 5 | Y = b, 6 | M = (fun (X) -> #{a => X} end)(Y), 7 | M#{a => 42, Y => 1}. 8 | 9 | b() -> #{a => 42, b => 1}. 10 | -------------------------------------------------------------------------------- /test/asm_data/map4.hrl: -------------------------------------------------------------------------------- 1 | -module(map4). 2 | -export([a/0, b/0]). 3 | 4 | a() -> 5 | #{key := Y} = #{key => b}, 6 | M = (fun (X) -> #{a => X} end)(Y), 7 | M#{a => 42, Y => 1}. 8 | 9 | b() -> #{a => 42, b => 1}. 10 | -------------------------------------------------------------------------------- /test/asm_data/src/deforestation0.E: -------------------------------------------------------------------------------- 1 | {deforestation0, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/deforestation0.erl",1}}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{call,4, 7 | {remote,4,{atom,4,erlang},{atom,4,hd}}, 8 | [{cons,4, 9 | {call,4,{remote,4,{atom,4,erlang},{atom,4,get}},[]}, 10 | {nil,4}}]}]}]}, 11 | {function,6,b,0, 12 | [{clause,6,[],[], 13 | [{call,6,{remote,6,{atom,6,erlang},{atom,6,get}},[]}]}]}, 14 | {function,0,module_info,0, 15 | [{clause,0,[],[], 16 | [{call,0, 17 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 18 | [{atom,0,deforestation0}]}]}]}, 19 | {function,0,module_info,1, 20 | [{clause,0, 21 | [{var,0,'X'}], 22 | [], 23 | [{call,0, 24 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 25 | [{atom,0,deforestation0},{var,0,'X'}]}]}]}]} 26 | -------------------------------------------------------------------------------- /test/asm_data/src/deforestation0.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/deforestation0.erl",1}}, 2 | {attribute,1,module,deforestation0}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{call,4, 7 | {atom,4,hd}, 8 | [{cons,4,{call,4,{atom,4,get},[]},{nil,4}}]}]}]}, 9 | {function,6,b,0,[{clause,6,[],[],[{call,6,{atom,6,get},[]}]}]}, 10 | {eof,7}] 11 | -------------------------------------------------------------------------------- /test/asm_data/src/deforestation0.S: -------------------------------------------------------------------------------- 1 | {deforestation0, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [], 4 | [{function,a,0,2, 5 | [{label,1}, 6 | {line,[{location,"test/asm_data/deforestation0.erl",4}]}, 7 | {func_info,{atom,deforestation0},{atom,a},0}, 8 | {label,2}, 9 | {allocate,0,0}, 10 | {line,[{location,"test/asm_data/deforestation0.erl",4}]}, 11 | {call_ext,0,{extfunc,erlang,get,0}}, 12 | {test_heap,2,1}, 13 | {put_list,{x,0},nil,{x,0}}, 14 | {line,[{location,"test/asm_data/deforestation0.erl",4}]}, 15 | {bif,hd,{f,0},[{x,0}],{x,0}}, 16 | {deallocate,0}, 17 | return]}, 18 | {function,b,0,4, 19 | [{label,3}, 20 | {line,[{location,"test/asm_data/deforestation0.erl",6}]}, 21 | {func_info,{atom,deforestation0},{atom,b},0}, 22 | {label,4}, 23 | {call_ext_only,0,{extfunc,erlang,get,0}}]}, 24 | {function,module_info,0,6, 25 | [{label,5}, 26 | {line,[]}, 27 | {func_info,{atom,deforestation0},{atom,module_info},0}, 28 | {label,6}, 29 | {move,{atom,deforestation0},{x,0}}, 30 | {line,[]}, 31 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 32 | {function,module_info,1,8, 33 | [{label,7}, 34 | {line,[]}, 35 | {func_info,{atom,deforestation0},{atom,module_info},1}, 36 | {label,8}, 37 | {move,{x,0},{x,1}}, 38 | {move,{atom,deforestation0},{x,0}}, 39 | {line,[]}, 40 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 41 | 9} 42 | -------------------------------------------------------------------------------- /test/asm_data/src/deforestation1.E: -------------------------------------------------------------------------------- 1 | {deforestation1, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/deforestation1.erl",1}}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{call,4, 7 | {remote,4,{atom,4,erlang},{atom,4,binary_to_list}}, 8 | [{bin,4, 9 | [{bin_element,4, 10 | {char,4,48}, 11 | {integer,4,8}, 12 | [integer,{unit,1},unsigned,big]}, 13 | {bin_element,4, 14 | {char,4,46}, 15 | {integer,4,8}, 16 | [integer,{unit,1},unsigned,big]}, 17 | {bin_element,4, 18 | {char,4,49}, 19 | {integer,4,8}, 20 | [integer,{unit,1},unsigned,big]}, 21 | {bin_element,4, 22 | {char,4,46}, 23 | {integer,4,8}, 24 | [integer,{unit,1},unsigned,big]}, 25 | {bin_element,4, 26 | {char,4,48}, 27 | {integer,4,8}, 28 | [integer,{unit,1},unsigned,big]}]}]}]}]}, 29 | {function,6,b,0,[{clause,6,[],[],[{string,6,"0.1.0"}]}]}, 30 | {function,0,module_info,0, 31 | [{clause,0,[],[], 32 | [{call,0, 33 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 34 | [{atom,0,deforestation1}]}]}]}, 35 | {function,0,module_info,1, 36 | [{clause,0, 37 | [{var,0,'X'}], 38 | [], 39 | [{call,0, 40 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 41 | [{atom,0,deforestation1},{var,0,'X'}]}]}]}]} 42 | -------------------------------------------------------------------------------- /test/asm_data/src/deforestation1.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/deforestation1.erl",1}}, 2 | {attribute,1,module,deforestation1}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{call,4, 7 | {atom,4,binary_to_list}, 8 | [{bin,4, 9 | [{bin_element,4, 10 | {string,4,"0.1.0"}, 11 | default,default}]}]}]}]}, 12 | {function,6,b,0,[{clause,6,[],[],[{string,6,"0.1.0"}]}]}, 13 | {eof,7}] 14 | -------------------------------------------------------------------------------- /test/asm_data/src/deforestation1.S: -------------------------------------------------------------------------------- 1 | {deforestation1, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [], 4 | [{function,a,0,2, 5 | [{label,1}, 6 | {line,[{location,"test/asm_data/deforestation1.erl",4}]}, 7 | {func_info,{atom,deforestation1},{atom,a},0}, 8 | {label,2}, 9 | {move,{literal,"0.1.0"},{x,0}}, 10 | return]}, 11 | {function,b,0,4, 12 | [{label,3}, 13 | {line,[{location,"test/asm_data/deforestation1.erl",6}]}, 14 | {func_info,{atom,deforestation1},{atom,b},0}, 15 | {label,4}, 16 | {move,{literal,"0.1.0"},{x,0}}, 17 | return]}, 18 | {function,module_info,0,6, 19 | [{label,5}, 20 | {line,[]}, 21 | {func_info,{atom,deforestation1},{atom,module_info},0}, 22 | {label,6}, 23 | {move,{atom,deforestation1},{x,0}}, 24 | {line,[]}, 25 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 26 | {function,module_info,1,8, 27 | [{label,7}, 28 | {line,[]}, 29 | {func_info,{atom,deforestation1},{atom,module_info},1}, 30 | {label,8}, 31 | {move,{x,0},{x,1}}, 32 | {move,{atom,deforestation1},{x,0}}, 33 | {line,[]}, 34 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 35 | 9} 36 | -------------------------------------------------------------------------------- /test/asm_data/src/deforestation10.E: -------------------------------------------------------------------------------- 1 | {deforestation10, 2 | [{a,0},{a,1},{b,0},{b,1},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/deforestation10.erl",1}}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{call,4, 7 | {atom,4,a}, 8 | [{cons,4, 9 | {atom,4,blip}, 10 | {cons,4, 11 | {atom,4,blop}, 12 | {cons,4,{integer,4,3},{nil,4}}}}]}]}]}, 13 | {function,5,a,1, 14 | [{clause,5, 15 | [{var,5,'Args'}], 16 | [], 17 | [{'case',6, 18 | {op,6,'not', 19 | {call,6, 20 | {remote,6,{atom,6,lists},{atom,6,member}}, 21 | [{call,6, 22 | {remote,6,{atom,6,erlang},{atom,6,length}}, 23 | [{var,6,'Args'}]}, 24 | {cons,6, 25 | {integer,6,1}, 26 | {cons,6,{integer,6,2},{nil,6}}}]}}, 27 | [{clause,7, 28 | [{atom,7,true}], 29 | [], 30 | [{call,7, 31 | {remote,7,{atom,7,io},{atom,7,format}}, 32 | [{string,7,"usage: ...\n"},{nil,7}]}]}, 33 | {clause,8, 34 | [{atom,8,false}], 35 | [], 36 | [{call,8, 37 | {remote,8,{atom,8,do},{atom,8,the_thing}}, 38 | [{var,8,'Args'}]}]}]}]}]}, 39 | {function,11,b,0, 40 | [{clause,11,[],[], 41 | [{call,11,{atom,11,b},[{cons,11,{atom,11,bla},{nil,11}}]}]}]}, 42 | {function,12,b,1, 43 | [{clause,12, 44 | [{cons,12,{var,12,'_'},{nil,12}}], 45 | [], 46 | [{call,12, 47 | {remote,12,{atom,12,io},{atom,12,format}}, 48 | [{string,12,"usage: ...\n"},{nil,12}]}]}, 49 | {clause,13, 50 | [{cons,13,{var,13,'_'},{cons,13,{var,13,'_'},{nil,13}}}], 51 | [], 52 | [{call,13, 53 | {remote,13,{atom,13,io},{atom,13,format}}, 54 | [{string,13,"usage: ...\n"},{nil,13}]}]}, 55 | {clause,14, 56 | [{match,14,{cons,14,{var,14,'_'},{var,14,'_'}},{var,14,'Args'}}], 57 | [], 58 | [{call,14, 59 | {remote,14,{atom,14,do},{atom,14,the_thing}}, 60 | [{var,14,'Args'}]}]}]}, 61 | {function,0,module_info,0, 62 | [{clause,0,[],[], 63 | [{call,0, 64 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 65 | [{atom,0,deforestation10}]}]}]}, 66 | {function,0,module_info,1, 67 | [{clause,0, 68 | [{var,0,'X'}], 69 | [], 70 | [{call,0, 71 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 72 | [{atom,0,deforestation10},{var,0,'X'}]}]}]}]} 73 | -------------------------------------------------------------------------------- /test/asm_data/src/deforestation10.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/deforestation10.erl",1}}, 2 | {attribute,1,module,deforestation10}, 3 | {attribute,2,export,[{a,0},{b,0},{a,1},{b,1}]}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{call,4, 7 | {atom,4,a}, 8 | [{cons,4, 9 | {atom,4,blip}, 10 | {cons,4, 11 | {atom,4,blop}, 12 | {cons,4,{integer,4,3},{nil,4}}}}]}]}]}, 13 | {function,5,a,1, 14 | [{clause,5, 15 | [{var,5,'Args'}], 16 | [], 17 | [{'case',6, 18 | {op,6,'not', 19 | {call,6, 20 | {remote,6,{atom,6,lists},{atom,6,member}}, 21 | [{call,6,{atom,6,length},[{var,6,'Args'}]}, 22 | {cons,6, 23 | {integer,6,1}, 24 | {cons,6,{integer,6,2},{nil,6}}}]}}, 25 | [{clause,7, 26 | [{atom,7,true}], 27 | [], 28 | [{call,7, 29 | {remote,7,{atom,7,io},{atom,7,format}}, 30 | [{string,7,"usage: ...\n"},{nil,7}]}]}, 31 | {clause,8, 32 | [{atom,8,false}], 33 | [], 34 | [{call,8, 35 | {remote,8,{atom,8,do},{atom,8,the_thing}}, 36 | [{var,8,'Args'}]}]}]}]}]}, 37 | {function,11,b,0, 38 | [{clause,11,[],[], 39 | [{call,11,{atom,11,b},[{cons,11,{atom,11,bla},{nil,11}}]}]}]}, 40 | {function,12,b,1, 41 | [{clause,12, 42 | [{cons,12,{var,12,'_'},{nil,12}}], 43 | [], 44 | [{call,12, 45 | {remote,12,{atom,12,io},{atom,12,format}}, 46 | [{string,12,"usage: ...\n"},{nil,12}]}]}, 47 | {clause,13, 48 | [{cons,13,{var,13,'_'},{cons,13,{var,13,'_'},{nil,13}}}], 49 | [], 50 | [{call,13, 51 | {remote,13,{atom,13,io},{atom,13,format}}, 52 | [{string,13,"usage: ...\n"},{nil,13}]}]}, 53 | {clause,14, 54 | [{match,14,{cons,14,{var,14,'_'},{var,14,'_'}},{var,14,'Args'}}], 55 | [], 56 | [{call,14, 57 | {remote,14,{atom,14,do},{atom,14,the_thing}}, 58 | [{var,14,'Args'}]}]}]}, 59 | {eof,15}] 60 | -------------------------------------------------------------------------------- /test/asm_data/src/deforestation2.E: -------------------------------------------------------------------------------- 1 | {deforestation2, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/deforestation2.erl",1}}, 4 | {function,6,a,0, 5 | [{clause,6,[],[], 6 | [{op,6,'++', 7 | {string,6,"User Agent/"}, 8 | {call,6, 9 | {remote,6,{atom,6,erlang},{atom,6,binary_to_list}}, 10 | [{bin,6, 11 | [{bin_element,6, 12 | {char,6,48}, 13 | {integer,6,8}, 14 | [integer,{unit,1},unsigned,big]}, 15 | {bin_element,6, 16 | {char,6,46}, 17 | {integer,6,8}, 18 | [integer,{unit,1},unsigned,big]}, 19 | {bin_element,6, 20 | {char,6,49}, 21 | {integer,6,8}, 22 | [integer,{unit,1},unsigned,big]}, 23 | {bin_element,6, 24 | {char,6,46}, 25 | {integer,6,8}, 26 | [integer,{unit,1},unsigned,big]}, 27 | {bin_element,6, 28 | {char,6,48}, 29 | {integer,6,8}, 30 | [integer,{unit,1},unsigned,big]}]}]}}]}]}, 31 | {function,8,b,0,[{clause,8,[],[],[{string,8,"User Agent/0.1.0"}]}]}, 32 | {function,0,module_info,0, 33 | [{clause,0,[],[], 34 | [{call,0, 35 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 36 | [{atom,0,deforestation2}]}]}]}, 37 | {function,0,module_info,1, 38 | [{clause,0, 39 | [{var,0,'X'}], 40 | [], 41 | [{call,0, 42 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 43 | [{atom,0,deforestation2},{var,0,'X'}]}]}]}]} 44 | -------------------------------------------------------------------------------- /test/asm_data/src/deforestation2.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/deforestation2.erl",1}}, 2 | {attribute,1,module,deforestation2}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,6,a,0, 5 | [{clause,6,[],[], 6 | [{op,6,'++', 7 | {string,6,"User Agent/"}, 8 | {call,6, 9 | {atom,6,binary_to_list}, 10 | [{bin,6, 11 | [{bin_element,6, 12 | {string,6,"0.1.0"}, 13 | default,default}]}]}}]}]}, 14 | {function,8,b,0,[{clause,8,[],[],[{string,8,"User Agent/0.1.0"}]}]}, 15 | {eof,9}] 16 | -------------------------------------------------------------------------------- /test/asm_data/src/deforestation2.S: -------------------------------------------------------------------------------- 1 | {deforestation2, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [], 4 | [{function,a,0,2, 5 | [{label,1}, 6 | {line,[{location,"test/asm_data/deforestation2.erl",6}]}, 7 | {func_info,{atom,deforestation2},{atom,a},0}, 8 | {label,2}, 9 | {move,{literal,"User Agent/0.1.0"},{x,0}}, 10 | return]}, 11 | {function,b,0,4, 12 | [{label,3}, 13 | {line,[{location,"test/asm_data/deforestation2.erl",8}]}, 14 | {func_info,{atom,deforestation2},{atom,b},0}, 15 | {label,4}, 16 | {move,{literal,"User Agent/0.1.0"},{x,0}}, 17 | return]}, 18 | {function,module_info,0,6, 19 | [{label,5}, 20 | {line,[]}, 21 | {func_info,{atom,deforestation2},{atom,module_info},0}, 22 | {label,6}, 23 | {move,{atom,deforestation2},{x,0}}, 24 | {line,[]}, 25 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 26 | {function,module_info,1,8, 27 | [{label,7}, 28 | {line,[]}, 29 | {func_info,{atom,deforestation2},{atom,module_info},1}, 30 | {label,8}, 31 | {move,{x,0},{x,1}}, 32 | {move,{atom,deforestation2},{x,0}}, 33 | {line,[]}, 34 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 35 | 9} 36 | -------------------------------------------------------------------------------- /test/asm_data/src/deforestation3.E: -------------------------------------------------------------------------------- 1 | {deforestation3, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/deforestation3.erl",1}}, 4 | {function,6,a,0, 5 | [{clause,6,[],[], 6 | [{call,6, 7 | {remote,6,{atom,6,erlang},{atom,6,atom_to_list}}, 8 | [{atom,6,my_app}]}]}]}, 9 | {function,8,b,0,[{clause,8,[],[],[{string,8,"my_app"}]}]}, 10 | {function,0,module_info,0, 11 | [{clause,0,[],[], 12 | [{call,0, 13 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 14 | [{atom,0,deforestation3}]}]}]}, 15 | {function,0,module_info,1, 16 | [{clause,0, 17 | [{var,0,'X'}], 18 | [], 19 | [{call,0, 20 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 21 | [{atom,0,deforestation3},{var,0,'X'}]}]}]}]} 22 | -------------------------------------------------------------------------------- /test/asm_data/src/deforestation3.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/deforestation3.erl",1}}, 2 | {attribute,1,module,deforestation3}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,6,a,0, 5 | [{clause,6,[],[], 6 | [{call,6,{atom,6,atom_to_list},[{atom,6,my_app}]}]}]}, 7 | {function,8,b,0,[{clause,8,[],[],[{string,8,"my_app"}]}]}, 8 | {eof,9}] 9 | -------------------------------------------------------------------------------- /test/asm_data/src/deforestation3.S: -------------------------------------------------------------------------------- 1 | {deforestation3, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [], 4 | [{function,a,0,2, 5 | [{label,1}, 6 | {line,[{location,"test/asm_data/deforestation3.erl",6}]}, 7 | {func_info,{atom,deforestation3},{atom,a},0}, 8 | {label,2}, 9 | {move,{literal,"my_app"},{x,0}}, 10 | return]}, 11 | {function,b,0,4, 12 | [{label,3}, 13 | {line,[{location,"test/asm_data/deforestation3.erl",8}]}, 14 | {func_info,{atom,deforestation3},{atom,b},0}, 15 | {label,4}, 16 | {move,{literal,"my_app"},{x,0}}, 17 | return]}, 18 | {function,module_info,0,6, 19 | [{label,5}, 20 | {line,[]}, 21 | {func_info,{atom,deforestation3},{atom,module_info},0}, 22 | {label,6}, 23 | {move,{atom,deforestation3},{x,0}}, 24 | {line,[]}, 25 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 26 | {function,module_info,1,8, 27 | [{label,7}, 28 | {line,[]}, 29 | {func_info,{atom,deforestation3},{atom,module_info},1}, 30 | {label,8}, 31 | {move,{x,0},{x,1}}, 32 | {move,{atom,deforestation3},{x,0}}, 33 | {line,[]}, 34 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 35 | 9} 36 | -------------------------------------------------------------------------------- /test/asm_data/src/deforestation4.E: -------------------------------------------------------------------------------- 1 | {deforestation4, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/deforestation4.erl",1}}, 4 | {function,6,a,0, 5 | [{clause,6,[],[], 6 | [{call,6, 7 | {remote,6,{atom,6,erlang},{atom,6,iolist_to_binary}}, 8 | [{cons,6, 9 | {string,6,"app ["}, 10 | {cons,6, 11 | {call,6, 12 | {remote,6,{atom,6,erlang},{atom,6,atom_to_list}}, 13 | [{atom,6,my_app}]}, 14 | {cons,6, 15 | {bin,6, 16 | [{bin_element,6, 17 | {char,6,93}, 18 | {integer,6,8}, 19 | [integer,{unit,1},unsigned,big]}]}, 20 | {nil,6}}}}]}]}]}, 21 | {function,8,b,0, 22 | [{clause,8,[],[], 23 | [{bin,8, 24 | [{bin_element,8, 25 | {char,8,97}, 26 | {integer,8,8}, 27 | [integer,{unit,1},unsigned,big]}, 28 | {bin_element,8, 29 | {char,8,112}, 30 | {integer,8,8}, 31 | [integer,{unit,1},unsigned,big]}, 32 | {bin_element,8, 33 | {char,8,112}, 34 | {integer,8,8}, 35 | [integer,{unit,1},unsigned,big]}, 36 | {bin_element,8, 37 | {char,8,32}, 38 | {integer,8,8}, 39 | [integer,{unit,1},unsigned,big]}, 40 | {bin_element,8, 41 | {char,8,91}, 42 | {integer,8,8}, 43 | [integer,{unit,1},unsigned,big]}, 44 | {bin_element,8, 45 | {char,8,109}, 46 | {integer,8,8}, 47 | [integer,{unit,1},unsigned,big]}, 48 | {bin_element,8, 49 | {char,8,121}, 50 | {integer,8,8}, 51 | [integer,{unit,1},unsigned,big]}, 52 | {bin_element,8, 53 | {char,8,95}, 54 | {integer,8,8}, 55 | [integer,{unit,1},unsigned,big]}, 56 | {bin_element,8, 57 | {char,8,97}, 58 | {integer,8,8}, 59 | [integer,{unit,1},unsigned,big]}, 60 | {bin_element,8, 61 | {char,8,112}, 62 | {integer,8,8}, 63 | [integer,{unit,1},unsigned,big]}, 64 | {bin_element,8, 65 | {char,8,112}, 66 | {integer,8,8}, 67 | [integer,{unit,1},unsigned,big]}, 68 | {bin_element,8, 69 | {char,8,93}, 70 | {integer,8,8}, 71 | [integer,{unit,1},unsigned,big]}]}]}]}, 72 | {function,0,module_info,0, 73 | [{clause,0,[],[], 74 | [{call,0, 75 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 76 | [{atom,0,deforestation4}]}]}]}, 77 | {function,0,module_info,1, 78 | [{clause,0, 79 | [{var,0,'X'}], 80 | [], 81 | [{call,0, 82 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 83 | [{atom,0,deforestation4},{var,0,'X'}]}]}]}]} 84 | -------------------------------------------------------------------------------- /test/asm_data/src/deforestation4.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/deforestation4.erl",1}}, 2 | {attribute,1,module,deforestation4}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,6,a,0, 5 | [{clause,6,[],[], 6 | [{call,6, 7 | {atom,6,iolist_to_binary}, 8 | [{cons,6, 9 | {string,6,"app ["}, 10 | {cons,6, 11 | {call,6,{atom,6,atom_to_list},[{atom,6,my_app}]}, 12 | {cons,6, 13 | {bin,6, 14 | [{bin_element,6, 15 | {string,6,"]"}, 16 | default,default}]}, 17 | {nil,6}}}}]}]}]}, 18 | {function,8,b,0, 19 | [{clause,8,[],[], 20 | [{bin,8, 21 | [{bin_element,8, 22 | {string,8,"app [my_app]"}, 23 | default,default}]}]}]}, 24 | {eof,9}] 25 | -------------------------------------------------------------------------------- /test/asm_data/src/deforestation4.S: -------------------------------------------------------------------------------- 1 | {deforestation4, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [], 4 | [{function,a,0,2, 5 | [{label,1}, 6 | {line,[{location,"test/asm_data/deforestation4.erl",6}]}, 7 | {func_info,{atom,deforestation4},{atom,a},0}, 8 | {label,2}, 9 | {move,{literal,["app [","my_app",<<"]">>]},{x,0}}, 10 | {line,[{location,"test/asm_data/deforestation4.erl",6}]}, 11 | {call_ext_only,1,{extfunc,erlang,iolist_to_binary,1}}]}, 12 | {function,b,0,4, 13 | [{label,3}, 14 | {line,[{location,"test/asm_data/deforestation4.erl",8}]}, 15 | {func_info,{atom,deforestation4},{atom,b},0}, 16 | {label,4}, 17 | {move,{literal,<<"app [my_app]">>},{x,0}}, 18 | return]}, 19 | {function,module_info,0,6, 20 | [{label,5}, 21 | {line,[]}, 22 | {func_info,{atom,deforestation4},{atom,module_info},0}, 23 | {label,6}, 24 | {move,{atom,deforestation4},{x,0}}, 25 | {line,[]}, 26 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 27 | {function,module_info,1,8, 28 | [{label,7}, 29 | {line,[]}, 30 | {func_info,{atom,deforestation4},{atom,module_info},1}, 31 | {label,8}, 32 | {move,{x,0},{x,1}}, 33 | {move,{atom,deforestation4},{x,0}}, 34 | {line,[]}, 35 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 36 | 9} 37 | -------------------------------------------------------------------------------- /test/asm_data/src/deforestation5.E: -------------------------------------------------------------------------------- 1 | {deforestation5, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/deforestation5.erl",1}}, 4 | {function,6,a,0, 5 | [{clause,6,[],[], 6 | [{call,6, 7 | {remote,6,{atom,6,erlang},{atom,6,atom_to_binary}}, 8 | [{atom,6,my_app},{atom,6,utf8}]}]}]}, 9 | {function,8,b,0, 10 | [{clause,8,[],[], 11 | [{bin,8, 12 | [{bin_element,8, 13 | {char,8,109}, 14 | {integer,8,8}, 15 | [integer,{unit,1},unsigned,big]}, 16 | {bin_element,8, 17 | {char,8,121}, 18 | {integer,8,8}, 19 | [integer,{unit,1},unsigned,big]}, 20 | {bin_element,8, 21 | {char,8,95}, 22 | {integer,8,8}, 23 | [integer,{unit,1},unsigned,big]}, 24 | {bin_element,8, 25 | {char,8,97}, 26 | {integer,8,8}, 27 | [integer,{unit,1},unsigned,big]}, 28 | {bin_element,8, 29 | {char,8,112}, 30 | {integer,8,8}, 31 | [integer,{unit,1},unsigned,big]}, 32 | {bin_element,8, 33 | {char,8,112}, 34 | {integer,8,8}, 35 | [integer,{unit,1},unsigned,big]}]}]}]}, 36 | {function,0,module_info,0, 37 | [{clause,0,[],[], 38 | [{call,0, 39 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 40 | [{atom,0,deforestation5}]}]}]}, 41 | {function,0,module_info,1, 42 | [{clause,0, 43 | [{var,0,'X'}], 44 | [], 45 | [{call,0, 46 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 47 | [{atom,0,deforestation5},{var,0,'X'}]}]}]}]} 48 | -------------------------------------------------------------------------------- /test/asm_data/src/deforestation5.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/deforestation5.erl",1}}, 2 | {attribute,1,module,deforestation5}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,6,a,0, 5 | [{clause,6,[],[], 6 | [{call,6, 7 | {atom,6,atom_to_binary}, 8 | [{atom,6,my_app},{atom,6,utf8}]}]}]}, 9 | {function,8,b,0, 10 | [{clause,8,[],[], 11 | [{bin,8,[{bin_element,8,{string,8,"my_app"},default,default}]}]}]}, 12 | {eof,9}] 13 | -------------------------------------------------------------------------------- /test/asm_data/src/deforestation5.S: -------------------------------------------------------------------------------- 1 | {deforestation5, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [], 4 | [{function,a,0,2, 5 | [{label,1}, 6 | {line,[{location,"test/asm_data/deforestation5.erl",6}]}, 7 | {func_info,{atom,deforestation5},{atom,a},0}, 8 | {label,2}, 9 | {move,{literal,<<"my_app">>},{x,0}}, 10 | return]}, 11 | {function,b,0,4, 12 | [{label,3}, 13 | {line,[{location,"test/asm_data/deforestation5.erl",8}]}, 14 | {func_info,{atom,deforestation5},{atom,b},0}, 15 | {label,4}, 16 | {move,{literal,<<"my_app">>},{x,0}}, 17 | return]}, 18 | {function,module_info,0,6, 19 | [{label,5}, 20 | {line,[]}, 21 | {func_info,{atom,deforestation5},{atom,module_info},0}, 22 | {label,6}, 23 | {move,{atom,deforestation5},{x,0}}, 24 | {line,[]}, 25 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 26 | {function,module_info,1,8, 27 | [{label,7}, 28 | {line,[]}, 29 | {func_info,{atom,deforestation5},{atom,module_info},1}, 30 | {label,8}, 31 | {move,{x,0},{x,1}}, 32 | {move,{atom,deforestation5},{x,0}}, 33 | {line,[]}, 34 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 35 | 9} 36 | -------------------------------------------------------------------------------- /test/asm_data/src/inline0.E: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/inline0.erl",1}}, 2 | {attribute,2,module,inline0}, 3 | {attribute,3,export,[{a,0},{b,0}]}, 4 | {function,5,a,0, 5 | [{clause,5,[],[], 6 | [{match,6, 7 | {tuple,6,[{var,6,'N'},{var,6,'_'}]}, 8 | {call,6,{atom,6,a1},[{integer,6,0}]}}, 9 | {var,7,'N'}]}]}, 10 | {function,9,a1,1, 11 | [{clause,9, 12 | [{var,9,'N'}], 13 | [], 14 | [{tuple,9,[{var,9,'N'},{var,9,'N'}]}]}]}, 15 | {function,11,b,0,[{clause,11,[],[],[{integer,11,0}]}]}, 16 | {eof,12}] 17 | -------------------------------------------------------------------------------- /test/asm_data/src/inline0.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/inline0.erl",1}}, 2 | {attribute,2,module,inline0}, 3 | {attribute,3,export,[{a,0},{b,0}]}, 4 | {function,5,a,0, 5 | [{clause,5,[],[], 6 | [{match,6, 7 | {tuple,6,[{var,6,'N'},{var,6,'_'}]}, 8 | {call,6,{atom,6,a1},[{integer,6,0}]}}, 9 | {var,7,'N'}]}]}, 10 | {function,9,a1,1, 11 | [{clause,9, 12 | [{var,9,'N'}], 13 | [], 14 | [{tuple,9,[{var,9,'N'},{var,9,'N'}]}]}]}, 15 | {function,11,b,0,[{clause,11,[],[],[{integer,11,0}]}]}, 16 | {eof,12}] 17 | -------------------------------------------------------------------------------- /test/asm_data/src/inline0.S: -------------------------------------------------------------------------------- 1 | {inline0,[{a,0},{b,0},{module_info,0},{module_info,1}], 2 | [], 3 | [{function,a,0,2, 4 | [{label,1}, 5 | {line,[{location,"test/asm_data/inline0.erl",5}]}, 6 | {func_info,{atom,inline0},{atom,a},0}, 7 | {label,2}, 8 | {allocate,0,0}, 9 | {move,{integer,0},{x,0}}, 10 | {line,[{location,"test/asm_data/inline0.erl",6}]}, 11 | {call,1,{f,5}}, 12 | {test,is_tuple,{f,3},[{x,0}]}, 13 | {test,test_arity,{f,3},[{x,0},2]}, 14 | {get_tuple_element,{x,0},0,{x,0}}, 15 | {deallocate,0}, 16 | return, 17 | {label,3}, 18 | {line,[{location,"test/asm_data/inline0.erl",6}]}, 19 | {badmatch,{x,0}}]}, 20 | {function,a1,1,5, 21 | [{label,4}, 22 | {line,[{location,"test/asm_data/inline0.erl",9}]}, 23 | {func_info,{atom,inline0},{atom,a1},1}, 24 | {label,5}, 25 | {test_heap,3,1}, 26 | {put_tuple,2,{x,1}}, 27 | {put,{x,0}}, 28 | {put,{x,0}}, 29 | {move,{x,1},{x,0}}, 30 | return]}, 31 | {function,b,0,7, 32 | [{label,6}, 33 | {line,[{location,"test/asm_data/inline0.erl",11}]}, 34 | {func_info,{atom,inline0},{atom,b},0}, 35 | {label,7}, 36 | {move,{integer,0},{x,0}}, 37 | return]}, 38 | {function,module_info,0,9, 39 | [{label,8}, 40 | {line,[]}, 41 | {func_info,{atom,inline0},{atom,module_info},0}, 42 | {label,9}, 43 | {move,{atom,inline0},{x,0}}, 44 | {line,[]}, 45 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 46 | {function,module_info,1,11, 47 | [{label,10}, 48 | {line,[]}, 49 | {func_info,{atom,inline0},{atom,module_info},1}, 50 | {label,11}, 51 | {move,{x,0},{x,1}}, 52 | {move,{atom,inline0},{x,0}}, 53 | {line,[]}, 54 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 55 | 12} 56 | -------------------------------------------------------------------------------- /test/asm_data/src/map1.E: -------------------------------------------------------------------------------- 1 | {map1, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/map1.erl",1}}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{match,5, 7 | {var,5,'M'}, 8 | {map,5,[{map_field_assoc,5,{atom,5,a},{integer,5,1}}]}}, 9 | {map,6, 10 | {var,6,'M'}, 11 | [{map_field_assoc,6,{atom,6,a},{integer,6,42}}, 12 | {map_field_assoc,6,{atom,6,b},{integer,6,1}}]}]}]}, 13 | {function,8,b,0, 14 | [{clause,8,[],[], 15 | [{map,8, 16 | [{map_field_assoc,8,{atom,8,a},{integer,8,42}}, 17 | {map_field_assoc,8,{atom,8,b},{integer,8,1}}]}]}]}, 18 | {function,0,module_info,0, 19 | [{clause,0,[],[], 20 | [{call,0, 21 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 22 | [{atom,0,map1}]}]}]}, 23 | {function,0,module_info,1, 24 | [{clause,0, 25 | [{var,0,'X'}], 26 | [], 27 | [{call,0, 28 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 29 | [{atom,0,map1},{var,0,'X'}]}]}]}]} 30 | -------------------------------------------------------------------------------- /test/asm_data/src/map1.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/map1.erl",1}}, 2 | {attribute,1,module,map1}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{match,5, 7 | {var,5,'M'}, 8 | {map,5,[{map_field_assoc,5,{atom,5,a},{integer,5,1}}]}}, 9 | {map,6, 10 | {var,6,'M'}, 11 | [{map_field_assoc,6,{atom,6,a},{integer,6,42}}, 12 | {map_field_assoc,6,{atom,6,b},{integer,6,1}}]}]}]}, 13 | {function,8,b,0, 14 | [{clause,8,[],[], 15 | [{map,8, 16 | [{map_field_assoc,8,{atom,8,a},{integer,8,42}}, 17 | {map_field_assoc,8,{atom,8,b},{integer,8,1}}]}]}]}, 18 | {eof,9}] 19 | -------------------------------------------------------------------------------- /test/asm_data/src/map1.S: -------------------------------------------------------------------------------- 1 | {map1,[{a,0},{b,0},{module_info,0},{module_info,1}], 2 | [], 3 | [{function,a,0,2, 4 | [{label,1}, 5 | {line,[{location,"test/asm_data/map1.erl",4}]}, 6 | {func_info,{atom,map1},{atom,a},0}, 7 | {label,2}, 8 | {move,{literal,#{a => 42,b => 1}},{x,0}}, 9 | return]}, 10 | {function,b,0,4, 11 | [{label,3}, 12 | {line,[{location,"test/asm_data/map1.erl",8}]}, 13 | {func_info,{atom,map1},{atom,b},0}, 14 | {label,4}, 15 | {move,{literal,#{a => 42,b => 1}},{x,0}}, 16 | return]}, 17 | {function,module_info,0,6, 18 | [{label,5}, 19 | {line,[]}, 20 | {func_info,{atom,map1},{atom,module_info},0}, 21 | {label,6}, 22 | {move,{atom,map1},{x,0}}, 23 | {line,[]}, 24 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 25 | {function,module_info,1,8, 26 | [{label,7}, 27 | {line,[]}, 28 | {func_info,{atom,map1},{atom,module_info},1}, 29 | {label,8}, 30 | {move,{x,0},{x,1}}, 31 | {move,{atom,map1},{x,0}}, 32 | {line,[]}, 33 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 34 | 9} 35 | -------------------------------------------------------------------------------- /test/asm_data/src/map2.E: -------------------------------------------------------------------------------- 1 | {map2, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/map2.erl",1}}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{match,5, 7 | {var,5,'M'}, 8 | {call,5, 9 | {'fun',5, 10 | {clauses, 11 | [{clause,5,[],[], 12 | [{map,5,[{map_field_assoc,5,{atom,5,a},{integer,5,1}}]}]}]}, 13 | {0,0,'-a/0-fun-0-'}}, 14 | []}}, 15 | {map,6, 16 | {var,6,'M'}, 17 | [{map_field_assoc,6,{atom,6,a},{integer,6,42}}, 18 | {map_field_assoc,6,{atom,6,b},{integer,6,1}}]}]}]}, 19 | {function,8,b,0, 20 | [{clause,8,[],[], 21 | [{map,8, 22 | [{map_field_assoc,8,{atom,8,a},{integer,8,42}}, 23 | {map_field_assoc,8,{atom,8,b},{integer,8,1}}]}]}]}, 24 | {function,0,module_info,0, 25 | [{clause,0,[],[], 26 | [{call,0, 27 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 28 | [{atom,0,map2}]}]}]}, 29 | {function,0,module_info,1, 30 | [{clause,0, 31 | [{var,0,'X'}], 32 | [], 33 | [{call,0, 34 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 35 | [{atom,0,map2},{var,0,'X'}]}]}]}]} 36 | -------------------------------------------------------------------------------- /test/asm_data/src/map2.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/map2.erl",1}}, 2 | {attribute,1,module,map2}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{match,5, 7 | {var,5,'M'}, 8 | {call,5, 9 | {'fun',5, 10 | {clauses, 11 | [{clause,5,[],[], 12 | [{map,5,[{map_field_assoc,5,{atom,5,a},{integer,5,1}}]}]}]}}, 13 | []}}, 14 | {map,6, 15 | {var,6,'M'}, 16 | [{map_field_assoc,6,{atom,6,a},{integer,6,42}}, 17 | {map_field_assoc,6,{atom,6,b},{integer,6,1}}]}]}]}, 18 | {function,8,b,0, 19 | [{clause,8,[],[], 20 | [{map,8, 21 | [{map_field_assoc,8,{atom,8,a},{integer,8,42}}, 22 | {map_field_assoc,8,{atom,8,b},{integer,8,1}}]}]}]}, 23 | {eof,9}] 24 | -------------------------------------------------------------------------------- /test/asm_data/src/map2.S: -------------------------------------------------------------------------------- 1 | {map2, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [], 4 | [{function,a,0,2, 5 | [{label,1}, 6 | {line,[{location,"test/asm_data/map2.erl",4}]}, 7 | {func_info,{atom,map2},{atom,a},0}, 8 | {label,2}, 9 | {allocate,0,0}, 10 | {make_fun2,{f,11},0,0,0}, 11 | {line,[{location,"test/asm_data/map2.erl",5}]}, 12 | {call_fun,0}, 13 | {test,is_map,{f,3},[{x,0}]}, 14 | {line,[{location,"test/asm_data/map2.erl",6}]}, 15 | {put_map_assoc, 16 | {f,0}, 17 | {x,0}, 18 | {x,0}, 19 | 1, 20 | {list,[{atom,a},{integer,42},{atom,b},{integer,1}]}}, 21 | {deallocate,0}, 22 | return, 23 | {label,3}, 24 | {test_heap,3,1}, 25 | {put_tuple,2,{x,1}}, 26 | {put,{atom,badmap}}, 27 | {put,{x,0}}, 28 | {move,{x,1},{x,0}}, 29 | {line,[{location,"test/asm_data/map2.erl",6}]}, 30 | {call_ext,1,{extfunc,erlang,error,1}}]}, 31 | {function,b,0,5, 32 | [{label,4}, 33 | {line,[{location,"test/asm_data/map2.erl",8}]}, 34 | {func_info,{atom,map2},{atom,b},0}, 35 | {label,5}, 36 | {move,{literal,#{a => 42,b => 1}},{x,0}}, 37 | return]}, 38 | {function,module_info,0,7, 39 | [{label,6}, 40 | {line,[]}, 41 | {func_info,{atom,map2},{atom,module_info},0}, 42 | {label,7}, 43 | {move,{atom,map2},{x,0}}, 44 | {line,[]}, 45 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 46 | {function,module_info,1,9, 47 | [{label,8}, 48 | {line,[]}, 49 | {func_info,{atom,map2},{atom,module_info},1}, 50 | {label,9}, 51 | {move,{x,0},{x,1}}, 52 | {move,{atom,map2},{x,0}}, 53 | {line,[]}, 54 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}, 55 | {function,'-a/0-fun-0-',0,11, 56 | [{label,10}, 57 | {line,[{location,"test/asm_data/map2.erl",5}]}, 58 | {func_info,{atom,map2},{atom,'-a/0-fun-0-'},0}, 59 | {label,11}, 60 | {move,{literal,#{a => 1}},{x,0}}, 61 | return]}], 62 | 12} 63 | -------------------------------------------------------------------------------- /test/asm_data/src/map3.E: -------------------------------------------------------------------------------- 1 | {map3, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/map3.erl",1}}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{match,5,{var,5,'Y'},{atom,5,b}}, 7 | {match,6, 8 | {var,6,'M'}, 9 | {call,6, 10 | {'fun',6, 11 | {clauses, 12 | [{clause,6, 13 | [{var,6,'X'}], 14 | [], 15 | [{map,6,[{map_field_assoc,6,{atom,6,a},{var,6,'X'}}]}]}]}, 16 | {0,0,'-a/0-fun-0-'}}, 17 | [{var,6,'Y'}]}}, 18 | {map,7, 19 | {var,7,'M'}, 20 | [{map_field_assoc,7,{atom,7,a},{integer,7,42}}, 21 | {map_field_assoc,7,{var,7,'Y'},{integer,7,1}}]}]}]}, 22 | {function,9,b,0, 23 | [{clause,9,[],[], 24 | [{map,9, 25 | [{map_field_assoc,9,{atom,9,a},{integer,9,42}}, 26 | {map_field_assoc,9,{atom,9,b},{integer,9,1}}]}]}]}, 27 | {function,0,module_info,0, 28 | [{clause,0,[],[], 29 | [{call,0, 30 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 31 | [{atom,0,map3}]}]}]}, 32 | {function,0,module_info,1, 33 | [{clause,0, 34 | [{var,0,'X'}], 35 | [], 36 | [{call,0, 37 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 38 | [{atom,0,map3},{var,0,'X'}]}]}]}]} 39 | -------------------------------------------------------------------------------- /test/asm_data/src/map3.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/map3.erl",1}}, 2 | {attribute,1,module,map3}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{match,5,{var,5,'Y'},{atom,5,b}}, 7 | {match,6, 8 | {var,6,'M'}, 9 | {call,6, 10 | {'fun',6, 11 | {clauses, 12 | [{clause,6, 13 | [{var,6,'X'}], 14 | [], 15 | [{map,6,[{map_field_assoc,6,{atom,6,a},{var,6,'X'}}]}]}]}}, 16 | [{var,6,'Y'}]}}, 17 | {map,7, 18 | {var,7,'M'}, 19 | [{map_field_assoc,7,{atom,7,a},{integer,7,42}}, 20 | {map_field_assoc,7,{var,7,'Y'},{integer,7,1}}]}]}]}, 21 | {function,9,b,0, 22 | [{clause,9,[],[], 23 | [{map,9, 24 | [{map_field_assoc,9,{atom,9,a},{integer,9,42}}, 25 | {map_field_assoc,9,{atom,9,b},{integer,9,1}}]}]}]}, 26 | {eof,10}] 27 | -------------------------------------------------------------------------------- /test/asm_data/src/map3.S: -------------------------------------------------------------------------------- 1 | {map3, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [], 4 | [{function,a,0,2, 5 | [{label,1}, 6 | {line,[{location,"test/asm_data/map3.erl",4}]}, 7 | {func_info,{atom,map3},{atom,a},0}, 8 | {label,2}, 9 | {allocate,0,0}, 10 | {make_fun2,{f,11},0,0,0}, 11 | {move,{x,0},{x,1}}, 12 | {move,{atom,b},{x,0}}, 13 | {line,[{location,"test/asm_data/map3.erl",6}]}, 14 | {call_fun,1}, 15 | {test,is_map,{f,3},[{x,0}]}, 16 | {line,[{location,"test/asm_data/map3.erl",7}]}, 17 | {put_map_assoc, 18 | {f,0}, 19 | {x,0}, 20 | {x,0}, 21 | 1, 22 | {list,[{atom,a},{integer,42},{atom,b},{integer,1}]}}, 23 | {deallocate,0}, 24 | return, 25 | {label,3}, 26 | {test_heap,3,1}, 27 | {put_tuple,2,{x,1}}, 28 | {put,{atom,badmap}}, 29 | {put,{x,0}}, 30 | {move,{x,1},{x,0}}, 31 | {line,[{location,"test/asm_data/map3.erl",7}]}, 32 | {call_ext,1,{extfunc,erlang,error,1}}]}, 33 | {function,b,0,5, 34 | [{label,4}, 35 | {line,[{location,"test/asm_data/map3.erl",9}]}, 36 | {func_info,{atom,map3},{atom,b},0}, 37 | {label,5}, 38 | {move,{literal,#{a => 42,b => 1}},{x,0}}, 39 | return]}, 40 | {function,module_info,0,7, 41 | [{label,6}, 42 | {line,[]}, 43 | {func_info,{atom,map3},{atom,module_info},0}, 44 | {label,7}, 45 | {move,{atom,map3},{x,0}}, 46 | {line,[]}, 47 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 48 | {function,module_info,1,9, 49 | [{label,8}, 50 | {line,[]}, 51 | {func_info,{atom,map3},{atom,module_info},1}, 52 | {label,9}, 53 | {move,{x,0},{x,1}}, 54 | {move,{atom,map3},{x,0}}, 55 | {line,[]}, 56 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}, 57 | {function,'-a/0-fun-0-',1,11, 58 | [{label,10}, 59 | {line,[{location,"test/asm_data/map3.erl",6}]}, 60 | {func_info,{atom,map3},{atom,'-a/0-fun-0-'},1}, 61 | {label,11}, 62 | {line,[{location,"test/asm_data/map3.erl",6}]}, 63 | {put_map_assoc,{f,0},{literal,#{}},{x,0},1,{list,[{atom,a},{x,0}]}}, 64 | return]}], 65 | 12} 66 | -------------------------------------------------------------------------------- /test/asm_data/src/map4.E: -------------------------------------------------------------------------------- 1 | {map4, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/map4.erl",1}}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{match,5, 7 | {map,5,[{map_field_exact,5,{atom,5,key},{var,5,'Y'}}]}, 8 | {map,5,[{map_field_assoc,5,{atom,5,key},{atom,5,b}}]}}, 9 | {match,6, 10 | {var,6,'M'}, 11 | {call,6, 12 | {'fun',6, 13 | {clauses, 14 | [{clause,6, 15 | [{var,6,'X'}], 16 | [], 17 | [{map,6,[{map_field_assoc,6,{atom,6,a},{var,6,'X'}}]}]}]}, 18 | {0,0,'-a/0-fun-0-'}}, 19 | [{var,6,'Y'}]}}, 20 | {map,7, 21 | {var,7,'M'}, 22 | [{map_field_assoc,7,{atom,7,a},{integer,7,42}}, 23 | {map_field_assoc,7,{var,7,'Y'},{integer,7,1}}]}]}]}, 24 | {function,9,b,0, 25 | [{clause,9,[],[], 26 | [{map,9, 27 | [{map_field_assoc,9,{atom,9,a},{integer,9,42}}, 28 | {map_field_assoc,9,{atom,9,b},{integer,9,1}}]}]}]}, 29 | {function,0,module_info,0, 30 | [{clause,0,[],[], 31 | [{call,0, 32 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 33 | [{atom,0,map4}]}]}]}, 34 | {function,0,module_info,1, 35 | [{clause,0, 36 | [{var,0,'X'}], 37 | [], 38 | [{call,0, 39 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 40 | [{atom,0,map4},{var,0,'X'}]}]}]}]} 41 | -------------------------------------------------------------------------------- /test/asm_data/src/map4.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/map4.erl",1}}, 2 | {attribute,1,module,map4}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{match,5, 7 | {map,5,[{map_field_exact,5,{atom,5,key},{var,5,'Y'}}]}, 8 | {map,5,[{map_field_assoc,5,{atom,5,key},{atom,5,b}}]}}, 9 | {match,6, 10 | {var,6,'M'}, 11 | {call,6, 12 | {'fun',6, 13 | {clauses, 14 | [{clause,6, 15 | [{var,6,'X'}], 16 | [], 17 | [{map,6,[{map_field_assoc,6,{atom,6,a},{var,6,'X'}}]}]}]}}, 18 | [{var,6,'Y'}]}}, 19 | {map,7, 20 | {var,7,'M'}, 21 | [{map_field_assoc,7,{atom,7,a},{integer,7,42}}, 22 | {map_field_assoc,7,{var,7,'Y'},{integer,7,1}}]}]}]}, 23 | {function,9,b,0, 24 | [{clause,9,[],[], 25 | [{map,9, 26 | [{map_field_assoc,9,{atom,9,a},{integer,9,42}}, 27 | {map_field_assoc,9,{atom,9,b},{integer,9,1}}]}]}]}, 28 | {eof,10}] 29 | -------------------------------------------------------------------------------- /test/asm_data/src/try0.E: -------------------------------------------------------------------------------- 1 | {try0, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/try0.erl",1}}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{match,5, 7 | {integer,5,42}, 8 | {op,5,'!', 9 | {call,5,{remote,5,{atom,5,erlang},{atom,5,self}},[]}, 10 | {integer,5,42}}}, 11 | {'receive',6, 12 | [{clause,7, 13 | [{bin,7, 14 | [{bin_element,7, 15 | {char,7,116}, 16 | {integer,7,8}, 17 | [integer,{unit,1},unsigned,big]}, 18 | {bin_element,7, 19 | {char,7,104}, 20 | {integer,7,8}, 21 | [integer,{unit,1},unsigned,big]}, 22 | {bin_element,7, 23 | {char,7,105}, 24 | {integer,7,8}, 25 | [integer,{unit,1},unsigned,big]}, 26 | {bin_element,7, 27 | {char,7,115}, 28 | {integer,7,8}, 29 | [integer,{unit,1},unsigned,big]}]}], 30 | [], 31 | [{atom,7,that}]}, 32 | {clause,8, 33 | [{integer,8,42}], 34 | [], 35 | [{call,8, 36 | {remote,8,{atom,8,erlang},{atom,8,length}}, 37 | [{call,8, 38 | {remote,8,{atom,8,lists},{atom,8,seq}}, 39 | [{integer,8,1},{integer,8,5}]}]}]}], 40 | {integer,9,0}, 41 | [{call,10, 42 | {remote,10,{atom,10,erlang},{atom,10,throw}}, 43 | [{atom,10,argh}]}]}]}]}, 44 | {function,13,b,0,[{clause,13,[],[],[{integer,14,5}]}]}, 45 | {function,0,module_info,0, 46 | [{clause,0,[],[], 47 | [{call,0, 48 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 49 | [{atom,0,try0}]}]}]}, 50 | {function,0,module_info,1, 51 | [{clause,0, 52 | [{var,0,'X'}], 53 | [], 54 | [{call,0, 55 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 56 | [{atom,0,try0},{var,0,'X'}]}]}]}]} 57 | -------------------------------------------------------------------------------- /test/asm_data/src/try0.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/try0.erl",1}}, 2 | {attribute,1,module,try0}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{match,5, 7 | {integer,5,42}, 8 | {op,5,'!',{call,5,{atom,5,self},[]},{integer,5,42}}}, 9 | {'receive',6, 10 | [{clause,7, 11 | [{bin,7, 12 | [{bin_element,7,{string,7,"this"},default,default}]}], 13 | [], 14 | [{atom,7,that}]}, 15 | {clause,8, 16 | [{integer,8,42}], 17 | [], 18 | [{call,8, 19 | {atom,8,length}, 20 | [{call,8, 21 | {remote,8,{atom,8,lists},{atom,8,seq}}, 22 | [{integer,8,1},{integer,8,5}]}]}]}], 23 | {integer,9,0}, 24 | [{call,10,{atom,10,throw},[{atom,10,argh}]}]}]}]}, 25 | {function,13,b,0,[{clause,13,[],[],[{integer,14,5}]}]}, 26 | {eof,15}] 27 | -------------------------------------------------------------------------------- /test/asm_data/src/try0.S: -------------------------------------------------------------------------------- 1 | {try0,[{a,0},{b,0},{module_info,0},{module_info,1}], 2 | [], 3 | [{function,a,0,2, 4 | [{label,1}, 5 | {line,[{location,"test/asm_data/try0.erl",4}]}, 6 | {func_info,{atom,try0},{atom,a},0}, 7 | {label,2}, 8 | {allocate,0,0}, 9 | {bif,self,{f,0},[],{x,0}}, 10 | {move,{integer,42},{x,1}}, 11 | {line,[{location,"test/asm_data/try0.erl",5}]}, 12 | send, 13 | {test,is_eq_exact,{f,7},[{x,0},{integer,42}]}, 14 | {line,[{location,"test/asm_data/try0.erl",6}]}, 15 | {label,3}, 16 | {loop_rec,{f,6},{x,0}}, 17 | {test,bs_start_match2,{f,4},1,[{x,0},0],{x,1}}, 18 | {test,bs_match_string,{f,5},[{x,1},32,{string,"this"}]}, 19 | {test,bs_test_tail2,{f,5},[{x,1},0]}, 20 | remove_message, 21 | {move,{atom,that},{x,0}}, 22 | {deallocate,0}, 23 | return, 24 | {label,4}, 25 | {test,is_eq_exact,{f,5},[{x,0},{integer,42}]}, 26 | remove_message, 27 | {move,{integer,5},{x,1}}, 28 | {move,{integer,1},{x,0}}, 29 | {line,[{location,"test/asm_data/try0.erl",8}]}, 30 | {call_ext,2,{extfunc,lists,seq,2}}, 31 | {line,[{location,"test/asm_data/try0.erl",8}]}, 32 | {gc_bif,length,{f,0},1,[{x,0}],{x,0}}, 33 | {deallocate,0}, 34 | return, 35 | {label,5}, 36 | {loop_rec_end,{f,3}}, 37 | {label,6}, 38 | timeout, 39 | {move,{atom,argh},{x,0}}, 40 | {line,[{location,"test/asm_data/try0.erl",10}]}, 41 | {call_ext,1,{extfunc,erlang,throw,1}}, 42 | {label,7}, 43 | {line,[{location,"test/asm_data/try0.erl",5}]}, 44 | {badmatch,{x,0}}]}, 45 | {function,b,0,9, 46 | [{label,8}, 47 | {line,[{location,"test/asm_data/try0.erl",13}]}, 48 | {func_info,{atom,try0},{atom,b},0}, 49 | {label,9}, 50 | {move,{integer,5},{x,0}}, 51 | return]}, 52 | {function,module_info,0,11, 53 | [{label,10}, 54 | {line,[]}, 55 | {func_info,{atom,try0},{atom,module_info},0}, 56 | {label,11}, 57 | {move,{atom,try0},{x,0}}, 58 | {line,[]}, 59 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 60 | {function,module_info,1,13, 61 | [{label,12}, 62 | {line,[]}, 63 | {func_info,{atom,try0},{atom,module_info},1}, 64 | {label,13}, 65 | {move,{x,0},{x,1}}, 66 | {move,{atom,try0},{x,0}}, 67 | {line,[]}, 68 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 69 | 14} 70 | -------------------------------------------------------------------------------- /test/asm_data/src/try1.E: -------------------------------------------------------------------------------- 1 | {try1, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/try1.erl",1}}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{'try',5, 7 | [{call,5,{remote,5,{atom,5,erlang},{atom,5,get}},[]}], 8 | [{clause,6, 9 | [{match,6, 10 | {cons,6,{var,6,'_'},{var,6,'_'}}, 11 | {var,6,'PD'}}], 12 | [], 13 | [{var,6,'PD'}]}, 14 | {clause,7,[{nil,7}],[],[{nil,7}]}], 15 | [{clause,9, 16 | [{tuple,9,[{var,9,'_'},{var,9,'_'},{var,9,'_'}]}], 17 | [], 18 | [{atom,9,impossible}]}], 19 | []}]}]}, 20 | {function,12,b,0, 21 | [{clause,12,[],[], 22 | [{call,13,{remote,13,{atom,13,erlang},{atom,13,get}},[]}]}]}, 23 | {function,0,module_info,0, 24 | [{clause,0,[],[], 25 | [{call,0, 26 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 27 | [{atom,0,try1}]}]}]}, 28 | {function,0,module_info,1, 29 | [{clause,0, 30 | [{var,0,'X'}], 31 | [], 32 | [{call,0, 33 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 34 | [{atom,0,try1},{var,0,'X'}]}]}]}]} 35 | -------------------------------------------------------------------------------- /test/asm_data/src/try1.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/try1.erl",1}}, 2 | {attribute,1,module,try1}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{'try',5, 7 | [{call,5,{atom,5,get},[]}], 8 | [{clause,6, 9 | [{match,6,{cons,6,{var,6,'_'},{var,6,'_'}},{var,6,'PD'}}], 10 | [], 11 | [{var,6,'PD'}]}, 12 | {clause,7,[{nil,7}],[],[{nil,7}]}], 13 | [{clause,9, 14 | [{tuple,9,[{var,9,'_'},{var,9,'_'},{var,9,'_'}]}], 15 | [], 16 | [{atom,9,impossible}]}], 17 | []}]}]}, 18 | {function,12,b,0,[{clause,12,[],[],[{call,13,{atom,13,get},[]}]}]}, 19 | {eof,14}] 20 | -------------------------------------------------------------------------------- /test/asm_data/src/try1.S: -------------------------------------------------------------------------------- 1 | {try1,[{a,0},{b,0},{module_info,0},{module_info,1}], 2 | [], 3 | [{function,a,0,2, 4 | [{label,1}, 5 | {line,[{location,"test/asm_data/try1.erl",4}]}, 6 | {func_info,{atom,try1},{atom,a},0}, 7 | {label,2}, 8 | {allocate,1,0}, 9 | {'try',{y,0},{f,4}}, 10 | {line,[{location,"test/asm_data/try1.erl",5}]}, 11 | {call_ext,0,{extfunc,erlang,get,0}}, 12 | {try_end,{y,0}}, 13 | {test,is_nonempty_list,{f,3},[{x,0}]}, 14 | {deallocate,1}, 15 | return, 16 | {label,3}, 17 | {test,is_nil,{f,5},[{x,0}]}, 18 | {deallocate,1}, 19 | return, 20 | {label,4}, 21 | {try_case,{y,0}}, 22 | {move,{atom,impossible},{x,0}}, 23 | {deallocate,1}, 24 | return, 25 | {label,5}, 26 | {line,[{location,"test/asm_data/try1.erl",5}]}, 27 | {try_case_end,{x,0}}]}, 28 | {function,b,0,7, 29 | [{label,6}, 30 | {line,[{location,"test/asm_data/try1.erl",12}]}, 31 | {func_info,{atom,try1},{atom,b},0}, 32 | {label,7}, 33 | {call_ext_only,0,{extfunc,erlang,get,0}}]}, 34 | {function,module_info,0,9, 35 | [{label,8}, 36 | {line,[]}, 37 | {func_info,{atom,try1},{atom,module_info},0}, 38 | {label,9}, 39 | {move,{atom,try1},{x,0}}, 40 | {line,[]}, 41 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 42 | {function,module_info,1,11, 43 | [{label,10}, 44 | {line,[]}, 45 | {func_info,{atom,try1},{atom,module_info},1}, 46 | {label,11}, 47 | {move,{x,0},{x,1}}, 48 | {move,{atom,try1},{x,0}}, 49 | {line,[]}, 50 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 51 | 12} 52 | -------------------------------------------------------------------------------- /test/asm_data/src/try2.E: -------------------------------------------------------------------------------- 1 | {try2, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/try2.erl",1}}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{'try',5, 7 | [{call,5,{remote,5,{atom,5,erlang},{atom,5,get}},[]}], 8 | [{clause,6, 9 | [{bin,6, 10 | [{bin_element,6, 11 | {char,6,97}, 12 | {integer,6,8}, 13 | [integer,{unit,1},unsigned,big]}, 14 | {bin_element,6, 15 | {char,6,98}, 16 | {integer,6,8}, 17 | [integer,{unit,1},unsigned,big]}, 18 | {bin_element,6, 19 | {char,6,99}, 20 | {integer,6,8}, 21 | [integer,{unit,1},unsigned,big]}]}], 22 | [], 23 | [{bin,6, 24 | [{bin_element,6, 25 | {char,6,100}, 26 | {integer,6,8}, 27 | [integer,{unit,1},unsigned,big]}, 28 | {bin_element,6, 29 | {char,6,101}, 30 | {integer,6,8}, 31 | [integer,{unit,1},unsigned,big]}, 32 | {bin_element,6, 33 | {char,6,102}, 34 | {integer,6,8}, 35 | [integer,{unit,1},unsigned,big]}]}]}, 36 | {clause,7, 37 | [{match,7, 38 | {bin,7, 39 | [{bin_element,7, 40 | {char,7,960}, 41 | {atom,7,undefined}, 42 | [utf8,{unit,undefined},unsigned,big]}]}, 43 | {var,7,'_Pi'}}], 44 | [], 45 | [{float,7,3.14}]}, 46 | {clause,8, 47 | [{var,8,'PD'}], 48 | [[{call,8, 49 | {remote,8,{atom,8,erlang},{atom,8,is_list}}, 50 | [{var,8,'PD'}]}]], 51 | [{var,8,'PD'}]}], 52 | [{clause,10, 53 | [{tuple,10,[{var,10,'_'},{var,10,'_'},{var,10,'_'}]}], 54 | [], 55 | [{atom,10,impossible}]}], 56 | []}]}]}, 57 | {function,13,b,0, 58 | [{clause,13,[],[], 59 | [{call,14,{remote,14,{atom,14,erlang},{atom,14,get}},[]}]}]}, 60 | {function,0,module_info,0, 61 | [{clause,0,[],[], 62 | [{call,0, 63 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 64 | [{atom,0,try2}]}]}]}, 65 | {function,0,module_info,1, 66 | [{clause,0, 67 | [{var,0,'X'}], 68 | [], 69 | [{call,0, 70 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 71 | [{atom,0,try2},{var,0,'X'}]}]}]}]} 72 | -------------------------------------------------------------------------------- /test/asm_data/src/try2.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/try2.erl",1}}, 2 | {attribute,1,module,try2}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{'try',5, 7 | [{call,5,{atom,5,get},[]}], 8 | [{clause,6, 9 | [{bin,6, 10 | [{bin_element,6,{string,6,"abc"},default,default}]}], 11 | [], 12 | [{bin,6, 13 | [{bin_element,6,{string,6,"def"},default,default}]}]}, 14 | {clause,7, 15 | [{match,7, 16 | {bin,7, 17 | [{bin_element,7, 18 | {string,7,[960]}, 19 | default, 20 | [utf8]}]}, 21 | {var,7,'_Pi'}}], 22 | [], 23 | [{float,7,3.14}]}, 24 | {clause,8, 25 | [{var,8,'PD'}], 26 | [[{call,8,{atom,8,is_list},[{var,8,'PD'}]}]], 27 | [{var,8,'PD'}]}], 28 | [{clause,10, 29 | [{tuple,10,[{var,10,'_'},{var,10,'_'},{var,10,'_'}]}], 30 | [], 31 | [{atom,10,impossible}]}], 32 | []}]}]}, 33 | {function,13,b,0,[{clause,13,[],[],[{call,14,{atom,14,get},[]}]}]}, 34 | {eof,15}] 35 | -------------------------------------------------------------------------------- /test/asm_data/src/try2.S: -------------------------------------------------------------------------------- 1 | {try2, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [], 4 | [{function,a,0,2, 5 | [{label,1}, 6 | {line,[{location,"test/asm_data/try2.erl",4}]}, 7 | {func_info,{atom,try2},{atom,a},0}, 8 | {label,2}, 9 | {allocate,1,0}, 10 | {'try',{y,0},{f,6}}, 11 | {line,[{location,"test/asm_data/try2.erl",5}]}, 12 | {call_ext,0,{extfunc,erlang,get,0}}, 13 | {try_end,{y,0}}, 14 | {test,bs_start_match2,{f,5},1,[{x,0},0],{x,1}}, 15 | {test,bs_get_integer2, 16 | {f,4}, 17 | 2, 18 | [{x,1}, 19 | {integer,8}, 20 | 1, 21 | {field_flags, 22 | [{anno,[6,{file,"test/asm_data/try2.erl"}]},unsigned,big]}], 23 | {x,2}}, 24 | {test,is_eq_exact,{f,3},[{x,2},{integer,97}]}, 25 | {test,bs_match_string,{f,3},[{x,1},16,{string,"bc"}]}, 26 | {test,bs_test_tail2,{f,3},[{x,1},0]}, 27 | {move,{literal,<<"def">>},{x,0}}, 28 | {deallocate,1}, 29 | return, 30 | {label,3}, 31 | {bs_restore2,{x,1},{atom,start}}, 32 | {label,4}, 33 | {test,bs_get_utf8, 34 | {f,5}, 35 | 2, 36 | [{x,1}, 37 | {field_flags, 38 | [{anno,[7,{file,"test/asm_data/try2.erl"}]},unsigned,big]}], 39 | {x,2}}, 40 | {test,is_eq_exact,{f,5},[{x,2},{integer,960}]}, 41 | {test,bs_test_tail2,{f,5},[{x,1},0]}, 42 | {move,{float,3.14},{x,0}}, 43 | {deallocate,1}, 44 | return, 45 | {label,5}, 46 | {test,is_list,{f,7},[{x,0}]}, 47 | {deallocate,1}, 48 | return, 49 | {label,6}, 50 | {try_case,{y,0}}, 51 | {move,{atom,impossible},{x,0}}, 52 | {deallocate,1}, 53 | return, 54 | {label,7}, 55 | {line,[{location,"test/asm_data/try2.erl",5}]}, 56 | {try_case_end,{x,0}}]}, 57 | {function,b,0,9, 58 | [{label,8}, 59 | {line,[{location,"test/asm_data/try2.erl",13}]}, 60 | {func_info,{atom,try2},{atom,b},0}, 61 | {label,9}, 62 | {call_ext_only,0,{extfunc,erlang,get,0}}]}, 63 | {function,module_info,0,11, 64 | [{label,10}, 65 | {line,[]}, 66 | {func_info,{atom,try2},{atom,module_info},0}, 67 | {label,11}, 68 | {move,{atom,try2},{x,0}}, 69 | {line,[]}, 70 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 71 | {function,module_info,1,13, 72 | [{label,12}, 73 | {line,[]}, 74 | {func_info,{atom,try2},{atom,module_info},1}, 75 | {label,13}, 76 | {move,{x,0},{x,1}}, 77 | {move,{atom,try2},{x,0}}, 78 | {line,[]}, 79 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 80 | 14} 81 | -------------------------------------------------------------------------------- /test/asm_data/src/try3.E: -------------------------------------------------------------------------------- 1 | {try3, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,1,file,{"test/asm_data/try3.erl",1}}, 4 | {function,4,a,0, 5 | [{clause,4,[],[], 6 | [{'catch',5, 7 | {call,5,{remote,5,{atom,5,erlang},{atom,5,get}},[]}}]}]}, 8 | {function,7,b,0, 9 | [{clause,7,[],[], 10 | [{call,8,{remote,8,{atom,8,erlang},{atom,8,get}},[]}]}]}, 11 | {function,0,module_info,0, 12 | [{clause,0,[],[], 13 | [{call,0, 14 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 15 | [{atom,0,try3}]}]}]}, 16 | {function,0,module_info,1, 17 | [{clause,0, 18 | [{var,0,'X'}], 19 | [], 20 | [{call,0, 21 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 22 | [{atom,0,try3},{var,0,'X'}]}]}]}]} 23 | -------------------------------------------------------------------------------- /test/asm_data/src/try3.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/try3.erl",1}}, 2 | {attribute,1,module,try3}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {function,4,a,0,[{clause,4,[],[],[{'catch',5,{call,5,{atom,5,get},[]}}]}]}, 5 | {function,7,b,0,[{clause,7,[],[],[{call,8,{atom,8,get},[]}]}]}, 6 | {eof,9}] 7 | -------------------------------------------------------------------------------- /test/asm_data/src/try3.S: -------------------------------------------------------------------------------- 1 | {try3,[{a,0},{b,0},{module_info,0},{module_info,1}], 2 | [], 3 | [{function,a,0,2, 4 | [{label,1}, 5 | {line,[{location,"test/asm_data/try3.erl",4}]}, 6 | {func_info,{atom,try3},{atom,a},0}, 7 | {label,2}, 8 | {allocate,1,0}, 9 | {'catch',{y,0},{f,3}}, 10 | {line,[{location,"test/asm_data/try3.erl",5}]}, 11 | {call_ext,0,{extfunc,erlang,get,0}}, 12 | {label,3}, 13 | {catch_end,{y,0}}, 14 | {deallocate,1}, 15 | return]}, 16 | {function,b,0,5, 17 | [{label,4}, 18 | {line,[{location,"test/asm_data/try3.erl",7}]}, 19 | {func_info,{atom,try3},{atom,b},0}, 20 | {label,5}, 21 | {call_ext_only,0,{extfunc,erlang,get,0}}]}, 22 | {function,module_info,0,7, 23 | [{label,6}, 24 | {line,[]}, 25 | {func_info,{atom,try3},{atom,module_info},0}, 26 | {label,7}, 27 | {move,{atom,try3},{x,0}}, 28 | {line,[]}, 29 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 30 | {function,module_info,1,9, 31 | [{label,8}, 32 | {line,[]}, 33 | {func_info,{atom,try3},{atom,module_info},1}, 34 | {label,9}, 35 | {move,{x,0},{x,1}}, 36 | {move,{atom,try3},{x,0}}, 37 | {line,[]}, 38 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 39 | 10} 40 | -------------------------------------------------------------------------------- /test/asm_data/src/unfold0.E: -------------------------------------------------------------------------------- 1 | {unfold0, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,4,record, 4 | [{r, 5 | [{record_field,4,{atom,4,'1'}}, 6 | {record_field,4,{atom,4,'2'}}, 7 | {record_field,4,{atom,4,'3'}}, 8 | {record_field,4,{atom,4,'4'}}, 9 | {record_field,4,{atom,4,'5'}}]}]}, 10 | {attribute,1,file,{"test/asm_data/unfold0.erl",1}}, 11 | {function,6,a,0, 12 | [{clause,6,[],[], 13 | [{match,7, 14 | {var,7,'Fs'}, 15 | {cons,7, 16 | {'fun',7, 17 | {clauses, 18 | [{clause,7, 19 | [{var,7,'R'}], 20 | [], 21 | [{call,7, 22 | {remote,7,{atom,7,erlang},{atom,7,setelement}}, 23 | [{op,7,'+',{integer,7,1},{integer,7,2}}, 24 | {var,7,'R'}, 25 | {string,7,"deux"}]}]}]}, 26 | {0,0,'-a/0-fun-0-'}}, 27 | {cons,8, 28 | {'fun',8, 29 | {clauses, 30 | [{clause,8, 31 | [{var,8,'R'}], 32 | [], 33 | [{call,8, 34 | {remote,8,{atom,8,erlang},{atom,8,setelement}}, 35 | [{integer,8,4},{var,8,'R'},{string,8,"trois"}]}]}]}, 36 | {0,0,'-a/0-fun-1-'}}, 37 | {cons,9, 38 | {'fun',9, 39 | {clauses, 40 | [{clause,9, 41 | [{var,9,'R'}], 42 | [], 43 | [{call,9, 44 | {remote,9,{atom,9,erlang},{atom,9,setelement}}, 45 | [{op,9,'+',{integer,9,1},{integer,9,5}}, 46 | {var,9,'R'}, 47 | {string,9,"cinq"}]}]}]}, 48 | {0,0,'-a/0-fun-2-'}}, 49 | {cons,10, 50 | {'fun',10, 51 | {clauses, 52 | [{clause,10, 53 | [{var,10,'R'}], 54 | [], 55 | [{call,10, 56 | {remote,10,{atom,10,erlang},{atom,10,setelement}}, 57 | [{op,10,'+',{integer,10,1},{integer,10,2}}, 58 | {var,10,'R'}, 59 | {string,10,"DEUX"}]}]}]}, 60 | {0,0,'-a/0-fun-3-'}}, 61 | {nil,11}}}}}}, 62 | {call,12, 63 | {remote,12,{atom,12,lists},{atom,12,foldl}}, 64 | [{'fun',12, 65 | {clauses, 66 | [{clause,12, 67 | [{var,12,'F'},{var,12,'R'}], 68 | [], 69 | [{call,12,{var,12,'F'},[{var,12,'R'}]}]}]}, 70 | {0,0,'-a/0-fun-4-'}}, 71 | {tuple,12, 72 | [{atom,12,r}, 73 | {atom,4,undefined}, 74 | {atom,4,undefined}, 75 | {atom,4,undefined}, 76 | {atom,4,undefined}, 77 | {atom,4,undefined}]}, 78 | {var,12,'Fs'}]}]}]}, 79 | {function,14,b,0, 80 | [{clause,14,[],[], 81 | [{tuple,15, 82 | [{atom,15,r}, 83 | {atom,4,undefined}, 84 | {string,15,"DEUX"}, 85 | {string,16,"trois"}, 86 | {atom,4,undefined}, 87 | {string,17,"cinq"}]}]}]}, 88 | {function,0,module_info,0, 89 | [{clause,0,[],[], 90 | [{call,0, 91 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 92 | [{atom,0,unfold0}]}]}]}, 93 | {function,0,module_info,1, 94 | [{clause,0, 95 | [{var,0,'X'}], 96 | [], 97 | [{call,0, 98 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 99 | [{atom,0,unfold0},{var,0,'X'}]}]}]}]} 100 | -------------------------------------------------------------------------------- /test/asm_data/src/unfold0.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/unfold0.erl",1}}, 2 | {attribute,1,module,unfold0}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {attribute,4,record, 5 | {r, 6 | [{record_field,4,{atom,4,'1'}}, 7 | {record_field,4,{atom,4,'2'}}, 8 | {record_field,4,{atom,4,'3'}}, 9 | {record_field,4,{atom,4,'4'}}, 10 | {record_field,4,{atom,4,'5'}}]}}, 11 | {function,6,a,0, 12 | [{clause,6,[],[], 13 | [{match,7, 14 | {var,7,'Fs'}, 15 | {cons,7, 16 | {'fun',7, 17 | {clauses, 18 | [{clause,7, 19 | [{var,7,'R'}], 20 | [], 21 | [{call,7, 22 | {atom,7,setelement}, 23 | [{op,7,'+',{integer,7,1},{integer,7,2}}, 24 | {var,7,'R'}, 25 | {string,7,"deux"}]}]}]}}, 26 | {cons,8, 27 | {'fun',8, 28 | {clauses, 29 | [{clause,8, 30 | [{var,8,'R'}], 31 | [], 32 | [{call,8, 33 | {atom,8,setelement}, 34 | [{record_index,8,r,{atom,8,'3'}}, 35 | {var,8,'R'}, 36 | {string,8,"trois"}]}]}]}}, 37 | {cons,9, 38 | {'fun',9, 39 | {clauses, 40 | [{clause,9, 41 | [{var,9,'R'}], 42 | [], 43 | [{call,9, 44 | {atom,9,setelement}, 45 | [{op,9,'+',{integer,9,1},{integer,9,5}}, 46 | {var,9,'R'}, 47 | {string,9,"cinq"}]}]}]}}, 48 | {cons,10, 49 | {'fun',10, 50 | {clauses, 51 | [{clause,10, 52 | [{var,10,'R'}], 53 | [], 54 | [{call,10, 55 | {atom,10,setelement}, 56 | [{op,10,'+',{integer,10,1},{integer,10,2}}, 57 | {var,10,'R'}, 58 | {string,10,"DEUX"}]}]}]}}, 59 | {nil,11}}}}}}, 60 | {call,12, 61 | {remote,12,{atom,12,lists},{atom,12,foldl}}, 62 | [{'fun',12, 63 | {clauses, 64 | [{clause,12, 65 | [{var,12,'F'},{var,12,'R'}], 66 | [], 67 | [{call,12,{var,12,'F'},[{var,12,'R'}]}]}]}}, 68 | {record,12,r,[]}, 69 | {var,12,'Fs'}]}]}]}, 70 | {function,14,b,0, 71 | [{clause,14,[],[], 72 | [{record,15,r, 73 | [{record_field,15,{atom,15,'2'},{string,15,"DEUX"}}, 74 | {record_field,16,{atom,16,'3'},{string,16,"trois"}}, 75 | {record_field,17,{atom,17,'5'},{string,17,"cinq"}}]}]}]}, 76 | {eof,19}] 77 | -------------------------------------------------------------------------------- /test/asm_data/src/unfold1.E: -------------------------------------------------------------------------------- 1 | {unfold1, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,4,record, 4 | [{r,[{record_field,4,{atom,4,'1'}}, 5 | {record_field,4,{atom,4,'2'}}, 6 | {record_field,4,{atom,4,'3'}}, 7 | {record_field,4,{atom,4,'4'}}, 8 | {record_field,4,{atom,4,'5'}}]}]}, 9 | {attribute,1,file,{"test/asm_data/unfold1.erl",1}}, 10 | {function,6,a,0, 11 | [{clause,6,[],[], 12 | [{match,7, 13 | {var,7,'R0'}, 14 | {tuple,7, 15 | [{atom,7,r}, 16 | {atom,4,undefined}, 17 | {atom,4,undefined}, 18 | {atom,4,undefined}, 19 | {atom,4,undefined}, 20 | {atom,4,undefined}]}}, 21 | {match,8, 22 | {var,8,'R1'}, 23 | {call,8, 24 | {remote,8,{atom,8,erlang},{atom,8,setelement}}, 25 | [{op,8,'+',{integer,8,1},{integer,8,2}}, 26 | {var,8,'R0'}, 27 | {string,8,"deux"}]}}, 28 | {match,9, 29 | {var,9,'R2'}, 30 | {call,9, 31 | {remote,9,{atom,9,erlang},{atom,9,setelement}}, 32 | [{op,9,'+',{integer,9,1},{integer,9,3}}, 33 | {var,9,'R1'}, 34 | {string,9,"trois"}]}}, 35 | {match,10, 36 | {var,10,'R3'}, 37 | {call,10, 38 | {remote,10,{atom,10,erlang},{atom,10,setelement}}, 39 | [{op,10,'+',{integer,10,1},{integer,10,5}}, 40 | {var,10,'R2'}, 41 | {string,10,"cinq"}]}}, 42 | {match,11, 43 | {var,11,'R4'}, 44 | {call,11, 45 | {remote,11,{atom,11,erlang},{atom,11,setelement}}, 46 | [{op,11,'+',{integer,11,1},{integer,11,2}}, 47 | {var,11,'R3'}, 48 | {string,11,"DEUX"}]}}, 49 | {var,12,'R4'}]}]}, 50 | {function,14,b,0, 51 | [{clause,14,[],[], 52 | [{tuple,15, 53 | [{atom,15,r}, 54 | {atom,4,undefined}, 55 | {string,15,"DEUX"}, 56 | {string,16,"trois"}, 57 | {atom,4,undefined}, 58 | {string,17,"cinq"}]}]}]}, 59 | {function,0,module_info,0, 60 | [{clause,0,[],[], 61 | [{call,0, 62 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 63 | [{atom,0,unfold1}]}]}]}, 64 | {function,0,module_info,1, 65 | [{clause,0, 66 | [{var,0,'X'}], 67 | [], 68 | [{call,0, 69 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 70 | [{atom,0,unfold1},{var,0,'X'}]}]}]}]} 71 | -------------------------------------------------------------------------------- /test/asm_data/src/unfold1.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/unfold1.erl",1}}, 2 | {attribute,1,module,unfold1}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {attribute,4,record, 5 | {r,[{record_field,4,{atom,4,'1'}}, 6 | {record_field,4,{atom,4,'2'}}, 7 | {record_field,4,{atom,4,'3'}}, 8 | {record_field,4,{atom,4,'4'}}, 9 | {record_field,4,{atom,4,'5'}}]}}, 10 | {function,6,a,0, 11 | [{clause,6,[],[], 12 | [{match,7,{var,7,'R0'},{record,7,r,[]}}, 13 | {match,8, 14 | {var,8,'R1'}, 15 | {call,8, 16 | {atom,8,setelement}, 17 | [{op,8,'+',{integer,8,1},{integer,8,2}}, 18 | {var,8,'R0'}, 19 | {string,8,"deux"}]}}, 20 | {match,9, 21 | {var,9,'R2'}, 22 | {call,9, 23 | {atom,9,setelement}, 24 | [{op,9,'+',{integer,9,1},{integer,9,3}}, 25 | {var,9,'R1'}, 26 | {string,9,"trois"}]}}, 27 | {match,10, 28 | {var,10,'R3'}, 29 | {call,10, 30 | {atom,10,setelement}, 31 | [{op,10,'+',{integer,10,1},{integer,10,5}}, 32 | {var,10,'R2'}, 33 | {string,10,"cinq"}]}}, 34 | {match,11, 35 | {var,11,'R4'}, 36 | {call,11, 37 | {atom,11,setelement}, 38 | [{op,11,'+',{integer,11,1},{integer,11,2}}, 39 | {var,11,'R3'}, 40 | {string,11,"DEUX"}]}}, 41 | {var,12,'R4'}]}]}, 42 | {function,14,b,0, 43 | [{clause,14,[],[], 44 | [{record,15,r, 45 | [{record_field,15,{atom,15,'2'},{string,15,"DEUX"}}, 46 | {record_field,16,{atom,16,'3'},{string,16,"trois"}}, 47 | {record_field,17,{atom,17,'5'},{string,17,"cinq"}}]}]}]}, 48 | {eof,19}] 49 | -------------------------------------------------------------------------------- /test/asm_data/src/unfold1.S: -------------------------------------------------------------------------------- 1 | {unfold1, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [], 4 | [{function,a,0,2, 5 | [{label,1}, 6 | {line,[{location,"test/asm_data/unfold1.erl",6}]}, 7 | {func_info,{atom,unfold1},{atom,a},0}, 8 | {label,2}, 9 | {move,{literal,{r,undefined,"DEUX","trois",undefined,"cinq"}},{x,0}}, 10 | return]}, 11 | {function,b,0,4, 12 | [{label,3}, 13 | {line,[{location,"test/asm_data/unfold1.erl",14}]}, 14 | {func_info,{atom,unfold1},{atom,b},0}, 15 | {label,4}, 16 | {move,{literal,{r,undefined,"DEUX","trois",undefined,"cinq"}},{x,0}}, 17 | return]}, 18 | {function,module_info,0,6, 19 | [{label,5}, 20 | {line,[]}, 21 | {func_info,{atom,unfold1},{atom,module_info},0}, 22 | {label,6}, 23 | {move,{atom,unfold1},{x,0}}, 24 | {line,[]}, 25 | {call_ext_only,1,{extfunc,erlang,get_module_info,1}}]}, 26 | {function,module_info,1,8, 27 | [{label,7}, 28 | {line,[]}, 29 | {func_info,{atom,unfold1},{atom,module_info},1}, 30 | {label,8}, 31 | {move,{x,0},{x,1}}, 32 | {move,{atom,unfold1},{x,0}}, 33 | {line,[]}, 34 | {call_ext_only,2,{extfunc,erlang,get_module_info,2}}]}], 35 | 9} 36 | -------------------------------------------------------------------------------- /test/asm_data/src/unfold2.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/unfold2.erl",1}}, 2 | {attribute,1,module,unfold2}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {attribute,4,record, 5 | {r,[{record_field,4,{atom,4,'1'}}, 6 | {record_field,4,{atom,4,'2'}}, 7 | {record_field,4,{atom,4,'3'}}, 8 | {record_field,4,{atom,4,'4'}}, 9 | {record_field,4,{atom,4,'5'}}]}}, 10 | {function,6,a,0, 11 | [{clause,6,[],[], 12 | [{match,7, 13 | {var,7,'Fs'}, 14 | {cons,7, 15 | {'fun',7,{function,two,1}}, 16 | {cons,8, 17 | {'fun',8,{function,three,1}}, 18 | {cons,9, 19 | {'fun',9,{function,five,1}}, 20 | {cons,10, 21 | {'fun',10,{function,'TWO',1}}, 22 | {nil,11}}}}}}, 23 | {call,12, 24 | {remote,12,{atom,12,lists},{atom,12,foldl}}, 25 | [{'fun',12, 26 | {clauses, 27 | [{clause,12, 28 | [{var,12,'F'},{var,12,'R'}], 29 | [], 30 | [{call,12,{var,12,'F'},[{var,12,'R'}]}]}]}}, 31 | {record,12,r,[]}, 32 | {var,12,'Fs'}]}]}]}, 33 | {function,14,two,1, 34 | [{clause,14, 35 | [{var,14,'R'}], 36 | [], 37 | [{call,14, 38 | {atom,14,setelement}, 39 | [{op,14,'+',{integer,14,1},{integer,14,2}}, 40 | {var,14,'R'}, 41 | {string,14,"deux"}]}]}]}, 42 | {function,15,'TWO',1, 43 | [{clause,15, 44 | [{var,15,'R'}], 45 | [], 46 | [{call,15, 47 | {atom,15,setelement}, 48 | [{op,15,'+',{integer,15,1},{integer,15,2}}, 49 | {var,15,'R'}, 50 | {string,15,"DEUX"}]}]}]}, 51 | {function,16,three,1, 52 | [{clause,16, 53 | [{var,16,'R'}], 54 | [], 55 | [{call,16, 56 | {atom,16,setelement}, 57 | [{op,16,'+',{integer,16,1},{integer,16,3}}, 58 | {var,16,'R'}, 59 | {string,16,"trois"}]}]}]}, 60 | {function,17,five,1, 61 | [{clause,17, 62 | [{var,17,'R'}], 63 | [], 64 | [{call,17, 65 | {atom,17,setelement}, 66 | [{op,17,'+',{integer,17,1},{integer,17,5}}, 67 | {var,17,'R'}, 68 | {string,17,"cinq"}]}]}]}, 69 | {function,19,b,0, 70 | [{clause,19,[],[], 71 | [{record,20,r, 72 | [{record_field,20,{atom,20,'2'},{string,20,"DEUX"}}, 73 | {record_field,21,{atom,21,'3'},{string,21,"trois"}}, 74 | {record_field,22,{atom,22,'5'},{string,22,"cinq"}}]}]}]}, 75 | {eof,24}] 76 | -------------------------------------------------------------------------------- /test/asm_data/src/unfold3.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/unfold3.erl",1}}, 2 | {attribute,1,module,unfold3}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {attribute,4,record, 5 | {r,[{record_field,4,{atom,4,'1'}}, 6 | {record_field,4,{atom,4,'2'}}, 7 | {record_field,4,{atom,4,'3'}}, 8 | {record_field,4,{atom,4,'4'}}, 9 | {record_field,4,{atom,4,'5'}}]}}, 10 | {function,6,a,0, 11 | [{clause,6,[],[], 12 | [{match,7, 13 | {var,7,'Fs'}, 14 | {cons,7, 15 | {'fun',7,{function,two,1}}, 16 | {cons,8, 17 | {'fun',8,{function,three,1}}, 18 | {cons,9, 19 | {'fun',9,{function,five,1}}, 20 | {cons,10, 21 | {'fun',10,{function,'TWO',1}}, 22 | {nil,11}}}}}}, 23 | {call,12,{atom,12,pipe},[{record,12,r,[]},{var,12,'Fs'}]}]}]}, 24 | {function,14,pipe,2, 25 | [{clause,14, 26 | [{var,14,'Acc0'},{var,14,'Routines'}], 27 | [], 28 | [{call,15, 29 | {remote,15,{atom,15,lists},{atom,15,foldl}}, 30 | [{'fun',15, 31 | {clauses, 32 | [{clause,15, 33 | [{var,15,'F'},{var,15,'R'}], 34 | [], 35 | [{call,15,{var,15,'F'},[{var,15,'R'}]}]}]}}, 36 | {var,15,'Acc0'}, 37 | {var,15,'Routines'}]}]}]}, 38 | {function,17,two,1, 39 | [{clause,17, 40 | [{var,17,'R'}], 41 | [], 42 | [{call,17, 43 | {atom,17,setelement}, 44 | [{op,17,'+',{integer,17,1},{integer,17,2}}, 45 | {var,17,'R'}, 46 | {string,17,"deux"}]}]}]}, 47 | {function,18,'TWO',1, 48 | [{clause,18, 49 | [{var,18,'R'}], 50 | [], 51 | [{call,18, 52 | {atom,18,setelement}, 53 | [{op,18,'+',{integer,18,1},{integer,18,2}}, 54 | {var,18,'R'}, 55 | {string,18,"DEUX"}]}]}]}, 56 | {function,19,three,1, 57 | [{clause,19, 58 | [{var,19,'R'}], 59 | [], 60 | [{call,19, 61 | {atom,19,setelement}, 62 | [{op,19,'+',{integer,19,1},{integer,19,3}}, 63 | {var,19,'R'}, 64 | {string,19,"trois"}]}]}]}, 65 | {function,20,five,1, 66 | [{clause,20, 67 | [{var,20,'R'}], 68 | [], 69 | [{call,20, 70 | {atom,20,setelement}, 71 | [{op,20,'+',{integer,20,1},{integer,20,5}}, 72 | {var,20,'R'}, 73 | {string,20,"cinq"}]}]}]}, 74 | {function,22,b,0, 75 | [{clause,22,[],[], 76 | [{record,23,r, 77 | [{record_field,23,{atom,23,'2'},{string,23,"DEUX"}}, 78 | {record_field,24,{atom,24,'3'},{string,24,"trois"}}, 79 | {record_field,25,{atom,25,'5'},{string,25,"cinq"}}]}]}]}, 80 | {eof,27}] 81 | -------------------------------------------------------------------------------- /test/asm_data/src/unfold5.E: -------------------------------------------------------------------------------- 1 | {unfold5, 2 | [{a,0},{b,0},{module_info,0},{module_info,1}], 3 | [{attribute,4,record, 4 | [{r, 5 | [{record_field,4,{atom,4,'1'}}, 6 | {record_field,4,{atom,4,'2'}}, 7 | {record_field,4,{atom,4,'3'}}, 8 | {record_field,4,{atom,4,'4'}}, 9 | {record_field,4,{atom,4,'5'}}]}]}, 10 | {attribute,1,file,{"test/asm_data/unfold5.erl",1}}, 11 | {function,6,a,0, 12 | [{clause,6,[],[], 13 | [{match,7, 14 | {var,7,'R0'}, 15 | {tuple,7, 16 | [{atom,7,r}, 17 | {atom,4,undefined}, 18 | {atom,4,undefined}, 19 | {atom,4,undefined}, 20 | {atom,4,undefined}, 21 | {atom,4,undefined}]}}, 22 | {match,8, 23 | {var,8,'R1'}, 24 | {call,8, 25 | {'fun',8, 26 | {clauses, 27 | [{clause,8,[],[], 28 | [{call,8, 29 | {remote,8,{atom,8,erlang},{atom,8,setelement}}, 30 | [{op,8,'+',{integer,8,1},{integer,8,2}}, 31 | {var,8,'R0'}, 32 | {string,8,"deux"}]}]}]}, 33 | {0,0,'-a/0-fun-0-'}}, 34 | []}}, 35 | {match,9, 36 | {var,9,'R2'}, 37 | {call,9, 38 | {'fun',9, 39 | {clauses, 40 | [{clause,9,[],[], 41 | [{call,9, 42 | {remote,9,{atom,9,erlang},{atom,9,setelement}}, 43 | [{op,9,'+',{integer,9,1},{integer,9,3}}, 44 | {var,9,'R1'}, 45 | {string,9,"trois"}]}]}]}, 46 | {0,0,'-a/0-fun-1-'}}, 47 | []}}, 48 | {match,10, 49 | {var,10,'R3'}, 50 | {call,10, 51 | {'fun',10, 52 | {clauses, 53 | [{clause,10,[],[], 54 | [{call,10, 55 | {remote,10,{atom,10,erlang},{atom,10,setelement}}, 56 | [{op,10,'+',{integer,10,1},{integer,10,5}}, 57 | {var,10,'R2'}, 58 | {string,10,"cinq"}]}]}]}, 59 | {0,0,'-a/0-fun-2-'}}, 60 | []}}, 61 | {match,11, 62 | {var,11,'R4'}, 63 | {call,11, 64 | {'fun',11, 65 | {clauses, 66 | [{clause,11,[],[], 67 | [{call,11, 68 | {remote,11,{atom,11,erlang},{atom,11,setelement}}, 69 | [{op,11,'+',{integer,11,1},{integer,11,2}}, 70 | {var,11,'R3'}, 71 | {string,11,"DEUX"}]}]}]}, 72 | {0,0,'-a/0-fun-3-'}}, 73 | []}}, 74 | {var,12,'R4'}]}]}, 75 | {function,14,b,0, 76 | [{clause,14,[],[], 77 | [{tuple,15, 78 | [{atom,15,r}, 79 | {atom,4,undefined}, 80 | {string,15,"DEUX"}, 81 | {string,16,"trois"}, 82 | {atom,4,undefined}, 83 | {string,17,"cinq"}]}]}]}, 84 | {function,0,module_info,0, 85 | [{clause,0,[],[], 86 | [{call,0, 87 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 88 | [{atom,0,unfold5}]}]}]}, 89 | {function,0,module_info,1, 90 | [{clause,0, 91 | [{var,0,'X'}], 92 | [], 93 | [{call,0, 94 | {remote,0,{atom,0,erlang},{atom,0,get_module_info}}, 95 | [{atom,0,unfold5},{var,0,'X'}]}]}]}]} 96 | -------------------------------------------------------------------------------- /test/asm_data/src/unfold5.P: -------------------------------------------------------------------------------- 1 | [{attribute,1,file,{"test/asm_data/unfold5.erl",1}}, 2 | {attribute,1,module,unfold5}, 3 | {attribute,2,export,[{a,0},{b,0}]}, 4 | {attribute,4,record, 5 | {r, 6 | [{record_field,4,{atom,4,'1'}}, 7 | {record_field,4,{atom,4,'2'}}, 8 | {record_field,4,{atom,4,'3'}}, 9 | {record_field,4,{atom,4,'4'}}, 10 | {record_field,4,{atom,4,'5'}}]}}, 11 | {function,6,a,0, 12 | [{clause,6,[],[], 13 | [{match,7,{var,7,'R0'},{record,7,r,[]}}, 14 | {match,8, 15 | {var,8,'R1'}, 16 | {call,8, 17 | {'fun',8, 18 | {clauses, 19 | [{clause,8,[],[], 20 | [{call,8, 21 | {atom,8,setelement}, 22 | [{op,8,'+',{integer,8,1},{integer,8,2}}, 23 | {var,8,'R0'}, 24 | {string,8,"deux"}]}]}]}}, 25 | []}}, 26 | {match,9, 27 | {var,9,'R2'}, 28 | {call,9, 29 | {'fun',9, 30 | {clauses, 31 | [{clause,9,[],[], 32 | [{call,9, 33 | {atom,9,setelement}, 34 | [{op,9,'+',{integer,9,1},{integer,9,3}}, 35 | {var,9,'R1'}, 36 | {string,9,"trois"}]}]}]}}, 37 | []}}, 38 | {match,10, 39 | {var,10,'R3'}, 40 | {call,10, 41 | {'fun',10, 42 | {clauses, 43 | [{clause,10,[],[], 44 | [{call,10, 45 | {atom,10,setelement}, 46 | [{op,10,'+',{integer,10,1},{integer,10,5}}, 47 | {var,10,'R2'}, 48 | {string,10,"cinq"}]}]}]}}, 49 | []}}, 50 | {match,11, 51 | {var,11,'R4'}, 52 | {call,11, 53 | {'fun',11, 54 | {clauses, 55 | [{clause,11,[],[], 56 | [{call,11, 57 | {atom,11,setelement}, 58 | [{op,11,'+',{integer,11,1},{integer,11,2}}, 59 | {var,11,'R3'}, 60 | {string,11,"DEUX"}]}]}]}}, 61 | []}}, 62 | {var,12,'R4'}]}]}, 63 | {function,14,b,0, 64 | [{clause,14,[],[], 65 | [{record,15,r, 66 | [{record_field,15,{atom,15,'2'},{string,15,"DEUX"}}, 67 | {record_field,16,{atom,16,'3'},{string,16,"trois"}}, 68 | {record_field,17,{atom,17,'5'},{string,17,"cinq"}}]}]}]}, 69 | {eof,19}] 70 | -------------------------------------------------------------------------------- /test/asm_data/try0.hrl: -------------------------------------------------------------------------------- 1 | -module(try0). 2 | -export([a/0, b/0]). 3 | 4 | a() -> 5 | 42 = self() ! 42, 6 | receive 7 | <<"this">> -> that; 8 | 42 -> length(lists:seq(1, 5)) 9 | after 0 -> 10 | throw(argh) 11 | end. 12 | 13 | b() -> 14 | 5. 15 | -------------------------------------------------------------------------------- /test/asm_data/try1.hrl: -------------------------------------------------------------------------------- 1 | -module(try1). 2 | -export([a/0, b/0]). 3 | 4 | a() -> 5 | try get() of 6 | [_|_]=PD -> PD; 7 | [] -> [] 8 | catch 9 | _:_ -> impossible 10 | end. 11 | 12 | b() -> 13 | get(). 14 | -------------------------------------------------------------------------------- /test/asm_data/try2.hrl: -------------------------------------------------------------------------------- 1 | -module(try2). 2 | -export([a/0, b/0]). 3 | 4 | a() -> 5 | try get() of 6 | <<"abc">> -> <<"def">>; 7 | <<"π"/utf8>>=_Pi -> 3.14e0; 8 | PD when is_list(PD) -> PD 9 | catch 10 | _:_ -> impossible 11 | end. 12 | 13 | b() -> 14 | get(). 15 | -------------------------------------------------------------------------------- /test/asm_data/try3.hrl: -------------------------------------------------------------------------------- 1 | -module(try3). 2 | -export([a/0, b/0]). 3 | 4 | a() -> 5 | catch get(). 6 | 7 | b() -> 8 | get(). 9 | -------------------------------------------------------------------------------- /test/asm_data/unfold0.hrl: -------------------------------------------------------------------------------- 1 | -module(unfold0). 2 | -export([a/0, b/0]). 3 | 4 | -record(r, {'1', '2', '3', '4', '5'}). 5 | 6 | a() -> 7 | Fs = [fun (R) -> setelement(1+2, R, "deux") end 8 | ,fun (R) -> setelement(#r.'3', R, "trois") end 9 | ,fun (R) -> setelement(1+5, R, "cinq") end 10 | ,fun (R) -> setelement(1+2, R, "DEUX") end 11 | ], 12 | lists:foldl(fun (F, R) -> F(R) end, #r{}, Fs). 13 | 14 | b() -> 15 | #r{'2' = "DEUX" 16 | ,'3' = "trois" 17 | ,'5' = "cinq" 18 | }. 19 | -------------------------------------------------------------------------------- /test/asm_data/unfold1.hrl: -------------------------------------------------------------------------------- 1 | -module(unfold1). 2 | -export([a/0, b/0]). 3 | 4 | -record(r, {'1', '2', '3', '4', '5'}). 5 | 6 | a() -> 7 | R0 = #r{}, 8 | R1 = setelement(1+2, R0, "deux"), 9 | R2 = setelement(1+3, R1, "trois"), 10 | R3 = setelement(1+5, R2, "cinq"), 11 | R4 = setelement(1+2, R3, "DEUX"), 12 | R4. 13 | 14 | b() -> 15 | #r{'2' = "DEUX" 16 | ,'3' = "trois" 17 | ,'5' = "cinq" 18 | }. 19 | -------------------------------------------------------------------------------- /test/asm_data/unfold2.hrl: -------------------------------------------------------------------------------- 1 | -module(unfold2). 2 | -export([a/0, b/0]). 3 | 4 | -record(r, {'1', '2', '3', '4', '5'}). 5 | 6 | a() -> 7 | Fs = [fun two/1 8 | ,fun three/1 9 | ,fun five/1 10 | ,fun 'TWO'/1 11 | ], 12 | lists:foldl(fun (F, R) -> F(R) end, #r{}, Fs). 13 | 14 | two(R) -> setelement(1+2, R, "deux"). 15 | 'TWO'(R) -> setelement(1+2, R, "DEUX"). 16 | three(R) -> setelement(1+3, R, "trois"). 17 | five(R) -> setelement(1+5, R, "cinq"). 18 | 19 | b() -> 20 | #r{'2' = "DEUX" 21 | ,'3' = "trois" 22 | ,'5' = "cinq" 23 | }. 24 | -------------------------------------------------------------------------------- /test/asm_data/unfold3.hrl: -------------------------------------------------------------------------------- 1 | -module(unfold3). 2 | -export([a/0, b/0]). 3 | 4 | -record(r, {'1', '2', '3', '4', '5'}). 5 | 6 | a() -> 7 | Fs = [fun two/1 8 | ,fun three/1 9 | ,fun five/1 10 | ,fun 'TWO'/1 11 | ], 12 | pipe(#r{}, Fs). 13 | 14 | pipe(Acc0, Routines) -> 15 | lists:foldl(fun (F, R) -> F(R) end, Acc0, Routines). 16 | 17 | two(R) -> setelement(1+2, R, "deux"). 18 | 'TWO'(R) -> setelement(1+2, R, "DEUX"). 19 | three(R) -> setelement(1+3, R, "trois"). 20 | five(R) -> setelement(1+5, R, "cinq"). 21 | 22 | b() -> 23 | #r{'2' = "DEUX" 24 | ,'3' = "trois" 25 | ,'5' = "cinq" 26 | }. 27 | -------------------------------------------------------------------------------- /test/asm_data/unfold4.hrl: -------------------------------------------------------------------------------- 1 | -module(unfold4). 2 | -export([a/0, b/0]). 3 | 4 | -record(r, {'1', '2', '3', '4', '5'}). 5 | 6 | a() -> 7 | S = {some, "state"}, 8 | Fs = [fun two/2 9 | ,fun three/2 10 | ,fun five/2 11 | ,fun 'TWO'/2 12 | ], 13 | lists:foldl(fun (F, R) -> F(R, S) end, #r{}, Fs). 14 | 15 | two(R, _) -> setelement(1+2, R, "deux"). 16 | 'TWO'(R, _) -> setelement(1+2, R, "DEUX"). 17 | three(R, _) -> setelement(1+3, R, "trois"). 18 | five(R, _) -> setelement(1+5, R, "cinq"). 19 | 20 | b() -> 21 | #r{'2' = "DEUX" 22 | ,'3' = "trois" 23 | ,'5' = "cinq" 24 | }. 25 | -------------------------------------------------------------------------------- /test/asm_data/unfold5.hrl: -------------------------------------------------------------------------------- 1 | -module(unfold5). 2 | -export([a/0, b/0]). 3 | 4 | -record(r, {'1', '2', '3', '4', '5'}). 5 | 6 | a() -> 7 | R0 = #r{}, 8 | R1 = (fun () -> setelement(1+2, R0, "deux") end)(), 9 | R2 = (fun () -> setelement(1+3, R1, "trois") end)(), 10 | R3 = (fun () -> setelement(1+5, R2, "cinq") end)(), 11 | R4 = (fun () -> setelement(1+2, R3, "DEUX") end)(), 12 | R4. 13 | 14 | b() -> 15 | #r{'2' = "DEUX" 16 | ,'3' = "trois" 17 | ,'5' = "cinq" 18 | }. 19 | --------------------------------------------------------------------------------