aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_nif.c
AgeCommit message (Collapse)Author
2017-01-12Support for dirty BIFsRickard Green
2016-11-29erts: Refactor BEAM_NIF_MIN_FUNC_SZSverker Eriksson
to be declared once in beam_load.h and get rid of #ifdef kludge.
2016-11-28Merge branch 'sverker/nif-entry-abi-compat'Sverker Eriksson
* sverker/nif-entry-abi-compat: erts: Fix code_SUITE:api_2_0,upgrade crash on win64 erts: Add tests of nif API 2.0 erts: Change nif_SUITE to use binaries for raw pointers erts: Use test groups to repeat for different APIs erts: Add testing of old nif API erts: Secure abi backward compat for tracer nifs erts: Mend broken checks in nif_SUITE
2016-11-23erts: Secure abi backward compat for tracer nifsSverker Eriksson
and simplify the code by handling the compatibility stuff at loading by creating modern struct copies in create_lib().
2016-11-23Merge branch 'maint'Rickard Green
* maint: Update etp-commands for dirty schedulers Fix scheduling of system tasks on processes executing dirty Fix call time tracing with dirty schedulers Fix send of exit signal to process executing dirty Fix dirty scheduler process priority Fix alloc-util hard-debug Silence debug warning when no beam jump table is used with dirty schedulers Fix check_process_code() when NifExport is in use Fix GC when NifExport is in use Fix saving of original arguments when rescheduling via NifExport Conflicts: erts/emulator/beam/beam_bif_load.c erts/emulator/beam/erl_nif.c
2016-11-23Merge branch 'rickard/nif-scheduling-fixes' into maintRickard Green
* rickard/nif-scheduling-fixes: Fix check_process_code() when NifExport is in use - OTP-14048 Fix GC when NifExport is in use - OTP-14049 Fix saving of original arguments when rescheduling via NifExport - OTP-14050
2016-11-22Fix check_process_code() when NifExport is in useRickard Green
2016-11-22Fix saving of original arguments when rescheduling via NifExportRickard Green
2016-11-22Merge branch 'maint'Sverker Eriksson
2016-11-22Merge branch 'sverker/erts/crash-dump-limit/OTP-14046' into maintSverker Eriksson
* sverker/erts/crash-dump-limit: erts: Add env variable ERL_CRASH_DUMP_BYTES erts: Add ErtsStrToSint64 erts: Refactor crash dumping with cbprintf erts: Add cbprintf for Callback Printing erts: Remove unused erl_crash_dump()
2016-11-17erts: Refactor crash dumping with cbprintfSverker Eriksson
Instead of passing around a file descriptor use a function pointer to facilitate more advanced backend write logic such as size limitation or compression.
2016-11-01erts: Add notsup error for load_nif/2 from hipe codeSverker Eriksson
2016-10-12Merge branch 'lukas/erts/beam_func_info_struct/OTP-13821'Lukas Larsson
* lukas/erts/beam_func_info_struct/OTP-13821: erts: Fix some dtrace related compile issues erts: Refactor rename Export.code[] to Export.beam[] erts: Improve printouts for some etp commands erts: Fix erts_debug:df with new func_info erts: Refactor find_function_from_pc to return MFA erts: Refactor out func_info into struct
2016-10-12erts: Refactor rename Export.code[] to Export.beam[]Sverker Eriksson
to avoid scary merge errors.
2016-10-12erts: Refactor find_function_from_pc to return MFALukas Larsson
2016-10-12erts: Refactor out func_info into structLukas Larsson
This commit adds two new structs to be used to represent erlang code in erts. ErtsCodeInfo is used to describe the i_func_info header that is part of all Export entries and the prelude of each function. This replaces all the BeamInstr * that were previously used to point to these locations. After this change the code should never use BeamInstr * with offsets to figure out different parts of the func_info header. ErtsCodeMFA is a struct that is used to descripe a MFA in code. It is used within ErtsCodeInfo and also in Process->current. All function that previously took Eterm * or BeamInstr * to identify a MFA now use the ErtsCodeMFA or ErtsCodeInfo where appropriate. The code has been tested to work when adding a new field to the ErtsCodeInfo struct, but some updates are needed in ops.tab to make it work.
2016-10-05Merge branch 'master' into sverker/master/load_nif-print-init-errorSverker Eriksson
2016-10-04erts: Print error code from failed NIF load/upgrade/reloadSverker Eriksson
in Text part of error tuple, like {error, {load, "Library load-call unsuccessful (606)}}
2016-09-19erts: Remove deprecated nif 'reload' featureSverker Eriksson
and instead let erlang:load_nif/2 return {error, {reload, _}} before even trying to load the library if a NIF library has already been successfully loaded for the calling module instance.
2016-09-15Merge branch 'maint'Björn Gustavsson
* maint: erts: Add nif_SUITE:t_on_load erts: Improve nif_SUITE:upgrade test Don't leak old code when loading a modules with an on_load function Conflicts: erts/preloaded/ebin/erts_code_purger.beam erts/preloaded/ebin/erts_internal.beam erts/preloaded/src/erts_code_purger.erl
2016-09-14Don't leak old code when loading a modules with an on_load functionBjörn Gustavsson
Normally, calling code:delete/1 before re-loading the code for a module is unnecessary but causes no problem. But there will be be problems if the new code has an on_load function. Code with an on_load function will always be loaded as old code to allowed it to be easily purged if the on_load function would fail. If the on_load function succeeds, the old and current code will be swapped. So in the scenario where code:delete/1 has been called explicitly, there is old code but no current code. Loading code with an on_load function will cause the reference to the old code to be overwritten. That will at best cause a memory leak, and at worst an emulator crash (especially if NIFs are involved). To avoid that situation, we will put the code with the on_load function in a special, third slot in Module. ERL-240
2016-09-09Merge branch 'maint'Rickard Green
* maint: Fix restore of 'current' field when rescheduled NIF completes
2016-09-09Fix restore of 'current' field when rescheduled NIF completesRickard Green
2016-08-31Merge branch 'maint'Rickard Green
* maint: Ensure correct mbuf_sz value in process structure
2016-08-30Ensure correct mbuf_sz value in process structureRickard Green
2016-08-29Merge branch 'maint'Rickard Green
* maint: Fix tracing of processes executing dirty Perform check_process_code while process is executing dirty Fix purge of code Reclaim literal area after purge has completed Separate literal area from code Conflicts: erts/emulator/beam/global.h
2016-08-29Merge branch 'rickard/ds-trace/OTP-13822' into maintRickard Green
* rickard/ds-trace/OTP-13822: Fix tracing of processes executing dirty
2016-08-29Fix tracing of processes executing dirtyRickard Green
2016-08-01erts: Refactor literal purge area argumentsBjörn-Egil Dahlberg
2016-08-01erts: Don't copy literals in enif_sendBjörn-Egil Dahlberg
2016-07-11erts: After a call to a tracer nif, reset htopLukas Larsson
This is needed in order for the heap to never contain any pointers to invalid memory. This is good for performance and debugging reasons.
2016-06-13erts: Allow enif_port_command in non-sched threadLukas Larsson
It has to be possible to send trace messages to a port from non-schedulers threads (specifically from the sys_msg_dispatcher).
2016-06-08Replace enif_is_on_dirty_scheduler() with enif_thread_type()Rickard Green
2016-06-01erts: Avoid literals in process independent ErlNifEnvSverker Eriksson
that would go undetected and cause havoc if module is purged.
2016-05-31Move dirty reduction count to erts_dirty_process_main()Rickard Green
2016-05-31Add dirty_process_main functionSteve Vinoski
Dirty schedulers only execute NIFs, so having them execute the full process_main function isn't necessary. Add dirty_process_main for dirty schedulers to execute instead. Add erts_pre_dirty_nif(), called when preparing to execute a dirty nif. Add more dirty NIF tests to verify that activities requiring the process main lock can succeed when the process is executing a dirty NIF.
2016-05-26Improve message allocation in enif_send()Rickard Green
2016-05-17Merge branch 'mikpe/otp-19-erts-integer-truncation-bugs/PR-1045/OTP-13606'Lukas Larsson
* mikpe/otp-19-erts-integer-truncation-bugs/PR-1045/OTP-13606: erl_unicode.c: fix integer truncation problems do not limit heap fragments to 4 giga-words erts_new_mso_binary(): do not truncate len Conflicts: erts/emulator/beam/erl_nif.c
2016-05-17erts: Fix bug when tracing in non-smp non-scheduler threadLukas Larsson
2016-05-13Merge branch 'egil/erts/nif-format_term/OTP-13580'Björn-Egil Dahlberg
* egil/erts/nif-format_term/OTP-13580: runtime_tools: Change erts_snprintf to enif_snprintf erts: Document enif_snprintf erts: Add tests for enif_snprintf erts: Add enif_snprintf Conflicts: erts/emulator/beam/erl_nif_api_funcs.h
2016-05-11Add better support for communication with a process executing dirty NIFRickard Green
- Termination of a process... - Modify trace flags of process... - Process info on process... - Register/unregister of name on process... - Set group leader on process... ... while it is executing a dirty NIF.
2016-05-11erts: Add enif_snprintfBjörn-Egil Dahlberg
* Add the capability to format erlang terms to a char buffer in nifs. * Bump NIF version to 2.11
2016-05-09Merge branch 'sverker/trace-send-receive-matchspec/OTP-13507'Sverker Eriksson
2016-05-05do not limit heap fragments to 4 giga-wordsMikael Pettersson
- struct erl_heap_fragment: use Uint for sizes - erl_nif.c: use size_t for sizes - erts_heap_frag_shrink(): remove now redundant cast
2016-05-04erts: Add Sender in 'receive' trace matchspecSverker Eriksson
All 'EXIT' and monitor messages are sent from 'system' Timeouts are "sent" from 'clock_service'
2016-05-04Reimplement -on_load()Björn Gustavsson
Load the module as old code; swap old and new code if the -on_load function succeeds. That way, a failed update attempt for a module that has an -on_load function will preserve the previous version of the code.
2016-04-29Merge branch 'egil/erts/tracing-support-lttng/OTP-13532'Björn-Egil Dahlberg
* egil/erts/tracing-support-lttng/OTP-13532: (28 commits) runtime_tools: User's guide to LTTng and dyntrace runtime_tools: Fix Dtrace build erts: Fix gc messages in tracer_SUITE erts: Fix gc messages in sensitive_SUITE erts: Fix gc messages in trace_port_SUITE tools: Update fprof tests tools: Update fprof with new gc traces runtime_tools: Update dyntrace_lttng_SUITE tests runtime_tools: Add 'return_to' for call tracing erts: Fix return_to trace callback erts: Update erl_tracer documentation erts: Fix erl_tracer documentation typos Update preloaded erl_tracer.beam erts: Update erl_tracer type specs runtime_tools: Add lttng dyntrace tests runtime_tools: Extend 'trace' and 'enabled' tracer callbacks erts: Extend 'enabled' and 'trace' tracer callbacks runtime_tools: Extend 'enabled' tracer callbacks erts: Extend 'enabled' tracer callbacks runtime_tools: Update lttng garbage collection trace ...
2016-04-22erts: Add BIF maps:take/2Björn-Egil Dahlberg
2016-04-19runtime_tools: Initial lttng tracing frameworkBjörn-Egil Dahlberg
2016-04-15erts: Deallocate heap fragments from trace nif callsLukas Larsson
Any heap fragment created during a nif call to a tracer nif should be free'd immediately in order for the GC not to treat it as live data.