X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmetadata%2Fmonitor.c;h=b950b5f88a72617bfce57ffa6b2d84b098ffe857;hb=8bee07fc5845602eb65d07df83d82e8e150fb96b;hp=84a20af60546c644ae5130a3e221944778d5f1cc;hpb=68150e7587e64a1874e3edf70e12bef2e4729b2c;p=mono.git diff --git a/mono/metadata/monitor.c b/mono/metadata/monitor.c index 84a20af6054..b950b5f88a7 100644 --- a/mono/metadata/monitor.c +++ b/mono/metadata/monitor.c @@ -871,12 +871,15 @@ mono_monitor_get_fast_enter_method (MonoMethod *monitor_enter_method) MonoMethodBuilder *mb; MonoMethod *res; static MonoMethod *compare_exchange_method; - int obj_null_branch, true_locktaken_branch, syncp_null_branch, has_owner_branch, other_owner_branch, tid_branch, thin_hash_branch; + int obj_null_branch, true_locktaken_branch = 0, syncp_null_branch, has_owner_branch, other_owner_branch, tid_branch, thin_hash_branch; int tid_loc, syncp_loc, owner_loc; int thread_tls_offset; gboolean is_v4 = mono_method_signature (monitor_enter_method)->param_count == 2; int fast_path_idx = is_v4 ? FASTPATH_ENTERV4 : FASTPATH_ENTER; + /* The !is_v4 version is not used/tested */ + g_assert (is_v4); + thread_tls_offset = mono_thread_get_tls_offset (); if (thread_tls_offset == -1) return NULL; @@ -907,7 +910,7 @@ mono_monitor_get_fast_enter_method (MonoMethod *monitor_enter_method) syncp_loc = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg); owner_loc = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg); - emit_obj_syncp_check (mb, syncp_loc, &obj_null_branch, &true_locktaken_branch, &syncp_null_branch, &thin_hash_branch, FALSE); + emit_obj_syncp_check (mb, syncp_loc, &obj_null_branch, is_v4 ? &true_locktaken_branch : NULL, &syncp_null_branch, &thin_hash_branch, FALSE); /* mono. tls thread_tls_offset threadp @@ -1015,6 +1018,8 @@ mono_monitor_get_fast_enter_method (MonoMethod *monitor_enter_method) mono_mb_patch_short_branch (mb, syncp_null_branch); mono_mb_patch_short_branch (mb, has_owner_branch); mono_mb_patch_short_branch (mb, other_owner_branch); + if (true_locktaken_branch) + mono_mb_patch_short_branch (mb, true_locktaken_branch); mono_mb_emit_byte (mb, CEE_LDARG_0); if (is_v4) mono_mb_emit_byte (mb, CEE_LDARG_1);