aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_alloc.h
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2013-05-06 18:13:16 +0200
committerSverker Eriksson <[email protected]>2013-05-06 18:13:33 +0200
commit8e00f4ce7a49b2fd1da7e481dc0985703e4131a5 (patch)
tree8a8ffdda6447d9ae3cfb71007c31763f37f73932 /erts/emulator/beam/erl_alloc.h
parentea3024202d8dfedfafa62a15286157d3843957cb (diff)
parent76ae102a243aa05df79dde1f2639542147ec4b44 (diff)
downloadotp-8e00f4ce7a49b2fd1da7e481dc0985703e4131a5.tar.gz
otp-8e00f4ce7a49b2fd1da7e481dc0985703e4131a5.tar.bz2
otp-8e00f4ce7a49b2fd1da7e481dc0985703e4131a5.zip
Merge branch 'sverk/fix-alloc-fixes' into maint
* sverk/fix-alloc-fixes: erts: Remove unnecessary utf8 analysis step in external decoding erts: Fix locking order violation for allocation wrappers erts: Change locking order for "port_table" and "port_sched_lock" erts: Adjust sizes for fix allocator erts: Fix unabused bug in fixed allocation erts: Fix benign size-bug for fix-allocators MONITOR_SH and NLINK_SH erts: Refactor in new struct ErtsAllctrFixDDBlock_t OTP-11085
Diffstat (limited to 'erts/emulator/beam/erl_alloc.h')
-rw-r--r--erts/emulator/beam/erl_alloc.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_alloc.h b/erts/emulator/beam/erl_alloc.h
index ba5ec9c367..9cafd8ddc8 100644
--- a/erts/emulator/beam/erl_alloc.h
+++ b/erts/emulator/beam/erl_alloc.h
@@ -135,6 +135,18 @@ typedef struct {
extern ErtsAllocatorThrSpec_t erts_allctr_thr_spec[ERTS_ALC_A_MAX+1];
+typedef struct ErtsAllocatorWrapper_t_ {
+ void (*lock)(void);
+ void (*unlock)(void);
+ struct ErtsAllocatorWrapper_t_* next;
+}ErtsAllocatorWrapper_t;
+ErtsAllocatorWrapper_t *erts_allctr_wrappers;
+extern int erts_allctr_wrapper_prelocked;
+extern erts_tsd_key_t erts_allctr_prelock_tsd_key;
+void erts_allctr_wrapper_prelock_init(ErtsAllocatorWrapper_t* wrapper);
+void erts_allctr_wrapper_pre_lock(void);
+void erts_allctr_wrapper_pre_unlock(void);
+
void erts_alloc_register_scheduler(void *vesdp);
#ifdef ERTS_SMP
void erts_alloc_scheduler_handle_delayed_dealloc(void *vesdp,
@@ -188,6 +200,7 @@ void *erts_realloc(ErtsAlcType_t type, void *ptr, Uint size);
void erts_free(ErtsAlcType_t type, void *ptr);
void *erts_alloc_fnf(ErtsAlcType_t type, Uint size);
void *erts_realloc_fnf(ErtsAlcType_t type, void *ptr, Uint size);
+int erts_is_allctr_wrapper_prelocked(void);
#endif /* #if !ERTS_ALC_DO_INLINE */
@@ -258,6 +271,13 @@ void *erts_realloc_fnf(ErtsAlcType_t type, void *ptr, Uint size)
size);
}
+ERTS_ALC_INLINE
+int erts_is_allctr_wrapper_prelocked(void)
+{
+ return erts_allctr_wrapper_prelocked /* locked */
+ && !!erts_tsd_get(erts_allctr_prelock_tsd_key); /* by me */
+}
+
#endif /* #if ERTS_ALC_DO_INLINE || defined(ERTS_ALC_INTERNAL__) */
#define ERTS_ALC_GET_THR_IX() ((int) erts_get_scheduler_id())