diff options
author | Björn Gustavsson <[email protected]> | 2015-04-29 12:27:16 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2015-04-29 12:27:16 +0200 |
commit | 688e88924ee453d4a617980ec38b12e30568bda9 (patch) | |
tree | 8fd0680c817cf6ea05ebaa729ed012e962db3ddd /lib/compiler/src/beam_listing.erl | |
parent | 3ce2fe4c0e88da5ff8f50624f133e1fee9726473 (diff) | |
parent | f4adfc60acb46a86f49627397913b6841b744ed2 (diff) | |
download | otp-688e88924ee453d4a617980ec38b12e30568bda9.tar.gz otp-688e88924ee453d4a617980ec38b12e30568bda9.tar.bz2 otp-688e88924ee453d4a617980ec38b12e30568bda9.zip |
Merge branch 'bjorn/compiler/misc'
* bjorn/compiler/misc:
test_lib: Simplify uniq/0
beam_dict: Correct comparison in opcode/2
beam_utils: Re-use the local helper function drop_labels/1
beam_asm: Speed up encoding of large numbers
compilation_SUITE: Speed up the self_compile test cases
beam_listing: Optimize writing of .S files
v3_core, v3_codegen: Eliminate old-style catches
cerl_inline: Replace old-style 'catch' with 'try'...'catch'
sys_core_fold: Suppress warnings better
beam_utils: Teach check_liveness/3 to understand get_map_elements
Teach beam_trim to handle map instructions
beam_utils: Be less conservative about liveness for exit instructions
beam_validator: Stop validating the 'aligned' flag for binaries
beam_validator: Clean up updating of types for y register
beam_validator: Remove support for removed BIF fault/1,2
beam_validator: Correct merging of states
beam_validator: Correct merging of y registers
sys_pre_expand: Remove unused fields in #expand{} record
Diffstat (limited to 'lib/compiler/src/beam_listing.erl')
-rw-r--r-- | lib/compiler/src/beam_listing.erl | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/compiler/src/beam_listing.erl b/lib/compiler/src/beam_listing.erl index 50d1f3cdb1..726bb7f5eb 100644 --- a/lib/compiler/src/beam_listing.erl +++ b/lib/compiler/src/beam_listing.erl @@ -46,8 +46,8 @@ module(Stream, {Mod,Exp,Attr,Code,NumLabels}) -> fun ({function,Name,Arity,Entry,Asm}) -> io:format(Stream, "\n\n{function, ~w, ~w, ~w}.\n", [Name, Arity, Entry]), - foreach(fun(Op) -> print_op(Stream, Op) end, Asm) end, - Code); + io:put_chars(Stream, format_asm(Asm)) + end, Code); module(Stream, {Mod,Exp,Inter}) -> %% Other kinds of intermediate formats. io:fwrite(Stream, "~w.~n~p.~n", [Mod,Exp]), @@ -56,10 +56,11 @@ module(Stream, [_|_]=Fs) -> %% Form-based abstract format. foreach(fun (F) -> io:format(Stream, "~p.\n", [F]) end, Fs). -print_op(Stream, Label) when element(1, Label) == label -> - io:format(Stream, " ~p.\n", [Label]); -print_op(Stream, Op) -> - io:format(Stream, " ~p.\n", [Op]). +format_asm([{label,L}|Is]) -> + [" {label,",integer_to_list(L),"}.\n"|format_asm(Is)]; +format_asm([I|Is]) -> + [io_lib:format(" ~p", [I]),".\n"|format_asm(Is)]; +format_asm([]) -> []. function(File, {function,Name,Arity,Args,Body,Vdb,_Anno}) -> io:nl(File), |