@@ -2886,65 +2886,11 @@ gboolean MONO_SIG_HANDLER_SIGNATURE (mono_chain_signal);
28862886MonoGenericContext
28872887mono_get_generic_context_from_stack_frame (MonoJitInfo * ji , gpointer generic_info );
28882888
2889- #if defined(__APPLE__ ) && defined(__arm64__ )
2890-
2891- typedef enum {
2892- JPM_NONE ,
2893- JPM_ENABLED ,
2894- JPM_DISABLED ,
2895- } jit_protect_mode ;
2896-
2897- extern __thread jit_protect_mode arm_current_jit_protect_mode ;
2898-
2899- static void mono_arm_jit_write_protect_enable ()
2900- {
2901- if (__builtin_available (macOS 11 , * )) {
2902- if (arm_current_jit_protect_mode != JPM_ENABLED ) {
2903- pthread_jit_write_protect_np (1 );
2904- arm_current_jit_protect_mode = JPM_ENABLED ;
2905- }
2906- }
2907- }
2908-
2909- static void mono_arm_jit_write_protect_disable ()
2910- {
2911- if (__builtin_available (macOS 11 , * )) {
2912- if (arm_current_jit_protect_mode != JPM_DISABLED ) {
2913- pthread_jit_write_protect_np (0 );
2914- arm_current_jit_protect_mode = JPM_DISABLED ;
2915- }
2916- }
2917- }
2918-
2919- #define MONO_SCOPE_ENABLE_JIT_WRITE () \
2920- __attribute__((unused, cleanup(mono_arm_restore_jit_protect_mode))) \
2921- jit_protect_mode scope_restrict_mode = arm_current_jit_protect_mode; \
2922- mono_arm_jit_write_protect_disable(); \
2923-
2924- #define MONO_SCOPE_ENABLE_JIT_EXEC () \
2925- __attribute__((unused, cleanup(mono_arm_restore_jit_protect_mode))) \
2926- jit_protect_mode scope_restrict_mode = arm_current_jit_protect_mode; \
2927- mono_arm_jit_write_protect_enable(); \
2928-
2929- static void mono_arm_restore_jit_protect_mode (jit_protect_mode * previous_jit_protect_mode )
2930- {
2931- if (* previous_jit_protect_mode == arm_current_jit_protect_mode )
2932- return ;
2933-
2934- switch (* previous_jit_protect_mode )
2935- {
2936- case JPM_ENABLED :
2937- mono_arm_jit_write_protect_enable ();
2938- break ;
2939- case JPM_DISABLED :
2940- case JPM_NONE :
2941- default :
2942- mono_arm_jit_write_protect_disable ();
2943- }
2944- }
2945-
2946- #else
2889+ #ifndef MONO_SCOPE_ENABLE_JIT_WRITE
29472890#define MONO_SCOPE_ENABLE_JIT_WRITE ()
2891+ #endif
2892+
2893+ #ifndef MONO_SCOPE_ENABLE_JIT_EXEC
29482894#define MONO_SCOPE_ENABLE_JIT_EXEC ()
29492895#endif
29502896
0 commit comments