[corlib] Ignore DirectoryNotFoundException in FileStreamTest.OpenCharDeviceRepeatedly test
public static X509Chain CreateX509Chain (XX509CertificateCollection certs)
{
var chain = new X509Chain ();
- chain.ChainPolicy = new X509ChainPolicy ();
+ chain.ChainPolicy = new X509ChainPolicy ((X509CertificateCollection)(object)certs);
#if !MOBILE
chain.ChainPolicy.RevocationMode = revocation_mode;
#endif
- for (int i = 1; i < certs.Count; i++) {
- chain.ChainPolicy.ExtraStore.Add (certs [i]);
- }
-
return chain;
}
private OidCollection apps;
private OidCollection cert;
- private X509Certificate2Collection store;
+ private X509CertificateCollection store;
+ private X509Certificate2Collection store2;
private X509RevocationFlag rflag;
private X509RevocationMode mode;
private TimeSpan timeout;
Reset ();
}
+ /*
+ * Lazy-init ExtraStore from X509CertificateCollection.
+ * This is called from Mono.Net.Security.SystemCertificateValidator.CreateX509Chain.
+ *
+ * AppleTLS supports a lazily-initialized X509Certificate, but not X509Certificate2 so
+ * we need to fall-back to using Mono.Security.X509 whenever we need an X509Certificate2.
+ * To avoid unnecessary fallbacks, the private Mono.Net.Security APIs use X509Certificate
+ * instead of X509Certificate2.
+ *
+ * Since 'ExtraStore' returns X509Certificate2Collection, we need to convert these to
+ * X509Certificate2.
+ */
+ internal X509ChainPolicy (X509CertificateCollection store)
+ {
+ this.store = store;
+ Reset ();
+ }
+
// properties
public OidCollection ApplicationPolicy {
}
public X509Certificate2Collection ExtraStore {
- get { return store; }
+ get {
+ if (store2 != null)
+ return store2;
+
+ store2 = new X509Certificate2Collection ();
+ if (store != null) {
+ foreach (var cert in store) {
+ store2.Add (new X509Certificate2 (cert));
+ }
+ }
+ return store2;
+ }
}
public X509RevocationFlag RevocationFlag {
{
apps = new OidCollection ();
cert = new OidCollection ();
- store = new X509Certificate2Collection ();
+ store2 = null;
rflag = X509RevocationFlag.ExcludeRoot;
mode = X509RevocationMode.Online;
timeout = TimeSpan.Zero;
namespace System.Threading
{
- [ComVisible (true)]
- public static class Monitor
+ public static partial class Monitor
{
- // Grabs the mutex on object 'obj', with a maximum
- // wait time 'ms' but doesn't block - if it can't get
- // the lock it returns false, true if it can
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- private extern static bool Monitor_try_enter(object obj, int ms);
+ extern static bool Monitor_test_synchronised(object obj);
- // Enter/Exit are implemented directly as icalls for performance reasons
-
- // Acquires the mutex on object 'obj'
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public extern static void Enter(object obj);
-
- // Releases the mutex on object 'obj'
- [ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public extern static void Exit(object obj);
-
- // Signals one of potentially many objects waiting on
- // object 'obj'
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- private extern static void Monitor_pulse(object obj);
+ extern static void Monitor_pulse(object obj);
- // Checks whether object 'obj' is currently synchronised
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private extern static bool Monitor_test_synchronised(object obj);
-
- public static void Pulse(object obj) {
- if(obj==null) {
- throw new ArgumentNullException("obj");
- }
- if(Monitor_test_synchronised(obj)==false) {
+ static void ObjPulse(Object obj)
+ {
+ if (!Monitor_test_synchronised (obj))
throw new SynchronizationLockException("Object is not synchronized");
- }
- Monitor_pulse(obj);
+ Monitor_pulse (obj);
}
- // Signals all of potentially many objects waiting on
- // object 'obj'
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- private extern static void Monitor_pulse_all(object obj);
-
- public static void PulseAll(object obj) {
- if(obj==null) {
- throw new ArgumentNullException("obj");
- }
- if(Monitor_test_synchronised(obj)==false) {
- throw new SynchronizationLockException("Object is not synchronized");
- }
-
- Monitor_pulse_all(obj);
- }
+ extern static void Monitor_pulse_all(object obj);
- public static bool TryEnter (object obj)
+ static void ObjPulseAll(Object obj)
{
- return TryEnter (obj, 0);
- }
-
- public static bool TryEnter (object obj, int millisecondsTimeout)
- {
- if (obj == null)
- throw new ArgumentNullException ("obj");
-
- if (millisecondsTimeout == Timeout.Infinite) {
- Enter (obj);
- return true;
- }
-
- if (millisecondsTimeout < 0)
- throw new ArgumentException ("negative value for millisecondsTimeout", "millisecondsTimeout");
-
- return Monitor_try_enter (obj, millisecondsTimeout);
- }
+ if (!Monitor_test_synchronised (obj))
+ throw new SynchronizationLockException("Object is not synchronized");
- public static bool TryEnter (object obj, TimeSpan timeout)
- {
- long ms = (long) timeout.TotalMilliseconds;
- if (ms < Timeout.Infinite || ms > Int32.MaxValue)
- throw new ArgumentOutOfRangeException ("timeout", "timeout out of range");
-
- return TryEnter (obj, (int) ms);
+ Monitor_pulse_all (obj);
}
- // Waits for a signal on object 'obj' with maximum
- // wait time 'ms'. Returns true if the object was
- // signalled, false if it timed out
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- private extern static bool Monitor_wait(object obj, int ms);
-
- public static bool Wait (object obj)
- {
- return Wait (obj, Timeout.Infinite);
- }
+ extern static bool Monitor_wait(object obj, int ms);
- public static bool Wait (object obj, int millisecondsTimeout)
+ static bool ObjWait(bool exitContext, int millisecondsTimeout, Object obj)
{
- if (obj == null)
- throw new ArgumentNullException ("obj");
-
- if (millisecondsTimeout < Timeout.Infinite)
- throw new ArgumentOutOfRangeException ("millisecondsTimeout", "timeout out of range");
-
+ if (millisecondsTimeout < 0 && millisecondsTimeout != (int) Timeout.Infinite)
+ throw new ArgumentOutOfRangeException ("millisecondsTimeout");
if (!Monitor_test_synchronised (obj))
throw new SynchronizationLockException ("Object is not synchronized");
- return Monitor_wait (obj, millisecondsTimeout);
- }
-
- public static bool Wait (object obj, TimeSpan timeout)
- {
- long ms = (long) timeout.TotalMilliseconds;
- if (ms < Timeout.Infinite || ms > Int32.MaxValue)
- throw new ArgumentOutOfRangeException ("timeout", "timeout out of range");
-
- return Wait (obj, (int) ms);
- }
-
- public static bool Wait(object obj, int millisecondsTimeout, bool exitContext) {
try {
#if !DISABLE_REMOTING
if (exitContext)
SynchronizationAttribute.ExitContext ();
#endif
- return Wait (obj, millisecondsTimeout);
- }
- finally {
-#if !DISABLE_REMOTING
- if (exitContext)
- SynchronizationAttribute.EnterContext ();
-#endif
- }
- }
- public static bool Wait(object obj, TimeSpan timeout, bool exitContext) {
- try {
-#if !DISABLE_REMOTING
- if (exitContext)
- SynchronizationAttribute.ExitContext ();
-#endif
- return Wait (obj, timeout);
- }
- finally {
+ return Monitor_wait (obj, millisecondsTimeout);
+ } finally {
#if !DISABLE_REMOTING
if (exitContext)
SynchronizationAttribute.EnterContext ();
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern static void try_enter_with_atomic_var (object obj, int millisecondsTimeout, ref bool lockTaken);
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- extern static void enter_with_atomic_var (object obj, ref bool lockTaken);
-
- // Can't make this an icall since it has the same name as the other Enter method
- [MethodImpl(MethodImplOptions.AggressiveInlining)]
- public static void Enter (object obj, ref bool lockTaken)
+ static void ReliableEnterTimeout(Object obj, int timeout, ref bool lockTaken)
{
- enter_with_atomic_var (obj, ref lockTaken);
- }
+ if (obj == null)
+ throw new ArgumentNullException ("obj");
+ if (timeout < 0 && timeout != (int) Timeout.Infinite)
+ throw new ArgumentOutOfRangeException ("millisecondsTimeout");
- public static void TryEnter (object obj, ref bool lockTaken)
- {
- TryEnter (obj, 0, ref lockTaken);
+ try_enter_with_atomic_var (obj, timeout, ref lockTaken);
}
- public static void TryEnter (object obj, TimeSpan timeout, ref bool lockTaken)
+ static void ReliableEnter(Object obj, ref bool lockTaken)
{
- long ms = (long) timeout.TotalMilliseconds;
- if (ms < Timeout.Infinite || ms > Int32.MaxValue)
- throw new ArgumentOutOfRangeException ("timeout", "timeout out of range");
- TryEnter (obj, (int)ms, ref lockTaken);
+ ReliableEnterTimeout (obj, (int) Timeout.Infinite, ref lockTaken);
}
- public static void TryEnter (object obj, int millisecondsTimeout, ref bool lockTaken)
- {
- if (obj == null)
- throw new ArgumentNullException ("obj");
- if (lockTaken)
- throw new ArgumentException ("lockTaken");
-
- if (millisecondsTimeout < 0 && millisecondsTimeout != Timeout.Infinite)
- throw new ArgumentException ("negative value for millisecondsTimeout", "millisecondsTimeout");
-
- try_enter_with_atomic_var (obj, millisecondsTimeout, ref lockTaken);
- }
-
-
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern static bool Monitor_test_owner (object obj);
- public
- static bool IsEntered (object obj)
+ static bool IsEnteredNative(Object obj)
{
- return Monitor_test_owner(obj);
+ return Monitor_test_owner (obj);
}
}
}
}
[Test]
- [ExpectedException (typeof (ArgumentException))]
+ [ExpectedException (typeof (ArgumentOutOfRangeException))]
public void TryEnter_Int_Negative ()
{
object o = new object ();
../referencesource/mscorlib/system/threading/lockrecursionexception.cs
../referencesource/mscorlib/system/threading/manualresetevent.cs
../referencesource/mscorlib/system/threading/ManualResetEventSlim.cs
+../referencesource/mscorlib/system/threading/monitor.cs
../referencesource/mscorlib/system/threading/parameterizedthreadstart.cs
../referencesource/mscorlib/system/threading/semaphorefullexception.cs
../referencesource/mscorlib/system/threading/SemaphoreSlim.cs
[HostProtection(Synchronization=true, ExternalThreading=true)]
[System.Runtime.InteropServices.ComVisible(true)]
- public static class Monitor
+ public static partial class Monitor
{
/*=========================================================================
** Obtain the monitor lock of obj. Will block if another thread holds the lock
throw new ArgumentException(Environment.GetResourceString("Argument_MustBeFalse"), "lockTaken");
}
+#if !MONO
[System.Security.SecuritySafeCritical]
[ResourceExposure(ResourceScope.None)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern void ReliableEnter(Object obj, ref bool lockTaken);
-
+#endif
/*=========================================================================
ReliableEnterTimeout(obj, MillisecondsTimeoutFromTimeSpan(timeout), ref lockTaken);
}
+#if !MONO
[System.Security.SecuritySafeCritical]
[ResourceExposure(ResourceScope.None)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern void ReliableEnterTimeout(Object obj, int timeout, ref bool lockTaken);
+#endif
[System.Security.SecuritySafeCritical]
public static bool IsEntered(object obj)
return IsEnteredNative(obj);
}
+#if !MONO
[System.Security.SecurityCritical]
[ResourceExposure(ResourceScope.None)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern bool IsEnteredNative(Object obj);
+#endif
/*========================================================================
** Waits for notification from the object (via a Pulse/PulseAll).
**
** Exceptions: ArgumentNullException if object is null.
========================================================================*/
+#if !MONO
[System.Security.SecurityCritical] // auto-generated
[ResourceExposure(ResourceScope.None)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern bool ObjWait(bool exitContext, int millisecondsTimeout, Object obj);
+#endif
[System.Security.SecuritySafeCritical] // auto-generated
public static bool Wait(Object obj, int millisecondsTimeout, bool exitContext)
* Exceptions: SynchronizationLockException if this method is not called inside
* a synchronized block of code.
========================================================================*/
+#if !MONO
[System.Security.SecurityCritical] // auto-generated
[ResourceExposure(ResourceScope.None)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern void ObjPulse(Object obj);
+#endif
[System.Security.SecuritySafeCritical] // auto-generated
public static void Pulse(Object obj)
/*========================================================================
** Sends a notification to all waiting objects.
========================================================================*/
+#if !MONO
[System.Security.SecurityCritical] // auto-generated
[ResourceExposure(ResourceScope.None)]
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private static extern void ObjPulseAll(Object obj);
+#endif
[System.Security.SecuritySafeCritical] // auto-generated
public static void PulseAll(Object obj)
+++ /dev/null
-// CS0121: The call is ambiguous between the following methods or properties: `A.GetValues(string[], string)' and `A.GetValues(string, params string[])'
-// Line: 23
-// CSC BUG: Correct according the spec, no identity conversion to do tie-breaking
-
-class A
-{
- public int GetValues (string[] s, string value = null)
- {
- return 1;
- }
-
- public int GetValues (string s, params string [] args)
- {
- return 2;
- }
-}
-
-
-class B
-{
- public static void Main ()
- {
- var a = new A ();
- a.GetValues (null);
- }
-}
\ No newline at end of file
AParametersCollection candidate_pd = ((IParametersMember) candidate).Parameters;
AParametersCollection best_pd = ((IParametersMember) best).Parameters;
- bool better_at_least_one = false;
+ int candidate_better_count = 0;
+ int best_better_count = 0;
+
bool are_equivalent = true;
int args_count = args == null ? 0 : args.Count;
int j = 0;
//
// No optional parameters tie breaking rules for delegates overload resolution
//
- if ((this.restrictions & Restrictions.CovariantDelegate) != 0)
+ if ((restrictions & Restrictions.CovariantDelegate) != 0)
return false;
- better_at_least_one = false;
-
- ++j;
- while (j < args_count && !args [j++].IsDefaultArgument) ;
-
- break;
+ ++best_better_count;
+ continue;
}
// for at least one argument, the conversion to 'ct' should be better than
// the conversion to 'bt'.
if (result != 0)
- better_at_least_one = true;
+ ++candidate_better_count;
}
- if (better_at_least_one)
+ if (candidate_better_count != 0 && best_better_count == 0)
return true;
+ if (best_better_count > 0 && candidate_better_count == 0)
+ return false;
+
//
// LAMESPEC: Tie-breaking rules for not equivalent parameter types
//
if (!are_equivalent) {
+ while (j < args_count && !args [j++].IsDefaultArgument) ;
+
//
// A candidate with no default parameters is still better when there
// is no better expression conversion
--- /dev/null
+class C
+{
+}
+
+class Foo
+{
+ public int SetValue (string name, string value, string defaultValue = null, bool preserveExistingCase = false)
+ {
+ return 1;
+ }
+
+ public int SetValue (string name, C value, C defaultValue = default(C), bool relativeToProject = true, C relativeToPath = default(C), bool mergeToMainGroup = false, string condition = null)
+ {
+ return 2;
+ }
+
+ public int SetValue (string name, object value, C defaultValue = null)
+ {
+ return 3;
+ }
+}
+
+class Test
+{
+ static int Main()
+ {
+ var f = new Foo ();
+ C b = null;
+ C c = null;
+
+ if (f.SetValue ("a", b, c) != 2)
+ return 1;
+
+ return 0;
+ }
+}
\ No newline at end of file
--- /dev/null
+class A
+{
+ public int GetValues (string[] s, string value = null)
+ {
+ return 1;
+ }
+
+ public int GetValues (string s, params string [] args)
+ {
+ return 2;
+ }
+}
+
+
+class B
+{
+ public static int Main ()
+ {
+ var a = new A ();
+ if (a.GetValues (null) != 1)
+ return 1;
+
+ return 0;
+ }
+}
\ No newline at end of file
</method>
</type>
</test>
+ <test name="gtest-optional-38.cs">
+ <type name="C">
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ <type name="Foo">
+ <method name="Int32 SetValue(System.String, System.String, System.String, Boolean)" attrs="134">
+ <size>10</size>
+ </method>
+ <method name="Int32 SetValue(System.String, C, C, Boolean, C, Boolean, System.String)" attrs="134">
+ <size>10</size>
+ </method>
+ <method name="Int32 SetValue(System.String, System.Object, C)" attrs="134">
+ <size>10</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ <type name="Test">
+ <method name="Int32 Main()" attrs="145">
+ <size>50</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
+ <test name="gtest-optional-39.cs">
+ <type name="A">
+ <method name="Int32 GetValues(System.String[], System.String)" attrs="134">
+ <size>10</size>
+ </method>
+ <method name="Int32 GetValues(System.String, System.String[])" attrs="134">
+ <size>10</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ <type name="B">
+ <method name="Int32 Main()" attrs="150">
+ <size>37</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="gtest-partial-01.cs">
<type name="B`1[U]">
<method name="Void .ctor()" attrs="6278">
ICALL(MONIT_3, "Monitor_pulse_all", ves_icall_System_Threading_Monitor_Monitor_pulse_all)
ICALL(MONIT_4, "Monitor_test_owner", ves_icall_System_Threading_Monitor_Monitor_test_owner)
ICALL(MONIT_5, "Monitor_test_synchronised", ves_icall_System_Threading_Monitor_Monitor_test_synchronised)
-ICALL(MONIT_6, "Monitor_try_enter", ves_icall_System_Threading_Monitor_Monitor_try_enter)
ICALL(MONIT_7, "Monitor_wait", ves_icall_System_Threading_Monitor_Monitor_wait)
-ICALL(MONIT_10, "enter_with_atomic_var", mono_monitor_enter_v4)
ICALL(MONIT_9, "try_enter_with_atomic_var", ves_icall_System_Threading_Monitor_Monitor_try_enter_with_atomic_var)
ICALL_TYPE(MUTEX, "System.Threading.Mutex", MUTEX_1)
if (!enter_method) {
MonoMethodDesc *desc;
- desc = mono_method_desc_new ("Monitor:enter_with_atomic_var(object,bool&)", FALSE);
+ desc = mono_method_desc_new ("Monitor:Enter(object,bool&)", FALSE);
enter_method = mono_method_desc_search_in_class (desc, mono_defaults.monitor_class);
g_assert (enter_method);
mono_method_desc_free (desc);
*nest_offset = ENCODE_OFF_SIZE (MONO_STRUCT_OFFSET (MonoThreadsSync, nest), sizeof (ts.nest));
}
-gboolean
-ves_icall_System_Threading_Monitor_Monitor_try_enter (MonoObject *obj, guint32 ms)
-{
- gint32 res;
-
- do {
- res = mono_monitor_try_enter_internal (obj, ms, TRUE);
- if (res == -1) {
- MonoException *exc = mono_thread_interruption_checkpoint ();
- if (exc) {
- mono_set_pending_exception (exc);
- return FALSE;
- }
- }
- } while (res == -1);
-
- return res == 1;
-}
-
void
ves_icall_System_Threading_Monitor_Monitor_try_enter_with_atomic_var (MonoObject *obj, guint32 ms, char *lockTaken)
{
{
if (*lock_taken == 1)
return FALSE;
+ if (G_UNLIKELY (!obj))
+ return FALSE;
gint32 res = mono_monitor_try_enter_internal (obj, 0, TRUE);
*lock_taken = res == 1;
return res == 1;
#define MONO_THREADS_SYNC_MEMBER_OFFSET(o) ((o)>>8)
#define MONO_THREADS_SYNC_MEMBER_SIZE(o) ((o)&0xff)
-extern gboolean ves_icall_System_Threading_Monitor_Monitor_try_enter(MonoObject *obj, guint32 ms);
extern gboolean ves_icall_System_Threading_Monitor_Monitor_test_owner(MonoObject *obj);
extern gboolean ves_icall_System_Threading_Monitor_Monitor_test_synchronised(MonoObject *obj);
extern void ves_icall_System_Threading_Monitor_Monitor_pulse(MonoObject *obj);
gboolean
mono_aot_is_linkonce_method (MonoMethod *method)
{
+ // FIXME:
+ // This doesn't work yet, because
+ // it can make us call methods which belong
+ // to aot modules which haven't been loaded yet,
+ // so the init method will read uninitialized got
+ // entries.
+ return FALSE;
+#if 0
WrapperInfo *info;
// FIXME: Add more cases
if ((info && (info->subtype == WRAPPER_SUBTYPE_GSHAREDVT_IN_SIG || info->subtype == WRAPPER_SUBTYPE_GSHAREDVT_OUT_SIG)))
return TRUE;
return FALSE;
+#endif
}
static gboolean
gboolean res;
MonoError error;
- // FIXME: Handle errors
res = init_method (amodule, method_index, NULL, NULL, NULL, &error);
- g_assert (res);
+ // FIXME: Pass the exception up to the caller ?
+ /* Its okay to raise in llvmonly mode */
+ mono_error_raise_exception (&error);
}
void
g_assert (context);
res = init_method (amodule, method_index, NULL, klass, context, &error);
- g_assert (res);
+ mono_error_raise_exception (&error);
}
void
context.method_inst = rgctx->method_inst;
res = init_method (amodule, method_index, NULL, rgctx->class_vtable->klass, &context, &error);
- g_assert (res);
+ mono_error_raise_exception (&error);
}
void
g_assert (context);
res = init_method (amodule, method_index, NULL, klass, context, &error);
- g_assert (res);
+ mono_error_raise_exception (&error);
}
/*
/* We emit the call on a separate dummy basic block */
cfg->cbb = mono_mempool_alloc0 ((cfg)->mempool, sizeof (MonoBasicBlock));
- first_bb = cfg->cbb;
+ first_bb = cfg->cbb;
- call = mono_emit_jit_icall_by_info (cfg, info, args);
+ call = mono_emit_jit_icall_by_info (cfg, bb->real_offset, info, args);
call->dreg = ins->dreg;
/* Replace ins with the emitted code and do the necessary bb linking */
{
/* LLVM on amd64 can't handle calls to non-32 bit addresses */
#ifdef TARGET_AMD64
- if (cfg->compile_llvm)
+ if (cfg->compile_llvm && !cfg->llvm_only)
return FALSE;
#endif
if (cfg->gen_sdb_seq_points || cfg->disable_direct_icalls)
}
MonoInst*
-mono_emit_jit_icall_by_info (MonoCompile *cfg, MonoJitICallInfo *info, MonoInst **args)
+mono_emit_jit_icall_by_info (MonoCompile *cfg, int il_offset, MonoJitICallInfo *info, MonoInst **args)
{
/*
* Call the jit icall without a wrapper if possible.
* an exception check.
*/
costs = inline_method (cfg, info->wrapper_method, NULL,
- args, NULL, cfg->real_offset, TRUE);
+ args, NULL, il_offset, TRUE);
g_assert (costs > 0);
g_assert (!MONO_TYPE_IS_VOID (info->sig->ret));
return NULL;
} else if (cmethod->klass == mono_defaults.monitor_class) {
gboolean is_enter = FALSE;
- gboolean is_v4 = FALSE;
- if (!strcmp (cmethod->name, "enter_with_atomic_var") && mono_method_signature (cmethod)->param_count == 2) {
- is_enter = TRUE;
- is_v4 = TRUE;
- }
if (!strcmp (cmethod->name, "Enter") && mono_method_signature (cmethod)->param_count == 1)
is_enter = TRUE;
NEW_BBLOCK (cfg, end_bb);
- ins = mono_emit_jit_icall (cfg, is_v4 ? (gpointer)mono_monitor_enter_v4_fast : (gpointer)mono_monitor_enter_fast, args);
+ ins = mono_emit_jit_icall (cfg, (gpointer)mono_monitor_enter_fast, args);
MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ICOMPARE_IMM, -1, ins->dreg, 0);
MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_IBNE_UN, end_bb);
- ins = mono_emit_jit_icall (cfg, is_v4 ? (gpointer)mono_monitor_enter_v4 : (gpointer)mono_monitor_enter, args);
+ ins = mono_emit_jit_icall (cfg, (gpointer)mono_monitor_enter, args);
MONO_START_BB (cfg, end_bb);
return ins;
}
if (cfg->verbose_level > 2)
printf ("REGION BB%d IL_%04x ID_%08X\n", bb->block_num, bb->real_offset, bb->region);
}
+ } else {
+ MonoBasicBlock *bb;
+ /* get_most_deep_clause () in mini-llvm.c depends on this for inlined bblocks */
+ for (bb = start_bblock; bb != end_bblock; bb = bb->next_bb) {
+ bb->real_offset = inline_offset;
+ }
}
if (inline_costs < 0) {
case MONO_TYPE_SZARRAY:
case MONO_TYPE_ARRAY:
case MONO_TYPE_PTR:
- return &mono_defaults.int_class->byval_arg;
+ // FIXME: refs and intptr cannot be shared because
+ // they are treated differently when a method has a vret arg,
+ // see get_call_info ().
+ return &mono_defaults.object_class->byval_arg;
+ //return &mono_defaults.int_class->byval_arg;
case MONO_TYPE_GENERICINST: {
MonoError error;
MonoClass *klass;
{
// Since they're sorted by nesting we just need
// the first one that the bb is a member of
- MonoExceptionClause *last = NULL;
-
for (int i = 0; i < cfg->header->num_clauses; i++) {
MonoExceptionClause *curr = &cfg->header->clauses [i];
if (MONO_OFFSET_IN_CLAUSE (curr, bb->real_offset))
return curr;
- /*
- if (MONO_OFFSET_IN_CLAUSE (curr, bb->real_offset)) {
- if (last && CLAUSE_END(last) > CLAUSE_END(curr))
- last = curr;
- else
- last = curr;
- } else if(last) {
- break;
- }
- */
}
- return last;
+ return NULL;
}
static void
void mono_add_seq_point (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst *ins, int native_offset);
void mono_add_var_location (MonoCompile *cfg, MonoInst *var, gboolean is_reg, int reg, int offset, int from, int to);
MonoInst* mono_emit_jit_icall (MonoCompile *cfg, gconstpointer func, MonoInst **args);
-MonoInst* mono_emit_jit_icall_by_info (MonoCompile *cfg, MonoJitICallInfo *info, MonoInst **args);
+MonoInst* mono_emit_jit_icall_by_info (MonoCompile *cfg, int il_offset, MonoJitICallInfo *info, MonoInst **args);
MonoInst* mono_emit_method_call (MonoCompile *cfg, MonoMethod *method, MonoInst **args, MonoInst *this_ins);
void mono_create_helper_signatures (void);
case AbortBlockingOk:
info->thread_saved_state [SELF_SUSPEND_STATE_INDEX].valid = FALSE;
break;
- case AbortBlockingOkAndPool:
- mono_threads_state_poll ();
+ case AbortBlockingWait:
+ mono_thread_info_wait_for_resume (info);
break;
default:
g_error ("Unknown thread state");
-Ignore: Thread was not in blocking, nothing to do;
-IgnoreAndPool: Thread was not blocking and there's a pending suspend that needs to be processed;
-Ok: Blocking state successfully aborted;
--OkAndPool: Blocking state successfully aborted, there's a pending suspend to be processed though
+-Wait: Blocking state successfully aborted, there's a pending suspend to be processed though
*/
MonoAbortBlockingResult
mono_threads_transition_abort_blocking (THREAD_INFO_TYPE* info)
trace_state_change ("ABORT_BLOCKING", info, raw_state, STATE_RUNNING, 0);
return AbortBlockingOk;
} else {
- if (InterlockedCompareExchange (&info->thread_state, build_thread_state (STATE_SELF_SUSPEND_REQUESTED, suspend_count), raw_state) != raw_state)
+ if (!(suspend_count > 0))
+ mono_fatal_with_history ("suspend_count = %d, but should be > 0", suspend_count);
+ if (InterlockedCompareExchange (&info->thread_state, build_thread_state (STATE_BLOCKING_AND_SUSPENDED, suspend_count), raw_state) != raw_state)
goto retry_state_change;
- trace_state_change ("ABORT_BLOCKING", info, raw_state, STATE_SELF_SUSPEND_REQUESTED, 0);
- return AbortBlockingOkAndPool;
+ trace_state_change ("ABORT_BLOCKING", info, raw_state, STATE_BLOCKING_AND_SUSPENDED, 0);
+ return AbortBlockingWait;
}
/*
STATE_ASYNC_SUSPENDED:
typedef enum {
AbortBlockingIgnore, //Ignore
- AbortBlockingIgnoreAndPoll, //Ignore and pool
+ AbortBlockingIgnoreAndPoll, //Ignore and poll
AbortBlockingOk, //Abort worked
- AbortBlockingOkAndPool, //Abort worked, but pool before
+ AbortBlockingWait, //Abort worked, but should wait for resume
} MonoAbortBlockingResult;
.stamp-clone:
@if [ ! -d $(CPPSHARP_DIR) ]; then \
- git clone git@github.com:xamarin/CppSharpBinaries.git $(CPPSHARP_DIR); \
- touch $@; \
+ git clone git@github.com:xamarin/CppSharpBinaries.git $(CPPSHARP_DIR) && touch $@; \
fi
MonoAotOffsetsDumper.exe: .stamp-clone MonoAotOffsetsDumper.cs $(MONO_OPTIONS_SRC)