aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2013-02-09Fix unsafe optimization of funsBjörn Gustavsson
Commits 53bd4974a101 and 726f6e4c7afe simplified the handling of match_fail (used to generated exceptions such as 'function_clause') by first rewriting them to a call to erlang/error{1,2} and later rewriting them to specialized BEAM instructions (to reduce the code size). There was one flaw, though, which only was exposed when more aggressive optimizations were added in c3b60f86c622. Here is an example to explain it: t(V) -> fun(get) -> V end. The following BEAM code will be initially generated for the fun: {function, '-t/1-fun-0-', 2, 5}. {label,1}. {line,[{location,"t.erl",5}]}. {func_info,{atom,t},{atom,'-t/1-fun-0-'},2}. {label,2}. {test,is_eq_exact,{f,2},[{x,0},{atom,get}]}. {move,{x,1},{x,0}}. return. {label,2}. {test_heap,2,1}. {put_list,{x,0},nil,{x,1}}. {move,{atom,function_clause},{x,0}}. {line,[{location,"t.erl",5}]}. {call_ext_only,2,{extfunc,erlang,error,2}}. Translating back to Erlang code, that would be roughly: '-t/1-fun-0-'(get, V) -> V; '-t/1-fun-0-'(Arg1, _) -> erlang:error(function_clause, [Arg1]). Note that the second argument (the free variable V) is not included in the call to erlang:error/2. The beam_except pass will simplify the code to: {function, '-t/1-fun-0-', 2, 8}. {label,1}. {line,[{location,"t.erl",5}]}. {func_info,{atom,t},{atom,'-t/1-fun-0-'},2}. {label,2}. {test,is_eq_exact,{f,1},[{x,0},{atom,get}]}. {move,{x,1},{x,0}}. return. The code has been shortened by jumping to the func_info/3 instruction. Translating back to Erlang: '-t/1-fun-0-'(get, V) -> V; '-t/1-fun-0-'(Arg1, Arg2) -> erlang:error(function_clause, [Arg1,Arg2]). it is clear that both arguments are now included in the 'function_clause' exception, even though the initially generated code only included the first argument. That is no problem in this particular case, but for some more complex funs, optimizing the first version based on variable usage could make the second version unsafe. I rejected the following potential solutions: - Including the free arguments in the call to erlang:error/2: '-t/1-fun-0-'(get, V) -> V; '-t/1-fun-0-'(Arg1, Arg2) -> erlang:error(function_clause, [Arg1,Arg2]). Unfortunately, that is tricky. The free variables are only known after the second pass in v3_kernel when variable usage has been calculated. We would need to add a third pass (only for funs) that would the free arguments to the second argument for erlang:error/2 *and* update the variable usage information. - Calling beam_except earlier, from within beam_block before any optimizations based on variable usages are done. But means that the problem could reappear in some other form in the future when other updates are done to the code generator and/or optimization passes. The solution I have chosen is to modify beam_except to only replace a call to erlang:error(function_class, Args) if the length of Args is the same as the arity in the func_info/3 instruction. The code will be slightly larger. Also, the free variables for funs and list comprehensions will no longer be included in the function_clause exception (that could be less confusing, but it also means less information during debugging).
2013-02-08Merge branch 'sverk/packet-http-string-maxlen'Sverker Eriksson
* sverk/packet-http-string-maxlen: erts: Increase length of well formed header names from {packet,http} OTP-10824
2013-02-08Merge branch 'sverk/erl_interface-enum-typedef'Sverker Eriksson
* sverk/erl_interface-enum-typedef: erl_interface: Change enum erlang_char_encoding to a typedef
2013-02-08Merge branch 'sverk/r16/erl_interface-fixup'Sverker Eriksson
* sverk/r16/erl_interface-fixup: erl_interface: Fix ei_skip_term
2013-02-08Merge branch 'maint'Micael Karlberg
2013-02-08Merge branch 'bmk/snmp/snmp4231_integration/r16'Micael Karlberg
2013-02-08Merge branch 'maint-r15' into maintMicael Karlberg
2013-02-08Merge branch 'hb/stdlib/bug_fixes/OTP-10622'Hans Bolinder
* hb/stdlib/bug_fixes/OTP-10622: [stdlib] Fix a bug that could cause the Erlang shell to loop [stdlib] Fix bugs in eval_bits
2013-02-08Merge branch 'fredrik/odbc/update-vsn'Fredrik Gustafsson
* fredrik/odbc/update-vsn: Bumped version number
2013-02-08Bumped version numberFredrik Gustafsson
2013-02-08Merge branch 'kp/odbc-empty-params/OTP-10798'Fredrik Gustafsson
* kp/odbc-empty-params/OTP-10798: Add testcases for odbc:param_query Fix odbc:param_query/3 and odbc:param_query/4.
2013-02-07[stdlib] Fix a bug that could cause the Erlang shell to loopHans Bolinder
2013-02-07[stdlib] Fix bugs in eval_bitsHans Bolinder
Unicode related.
2013-02-07erl_interface: Change enum erlang_char_encoding to a typedefSverker Eriksson
to make the API independent of the actual type of erlang_char_encoding
2013-02-07Merge branch 'siri/ts-and-tp-in-test-logs/OTP-10780'Siri Hansen
* siri/ts-and-tp-in-test-logs/OTP-10780: [test_server] Add error printouts in case writing to test case html log fails [test_server] Don't write unicode strings to latin1 log files
2013-02-07Merge branch 'bmk/snmp/snmp4222_integration/r15' into maint-r15Erlang/OTP
* bmk/snmp/snmp4222_integration/r15: [snmp/compiler] Improved debug printouts [snmp/compiler] Add test case and test mib [snmp/compiler] Proper release nodes [snmp/compiler] Add the mib (ALARM-MIB) [snmp/compiler] MIB compiler did not handle forward index ref [snmp/compiler] Added test case for BITS import [snmp/compiler] Release notes, appup and proper version [snmp/compiler] Corrected test mibs [snmp/compiler] MIB compiler did not handle import BITS
2013-02-07Merge branch 'siri/sasl/appup-R16/OTP-10806'Siri Hansen
* siri/sasl/appup-R16/OTP-10806: Update sasl.appup.src with R16 release and remove R13 versions
2013-02-07Merge branch 'maint'Björn Gustavsson
* maint: Prepare release Don't run testX420/1 on old slow Sparc systems testX420: Pass Options to the ASN.1 compiler asn1_erl_nif: Correct broken length encoding asn1_SUITE: Mend broken test_modified_x420/1 Revert "Prepare release" Conflicts: lib/asn1/doc/src/notes.xml lib/asn1/test/asn1_SUITE.erl
2013-02-07Merge branch 'maint-r15' into maintBjörn Gustavsson
* maint-r15: Prepare release Don't run testX420/1 on old slow Sparc systems testX420: Pass Options to the ASN.1 compiler asn1_erl_nif: Correct broken length encoding asn1_SUITE: Mend broken test_modified_x420/1 Fix a bug for multiple extension addition groups
2013-02-07[test_server] Add error printouts in case writing to test case html log failsSiri Hansen
Errors are printed to unexpected_io log.
2013-02-07Update primary bootstrapBjörn Gustavsson
2013-02-07Merge branch 'bjorn/compiler/dialyzer-warnings'Björn Gustavsson
* bjorn/compiler/dialyzer-warnings: compile: Eliminate warnings for unmatched return values beam_receive: Eliminate dialyzer warning for unmatched return beam_validator: Eliminate dialyzer warnings for unmatched returns
2013-02-06Update primary bootstrapBjörn Gustavsson
2013-02-06Merge branch 'bjorn/stdlib/erl_lint-coverage'Björn Gustavsson
* bjorn/stdlib/erl_lint-coverage: Test calling deprecated or removed functions Test deprecating list_to_atom/1 to cover more code Cover binary syntax errors and warnings Remove unused error message {bittype_mismatch,_,_,_} Remove unused error message for importing an auto-imported BIF Remove the error message for future reserved keyword Test a few more kinds of illegal guard expressions Remove error handling for calling a BIF that is not auto-imported Provoke basic semantic errors to improve test coverage
2013-02-06Merge branch 'nox/fix-seq-opt/OTP-10818'Fredrik Gustafsson
* nox/fix-seq-opt/OTP-10818: Add two tests for unused multiple values in effect context Forbid multiple values in Core Erlang sequence arguments
2013-02-06Merge branch 'mh/duplicate_name_error_message/OTP-10797'Fredrik Gustafsson
* mh/duplicate_name_error_message/OTP-10797: Slightly nicer error message when node start fails due to duplicate name
2013-02-06Merge branch 'fredrik/tools/version_bumps'Fredrik Gustafsson
* fredrik/tools/version_bumps: Bumped version number
2013-02-06Bumped version numberFredrik Gustafsson
2013-02-06erts: Increase length of well formed header names from {packet,http}Sverker Eriksson
To ease matching of unrecognized header field names we convert them from case insensitive to the format Sec-Websocket-Version with capital letters only first and after hyphens. Earlier only header names up to 20 characters were converted to this format due to internal buffer limitation. Raising this limit to 50 is a pragmatic solution for existing long header names such as Sec-Websocket-Version, while valid header names longer than 50 characters are not very probable.
2013-02-06compile: Eliminate warnings for unmatched return valuesBjörn Gustavsson
2013-02-06beam_receive: Eliminate dialyzer warning for unmatched returnBjörn Gustavsson
2013-02-06beam_validator: Eliminate dialyzer warnings for unmatched returnsBjörn Gustavsson
The assert_fls/2 and assert_type/3 functions both return the Vst passed to them, but all callers ignore the return value. Given the name of the functions, they are not expected to return anything. Make it so by changing the return value to 'ok'. There are two calls to bsm_get_context/2 used only to validate that the match context is valid. Call bsm_validate_context/2 instead. In bsm_validate_context/2, explicitly match the return value of bsm_get_context/2 to '_' to make it clear that it is not used.
2013-02-06Prepare releaseErlang/OTP
2013-02-06Merge branch 'bjorn/asn1/open-type-error/OTP-10805' into maint-r15Erlang/OTP
* bjorn/asn1/open-type-error/OTP-10805: asn1_erl_nif: Correct broken length encoding asn1_SUITE: Mend broken test_modified_x420/1
2013-02-06Merge branch 'bjorn/asn1/extension-addition-groups/OTP-10811' into maint-r15Erlang/OTP
* bjorn/asn1/extension-addition-groups/OTP-10811: Fix a bug for multiple extension addition groups
2013-02-06Merge branch 'bjorn/asn1/test-cases' into maint-r15Erlang/OTP
* bjorn/asn1/test-cases: Don't run testX420/1 on old slow Sparc systems testX420: Pass Options to the ASN.1 compiler
2013-02-06Don't run testX420/1 on old slow Sparc systemsBjörn Gustavsson
One and a half hour is not enough for it to finish.
2013-02-06testX420: Pass Options to the ASN.1 compilerBjörn Gustavsson
When the caller passed the 'der' option, it was ignored.
2013-02-05Merge branch 'bmk/snmp/snmp4222_integration/r15' into ↵Micael Karlberg
bmk/snmp/snmp4231_integration/r16 Conflicts: lib/snmp/doc/src/notes.xml lib/snmp/src/app/snmp.appup.src lib/snmp/vsn.mk
2013-02-05Merge branch 'bmk/snmp/compiler/forward_table_indexes/r15/OTP-10808' into ↵Micael Karlberg
bmk/snmp/snmp4222_integration/r15
2013-02-05Merge branch ↵Micael Karlberg
'bmk/snmp/compiler/handling_import_of_BITS_in_mibs/r15/OTP-10799' into bmk/snmp/snmp4222_integration/r15
2013-02-05[snmp/compiler] Improved debug printoutsMicael Karlberg
2013-02-05[snmp/compiler] Add test case and test mibMicael Karlberg
2013-02-05[snmp/compiler] Proper release nodesMicael Karlberg
2013-02-05[snmp/compiler] Add the mib (ALARM-MIB)Micael Karlberg
2013-02-05[snmp/compiler] MIB compiler did not handle forward index refMicael Karlberg
The MIB compiler could not handle a table index refering to an object defined later in the MIB.
2013-02-05[snmp/compiler] Added test case for BITS importMicael Karlberg
2013-02-05Merge branch 'jv/cover-patches/OTP-10778'Fredrik Gustafsson
* jv/cover-patches/OTP-10778: Fix a bug in cover when used with no_auto_import Ensure cover keeps the proper file source cover now relies on the compile info to find file sources
2013-02-04[test_server] Don't write unicode strings to latin1 log filesSiri Hansen
The unicode update of test_server for R16A introduced a few potential errors when logging to files. Sometimes ~tp or ~ts was used for formatting also when writing to files that were not opened with the {encoding,utf8} option. If then the argument contained unicode characters above 255, the file descriptor would crash. This has been corrected by the following modifications: * Since the 'unexpected_io' log file is used only when the test case HTML file is not available (e.g. between test cases), this file is now also a HTML file and as other test_server HTML logs it is always UTF-8 encoded * Since it is possible to change which information is going to which log file (with test_server_ctrl:set_levels/3), we do not have full control over which information is written to which file. This means that any printout could be written to the 'major' log file (suite.log), which was earlier encoded as latin1. To avoid crashing this file descriptor due to unicode strings, the 'major' log file is now also encoded in UTF-8 (possible incopatibility). * The cross_cover.info file is no longer a text file which can be read with file:consult/1, instead it is written as a pure binary file using term_to_binary when writing and binary_to_term when reading. * The encoding of the file named 'last_name', which only content is the path to the last run.<timestamp> directory, is now dependent on the file name mode of the VM. If file names are expected to be unicode, then the 'last_name' file is UTF-8 encoded, else it is latin1 encoded. Also, ~tp is changed back to ~p unless it is somehow likely that the argument includes strings. It is not obvious that this is the correct thing to do, but some decission had to be taken...
2013-02-04asn1_erl_nif: Correct broken length encodingBjörn Gustavsson
The ber_bin_v2 backend calls a NIF function to decode all tags and lengths. Even open types that should not be decoded will also be decoded, which makes it necessary to later re-encode the data using a NIF function. The NIF function incorrectly encoded lengths.