aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2011-11-07beam_asm: Fix broken NewIndex in fun entriesBjörn Gustavsson
The calculation of the NewIndex field in fun entries is broken: the sys_pre_expand and v3_kernel modules keep separate index counters starting at zero; thus there is no guarantee that each fun within a module will have its own unique NewIndex. We don't really need the NewIndex any more (see below), but since we do need the NewUniq field, we should fix NewIndex for cleanliness sake. The simplest way is to assign NewIndex as late as possible, namely in beam_asm, and to set it to the same value as Index. Historical Note: Why NewIndex Was Introduced There was once an idea that the debugger should be able to interpret only a single function in a module (for speed). To make sure that interpreted funs could be called from BEAM code and vice versa, the fun identification must be visible in the abstract code. Therefore a NewIndex field was introduced in each fun in the abstract code. However, it turned out that interpreting single functions does not play well with aggressive code optimization. For example, in this code: f() -> X = 1, fun() -> X+2 end. the variable X will seem to be free in the fun, but an aggressive optimizer will replace X with 1 in the fun; thus the fun will no longer have any free variables. Therefore, the debugger will always interpret entire modules.
2011-11-07beam_asm: Strenghten the calculation of Uniq for funsBjörn Gustavsson
Funs are identified by a triple, <Module,Uniq,Index>, where Module is the module name, Uniq is a 27 bit hash value of some intermediate representation of the code for the fun, and index is a small integer. When a fun is loaded, the triple for the fun will be compared to previously loaded funs. If all elements in the triple in the newly loaded fun are the same, the newly loaded fun will replace the previous fun. The idea is that if Uniq are the same, the code for the fun is also the same. The problem is that Uniq is only based on the intermediate representation of the fun itself. If the fun calls local functions in the same module, Uniq may remain the same even if the behavior of the fun has been changed. See http://erlang.org/pipermail/erlang-bugs/2007-June/000368.htlm for an example. As a long-term plan to fix this problem, the NewIndex and NewUniq fields was added to each fun in the R8 release (where NewUniq is the MD5 of the BEAM code for the module). Unfortunately, it turns out that the compiler does not assign unique value to NewIndex (if it isn't tested, it doesn't work), so we cannot use the <Module,NewUniq,NewIndex> triple as identification. It would be possible to use <Module,NewUniq,Index>, but that seems ugly. Therefore, fix the problem by making Uniq more unique by taking 27 bits from the MD5 for the BEAM code. That only requires a change to the compiler. Also update a test case for cover, which now fails because of the stronger Uniq calculation. (The comment in test case about why the Pid2 process survived is not correct.)
2011-11-07EEP-23: Allow variables in fun M:F/ABjörn Gustavsson
Currently, the external fun syntax "fun M:F/A" only supports literals. That is, "fun lists:reverse/1" is allowed but not "fun M:F/A". In many real-life situations, some or all of M, F, A are not known until run-time, and one is forced to either use the undocumented erlang:make_fun/3 BIF or to use a "tuple fun" (which is deprecated). EEP-23 suggests that the parser (erl_parse) should immediately transform "fun M:F/A" to "erlang:make_fun(M, F, A)". We have not followed that approach in this implementation, because we want the abstract code to mirror the source code as closely as possible, and we also consider erlang:make_fun/3 to be an implementation detail that we might want to remove in the future. Instead, we will change the abstract format for "fun M:F/A" (in a way that is not backwards compatible), and while we are at it, we will move the translation from "fun M:F/A" to "erlang:make_fun(M, F, A)" from sys_pre_expand down to the v3_core pass. We will also update the debugger and xref to use the new format. We did consider making the abstract format backward compatible if no variables were used in the fun, but decided against it. Keeping it backward compatible would mean that there would be different abstract formats for the no-variable and variable case, and tools would have to handle both formats, probably forever. Reference: http://www.erlang.org/eeps/eep-0023.html
2011-11-07OTP-9683Ingela Anderton Andin
Merge branch 'ssl-cbc-fix' * ssl-cbc-fix: fix handling of block_decipher/5 failure
2011-11-04Minor improvements to the meas tools.Micael Karlberg
OTP-9604 Merge branch 'bmk/megaco/20111003/improving_mstone1/OTP-9604' into bmk/megaco/r15_integration Conflicts: lib/megaco/doc/src/notes.xml
2011-11-04The profiling test tool has been rewritten.Micael Karlberg
H�kan Mattsson. OTP-9679 Merge branch 'bmk/megaco/improving_profiling_tool/OTP-9679' into bmk/megaco/r15_integration
2011-11-04Updated release notes and appup file.Micael Karlberg
OTP-9679
2011-11-04beam_type: Improve FP optimizations in the presence of line numbersBjörn Gustavsson
Allow line/1 instructions to be part of a sequence of floating point instructions to avoid outputting fclearerror / fcheckerror around every floating point instruction.
2011-11-02Reference manual: Improve the documentation for external funsBjörn Gustavsson
2011-11-02Test calling a parameterized module within a funBjörn Gustavsson
It is tempting to transform code such as: fun(X) -> M:foo(X) end to: fun M:foo/1 Unfortunately, that transformation is not safe if M happens to be a parameterized module. Add a test case so that we don't attempt to do such an optimization in the future.
2011-11-02beam_loader: Support external funs in the literal poolBjörn Gustavsson
A future release of the compiler might want to treat external funs as literals. Make sure that the loader can cope with an export entry being created from both an entry in the literal pool and from the export table (i.e. if an external fun refers to an exported function in the same module).
2011-11-02beam_load.c: Clarify error message when loading unsupported BEAM filesBjörn Gustavsson
Make it clear for the user what has happened and how to fix it when an attempt is made to load a BEAM file containing new instructions that the current run-time system cannot handle. Suggested-by: Thomas Lindgren
2011-11-02Fix re:split spec not to accept option 'global'Shunichi Shinohara
2011-11-01Skipping the dist test case. Needs a major re-write (sometime).Micael Karlberg
2011-11-01Merge branch 'lukas/kernel/tc_fixes'Lukas Larsson
* lukas/kernel/tc_fixes: Kill nodes inbetween tests
2011-11-01Merge branch 'rc/remote-shell-completion'Henrik Nord
OTP-9673
2011-11-01Merge branch 'lukas/erts/large_float_cmp/OTP-9497'Lukas Larsson
* lukas/erts/large_float_cmp/OTP-9497: Update documentation after changes in integer and float comparison Do small optimisation on platforms with 32 bit Eterm Add tests for equality checking Optimize comparison of huge floats and smaller bignums Add tests for comparing large floats and small bignums Cleanup double_to_bignum conversion code Update size of tmp cmp bignum buffer Expand tests for float and number comparison Update heauristic to work on halfword Add heauristics bignum vs float checks Optimise bugnum and small comparison Add float vs integer comparison tests Update integer and floating point number comparisons
2011-11-01Merge branch 'lukas/megaco/remove_driver_warning/OTP-9672'Lukas Larsson
* lukas/megaco/remove_driver_warning/OTP-9672: Remove the warning that driver option is replaced by nif
2011-10-31erts: Fix memory leak of enif_inspect_* on independent environmentSverker Eriksson
Affects enif_inspect_iolist_as_binary() on iolists and enif_inspect_binary() on byte-unaligned binaries. Also need to allocate inspection buffers in ERTS_ALC_T_NIF for process independent environments, as we don't know when and where the environment will be freed.
2011-10-28Handle undefined pid when reporting error from supervisorSiri Hansen
2011-10-28Merge branch 'siri/observer/ttb-test-cleanup-slave-nodes/OTP-9644'Siri Hansen
* siri/observer/ttb-test-cleanup-slave-nodes/OTP-9644: Adjust ttb_SUITE to work better on windows Cleanup after testcases in ttb_SUITE
2011-10-28Merge branch 'siri/observer/close-ip-to-file-trace-port/OTP-9665'Siri Hansen
* siri/observer/close-ip-to-file-trace-port/OTP-9665: Close ip_to_file trace port in ttb:stop
2011-10-27erts: Make erl_nif.h compile with gcc on WindowsSverker Eriksson
and some added comments
2011-10-27Remove unused */doc/src/make.dep filesBjörn Gustavsson
These dependency files was once used when building the documentation, but are no longer needed.
2011-10-27doc Makefiles: Eliminate DOCSUPPORT ifdefsBjörn Gustavsson
Some applications still have support for an ancient documentation build system. Eliminate the DOCSUPPORT define in otp.mk.in and the not taken arm of the ifdefs in the Makefiles.
2011-10-27Merge branch 'bjorn/eliminate-regexp-usage'Björn Gustavsson
* bjorn/eliminate-regexp-usage: erl_tidy: Eliminate two references to 'regexp' in the documentation erts/z_SUITE: Eliminate use of deprecated regexp module erts/nt_SUITE: Eliminate use of deprecated regexp module erl_html_tools: Eliminate mention of deprecated regexp module erl_interface tests: Eliminate use of deprecated regexp module tools test suite: Eliminate compilation warnings for the eed module tools test suite: Eliminate use of deprecated regexp module xmerl test suite: Eliminate use of deprecated regexp module appmon: Eliminate use of deprecated regexp module tv: Eliminate use of deprecated regexp module gs: Eliminate use of deprecated regexp module inviso: Eliminate use of deprecated regexp module
2011-10-27erl_tidy: Eliminate two references to 'regexp' in the documentationBjörn Gustavsson
2011-10-27erts/z_SUITE: Eliminate use of deprecated regexp moduleBjörn Gustavsson
2011-10-27erts/nt_SUITE: Eliminate use of deprecated regexp moduleBjörn Gustavsson
2011-10-27erl_html_tools: Eliminate mention of deprecated regexp moduleBjörn Gustavsson
2011-10-27erl_interface tests: Eliminate use of deprecated regexp moduleBjörn Gustavsson
2011-10-27tools test suite: Eliminate compilation warnings for the eed moduleBjörn Gustavsson
2011-10-27tools test suite: Eliminate use of deprecated regexp moduleBjörn Gustavsson
Also extend the test suite so that the changed code will be executed.
2011-10-27xmerl test suite: Eliminate use of deprecated regexp moduleBjörn Gustavsson
2011-10-27Close ip_to_file trace port in ttb:stopSiri Hansen
This is a relay port opened from the IP trace client when tracing diskless nodes. The port was not closed properly in ttb:stop, which caused problems on windows since the file could not be moved to the upload directory before the file descriptor was closed.
2011-10-27Adjust ttb_SUITE to work better on windowsSiri Hansen
There is a problem with long paths on windows, which causes some of the ttb logs in this suite not to be created. To go around this, the original priv_dir from the Config is no longer used for writing the logs. Instead a new priv_dir is created in the data_dir - which makes the path much shorter. There is also a problem caused by the lower resolution of the system clock on windows. It makes the test cases for sorting trace messages fail. To get around this a sleep of 2 ms is added in "appropriate places", and also the messages sent between client and server when creating the trace log for these test cases is now better synched. The cleanup functions, which terminate slave nodes, was called in end_per_testcase. However, it seems to be a bug in the test_server which causes this to hang if the test case failed with a timetrap_timeout. Workaround for this is to do the cleanup in init_per_testcase instead - i.e. make sure that nodes that are to be started by the test case do not already live when the test case starts.
2011-10-27Cleanup after testcases in ttb_SUITESiri Hansen
Slave nodes were earlier stopped inside each test case. If a test case failed before this point, a slave node would survive and it might interfere with the next test case causing multiple failures. This commit moves the stopping of slave nodes out to a separate function for each test case - called during end_per_testcase. A minor correction is also done in ttb:ensure_no_overloaded_nodes - the reply message sent back from the ttb process is tagged so only the expected message will be picked from the message queue. Otherwise, for instance nodedown messages from the monitoring of slave nodes (by the test cases) could be received here. Finally, the sleep timer when waiting for trace messages to arrive over tcp/ip is extended a bit since test cases sometimes failed with missing trace messages here.
2011-10-27Merge branch ↵Siri Hansen
'siri/runtime_tools/dbg-flush-trace-file-driver-before-stop/OTP-9651' * siri/runtime_tools/dbg-flush-trace-file-driver-before-stop/OTP-9651: Flush trace file driver before stopping dbg
2011-10-26erts-hipe: Change THE_NON_VALUE for HiPE enabled debug emulatorSverker Eriksson
This is a work-around as there are hipe BIFs that return untagged integers that may be intepreted as THE_NON_VALUE (24). Hipe bifs that return offsets as untagged integers: hipe_bs_put_utf8 hipe_bs_put_utf16be hipe_bs_put_utf16le Hipe bifs that return raw pointers: hipe_find_na_or_make_stub hipe_nonclosure_address
2011-10-26erts-hipe: Enable debug compiled hipe-VM with lock checkerSverker Eriksson
Add hipe_debug_bif_wrapper() as a wrapper for every BIF called by native code.
2011-10-26erts-hipe: Rename fail_bif_interface_0 to standard_bif_interface_0Sverker Eriksson
2011-10-26erts-hipe: Deliberate leak of native fun entriesSverker Eriksson
This is a workaround as hipe code upgrade/unloading does not work properly.
2011-10-26erts-hipe: Fix new trap conventions for x86, amd64 and ppcSverker Eriksson
2011-10-26Store the trap address in p->iBjörn Gustavsson
For cleanliness, store the trap address in p->i instead of in p->def_arg_reg[3].
2011-10-26Store the trap arguments in the X register arrayBjörn Gustavsson
Store arguments for a trap in the X register array to allow traps to have any number of arguments.
2011-10-26erts-hipe: Make some primops use new BIF calling conventionSverker Eriksson
These primops use the standard_bif_interface_X macros in hipe_bif_list.m4 and must therefor be implemented as bifs for things to work. Maybe there is room for optimization here to call the primops more directly with arguments in registers without having to push them on stack to emulate bif calls.
2011-10-26erts-hipe: Adapt generated BIF wrappers for new calling conventionSverker Eriksson
x86 and amd64: Push BIF__ARGS array on C-stack. ppc, sparc and arm: Write BIF__ARGS array to P->def_arg_reg[] Just the simplest solution with limited assembler knowledge, probably room for improvements.
2011-10-26appmon: Eliminate use of deprecated regexp moduleBjörn Gustavsson
2011-10-26tv: Eliminate use of deprecated regexp moduleBjörn Gustavsson
2011-10-26gs: Eliminate use of deprecated regexp moduleBjörn Gustavsson