diff options
author | Paul Guyot <[email protected]> | 2010-07-04 15:08:47 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2010-07-29 09:11:52 +0200 |
commit | 173d1fd1c3fef385f73accc4b2bbb1b6f92ac3f5 (patch) | |
tree | 830f6e894ef2aba363ee7147ac2fd6a55d8eebac /lib/compiler/test | |
parent | 6ec6250f8ad4fd13318d13e566602dccc9f6746f (diff) | |
download | otp-173d1fd1c3fef385f73accc4b2bbb1b6f92ac3f5.tar.gz otp-173d1fd1c3fef385f73accc4b2bbb1b6f92ac3f5.tar.bz2 otp-173d1fd1c3fef385f73accc4b2bbb1b6f92ac3f5.zip |
beam_asm: Simplify string table generation for beams
The code for generating the string table (which is now
only used for bit syntax matching) in a BEAM file is quite
complicated and potentially expensive when compiling modules
with many thousands of clauses doing bit syntax matching.
Simplify and optimize the code using bit syntax and
binary:match/2 instead of the list operations in the
original code.
Diffstat (limited to 'lib/compiler/test')
-rw-r--r-- | lib/compiler/test/compilation_SUITE.erl | 13 | ||||
-rw-r--r-- | lib/compiler/test/compilation_SUITE_data/string_table.erl | 8 |
2 files changed, 20 insertions, 1 deletions
diff --git a/lib/compiler/test/compilation_SUITE.erl b/lib/compiler/test/compilation_SUITE.erl index d4843c9eba..9c06740816 100644 --- a/lib/compiler/test/compilation_SUITE.erl +++ b/lib/compiler/test/compilation_SUITE.erl @@ -46,7 +46,7 @@ all(suite) -> trycatch_4, opt_crash, otp_5404,otp_5436,otp_5481,otp_5553,otp_5632, otp_5714,otp_5872,otp_6121,otp_6121a,otp_6121b, - otp_7202,otp_7345,on_load + otp_7202,otp_7345,on_load,string_table ]. -define(comp(N), @@ -596,4 +596,15 @@ otp_7345(ObjRef, _RdEnv, Args) -> 10}, id(LlUnitdataReq). +%% Check the generation of the string table. + +string_table(Config) when is_list(Config) -> + ?line DataDir = ?config(data_dir, Config), + ?line File = filename:join(DataDir, "string_table.erl"), + ?line {ok,string_table,Beam,[]} = compile:file(File, [return, binary]), + ?line {ok,{string_table,[StringTableChunk]}} = beam_lib:chunks(Beam, ["StrT"]), + ?line {"StrT", <<"stringabletringtable">>} = StringTableChunk, + ok. + + id(I) -> I. diff --git a/lib/compiler/test/compilation_SUITE_data/string_table.erl b/lib/compiler/test/compilation_SUITE_data/string_table.erl new file mode 100644 index 0000000000..1da1d015dd --- /dev/null +++ b/lib/compiler/test/compilation_SUITE_data/string_table.erl @@ -0,0 +1,8 @@ +-module(string_table). +-export([f/1, g/1]). + +f(<<"string">>) -> string; +f(<<"stringtable">>) -> stringtable. + +g(<<"stringtable">>) -> stringtable; +g(<<"table">>) -> table. |