aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_nif.c
AgeCommit message (Collapse)Author
2017-04-04erts: Refactor ErtsCodeInfo.nativeSverker Eriksson
into union with actual usage types.
2017-03-24Fix dirty scheduler type testsRickard Green
Old test for dirty schedulers didn't work with Visual C++
2017-03-06erts: Add enif_inspect_binary emasculation of refc binsLukas Larsson
2017-02-20Fix ErlNifMonitor handlingSverker Eriksson
2017-02-20erts: Avoid revival of dying resource by dec_termSverker Eriksson
2017-02-20Merge branch 'master' into sverker/enif_selectSverker Eriksson
Conflicts: erts/emulator/beam/erl_binary.h erts/emulator/beam/erl_monitors.c erts/emulator/beam/erl_nif.c erts/emulator/beam/global.h erts/emulator/test/nif_SUITE_data/nif_SUITE.c
2017-02-20erts: Add enif_compare_monitorsSverker Eriksson
# Conflicts: # erts/emulator/test/nif_SUITE_data/nif_SUITE.c
2017-02-16Merge branch 'maint'Sverker Eriksson
2017-02-16Merge branch 'sverker/enif_send-noproc-fix/OTP-14229' into maintSverker Eriksson
* sverker/enif_send-noproc-fix: erts: Fix enif_send from noproc and no msg_env
2017-02-14erts: Add deallocation veto for magic destructorsSverker Eriksson
A magic destructor can return 0 and thereby take control and prolong the lifetime of a magic binary.
2017-02-09erts: Add enif_monitor_process and enif_demonitor_processSverker Eriksson
2017-02-06Adjust the only usage of exposed magic binariesRickard Green
2017-02-06Use magic refs for NIF resourcesRickard Green
2017-02-06Implement magic referencesRickard Green
Magic references are *intentionally* indistinguishable from ordinary references for the Erlang software. Magic references do not change the language, and are intended as a pure runtime internal optimization. An ordinary reference is typically used as a key in some table. A magic reference has a direct pointer to a reference counted magic binary. This makes it possible to implement various things without having to do lookups in a table, but instead access the data directly. Besides very fast lookups this can also improve scalability by removing a potentially contended table. A couple of examples of planned future usage of magic references are ETS table identifiers, and BIF timer identifiers. Besides future optimizations using magic references it should also be possible to replace the exposed magic binary cludge with magic references. That is, magic binaries that are exposed as empty binaries to the Erlang software.
2017-02-03erts: Rename ErlNifResource as ErtsResourceSverker Eriksson
as it's not part of the API
2017-02-03erts: Add deallocation veto for magic destructorsSverker Eriksson
A magic destructor can return 0 and thereby take control and prolong the lifetime of a magic binary.
2017-02-03Merge branch 'master' into sverker/enif_selectSverker Eriksson
2017-01-25Merge branch 'rickard/ds-20-fix'Rickard Green
* rickard/ds-20-fix: Fix unused warning Change exception for enif_schedule_nif() with dirty flags Remove double check of NifExport when checking process code
2017-01-23Merge branch 'sverker/ASSERT_IN_ENV'Sverker Eriksson
* sverker/ASSERT_IN_ENV: erts: Add macro ERTS_PROC_LOCKS_HIGHER_THAN erts: Cleanup and extra assertions in nif_SUITE.c erts: Cleanup enif_make_reverse_list erts: Add assertions for correct ErlNifEnv erts: Make erts_dbg_within_proc available # Conflicts: # erts/emulator/beam/erl_gc.h
2017-01-18Change exception for enif_schedule_nif() with dirty flagsRickard Green
2017-01-17Merge branch 'maint'Sverker Eriksson
2017-01-13erts: Fix enif_send from noproc and no msg_envSverker Eriksson
Only try direct allocation on receiver heap when called in a real process context to avoid trylock on our own main lock.
2017-01-12erts: Cleanup enif_make_reverse_listSverker Eriksson
2017-01-12erts: Add assertions for correct ErlNifEnvSverker Eriksson
when constructing container terms.
2017-01-12Return and exception trace for nif-export scheduled BIFsRickard Green
The support is somewhat primitive, since it is determined at call time if trace on return or exception should be sent.
2017-01-12Optimize handling of BIF errorsRickard Green
2017-01-12Support for dirty BIFsRickard Green
2017-01-05erts: Fix GC tracing to use temp heapSverker Eriksson
Can't use HAlloc as it might consume part of callers 'need'.
2016-12-19Add stop arguments: fd and is_direct_callSverker Eriksson
2016-11-30erts: Add enif_select & enif_open_resource_type_xSverker Eriksson
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