aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_bif_load.c
AgeCommit message (Collapse)Author
2013-02-22Update copyright yearsBjörn-Egil Dahlberg
2013-02-18erts: Fix code:is_module_nativeSverker Eriksson
code:is_module_native returned false for hipe compiled module if the first function in the module was a BIF stub
2013-01-28erts: Fix ASSERT crash in erts_try_seize_code_write_permissionSverker Eriksson
ASSERT(code_writing_process != c_p); The assert was actually harmless and could be removed as one solution. But I think it's better to keep it as a way to catch bugs that would otherwise lead to horrible deadlocks if a thread "forgets" to call erts_release_code_write_permission(). As a result erts_release_code_write_permission() must be called BEFORE resuming the suspended process.
2012-12-07Merge branch 'rickard/port-optimizations/OTP-10336' into ↵Rickard Green
rickard/r16/port-optimizations/OTP-10336 * rickard/port-optimizations/OTP-10336: Change annotate level for emacs-22 in cerl Update etp-commands Add documentation on communication in Erlang Add support for busy port message queue Add driver callback epilogue Implement true asynchronous signaling between processes and ports Add erl_drv_[send|output]_term Move busy port flag Use rwlock for driver list Optimize management of port tasks Improve configuration of process and port tables Remove R9 compatibility features Use ptab functionality also for ports Prepare for use of ptab functionality also for ports Atomic port state Generalize process table implementation Implement functionality for delaying thread progress from unmanaged threads Conflicts: erts/doc/src/erl_driver.xml erts/doc/src/erlang.xml erts/emulator/beam/beam_bif_load.c erts/emulator/beam/beam_bp.c erts/emulator/beam/beam_emu.c erts/emulator/beam/bif.c erts/emulator/beam/copy.c erts/emulator/beam/erl_alloc.c erts/emulator/beam/erl_alloc.types erts/emulator/beam/erl_bif_info.c erts/emulator/beam/erl_bif_port.c erts/emulator/beam/erl_bif_trace.c erts/emulator/beam/erl_init.c erts/emulator/beam/erl_message.c erts/emulator/beam/erl_port_task.c erts/emulator/beam/erl_process.c erts/emulator/beam/erl_process.h erts/emulator/beam/erl_process_lock.c erts/emulator/beam/erl_trace.c erts/emulator/beam/export.h erts/emulator/beam/global.h erts/emulator/beam/io.c erts/emulator/sys/unix/sys.c erts/emulator/sys/vxworks/sys.c erts/emulator/test/port_SUITE.erl erts/etc/unix/cerl.src erts/preloaded/ebin/erlang.beam erts/preloaded/ebin/prim_inet.beam erts/preloaded/src/prim_inet.erl lib/hipe/cerl/erl_bif_types.erl lib/kernel/doc/src/inet.xml lib/kernel/src/inet.erl
2012-12-03Generalize process table implementationRickard Green
2012-10-05Merge branch 'sverk/code-load-refactor-later-op'Sverker Eriksson
* sverk/code-load-refactor-later-op: erts: Fix faulty lock check assert erts: Refactor naming regarding code_write_permission erts: Refactor tracing to use erts_schedule_thr_prgr_later_op erts: Allow thr_prgr_later_op to reschedule erts: Refactor code loading to use erts_schedule_thr_prgr_later_op erts: Remove some compiler warnings
2012-08-31erts: Refactor code loading to use erts_schedule_thr_prgr_later_opSverker Eriksson
2012-08-31Merge branch 'maint'Björn-Egil Dahlberg
Conflicts: lib/diameter/autoconf/vxworks/sed.general xcomp/README.md
2012-08-31Update copyright yearsBjörn-Egil Dahlberg
2012-06-25Don't go to single-scheduler mode when managing breakpointsBjörn Gustavsson
Calls to erlang:set_trace_pattern/3 will no longer block all other schedulers. We will still go to single-scheduler mode when new code is loaded for a module that is traced, or when loading code when there is a default trace pattern set. That is not impossible to fix, but that requires much closer cooperation between tracing BIFs and the loader BIFs.
2012-06-20Merge branch 'maint'Rickard Green
* maint: Fix faulty use of thread progress in handle_aux_work() Conflicts: erts/emulator/beam/erl_process.c Needed modifications: erts/emulator/beam/beam_bif_load.c
2012-06-04Merge branch 'maint'Lukas Larsson
* maint: Remove stale code for hybrid heap and incremental GC Remove the hipe_bifs:show_message_area/0 BIF Remove support for erlang:system_info(global_heaps_size) Remove the erlang:garbage_collect_message_area/0 BIF Remove workarounds for hybrid and shared heaps in test suites Conflicts: erts/doc/src/erlang.xml erts/emulator/beam/erl_message.c erts/emulator/beam/erl_process.c erts/emulator/beam/erl_process.h erts/emulator/hipe/hipe_bif2.tab lib/hipe/cerl/erl_bif_types.erl
2012-05-10Remove stale code for hybrid heap and incremental GCBjörn Gustavsson
The hybrid heap emulator was last working in the non-SMP R11B run-time system. When the constant pools were introduced in R12B, the hybrid heap emulator was not updated to handle them. At this point, the harm from reduced readability of the code is greater than any potential usefulness of keeping the code.
2012-03-06erts: Fix memory leak in code loadingSverker Eriksson
All magic binaries returned by prepare_loading/2 was leaking. prepare_loading/2 left the reference count as 2 of the magic binary when it should be 1 (only owned by the returned term).
2012-02-24erts: Set correct default tracing when loading codeSverker Eriksson
Default trace (on_load) was lost in commit 64bcf5db63d73fe when load_module/2 was split.
2012-02-23erts: Use correct macro for "yield-return"Sverker Eriksson
2012-02-23erts: Refactor code loading with renamingSverker Eriksson
Rename lock_code_ix as seize_code_write_permission. Don't want to call it a "lock" as it can be held between schedulings and different threads and is not managed by lock checker. Rename "activate" staging as "commit" staging. Why not be consistent and use git terminology all the way.
2012-02-23erts: Switch order between code_ix lock and thread blockingSverker Eriksson
Make for simpler code when we just can block threads and continue without having to release code_ix lock and repeat code lookups to avoid race.
2012-02-21erts: Fix race bug in finish_after_on_loadSverker Eriksson
Must block system before looking up module to not race with other "code upgrader".
2012-02-21erts: Activate staged code in a thread safe waySverker Eriksson
Activation of staged code is scheduled for a later moment when all schedulers have done a full memory barrier. This allow them to read active code index while executing without any memory barriers at all.
2012-02-21erts: Suspend processes waiting for code_ix lockSverker Eriksson
This will prevent blocking entrire schedulers in the rare case when several processes are racing to load/upgrade/delete/purge code.
2012-02-21erts: Fix single threaded fallback in new BIF finish_loading_1Sverker Eriksson
Must "start staging" even when we go single threaded.
2012-02-21Break apart erlang:load_module/2 into two separate BIFsBjörn Gustavsson
Introduce two new BIFs, erlang:prepare_loading/2 and erlang:finish_loading/1, and re-implement erlang:load_module/2 in Erlang code. We have two reasons for doing this: * To facilitate suspending a process if another process is already doing code loading. * In the future, we can implement parallel and atomic loading of several modules. Atomic loading works except for modules with on_load handlers. Because of that issue, erlang:finish_loading/2 will currently only accept a list with a single magic binary.
2012-02-21Use magic binaries in erts_prepare_loading() and erts_finish_loading()Björn Gustavsson
2012-02-21erts: Cleanup non-blocking loadSverker Eriksson
2012-02-21erts: Fix tracing bug for new non-blocking loadSverker Eriksson
Made on_load-tracing always set after commit on active code_ix when system is still blocked. Bug caused cprof_SUITE:on_load to fail.
2012-02-21erts: Fallback to blocking upgrade when tracing is enabledSverker Eriksson
2012-02-21erts: Keep count of number of global traced functions per moduleSverker Eriksson
2012-02-21erts: Move number-of-breakpoint counter from code to Module structSverker Eriksson
The is a refactoring in preparation to add a counter in Module struct for export entry tracing. It is nicer if the two are kept together.
2012-02-21erts: Rename "loader" code_ix as "staging" code_ixSverker Eriksson
Staging is a better and more general name as does not necessary need to involve code loading (can be deletion, tracing, etc).
2012-02-21erts: Fix purge of module with loaded nif librarySverker Eriksson
Easy fallback solution that goes single threaded if the module to be purged has a loaded nif lib.
2012-02-21erts: Fix case of breakpoint when deleting moduleSverker Eriksson
2012-02-21erts: Call erts_export_consolidate automaticallySverker Eriksson
Renamed merge_secondary_table and called by export_start_load
2012-02-21First try at non-blocking code loading!Sverker Eriksson
Implemented some code_ix locks and commented calls to erts_smp_thr_progress_block()
2012-02-21BEAM loader: Break out handling of ranges into beam_ranges.cBjörn Gustavsson
Having the entire implementation of range handling (address table) in one source file will help when we'll need to update the ranges without stopping all schedulers in the next commit.
2012-02-21erts: Fix code_ix handling and locking for some more bifsSverker Eriksson
2012-02-21erts: Multiple module tables using code_ixSverker Eriksson
2012-02-21erts: Use several addresses in each ExportSverker Eriksson
2012-02-21erts: Multiple export tab's using code_ixSverker Eriksson
Still blocking code loading
2012-02-21erts: First stab at code_ix interface and beam_catches using itSverker Eriksson
Code loading still blocking
2012-02-21erts: Refactor Module structSverker Eriksson
2011-12-02Get cerl and distribution working in Win64Patrik Nyblom
Can still not setup -a, but cerl works.
2011-11-17Allow refc binaries in literal poolsBjörn Gustavsson
To simplify the implementation of literal pools (constant pools) for the R12 release, a shortcut was taken regarding binaries -- all binaries would be stored as heap binaries regardless of size. To allow a module containing literals to be unloaded, literal terms are copied when sent to another process. That means that huge literal binaries will also be copied if they are sent to another process, which could be surprising. Another problem is that the arity field in the header for the heap object may not be wide enough to handle big binaries. Therefore, bite the bullet and allow refc binaries to be stored in literal pools. In short, the following need to be changed: * Each loaded module needs a MSO list, linking all refc binaries in the literal pool. * When check_process_code/2 copies literals to a process heap, it must link each referenced binary into the MSO list for the process and increment the reference counter for the binary. * purge_module/1 must decrement the reference counter for each refc binary in the literal pool.
2011-11-17BEAM loader: Don't stop other schedulers until truly neededBjörn Gustavsson
The erlang:module_load/2 BIF will stop all other schedulers before it starts to process the BEAM file. That is not a problem when starting the Erlang/OTP system, since the start-up is mostly sequential. It is a problem, however, when big BEAM files are loaded in an already running system. After the refactoring in the previous commits, we can now do most of the processing of the BEAM file before we stop the other schedulers, so that we can minimize the time when only one scheduler will be running. Suggested-by: Bob Ippolito
2011-11-14BEAM loader: Clean up handling of error reasonsBjörn Gustavsson
There is no reason to have erts_load_module() return integer values, only to have the caller convert the values to atoms. Return the appropriate atom directly from the place where the error is generated instead. Return NIL if the module was successfully loaded.
2011-11-14Remove the useless -l optionBjörn Gustavsson
The -l option used to print information about modules being loaded, but now it prints very little information.
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-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-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-08-25Add erlang:check_old_code/1Björn Gustavsson
Add erlang:check_old_code/1 to quickly check whether a module has old code. If there is no old code, there is no need to call erlang:check_process_code/2 for all processes, which will save some time if there are many processes.