aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
AgeCommit message (Collapse)Author
2011-11-13Merge branch 'rickard/generic-thr-queue/OTP-9632'Rickard Green
* rickard/generic-thr-queue/OTP-9632: Use generic lock-free queue for async threads Use generic lock-free queue for misc aux work Implement generic lock-free queue
2011-11-13Merge branch 'rickard/thr-progress-block/OTP-9631'Rickard Green
* rickard/thr-progress-block/OTP-9631: Replace system block with thread progress block
2011-11-13Merge branch 'rickard/alloc-opt/OTP-7775'Rickard Green
* rickard/alloc-opt/OTP-7775: Optimize memory allocation Conflicts: erts/aclocal.m4 erts/emulator/hipe/hipe_bif_list.m4 erts/preloaded/ebin/erl_prim_loader.beam erts/preloaded/ebin/erlang.beam erts/preloaded/ebin/init.beam erts/preloaded/ebin/otp_ring0.beam erts/preloaded/ebin/prim_file.beam erts/preloaded/ebin/prim_inet.beam erts/preloaded/ebin/prim_zip.beam erts/preloaded/ebin/zlib.beam
2011-11-13Make sure only one thread exits the runtime systemRickard Green
The runtime system crashed if more than one thread tried to exit the runtime system at the same time.
2011-11-13Use critical sections as mutex implementation on WindowsRickard Green
Windows native critical sections are now used internally in the runtime system as mutex implementation. This since they perform better under extreme contention than our own implementation.
2011-11-13Use generic lock-free queue for async threadsRickard Green
Queues used for communication between async threads and scheduler threads have been replaced with lock-free queues. Drivers using the driver_async functionality are not automatically locked to the system anymore, and can be unloaded as any dynamically linked in driver. Scheduling of ready async jobs is now also interleaved in between other jobs. Previously all ready async jobs was performed at once.
2011-11-13Use generic lock-free queue for misc aux workRickard Green
2011-11-13Implement generic lock-free queueRickard Green
The implementation of an ERTS internal, generic, many to one, lock-free queue for communication between threads. The many to one scenario is very common in ERTS, so it can be used in a lot of places in the future. Changing to this queue from a lock based queue, however, often requires some redesigning. This since we have often used the lock of the queue to protect other information too.
2011-11-13Replace system block with thread progress blockRickard Green
The ERTS internal system block functionality has been replaced by new functionality for blocking the system. The old system block functionality had contention issues and complexity issues. The new functionality piggy-backs on thread progress tracking functionality needed by newly introduced lock-free synchronization in the runtime system. When the functionality for blocking the system isn't used there is more or less no overhead at all. This since the functionality for tracking thread progress is there and needed anyway.
2011-11-13Optimize memory allocationRickard Green
A number of memory allocation optimizations have been implemented. Most optimizations reduce contention caused by synchronization between threads during allocation and deallocation of memory. Most notably: * Synchronization of memory management in scheduler specific allocator instances has been rewritten to use lock-free synchronization. * Synchronization of memory management in scheduler specific pre-allocators has been rewritten to use lock-free synchronization. * The 'mseg_alloc' memory segment allocator now use scheduler specific instances instead of one instance. Apart from reducing contention this also ensures that memory allocators always create memory segments on the local NUMA node on a NUMA system.
2011-11-10erts: Teach VM to reallocate beam catch tableBjörn-Egil Dahlberg
Previously this table were statically allocated to 16*1024 entries. Now the default size is 1024 entries but that is doubled each time the limit is reached. Theoretical upper limit is 2^26 entries (the remaining bits on a catch datatype) in a 32 bit system.
2011-11-09Merge branch 'sverk/bif-args/OTP-9662'Sverker Eriksson
* sverk/bif-args/OTP-9662: erts,hipe: Limited support for hipe cross compilation erts-hipe: Change THE_NON_VALUE for HiPE enabled debug emulator erts-hipe: Enable debug compiled hipe-VM with lock checker erts-hipe: Rename fail_bif_interface_0 to standard_bif_interface_0 erts-hipe: Deliberate leak of native fun entries erts-hipe: Fix new trap conventions for x86, amd64 and ppc Store the trap address in p->i Store the trap arguments in the X register array erts-hipe: Make some primops use new BIF calling convention erts-hipe: Adapt generated BIF wrappers for new calling convention erts-hipe: Remove obscuring macros in generated assembler code erts-hipe: Make hipe enabled emulator compile with new BIF calls Simplify the instructions for calling BIFs Change the calling convention for BIFs Use the proper macros in all BIFs Conflicts: erts/emulator/beam/bif.h erts/emulator/beam/erl_bif_info.c
2011-11-09Merge branch 'sverk/enif_inspect-memleak/OTP-9668'Sverker Eriksson
* sverk/enif_inspect-memleak/OTP-9668: erts: Fix memory leak of enif_inspect_* on independent environment
2011-11-08Merge branch 'bjorn/create-less-garbage'Björn Gustavsson
* bjorn/create-less-garbage: Optimize filename:basename/1 to produce less garbage Optimize filename:extension/1 to produce less garbage sys.c for Unix: Undo caching of utsname in os_flavor() Pre-build the tuples returned by os:type/0 and os:version/0
2011-11-07Merge branch 'egil/fix-compiler-warnings'Björn-Egil Dahlberg
* egil/fix-compiler-warnings: erts: Remove unused variable in enif_make_binary erts: Remove debug variable in list_to_binary erts: Remove cp on exiting and trapping processes erts: Remove debug variables in erl_db erts: Remove dead code in efile_drv erts: Remove lock_check debug variables erts: Remove unused variable in ttsl_drv erts: "initialized" is only used with CHLDWTHR erts: remove debug variables in beam_bp
2011-11-07Merge branch 'ta/nif-variadic-funs'Henrik Nord
OTP-9675
2011-11-07erts: Remove unused variable in enif_make_binaryBjörn-Egil Dahlberg
2011-11-07erts: Remove debug variable in list_to_binaryBjörn-Egil Dahlberg
2011-11-07erts: Remove cp on exiting and trapping processesBjörn-Egil Dahlberg
2011-11-07erts: Remove debug variables in erl_dbBjörn-Egil Dahlberg
2011-11-07erts: Remove lock_check debug variablesBjörn-Egil Dahlberg
2011-11-07erts: remove debug variables in beam_bpBjörn-Egil Dahlberg
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-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-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-27erts: Make erl_nif.h compile with gcc on WindowsSverker Eriksson
and some added comments
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: 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-26Simplify the instructions for calling BIFsBjörn Gustavsson
Taking advantage of the new calling convention for BIFs, we only need one instruction to handle BIFs with any number of arguments. This change eliminates the limit of three arguments for BIFs, but traps are still limited to three arguments.
2011-10-26Change the calling convention for BIFsBjörn Gustavsson
The current calling convention for BIFs makes it necessary to handle each arity specially, since each argument for the BIF also becomes an argument for the C function implementing the BIF, which makes it hard to allow BIFs with any number of arguments. Change the calling convention for BIFs, so that BIF arguments are passed in an array to the C function implementing the BIF.
2011-10-26Use the proper macros in all BIFsBjörn Gustavsson
As a preparation for changing the calling convention for BIFs, make sure that all BIFs use the macros. Also, eliminate all calls from one BIF to another, since that also breaks the calling convention abstraction.
2011-10-20Merge branch 'bjorn/unicode-noncharacters/OTP-9624'Björn Gustavsson
* bjorn/unicode-noncharacters/OTP-9624: Allow noncharacter code points in unicode encoding and decoding
2011-10-18erts: convert variadic nif funs into inline funsTuncer Ayaz
2011-10-18Merge branch 'fm/enif_is_number'Henrik Nord
* fm/enif_is_number: Add NIF function enif_is_number Conflicts: erts/emulator/beam/erl_nif_api_funcs.h OTP-9629
2011-10-14Merge branch 'rickard/atomics-api/OTP-9014' and OTP_R14B04Rickard Green
Conflicts: erts/aclocal.m4 erts/emulator/beam/erl_db.c erts/emulator/sys/win32/sys.c erts/include/internal/ethread_header_config.h.in
2011-10-13Allow noncharacter code points in unicode encoding and decodingBjörn Gustavsson
The two noncharacter code points 16#FFFE and 16#FFFF were not allowed to be encoded or decoded using the unicode module or bit syntax. That causes an inconsistency, since the noncharacters 16#FDD0 to 16#FDEF could be encoded/decoded. There is two ways to fix that inconsistency. We have chosen to allow 16#FFFE and 16#FFFF to be encoded and decoded, because the noncharacters could be useful internally within an application and it will make encoding and decoding slightly faster. Reported-by: Alisdair Sullivan
2011-10-11Do small optimisation on platforms with 32 bit EtermLukas Larsson
On 32 bit we know that a comparison with a lossfull double and a short will always give the float is being superior. So therefore we only have to check the sign on the double.
2011-10-11Optimize comparison of huge floats and smaller bignumsLukas Larsson
2011-10-11Cleanup double_to_bignum conversion codeLukas Larsson
2011-10-11Update size of tmp cmp bignum bufferLukas Larsson
This is needed for use on 32 bit with very large floats.
2011-10-11Update heauristic to work on halfwordLukas Larsson
2011-10-11Add heauristics bignum vs float checksLukas Larsson
These tests are useful when the difference between the bignum and float is larger than one bignum segment.
2011-10-11Optimise bugnum and small comparisonLukas Larsson
As it is possible to assume that bignums are bigger than smalls, we can just check the sign of the bignum.
2011-10-11Update integer and floating point number comparisonsLukas Larsson
For floating point values which are greater than 9007199254740990.0 or smaller than -9007199254740990.0, the floating point numbers are now converted to integers during comparison with an integer. This makes number comparisons transitive for large floating point numbers.
2011-10-11Simplify transformations of gc_bif[123] instructionsBjörn Gustavsson
Each gc_bif[123] instruction must have both a transformation in ops.tab and special code in gen_guard_bif[123](). Rewrite it to do most of the work in gen_guard_bif[123]().
2011-10-11Refactor 'too_old_compiler' handlingBjörn Gustavsson
In the handling of generic instructions, we used to always test whether the instruction was 'too_old_compiler' and abort loading with a special error message. Refactor the code so that we only do test if we an error has occurred. That will allow us to make the test more expensive in the future, allowing us to customize error messages for certain opcode without any cost in the successful case.