Commits on Nov 3, 2013
  1. [jit] Add support for generating the push/pop the LMF from the LMF st…

    …ack as IR instead of hand-written assembly code in the backends. Not yet used.
    vargaz committed Nov 3, 2013
  2. [jit] Disable the optimization added by 63eb94e when using LLVM, the …

    …handler bblock has no in edges, which seems to cause problems when using LLVM.
    vargaz committed Nov 3, 2013
Commits on Nov 2, 2013
  1. [jit] Add a comment.

    vargaz committed Nov 2, 2013
  2. Merge pull request #798 from akoeplinger/fix-test

    Fixed an issue in corlib Makefile
    marek-safar committed Nov 2, 2013
Commits on Nov 1, 2013
  1. [System] Avoid an NRE when Close() and Write() are concurrent.

    Scenario (for which I couldn't easily create a testcase, but can
    sketch out): Imagine using a multithreaded manner:
    	// shared:
    	static CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource ();
    	// Thread 1
    	var request = new HttpRequestMessage(HttpMethod.Post, "") {
    		Content = new StringContent (new string('x', 1024)),
    	using (request)
    	using (HttpClient httpClient = new HttpClient())
    	using (HttpResponseMessage response = await httpClient.SendAsync(request,
    			_cancellationTokenSource.Token)) {
    		string responseContent = await response.Content.ReadAsStringAsync();
    		Console.WriteLine ("Read {0} chars", responseContent.Length);
    	// Thread 2
    	_cancellationTokenSource.Cancel ();
    This isn't entirely farfetched; in the case of #15857, Thread 2 was
    the Main thread (due to the user clicking a button), while Thread 1
    was the ThreadPool (because of async/await).
    The _occasional_ result: a TargetInvocationException exception:
    	System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object
    	  at (wrapper delegate-invoke) <Module>:invoke_bool__this___HttpsClientStream (Mono.Security.Protocol.Tls.HttpsClientStream)
    	  at System.Reflection.MonoProperty.GetterAdapterFrame[HttpsClientStream,Boolean] (System.Reflection.Getter`2 getter, System.Object obj)
    	  at System.Reflection.MonoProperty.GetValue (System.Object obj, System.Object[] index)
    	  --- End of inner exception stack trace ---
    	  at System.Reflection.MonoProperty.GetValue (System.Object obj, System.Object[] index)
    	  at System.Net.WebConnection.Write (System.Net.HttpWebRequest request, System.Byte[] buffer, Int32 offset, Int32 size, System.String& err_msg)
    	  at System.Net.WebConnectionStream.WriteHeaders ()
    	  at System.Net.WebConnectionStream.SetHeaders (System.Byte[] buffer)
    	  at System.Net.HttpWebRequest.SendRequestHeaders (Boolean propagate_error)
    	--- End of stack trace from previous location where exception was thrown ---
    	  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
    	  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[System.Net.Http.HttpResponseMessage].GetResult ()
    	  at System.Net.Http.HttpClient+<SendAsyncWorker>c__async0.MoveNext ()
    	--- End of stack trace from previous location where exception was thrown ---
    	  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw ()
    	  at System.Runtime.CompilerServices.TaskAwaiter`1[System.Net.Http.HttpResponseMessage].GetResult ()
    	  at HttpClientAsyncCancellationRepro.Activity1+<AccessGoogleButton_Click>c__async0.MoveNext ()
    The reason why is because HttpClientHandler.SendAsync() registers a
    Cancel handler with the CancellationTokenSource, and the registered
    handler calls HttpWebRequest.Abort() (which eventually calls
    WebConnection.Close()). This causes WebConnection.nstream to _change_
    while WebConnection.Write() is executing, causing
    WebConnection.nstream to go from non-null to null, which
    WebConnection.Write() does not expect:
    	# WebConnection.CreateStream; from 5 Threadpool worker
    	# WebConnection.Write; from 5 Threadpool worker
    	# WebConnection.Close; from 1  at    at System.Environment.get_StackTrace()
    	   at System.Net.WebConnection.Close(Boolean sendNext)
    	   at System.Net.WebConnection.Abort(System.Object sender, System.EventArgs args)
    	   at System.Net.WebConnection+AbortHelper.Abort(System.Object sender, System.EventArgs args)
    	   at System.Net.HttpWebRequest.Abort()
    	   at System.Net.Http.HttpClientHandler+<SendAsync>c__async0.<>m__0(System.Object l)
    	   at System.Threading.CancellationToken+<Register>c__AnonStorey0.<>m__0()
    	   at System.Threading.CancellationTokenSource.Cancel(Boolean throwOnFirstException)
    	   at System.Threading.CancellationTokenSource.Cancel()
    	   at System.Threading.CancellationTokenSource.SafeLinkedCancel()
    	   at System.Threading.CancellationTokenSource.Cancel(Boolean throwOnFirstException)
    	   at System.Threading.CancellationTokenSource.Cancel()
    	   at HttpClientAsyncCancellationRepro.Activity1.CancelButton_Click(System.Object sender, System.EventArgs e)
    	   at Android.Views.View+IOnClickListenerImplementor.OnClick(Android.Views.View v)
    	   at Android.Views.View+IOnClickListenerInvoker.n_OnClick_Landroid_view_View_(IntPtr jnienv, IntPtr native__this, IntPtr native_v)
    	   at System.Object.e7b5b870-ea0f-434f-bc31-984f665a44ad(IntPtr , IntPtr , IntPtr )
    	# WebConnection.Write: checking piTrustFailure; from 5 Threadpool worker
    (Yay extra logging. Notice that WebConnection creates a stream from
    the ThreadPool, starts WebConnection.Write(), then before it can se
    piTrustFailure the instance is Close()d, which nulls out nstream.)
    Since WebConnection.Write() attempts to access the (now null)
    WebConnection.nstream field, it results in a NullReferenceException,
    which is wrapped into a TargetInvocationException by
    The fix? As usual, "don't do that."
    In this case, WebConnection.Write() has already captured
    WebConnection.nstream into the local variable `s` (which thus can't be
    changed by another thread). Instead of using WebConnection.nstream,
    reuse the `s` local variable, which cannot be null, thus avoiding the
    (This solution could fail if HttpsClientStream ever throws e.g.
    ObjectDisposedException from HttpsClientStream.TrustFailure, but at
    present HttpsClientStream.TrustFailure never throws, so this is fine.)
    jonpryor committed Nov 1, 2013
  2. Comment style

    migueldeicaza committed Nov 1, 2013
  3. [jit] Avoid linking the try block with the EH block as this produces …

    …spurious BBs during inlining.
    The inliner could not handle optimally when we inline code inside the try block as it would be linked
    with the catch block.
    Since the source block would have more than one exit, the inliner would conservatively not link them together,
    which hinders further local optimizations.
    kumpera committed Nov 1, 2013
  4. Fixed an issue in corlib Makefile that would make a resource test cas…

    …e fail which relies on satellite assemblies.
    The satellite assembly generated by the Makefile was suffixed with '.Resources.dll', but the assembly loader looks for '.resources.dll', thus the satellite assembly wasn't found.
    akoeplinger committed Nov 1, 2013
  5. [jit]Extract emit_init_local and use it with the ldloca optimization …

    …to handle any kind of types.
    kumpera committed Nov 1, 2013
  6. Revert "[sgen] Use mono_class_has_parent () instead of mono_class_has…

    …_parent_fast () in one place."
    This reverts commit 2594b36.
    Revert this as its wrong.
    vargaz committed Nov 1, 2013
  7. Fix warnings.

    vargaz committed Nov 1, 2013
  8. [sgen] Use mono_class_has_parent () instead of mono_class_has_parent_…

    …fast () in one place.
    vargaz committed Nov 1, 2013
  9. Merge pull request #797 from ranma42/fix-log-message

    [runtime] Fix AOT log message
    vargaz committed Nov 1, 2013
  10. [sdb] Fix an assertion if a single step breakpoint is hit in a thread…

    … other than the thread the single stepping is done on. Fixes #14950.
    vargaz committed Nov 1, 2013
  11. [jit] Fix the processing of LLVM compiled method frames on x86. Fixes…

    … running corlib tests with LLVM.
    vargaz committed Nov 1, 2013
  12. [sdb] Fix tests.

    vargaz committed Nov 1, 2013
  13. [runtime] Fix AOT log message

    In 72ca429 the message format was
    refactored and an additional '%s' format specifier was left over.
    ranma42 committed Nov 1, 2013
  14. Fix indentation.

    Oddly, we don't use tabs here...
    alexrp committed Nov 1, 2013
Commits on Oct 31, 2013
  1. [jit] The AggressiveInlining hint now triggers class initialization s…

    …o more stuff gets force-inlined.
    kumpera committed Oct 31, 2013
  2. [jit]Add an alias analysis pass to the JIT.

    The alias analysis pass is capable of simplifying indirection against
    local or temporary variables. It will replace a memory load or store
    with direct access to the variable.
    It does a local pass looking for addresses and replacing memory
    ops with direct ops.
    If any conversion happens, it does a DCE pass to try to kill those
    LDADDR and then recalculate the indirect flag.
    Finally, if the number of indirect variables is reduced, it does a
    global to local vreg pass and another DCE pass to kill most spurious
    Performance numbers on 32bits OSX:
    Code size:
    mcs: -11.366 (0.6%)
    corlib: -15.397 (0.6%)
    Execution time increased by less than 0.2% which is about the same
    value of the test variance.
    Numbers are not impressive since we don't perform store forwarding
    or constant load elimination. Proper handling of value type aggregates
    and longs would move us much further.
    kumpera committed Oct 31, 2013