Age | Commit message (Collapse) | Author |
|
|
|
|
|
A magic destructor can return 0 and thereby take control
and prolong the lifetime of a magic binary.
|
|
|
|
* maint:
Atomic reference count of binaries also in non-SMP
Conflicts:
erts/emulator/beam/erl_fun.c
|
|
OTP-14202
* rickard/binary-refc:
Atomic reference count of binaries also in non-SMP
Conflicts:
erts/emulator/beam/beam_bp.c
|
|
NIF resources was not handled in a thread-safe manner in the runtime
system without SMP support.
As a consequence of this fix, the following driver functions are now
thread-safe also in the runtime system without SMP support:
- driver_free_binary()
- driver_realloc_binary()
- driver_binary_get_refc()
- driver_binary_inc_refc()
- driver_binary_dec_refc()
|
|
* 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
|
|
* maint:
Remove debug printout and unnecessary GC
|
|
|
|
|
|
|
|
for debug assertions.
|
|
8bb80fe76f5b replaced the "__arm__" macro used to test for the arm
architecture in hipe_bif0 with the "arm" macro, which is not universally
available. As this replacement is not motivated in the commit message,
nor replicated in any other file that uses the "__arm__" macro, this
seems to be an accident, and this commit reverts the replacement.
When compiled in an environment without the "arm" macro, upgrading hipe
code would occasionally not patch relocations to the new module due to
being out of range for a shortjump, and a trampoline not being provided
to do a longjump. Since this type of relocation patches are not expected
to be able to fail, there is no error handling, and aside from a
"hipe_redirect_to_module: patch failed" message, code upgrade would
proceed and lead to various incorrect behaviour.
|
|
|
|
|
|
|
|
|
|
Conflicts:
erts/emulator/beam/beam_bif_load.c
erts/emulator/beam/beam_load.c
and added macro DBG_TRACE_MFA_P in beam_load.h
|
|
with hash table mod2mfa_tab
|
|
|
|
erlang:system_info({allocator, exec_alloc})
have stats if we need it.
|
|
Symptom: Got ra==NULL at nsp==nsp_end
when running basic_SUITE:basic_arith on arm
why has this not been detected before?
|
|
* Use erts_alloc(ERTS_ALC_T_HIPE_EXEC,_)
* Each module has its own trampolines
|
|
* Use erts_alloc(ERTS_ALC_T_HIPE_EXEC,_)
* Each module has its own trampolines
* Stubs do not use trampolines,
they do their own long jumps.
|
|
|
|
|
|
creation and destruction.
|
|
|
|
from hipe_purge_module.
|
|
that is only called once.
Basically switch hipe_free_loader_state and hipe_loader_state_dtor.
|
|
Did not work with purge and made worse by new purge strategy.
Did yield terrible performance when fun thing is created *before*
fun code is loaded. Like when receiving not yet loaded fun
from other node. The cached 'native_address' in ErlFunThing
will not be updated leading to mode switch and error_handler
being called for every call to the fun from native code.
|
|
by introducing hipe_bifs:commit_patch_load/1
that creates the HipeModule.
|
|
|
|
|
|
This is part of commit 1bd508921dd93086b05e7d0038b816b36c421d86.
I did not include the fun-checking as we have a new purge strategy
for funs in OTP 20. That remains to be solved some other way for hipe.
|
|
Just like the BEAM loader state (as returned by
erlang:prepare_loading/2), the HiPE loader state is contained in a magic
binary.
Eventually, we will separate HiPE loading into a prepare and a finalise
phase, like the BEAM loader, where the prepare phase will be implemented
by hipe_unified_loader and the finalise phase be implemented in C by
hipe_load.c and beam_load.c, making prepare side-effect free and
finalise atomic. The finalise phase will be exposed through the
erlang:finish_loading/1 API, just like the BEAM loader, as this will
allow HiPE and BEAM modules to be mixed in the same atomic "commit".
The usage of a loader state makes it easier to keep track of all
resources allocated during loading, and will not only make it easy to
prevent leaks when hipe_unified_loader crashes, but also paves the way
for proper, leak-free, unloading of HiPE modules.
|
|
|
|
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.
|
|
and hipe_bifs:update_code_size
|
|
A step toward better integration of hipe load and purge
Highlights:
* code_server no longer needs to call hipe_unified_loader:post_beam_load/1
Instead new internal function hipe_redirect_to_module()
is called by loading BIFs to patch native call sites if needed.
* hipe_purge_module() is called by erts_internal:purge_module/2
to purge any native code.
* struct hipe_mfa_info redesigned and only used for exported
functions that are called from or implemented by native code.
A list of native call sites (struct hipe_ref) are kept for each hipe_mfa_info.
* struct hipe_sdesc used by hipe_find_mfa_from_ra()
to build native stack traces.
|
|
|
|
|
|
|
|
|
|
* margnus1/erts/fix-hipe-literal-gc/PR-1122/OTP-13777:
check_process_code: Sweep HiPE stack for literals
|
|
This type of statistics is now available through the microstate
accounting API.
|
|
Because check_process_code neglected checking the HiPE stack for
references to the literal area, such references would survive the purge
and subsequent deletion of a module and its literal area. These dangling
references would then cause incorrect behaviour or even hard crashes of
the VM.
By simply adding a scan of the HiPE stack to check_process_code and
erts_garbage_collect_literals, this problem is fixed.
In order to support full stack walks without deleting the graylimit
trap, a new stack walking interface function,
nstack_walk_init_sdesc_ignore_trap() was introduced.
|
|
The trap frame allocation wrappers occasionally call the garbage
collector, even though built-in functions are not supposed to.
On non-{x86,amd64} platforms, HiPE was optimising the BIF wrapper
interface on the basis that BIFs do not GC. So, when
hipe_reserve_beam_trap_frame called the garbage collector, the state in
the PCB was stale and corruption happened.
Now, these particular BIFs are reclassified as GC BIFs.
Unfortunately, in order to do that we needed to introduce a
gc_bif_interface_3 macro in every hipe_$ARCH_bifs.m4 file.
|
|
An easy source of tricky bugs is to start calling the garbage collector
from a built-in function without adding that bif to hipe_bif_list.m4.
With this change we, in the debug build, keep track of whether the
canonical stack and heap pointers are stored in the PCB or in
registers/stack, allowing us to catch this class of mistakes with an
assertion.
|