AM_CONDITIONAL(ENABLE_INTERPRETER, [test x$enable_interpreter = xyes])
+if test "x$enable_interpreter" = "xyes" || test "x$mono_feature_disable_jit" != "xyes"; then
+ AC_DEFINE(HAVE_ONLINE_VES, 1, [Some VES is available at runtime])
+fi
+
+AM_CONDITIONAL(HAVE_ONLINE_VES, [test x$enable_interpreter = xyes] || [test x$mono_feature_disable_jit != xyes])
dnl
dnl Simple Generational checks (sgen)
-Subproject commit c0de20bce4af381ebe7258bfd723f0b979806f8f
+Subproject commit 1563f6ea5ba2f4c6f3e9c6e625ee8b16e3a1d39e
-Subproject commit e49886bd091487abfbf5de934a451c5a8fe7f4c5
+Subproject commit eed0d37c001fdd17acf3dd33cacd4f66df5294c0
.I info
Print the architecture the AOT in this copy of Mono targets and quit.
.TP
+.I interp
+Generates all required wrappers, so that it is possible to run --interpreter without
+any code generation at runtime. This option only makes sense with \fBmscorlib.dll\fR.
+Embedders can set
+
+.nf
+mono_jit_set_aot_mode (MONO_AOT_MODE_INTERP);
+.fi
+.ne
+.TP
.I ld-flags
Additional flags to pass to the C linker (if the current AOT mode calls for invoking it).
.TP
compile 10 methods with LLVM and then switch to the Mono JIT engine.
\fBLLVM_COUNT=0\fR would disable the LLVM engine altogether.
.TP
-\fBMONO_AOT_CACHE\fR
-If set, this variable will instruct Mono to ahead-of-time compile new
-assemblies on demand and store the result into a cache in
-~/.mono/aot-cache.
-.TP
\fBMONO_ASPNET_INHIBIT_SETTINGSMAP\fR
Mono contains a feature which allows modifying settings in the .config files shipped
with Mono by using config section mappers. The mappers and the mapping rules are
void EndWrite (IAsyncResult asyncResult);
+ Task ShutdownAsync ();
+
TransportContext TransportContext {
get;
}
Mono.Security.Cryptography/RSAManagedTest.cs
Mono.Security.Cryptography/SHA224ManagedTest.cs
Mono.Security.Cryptography/SHA224Test.cs
+Mono.Security.Interface/TestProvider.cs
Mono.Security.Protocol.Ntlm/ChallengeResponseTest.cs
Mono.Security.Protocol.Ntlm/MessageBaseTest.cs
Mono.Security.Protocol.Ntlm/Type1MessageTest.cs
--- /dev/null
+//
+// TestProvider.cs
+//
+// Author:
+// Martin Baulig <mabaul@microsoft.com>
+//
+// Copyright (c) 2017 Xamarin, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using System.IO;
+using System.Security.Cryptography;
+using System.Text;
+
+using Mono.Security;
+using Mono.Security.Interface;
+using NUnit.Framework;
+
+namespace MonoTests.Mono.Security
+{
+ [TestFixture]
+ public class TestProvider
+ {
+ [Test]
+ public void GetProvider ()
+ {
+ var provider = MonoTlsProviderFactory.GetProvider ();
+ Assert.IsNotNull (provider, "TLS Provider");
+ }
+ }
+}
+++ /dev/null
-//
-// System.Drawing.Design.CategoryNameCollection.cs
-//
-// Authors:
-// Alejandro Sánchez Acosta
-// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-// (C) Alejandro Sánchez Acosta
-// (C) 2003 Andreas Nahr
-//
-
-//
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Collections;
-
-namespace System.Drawing.Design
-{
- public sealed class CategoryNameCollection : ReadOnlyCollectionBase
- {
-
- public CategoryNameCollection (CategoryNameCollection value)
- {
- if (value == null)
- throw new ArgumentNullException ("value");
- InnerList.AddRange (value);
- }
-
- public CategoryNameCollection (string[] value)
- {
- if (value == null)
- throw new ArgumentNullException ("value");
- InnerList.AddRange (value);
- }
-
- public string this[int index] {
- get {
- return (string) InnerList[index];
- }
- }
-
- public bool Contains (string value)
- {
- return InnerList.Contains (value);
- }
-
- public void CopyTo (string[] array, int index)
- {
- InnerList.CopyTo (array, index);
- }
-
- public int IndexOf (string value)
- {
- return InnerList.IndexOf (value);
- }
- }
-}
+++ /dev/null
-// System.Drawing.Design.IPropertyValueUIService.cs
-//
-// Author:
-// Alejandro Sánchez Acosta <raciel@es.gnu.org>
-//
-// (C) Alejandro Sánchez Acosta
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Drawing;
-using System.ComponentModel;
-
-namespace System.Drawing.Design
-{
- public interface IPropertyValueUIService
- {
-
- #region Methods
- void AddPropertyValueUIHandler (PropertyValueUIHandler newHandler);
- PropertyValueUIItem[] GetPropertyUIValueItems (ITypeDescriptorContext context, PropertyDescriptor propDesc);
-
- void NotifyPropertyValueUIItemsChanged ();
-
- void RemovePropertyValueUIHandler (PropertyValueUIHandler newHandler);
- #endregion Methods
-
- #region Events
- event EventHandler PropertyUIValueItemsChanged;
- #endregion Events
- }
-}
-
+++ /dev/null
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-// Authors:
-//
-// Jordi Mas i Hernandez <jordimash@gmail.com>
-//
-//
-
-
-namespace System.Drawing.Design
-{
- public interface IToolboxItemProvider
- {
- ToolboxItemCollection Items { get; }
- }
-}
-
-
+++ /dev/null
-//
-// System.Drawing.Design.IToolboxService.cs
-//
-// Authors:
-// Alejandro Sánchez Acosta <raciel@es.gnu.org>
-// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-// (C) Alejandro Sánchez Acosta
-// (C) 2003 Andreas Nahr
-// Copyright (C) 2004, 2006 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Collections;
-using System.ComponentModel.Design;
-using System.Runtime.InteropServices;
-
-namespace System.Drawing.Design {
-
- [ComImport]
- [Guid("4BACD258-DE64-4048-BC4E-FEDBEF9ACB76"),
- InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
- public interface IToolboxService
- {
- CategoryNameCollection CategoryNames {get;}
-
- string SelectedCategory {get; set;}
-
- void AddCreator (ToolboxItemCreatorCallback creator, string format);
-
- void AddCreator (ToolboxItemCreatorCallback creator, string format, IDesignerHost host);
-
- void AddLinkedToolboxItem (ToolboxItem toolboxItem, IDesignerHost host);
-
- void AddLinkedToolboxItem (ToolboxItem toolboxItem, string category, IDesignerHost host);
-
- void AddToolboxItem (ToolboxItem toolboxItem, String category);
-
- void AddToolboxItem (ToolboxItem toolboxItem);
-
- ToolboxItem DeserializeToolboxItem (object serializedObject);
-
- ToolboxItem DeserializeToolboxItem (object serializedObject, IDesignerHost host);
-
- ToolboxItem GetSelectedToolboxItem ();
-
- ToolboxItem GetSelectedToolboxItem (IDesignerHost host);
-
- ToolboxItemCollection GetToolboxItems ();
-
- ToolboxItemCollection GetToolboxItems (IDesignerHost host);
-
- ToolboxItemCollection GetToolboxItems (String category);
-
- ToolboxItemCollection GetToolboxItems (String category, IDesignerHost host);
-
- bool IsSupported (object serializedObject, ICollection filterAttributes);
-
- bool IsSupported (object serializedObject, IDesignerHost host);
-
- bool IsToolboxItem (object serializedObject);
-
- bool IsToolboxItem (object serializedObject, IDesignerHost host);
-
- void Refresh();
-
- void RemoveCreator (string format);
-
- void RemoveCreator (string format, IDesignerHost host);
-
- void RemoveToolboxItem (ToolboxItem toolboxItem);
-
- void RemoveToolboxItem (ToolboxItem toolboxItem, string category);
-
- void SelectedToolboxItemUsed ();
-
- object SerializeToolboxItem (ToolboxItem toolboxItem);
-
- bool SetCursor ();
-
- void SetSelectedToolboxItem (ToolboxItem toolboxItem);
- }
-}
+++ /dev/null
-// System.Drawing.Design.IToolboxUser.cs
-//
-// Author:
-// Alejandro Sánchez Acosta <raciel@es.gnu.org>
-//
-// (C) Alejandro Sánchez Acosta
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace System.Drawing.Design
-{
- public interface IToolboxUser
- {
- bool GetToolSupported (ToolboxItem tool);
-
- void ToolPicked (ToolboxItem tool);
- }
-}
+++ /dev/null
-// System.Drawing.Design.PaintvalueEventArgs.cs
-//
-// Author:
-// Alejandro Sánchez Acosta <raciel@es.gnu.org>
-//
-// (C) Alejandro Sánchez Acosta
-//
-
-//
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.ComponentModel;
-
-namespace System.Drawing.Design
-{
- public class PaintValueEventArgs : EventArgs
- {
- private ITypeDescriptorContext context;
- private object value;
- private Graphics graphics;
- private Rectangle bounds;
-
- public PaintValueEventArgs(ITypeDescriptorContext context, object value, Graphics graphics, Rectangle bounds)
- {
- if (graphics == null)
- throw new ArgumentNullException ("graphics");
- this.context = context;
- this.value = value;
- this.graphics = graphics;
- this.bounds = bounds;
- }
-
- public Rectangle Bounds
- {
- get {
- return bounds;
- }
- }
-
- public ITypeDescriptorContext Context
- {
- get {
- return context;
- }
- }
-
- public Graphics Graphics
- {
- get {
- return graphics;
- }
- }
-
- public object Value
- {
- get {
- return value;
- }
- }
- }
-}
-
+++ /dev/null
-//
-// System.Drawing.Design.PropertyValueItem.cs
-//
-// Authors:
-// Alejandro Sánchez Acosta <raciel@es.gnu.org>
-// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-// (C) Alejandro Sánchez Acosta
-// (C) 2003 Andreas Nahr
-//
-
-//
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace System.Drawing.Design
-{
- public class PropertyValueUIItem
- {
-
- private Image uiItemImage;
- private PropertyValueUIItemInvokeHandler handler;
- private string tooltip;
-
- public PropertyValueUIItem (Image uiItemImage,
- PropertyValueUIItemInvokeHandler handler, string tooltip)
- {
- if (uiItemImage == null)
- throw new ArgumentNullException ("uiItemImage");
- if (handler == null)
- throw new ArgumentNullException ("handler");
- this.uiItemImage = uiItemImage;
- this.handler = handler;
- this.tooltip = tooltip;
- }
-
- public virtual Image Image
- {
- get
- {
- return uiItemImage;
- }
- }
-
- public virtual PropertyValueUIItemInvokeHandler InvokeHandler
- {
- get
- {
- return handler;
- }
- }
-
- public virtual string ToolTip
- {
- get
- {
- return tooltip;
- }
- }
-
- public virtual void Reset()
- {
- // To be overriden in child classes
- }
- }
-}
+++ /dev/null
-// System.Drawing.Design.PropertyValueUIHandler.cs
-//
-// Author:
-// Alejandro Sánchez Acosta <raciel@es.gnu.org>
-//
-// (C) Alejandro Sánchez Acosta
-// Copyright (C) 2004,2006 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Collections;
-using System.ComponentModel;
-
-namespace System.Drawing.Design {
-
- public delegate void PropertyValueUIHandler (ITypeDescriptorContext context, PropertyDescriptor propDesc, ArrayList valueUIItemList);
-}
+++ /dev/null
-// System.Drawing.Design.PropertyValueUIItemInvokeHandler.cs
-//
-// Author:
-// Alejandro Sánchez Acosta <raciel@es.gnu.org>
-//
-// (C) Alejandro Sánchez Acosta
-// Copyright (C) 2004,2006 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.ComponentModel;
-
-namespace System.Drawing.Design {
-
- public delegate void PropertyValueUIItemInvokeHandler (
- ITypeDescriptorContext context,
- PropertyDescriptor descriptor,
- PropertyValueUIItem invokedItem);
-}
+++ /dev/null
-// System.Drawing.Design.ToolboxComponentsCreatedEventArgs.cs
-//
-// Author:
-// Alejandro Sánchez Acosta <raciel@es.gnu.org>
-//
-// (C) Alejandro Sánchez Acosta
-//
-//
-
-//
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.ComponentModel;
-
-namespace System.Drawing.Design
-{
- public class ToolboxComponentsCreatedEventArgs : EventArgs
- {
- private IComponent[] components;
-
- public ToolboxComponentsCreatedEventArgs (IComponent[] components) {
- this.components = components;
- }
-
- public IComponent[] Components {
- get {
- return components;
- }
- }
- }
-}
+++ /dev/null
-// System.Drawing.Design.IDesignerHost.cs
-//
-// Author:
-// Alejandro Sánchez Acosta <raciel@es.gnu.org>
-//
-// (C) Alejandro Sánchez Acosta
-// Copyright (C) 2004,2006 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace System.Drawing.Design {
-
- public delegate void ToolboxComponentsCreatedEventHandler (object sender, ToolboxComponentsCreatedEventArgs e);
-}
-
+++ /dev/null
-//
-// System.Drawing.Design.ToolboxComponentsCreatingEventArgs.cs
-//
-// Author:
-// Alejandro Sánchez Acosta <raciel@es.gnu.org>
-//
-// (C) Alejandro Sánchez Acosta
-//
-
-//
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.ComponentModel.Design;
-using System.Security.Permissions;
-
-namespace System.Drawing.Design
-{
- [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
- [PermissionSet (SecurityAction.InheritanceDemand, Unrestricted = true)]
- public class ToolboxComponentsCreatingEventArgs : EventArgs
- {
- private IDesignerHost host;
-
- public ToolboxComponentsCreatingEventArgs (IDesignerHost host)
- {
- this.host = host;
- }
-
- public IDesignerHost DesignerHost {
- get {
- return host;
- }
- }
- }
-}
-
-
+++ /dev/null
-// System.Drawing.Design.ToolboxComponentsCreatingEventHandler.cs
-//
-// Author:
-// Alejandro Sánchez Acosta <raciel@es.gnu.org>
-//
-// (C) Alejandro Sánchez Acosta
-// Copyright (C) 2004,2006 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace System.Drawing.Design {
-
- public delegate void ToolboxComponentsCreatingEventHandler (object sender, ToolboxComponentsCreatingEventArgs e);
-}
+++ /dev/null
-//
-// System.Drawing.Design.ToolboxItemCollection.cs
-//
-// Authors:
-// Martin Willemoes Hansen (mwh@sysrq.dk)
-// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-// (C) 2003 Martin Willemoes Hansen
-// (C) 2003 Andreas Nahr
-//
-
-//
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Collections;
-using System.Security.Permissions;
-
-namespace System.Drawing.Design
-{
- [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
- public sealed class ToolboxItemCollection : ReadOnlyCollectionBase
- {
-
- public ToolboxItemCollection (ToolboxItem[] value) : base()
- {
- InnerList.AddRange (value);
- }
-
- public ToolboxItemCollection (ToolboxItemCollection value) : base()
- {
- InnerList.AddRange (value);
- }
-
- public ToolboxItem this [int index] {
- get { return (ToolboxItem) InnerList[index]; }
- }
-
- public bool Contains (ToolboxItem value)
- {
- return InnerList.Contains (value);
- }
-
- public void CopyTo (ToolboxItem[] array, int index)
- {
- InnerList.CopyTo (array, index);
- }
-
- public int IndexOf (ToolboxItem value)
- {
- return InnerList.IndexOf (value);
- }
- }
-}
+++ /dev/null
-// System.Drawing.Design.ToolboxItemCreatorCallback.cs
-//
-// Author:
-// Alejandro Sánchez Acosta <raciel@es.gnu.org>
-//
-// (C) Alejandro Sánchez Acosta
-// Copyright (C) 2004,2006 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace System.Drawing.Design {
-
- public delegate ToolboxItem ToolboxItemCreatorCallback(
- object serializedObject,
- string format);
-}
+++ /dev/null
-//
-// System.Drawing.Design.UITypeEditorEditStyle.cs
-//
-// (C) 2001 Ximian, Inc. http://www.ximian.com
-// Author: Dennis Hayes (dennish@raytek.com)
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-namespace System.Drawing.Design
-{
- public enum UITypeEditorEditStyle{
- DropDown=3,
- Modal=2,
- None=1
- }
-}
\ No newline at end of file
+++ /dev/null
-//
-// System.Drawing.PreviewPageInfo.cs
-//
-// Author:
-// Dennis Hayes (dennish@Raytek.com)
-//
-// (C) 2002 Ximian, Inc
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-
-namespace System.Drawing.Printing
-{
- /// <summary>
- /// Summary description for PreviewPageInfo.
- /// </summary>
- public sealed class PreviewPageInfo {
- Image image;
- Size physicalSize;
- public PreviewPageInfo(Image image, Size physicalSize) {
- this.image = image;
- this.physicalSize = physicalSize;
- }
- public Image Image {
- get{
- return image;
- }
- }
- public Size PhysicalSize{
- get{
- return physicalSize;
- }
- }
- }
-}
+++ /dev/null
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-// Authors:
-//
-// Jordi Mas i Hernandez <jordimash@gmail.com>
-//
-//
-
-
-using System;
-
-namespace System.Drawing.Printing
-{
- public enum PrintAction
- {
- PrintToFile = 0,
- PrintToPreview = 1,
- PrintToPrinter = 2
- }
-
-}
-
-
+++ /dev/null
-//
-// System.Drawing.PrintEventHandler.cs
-//
-// Author:
-// Dennis Hayes (dennish@Raytek.com)
-//
-// (C) 2002 Ximian, Inc
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-
-namespace System.Drawing.Printing
-{
- /// <summary>
- /// Summary description for PrintEventHandler.
- /// </summary>
- public delegate void PrintEventHandler(object sender, PrintEventArgs e);
-}
+++ /dev/null
-//\r
-// System.Drawing.PrintPageEventHandler.cs\r
-//\r
-// Author:\r
-// Dennis Hayes (dennish@Raytek.com)\r
-//\r
-// (C) 2002 Ximian, Inc\r
-//\r
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;\r
-\r
-namespace System.Drawing.Printing\r
-{\r
- /// <summary>\r
- /// Summary description for PrintPageEventHandler.\r
- /// </summary>\r
- public delegate void PrintPageEventHandler(object sender, PrintPageEventArgs e);\r
-}\r
+++ /dev/null
-//\r
-// System.Drawing.PrinterUnit.cs\r
-//\r
-// (C) 2002 Ximian, Inc. http://www.ximian.com\r
-// Author: Dennis Hayes (dennish@raytek.com)\r
-//\r
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;\r
-namespace System.Drawing.Printing \r
-{\r
- public enum PrinterUnit {\r
- Display = 0,\r
- HundredthsOfAMillimeter = 2,\r
- TenthsOfAMillimeter = 3,\r
- ThousandthsOfAnInch = 1\r
- }\r
-}\r
+++ /dev/null
-//\r
-// System.Drawing.PrintingPermissionLevel.cs\r
-//\r
-// Author:
-// Dennis Hayes (dennish@raytek.com)\r
-//
-// (C) 2002 Ximian, Inc. http://www.ximian.com\r
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace System.Drawing.Printing {
-
- [Serializable]
- public enum PrintingPermissionLevel {\r
- AllPrinting = 3,\r
- DefaultPrinting = 2,\r
- NoPrinting = 0,\r
- SafePrinting = 1\r
- }\r
-}\r
+++ /dev/null
-//\r
-// System.Drawing.QueryPageSettingsEventArgs.cs\r
-//\r
-// Author:\r
-// Dennis Hayes (dennish@Raytek.com)\r
-//\r
-// (C) 2002 Ximian, Inc\r
-//\r
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;\r
-\r
-namespace System.Drawing.Printing\r
-{\r
- /// <summary>\r
- /// Summary description for QueryPageSettingEventArgs.\r
- /// </summary>\r
- public class QueryPageSettingsEventArgs : PrintEventArgs\r
- {\r
- private PageSettings pageSettings;\r
-\r
- public QueryPageSettingsEventArgs(PageSettings pageSettings)\r
- {\r
- this.pageSettings = pageSettings;\r
- }\r
- public PageSettings PageSettings {\r
- get{\r
- return pageSettings;\r
- }\r
- set{\r
- pageSettings = value;\r
- }\r
- }\r
-\r
- }\r
-}\r
+++ /dev/null
-//
-// System.Drawing.QueryPageSettingsEventHandler.cs
-//
-// Author:
-// Dennis Hayes (dennish@Raytek.com)
-//
-// (C) 2002 Ximian, Inc
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-
-namespace System.Drawing.Printing
-{
- /// <summary>
- /// Summary description for QueryPageSettingsEventHandler.
- /// </summary>
- public delegate void QueryPageSettingsEventHandler(object sender, QueryPageSettingsEventArgs e);
-}
../../build/common/Consts.cs
../../build/common/Locale.cs
System.Drawing/Bitmap.cs
-System.Drawing/BitmapSuffixInSameAssemblyAttribute.cs
-System.Drawing/BitmapSuffixInSatelliteAssemblyAttribute.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/BitmapSuffixInSameAssemblyAttribute.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/BitmapSuffixInSatelliteAssemblyAttribute.cs
System.Drawing/Brush.cs
System.Drawing/Brushes.cs
System.Drawing/BufferedGraphics.cs
System.Drawing/KnownColors.cs
System.Drawing/IconConverter.cs
System.Drawing/Icon.cs
-System.Drawing/IDeviceContext.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/IDeviceContext.cs
System.Drawing/ImageAnimator.cs
System.Drawing/ImageConverter.cs
System.Drawing/Image.cs
System.Drawing/Rectangle.cs
System.Drawing/RectangleF.cs
System.Drawing/Region.cs
-System.Drawing/RotateFlipType.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/RotateFlipType.cs
System.Drawing/SizeConverter.cs
System.Drawing/Size.cs
System.Drawing/SizeF.cs
System.Drawing/SystemPens.cs
System.Drawing/TextureBrush.cs
System.Drawing/ToolboxBitmapAttribute.cs
-System.Drawing.Design/UITypeEditorEditStyle.cs
-System.Drawing.Design/IPropertyValueUIService.cs
-System.Drawing.Design/IToolboxItemProvider.cs
-System.Drawing.Design/PropertyValueItem.cs
-System.Drawing.Design/PropertyValueUIHandler.cs
-System.Drawing.Design/PropertyValueUIItemInvokeHandler.cs
-System.Drawing.Design/CategoryNameCollection.cs
-System.Drawing.Design/IToolboxService.cs
-System.Drawing.Design/IToolboxUser.cs
-System.Drawing.Design/PaintValueEventArgs.cs
-System.Drawing.Design/ToolboxComponentsCreatedEventArgs.cs
-System.Drawing.Design/ToolboxComponentsCreatedEventHandler.cs
-System.Drawing.Design/ToolboxComponentsCreatingEventArgs.cs
-System.Drawing.Design/ToolboxComponentsCreatingEventHandler.cs
-System.Drawing.Design/ToolboxItemCreatorCallback.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/UITypeEditorEditStyle.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/IPropertyValueUIService.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/IToolboxItemProvider.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/PropertyValueUIItem.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/PropertyValueUIHandler.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/PropertyValueUIItemInvokeHandler.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/CategoryNameCollection.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/IToolboxService.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/IToolboxUser.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/PaintValueEventArgs.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxComponentsCreatedEventArgs.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxComponentsCreatedEventHandler.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxComponentsCreatingEventArgs.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxComponentsCreatingEventHandler.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxItemCreatorCallback.cs
System.Drawing.Design/ToolboxItem.cs
System.Drawing.Design/UITypeEditor.cs
-System.Drawing.Design/ToolboxItemCollection.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxItemCollection.cs
System.Drawing.Drawing2D/AdjustableArrowCap.cs
System.Drawing.Drawing2D/Blend.cs
System.Drawing.Drawing2D/ColorBlend.cs
System.Drawing.Printing/PaperSize.cs
System.Drawing.Printing/PaperSource.cs
System.Drawing.Printing/PaperSourceKind.cs
-System.Drawing.Printing/PreviewPageInfo.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PreviewPageInfo.cs
System.Drawing.Printing/PreviewPrintController.cs
System.Drawing.Printing/PrintController.cs
System.Drawing.Printing/PrintDocument.cs
System.Drawing.Printing/PrinterResolution.cs
System.Drawing.Printing/PrinterResolutionKind.cs
System.Drawing.Printing/PrinterSettings.cs
-System.Drawing.Printing/PrinterUnit.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterUnit.cs
System.Drawing.Printing/PrinterUnitConvert.cs
System.Drawing.Printing/PrintEventArgs.cs
-System.Drawing.Printing/PrintEventHandler.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintEventHandler.cs
System.Drawing.Printing/PrintingPermissionAttribute.cs
System.Drawing.Printing/PrintingPermission.cs
-System.Drawing.Printing/PrintingPermissionLevel.cs
-System.Drawing.Printing/PrintAction.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintingPermissionLevel.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintAction.cs
System.Drawing.Printing/PrintPageEventArgs.cs
-System.Drawing.Printing/PrintPageEventHandler.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintPageEventHandler.cs
System.Drawing.Printing/PrintRange.cs
-System.Drawing.Printing/QueryPageSettingsEventArgs.cs
-System.Drawing.Printing/QueryPageSettingsEventHandler.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/QueryPageSettingsEventArgs.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/QueryPageSettingsEventHandler.cs
System.Drawing.Printing/StandardPrintController.cs
System.Drawing.Text/FontCollection.cs
System.Drawing.Text/PrivateFontCollection.cs
+++ /dev/null
-//
-// System.Drawing.BitmapSuffixInSameAssemblyAttribute.cs
-//
-// Authors:
-// Andrés G. Aragoneses (knocte@gmail.com)
-//
-// Copyright (C) 2016 Andrés G. Aragoneses
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.ComponentModel;
-
-namespace System.Drawing
-{
- [AttributeUsage (AttributeTargets.Assembly)]
- public class BitmapSuffixInSameAssemblyAttribute : Attribute {
-
- public BitmapSuffixInSameAssemblyAttribute ()
- : base ()
- {
- }
- }
-}
+++ /dev/null
-//
-// System.Drawing.BitmapSuffixInSatelliteAssemblyAttribute.cs
-//
-// Authors:
-// Andrés G. Aragoneses (knocte@gmail.com)
-//
-// Copyright (C) 2016 Andrés G. Aragoneses
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.ComponentModel;
-
-namespace System.Drawing
-{
- [AttributeUsage (AttributeTargets.Assembly)]
- public class BitmapSuffixInSatelliteAssemblyAttribute : Attribute {
-
- public BitmapSuffixInSatelliteAssemblyAttribute ()
- : base ()
- {
- }
- }
-}
+++ /dev/null
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-// Authors:
-//
-// Jordi Mas i Hernandez <jordimash@gmail.com>
-//
-//
-
-
-using System.ComponentModel;
-
-namespace System.Drawing
-{
- public interface IDeviceContext : IDisposable
- {
- IntPtr GetHdc ();
- void ReleaseHdc ();
- }
-}
-
-
//
// Copyright (C) 2002 Ximian, Inc. http://www.ximian.com
// Copyright (C) 2004, 2007 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2013 Kristof Ralovich, changes are available under the terms of the MIT X11 license
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
public void SetPropertyItem(PropertyItem propitem)
{
- throw new NotImplementedException ();
-/*
- GdipPropertyItem pi = new GdipPropertyItem ();
- GdipPropertyItem.MarshalTo (pi, propitem);
- unsafe {
- Status status = GDIPlus.GdipSetPropertyItem (nativeObject, &pi);
+ if (propitem == null)
+ throw new ArgumentNullException ("propitem");
+
+ int nItemSize = Marshal.SizeOf (propitem.Value[0]);
+ int size = nItemSize * propitem.Value.Length;
+ IntPtr dest = Marshal.AllocHGlobal (size);
+ try {
+ GdipPropertyItem pi = new GdipPropertyItem ();
+ pi.id = propitem.Id;
+ pi.len = propitem.Len;
+ pi.type = propitem.Type;
+
+ Marshal.Copy (propitem.Value, 0, dest, size);
+ pi.value = dest;
+
+ unsafe {
+ Status status = GDIPlus.GdipSetPropertyItem (nativeObject, &pi);
- GDIPlus.CheckStatus (status);
+ GDIPlus.CheckStatus (status);
+ }
+ }
+ finally {
+ Marshal.FreeHGlobal (dest);
}
-*/
}
// properties
+++ /dev/null
-//
-// System.Drawing.RotateFlipType .cs
-//
-// Author: Dennis Hayes (dennish@raytek.com)
-//
-// (C) 2001 Ximian, Inc. http://www.ximian.com
-// Copyright (C) 2004,2006 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace System.Drawing {
-
- public enum RotateFlipType {
- RotateNoneFlipNone = 0,
- Rotate180FlipXY = 0,
- Rotate90FlipNone = 1,
- Rotate270FlipXY = 1,
- Rotate180FlipNone = 2,
- RotateNoneFlipXY = 2,
- Rotate270FlipNone = 3,
- Rotate90FlipXY = 3,
- RotateNoneFlipX = 4,
- Rotate180FlipY = 4,
- Rotate90FlipX = 5,
- Rotate270FlipY = 5,
- Rotate180FlipX = 6,
- RotateNoneFlipY = 6,
- Rotate270FlipX = 7,
- Rotate90FlipY = 7,
- }
-}
*/
var certificate2 = certificate as X509Certificate2;
if (certificate2 != null)
+#if MONOTOUCH
+ return SecIdentity.Import (certificate2);
+#else
return SecImportExport.ItemImport (certificate2);
+#endif
/*
* Reading Certificates from the Mac Keychain
[DllImport (SecurityLibrary)]
extern static /* OSStatus */ SslStatus SSLClose (/* SSLContextRef */ IntPtr context);
- public override void Close ()
+ public override void Shutdown ()
{
if (Interlocked.Exchange (ref pendingIO, 1) == 1)
throw new InvalidOperationException ();
- Debug ("Close");
+ Debug ("Shutdown");
lastException = null;
return;
var status = SSLClose (Handle);
- Debug ("Close done: {0}", status);
+ Debug ("Shutdown done: {0}", status);
CheckStatusAndThrow (status);
} finally {
closed = true;
}
protected override MNS.MobileTlsContext CreateContext (
- MNS.MobileAuthenticatedStream parent, bool serverMode, string targetHost,
- SslProtocols enabledProtocols, X509Certificate serverCertificate,
- X509CertificateCollection clientCertificates, bool askForClientCert)
+ bool serverMode, string targetHost, SslProtocols enabledProtocols,
+ X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
+ bool askForClientCert)
{
return new AppleTlsContext (
- parent, serverMode, targetHost,
+ this, serverMode, targetHost,
enabledProtocols, serverCertificate,
clientCertificates, askForClientCert);
}
return code;
}
+#if !MONOTOUCH
[DllImport (AppleTlsContext.SecurityLibrary)]
extern static SecStatusCode SecItemImport (
/* CFDataRef */ IntPtr importedData,
IntPtr keyUsage;
IntPtr keyAttributes;
}
+#endif
}
}
#endif
if (status == MonoBtlsSslError.WantRead) {
wantMore = true;
return 0;
+ } else if (status == MonoBtlsSslError.ZeroReturn) {
+ wantMore = false;
+ return size;
} else if (status != MonoBtlsSslError.None) {
throw GetException (status);
}
}
}
- public override void Close ()
+ public override void Shutdown ()
{
- Debug ("Close!");
-
- if (ssl != null) {
- ssl.Dispose ();
- ssl = null;
- }
- if (ctx != null) {
- ctx.Dispose ();
- ctx = null;
- }
- if (bio != null) {
- bio.Dispose ();
- bio = null;
- }
- if (errbio != null) {
- errbio.Dispose ();
- errbio = null;
- }
+ Debug ("Shutdown!");
+// ssl.SetQuietShutdown ();
+ ssl.Shutdown ();
}
void Dispose<T> (ref T disposable)
{
try {
if (disposing) {
+ Dispose (ref ssl);
+ Dispose (ref ctx);
Dispose (ref remoteCertificate);
Dispose (ref nativeServerCertificate);
Dispose (ref nativeClientCertificate);
Dispose (ref clientCertificate);
- Dispose (ref ctx);
- Dispose (ref ssl);
Dispose (ref bio);
Dispose (ref errbio);
}
CheckError (ret == 1, callerName);
}
+ protected internal void CheckLastError ([CallerMemberName] string callerName = null)
+ {
+ var error = Interlocked.Exchange (ref lastError, null);
+ if (error == null)
+ return;
+
+ string message;
+ if (callerName != null)
+ message = string.Format ("Caught unhandled exception in {0}.{1}.", GetType ().Name, callerName);
+ else
+ message = string.Format ("Caught unhandled exception.");
+ throw new MonoBtlsException (message, error);
+ }
+
[DllImport (BTLS_DYLIB)]
extern static void mono_btls_free (IntPtr data);
protected override bool ReleaseHandle ()
{
mono_btls_ssl_destroy (handle);
+ handle = IntPtr.Zero;
return true;
}
}
[DllImport (BTLS_DYLIB)]
extern static void mono_btls_ssl_close (IntPtr handle);
+ [DllImport (BTLS_DYLIB)]
+ extern static int mono_btls_ssl_shutdown (IntPtr handle);
+
+ [DllImport (BTLS_DYLIB)]
+ extern static void mono_btls_ssl_set_quiet_shutdown (IntPtr handle, int mode);
+
[DllImport (BTLS_DYLIB)]
extern static void mono_btls_ssl_set_bio (IntPtr handle, IntPtr bio);
return new BoringSslHandle (handle);
}
+ MonoBtlsBio bio;
PrintErrorsCallbackFunc printErrorsFunc;
IntPtr printErrorsFuncPtr;
public void SetBio (MonoBtlsBio bio)
{
CheckThrow ();
+ this.bio = bio;
mono_btls_ssl_set_bio (
Handle.DangerousGetHandle (),
bio.Handle.DangerousGetHandle ());
errors = null;
}
- if (errors != null) {
- Console.Error.WriteLine ("ERROR: {0} failed: {1}", callerName, errors);
+ if (errors != null)
throw new MonoBtlsException ("{0} failed: {1}.", callerName, errors);
- } else {
- Console.Error.WriteLine ("ERROR: {0} failed.", callerName);
+ else
throw new MonoBtlsException ("{0} failed.", callerName);
- }
}
MonoBtlsSslError GetError (int ret_code)
{
CheckThrow ();
+ bio.CheckLastError ();
+
var error = mono_btls_ssl_get_error (
Handle.DangerousGetHandle (), ret_code);
return (MonoBtlsSslError)error;
var ret = mono_btls_ssl_read (
Handle.DangerousGetHandle (), data, dataSize);
- if (ret >= 0) {
+ if (ret > 0) {
dataSize = ret;
return MonoBtlsSslError.None;
}
- var error = mono_btls_ssl_get_error (
- Handle.DangerousGetHandle (), ret);
+ var error = GetError (ret);
+ if (ret == 0 && error == MonoBtlsSslError.Syscall) {
+ // End-of-stream
+ dataSize = 0;
+ return MonoBtlsSslError.None;
+ }
+
dataSize = 0;
- return (MonoBtlsSslError)error;
+ return error;
}
public MonoBtlsSslError Write (IntPtr data, ref int dataSize)
return Marshal.PtrToStringAnsi (namePtr);
}
+ public void Shutdown ()
+ {
+ CheckThrow ();
+ var ret = mono_btls_ssl_shutdown (Handle.DangerousGetHandle ());
+ if (ret < 0)
+ throw ThrowError ();
+ }
+
+ public void SetQuietShutdown ()
+ {
+ CheckThrow ();
+ mono_btls_ssl_set_quiet_shutdown (Handle.DangerousGetHandle (), 1);
+ }
+
protected override void Close ()
{
- mono_btls_ssl_close (Handle.DangerousGetHandle ());
+ if (!Handle.IsInvalid)
+ mono_btls_ssl_close (Handle.DangerousGetHandle ());
}
}
}
}
protected override MNS.MobileTlsContext CreateContext (
- MNS.MobileAuthenticatedStream parent, bool serverMode, string targetHost,
- SslProtocols enabledProtocols, X509Certificate serverCertificate,
- X509CertificateCollection clientCertificates, bool askForClientCert)
+ bool serverMode, string targetHost, SslProtocols enabledProtocols,
+ X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
+ bool askForClientCert)
{
return new MonoBtlsContext (
- parent, serverMode, targetHost,
+ this, serverMode, targetHost,
enabledProtocols, serverCertificate,
clientCertificates, askForClientCert);
}
using System.IO;
using System.Net;
using System.Net.Security;
+using System.Security.Authentication;
using SD = System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
+using System.Runtime.ExceptionServices;
namespace Mono.Net.Security
{
- delegate AsyncOperationStatus AsyncOperation (AsyncProtocolRequest asyncRequest, AsyncOperationStatus status);
-
class BufferOffsetSize
{
public byte[] Buffer;
public BufferOffsetSize (byte[] buffer, int offset, int size)
{
+ if (buffer == null)
+ throw new ArgumentNullException (nameof (buffer));
+ if (offset < 0)
+ throw new ArgumentOutOfRangeException (nameof (offset));
+ if (size < 0 || offset + size > buffer.Length)
+ throw new ArgumentOutOfRangeException (nameof (size));
+
Buffer = buffer;
Offset = offset;
Size = size;
public readonly int InitialSize;
public BufferOffsetSize2 (int size)
- : base (new byte [size], 0, 0)
+ : base (new byte[size], 0, 0)
{
InitialSize = size;
}
{
Offset = Size = 0;
TotalBytes = 0;
- Buffer = new byte [InitialSize];
+ Buffer = new byte[InitialSize];
Complete = false;
}
int missing = size - Remaining;
if (Offset == 0 && Size == 0) {
- Buffer = new byte [size];
+ Buffer = new byte[size];
return;
}
- var buffer = new byte [Buffer.Length + missing];
+ var buffer = new byte[Buffer.Length + missing];
Buffer.CopyTo (buffer, 0);
Buffer = buffer;
}
}
}
- enum AsyncOperationStatus {
- NotStarted,
+ enum AsyncOperationStatus
+ {
Initialize,
Continue,
- Running,
- Complete,
- WantRead,
- WantWrite,
ReadDone,
- FinishWrite
+ Complete
}
- class AsyncProtocolRequest
+ class AsyncProtocolResult
{
- public readonly MobileAuthenticatedStream Parent;
- public readonly BufferOffsetSize UserBuffer;
+ public int UserResult {
+ get;
+ }
+ public ExceptionDispatchInfo Error {
+ get;
+ }
- int RequestedSize;
- public int CurrentSize;
- public int UserResult;
+ public AsyncProtocolResult (int result)
+ {
+ UserResult = result;
+ }
- AsyncOperation Operation;
- int Status;
+ public AsyncProtocolResult (ExceptionDispatchInfo error)
+ {
+ Error = error;
+ }
+ }
- public readonly int ID = ++next_id;
- static int next_id;
+ abstract class AsyncProtocolRequest
+ {
+ public MobileAuthenticatedStream Parent {
+ get;
+ }
- public readonly LazyAsyncResult UserAsyncResult;
+ public bool RunSynchronously {
+ get;
+ }
- public AsyncProtocolRequest (MobileAuthenticatedStream parent, LazyAsyncResult lazyResult, BufferOffsetSize userBuffer = null)
- {
- Parent = parent;
- UserAsyncResult = lazyResult;
- UserBuffer = userBuffer;
+ public int ID => ++next_id;
+
+ public string Name => GetType ().Name;
+
+ public int UserResult {
+ get;
+ protected set;
}
- public bool CompleteWithError (Exception ex)
+ int Started;
+ int RequestedSize;
+ int WriteRequested;
+ readonly object locker = new object ();
+
+ static int next_id;
+
+ public AsyncProtocolRequest (MobileAuthenticatedStream parent, bool sync)
{
- Status = (int)AsyncOperationStatus.Complete;
- if (UserAsyncResult == null)
- return true;
- if (!UserAsyncResult.InternalPeekCompleted)
- UserAsyncResult.InvokeCallback (ex);
- return false;
+ Parent = parent;
+ RunSynchronously = sync;
}
[SD.Conditional ("MARTIN_DEBUG")]
protected void Debug (string message, params object[] args)
{
- Parent.Debug ("AsyncProtocolRequest({0}:{1}): {2}", Parent.ID, ID, string.Format (message, args));
+ Parent.Debug ("{0}({1}:{2}): {3}", Name, Parent.ID, ID, string.Format (message, args));
}
internal void RequestRead (int size)
{
- var oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)AsyncOperationStatus.WantRead, (int)AsyncOperationStatus.Running);
- Debug ("RequestRead: {0} {1}", oldStatus, size);
- if (oldStatus == AsyncOperationStatus.Running)
- RequestedSize = size;
- else if (oldStatus == AsyncOperationStatus.WantRead)
+ lock (locker) {
RequestedSize += size;
- else if (oldStatus != AsyncOperationStatus.WantWrite)
- throw new InvalidOperationException ();
+ Debug ("RequestRead: {0}", size);
+ }
}
- internal void ResetRead ()
+ internal void RequestWrite ()
{
- var oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)AsyncOperationStatus.Complete, (int)AsyncOperationStatus.WantRead);
- Debug ("ResetRead: {0} {1}", oldStatus, Status);
+ WriteRequested = 1;
}
- internal void ResetWrite ()
+ internal async Task<AsyncProtocolResult> StartOperation (CancellationToken cancellationToken)
{
- var oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)AsyncOperationStatus.Complete, (int)AsyncOperationStatus.WantWrite);
- Debug ("ResetWrite: {0} {1}", oldStatus, Status);
+ Debug ("Start Operation: {0}", this);
+ if (Interlocked.CompareExchange (ref Started, 1, 0) != 0)
+ throw new InvalidOperationException ();
+
+ try {
+ await ProcessOperation (cancellationToken).ConfigureAwait (false);
+ return new AsyncProtocolResult (UserResult);
+ } catch (Exception ex) {
+ var info = Parent.SetException (MobileAuthenticatedStream.GetSSPIException (ex));
+ return new AsyncProtocolResult (info);
+ }
}
- internal void RequestWrite ()
+ async Task ProcessOperation (CancellationToken cancellationToken)
{
- var oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)AsyncOperationStatus.WantWrite, (int)AsyncOperationStatus.Running);
- Debug ("RequestWrite: {0} {1}", oldStatus, Status);
- if (oldStatus == AsyncOperationStatus.Running)
- return;
- else if (oldStatus != AsyncOperationStatus.WantRead && oldStatus != AsyncOperationStatus.WantWrite)
- throw new InvalidOperationException ();
+ var status = AsyncOperationStatus.Initialize;
+ while (status != AsyncOperationStatus.Complete) {
+ cancellationToken.ThrowIfCancellationRequested ();
+ Debug ("ProcessOperation: {0}", status);
+
+ var ret = await InnerRead (cancellationToken).ConfigureAwait (false);
+ if (ret != null) {
+ if (ret == 0) {
+ // End-of-stream
+ Debug ("END OF STREAM!");
+ status = AsyncOperationStatus.ReadDone;
+ } else if (ret < 0) {
+ // remote prematurely closed connection.
+ throw new IOException ("Remote prematurely closed connection.");
+ }
+ }
+
+ Debug ("ProcessOperation run: {0}", status);
+
+ AsyncOperationStatus newStatus;
+ switch (status) {
+ case AsyncOperationStatus.Initialize:
+ case AsyncOperationStatus.Continue:
+ case AsyncOperationStatus.ReadDone:
+ newStatus = Run (status);
+ break;
+ default:
+ throw new InvalidOperationException ();
+ }
+
+ if (Interlocked.Exchange (ref WriteRequested, 0) != 0) {
+ // Flush the write queue.
+ await Parent.InnerWrite (RunSynchronously, cancellationToken);
+ }
+
+ Debug ("ProcessOperation done: {0} -> {1}", status, newStatus);
+
+ status = newStatus;
+ }
}
- internal void StartOperation (AsyncOperation operation)
+ async Task<int?> InnerRead (CancellationToken cancellationToken)
{
- Debug ("Start Operation: {0} {1}", Status, operation);
- if (Interlocked.CompareExchange (ref Status, (int)AsyncOperationStatus.Initialize, (int)AsyncOperationStatus.NotStarted) != (int)AsyncOperationStatus.NotStarted)
- throw new InvalidOperationException ();
+ int? totalRead = null;
+ var requestedSize = Interlocked.Exchange (ref RequestedSize, 0);
+ while (requestedSize > 0) {
+ Debug ("ProcessOperation - read inner: {0}", requestedSize);
- Operation = operation;
+ var ret = await Parent.InnerRead (RunSynchronously, requestedSize, cancellationToken).ConfigureAwait (false);
+ Debug ("ProcessOperation - read inner done: {0} - {1}", requestedSize, ret);
- if (UserAsyncResult == null) {
- StartOperation ();
- return;
+ if (ret <= 0)
+ return ret;
+ if (ret > requestedSize)
+ throw new InvalidOperationException ();
+
+ totalRead += ret;
+ requestedSize -= ret;
+ var newRequestedSize = Interlocked.Exchange (ref RequestedSize, 0);
+ requestedSize += newRequestedSize;
}
- ThreadPool.QueueUserWorkItem (_ => StartOperation ());
+ return totalRead;
}
- void StartOperation ()
+ /*
+ * This will operate on the internal buffers and never block.
+ */
+ protected abstract AsyncOperationStatus Run (AsyncOperationStatus status);
+
+ public override string ToString ()
{
- try {
- ProcessOperation ();
- if (UserAsyncResult != null && !UserAsyncResult.InternalPeekCompleted)
- UserAsyncResult.InvokeCallback (UserResult);
- } catch (Exception ex) {
- if (UserAsyncResult == null)
- throw;
- if (!UserAsyncResult.InternalPeekCompleted)
- UserAsyncResult.InvokeCallback (ex);
- }
+ return string.Format ("[{0}]", Name);
}
+ }
- void ProcessOperation ()
+ class AsyncHandshakeRequest : AsyncProtocolRequest
+ {
+ public AsyncHandshakeRequest (MobileAuthenticatedStream parent, bool sync)
+ : base (parent, sync)
{
- AsyncOperationStatus status;
- do {
- status = (AsyncOperationStatus)Interlocked.Exchange (ref Status, (int)AsyncOperationStatus.Running);
+ }
- Debug ("ProcessOperation: {0}", status);
+ protected override AsyncOperationStatus Run (AsyncOperationStatus status)
+ {
+ return Parent.ProcessHandshake (status);
+ }
+ }
- status = ProcessOperation (status);
+ abstract class AsyncReadOrWriteRequest : AsyncProtocolRequest
+ {
+ protected BufferOffsetSize UserBuffer {
+ get;
+ }
- Debug ("ProcessOperation done: {0}", status);
+ protected int CurrentSize {
+ get; set;
+ }
- AsyncOperationStatus oldStatus;
- if (status == AsyncOperationStatus.Complete) {
- oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)AsyncOperationStatus.FinishWrite, (int)AsyncOperationStatus.WantWrite);
- if (oldStatus == AsyncOperationStatus.WantWrite) {
- // We are done, but still need to flush the write queue.
- status = AsyncOperationStatus.FinishWrite;
- continue;
- }
- }
+ public AsyncReadOrWriteRequest (MobileAuthenticatedStream parent, bool sync, byte[] buffer, int offset, int size)
+ : base (parent, sync)
+ {
+ UserBuffer = new BufferOffsetSize (buffer, offset, size);
+ }
- oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)status, (int)AsyncOperationStatus.Running);
- Debug ("ProcessOperation done: {0} -> {1}", oldStatus, status);
+ public override string ToString ()
+ {
+ return string.Format ("[{0}: {1}]", Name, UserBuffer);
+ }
+ }
- if (oldStatus != AsyncOperationStatus.Running) {
- if (status == oldStatus || status == AsyncOperationStatus.Continue || status == AsyncOperationStatus.Complete)
- status = oldStatus;
- else
- throw new InvalidOperationException ();
- }
- } while (status != AsyncOperationStatus.Complete);
+ class AsyncReadRequest : AsyncReadOrWriteRequest
+ {
+ public AsyncReadRequest (MobileAuthenticatedStream parent, bool sync, byte[] buffer, int offset, int size)
+ : base (parent, sync, buffer, offset, size)
+ {
}
- AsyncOperationStatus ProcessOperation (AsyncOperationStatus status)
+ protected override AsyncOperationStatus Run (AsyncOperationStatus status)
{
- if (status == AsyncOperationStatus.WantRead) {
- if (RequestedSize < 0)
- throw new InvalidOperationException ();
- else if (RequestedSize == 0)
- return AsyncOperationStatus.Continue;
-
- Debug ("ProcessOperation - read inner: {0}", RequestedSize);
- var ret = Parent.InnerRead (RequestedSize);
- Debug ("ProcessOperation - read inner done: {0} - {1}", RequestedSize, ret);
-
- if (ret < 0)
- return AsyncOperationStatus.ReadDone;
-
- RequestedSize -= ret;
-
- if (ret == 0 || RequestedSize == 0)
- return AsyncOperationStatus.Continue;
- else
- return AsyncOperationStatus.WantRead;
- } else if (status == AsyncOperationStatus.WantWrite) {
- Debug ("ProcessOperation - want write");
- Parent.InnerWrite ();
- Debug ("ProcessOperation - want write done");
+ Debug ("ProcessRead - read user: {0} {1}", this, status);
+
+ var (ret, wantMore) = Parent.ProcessRead (UserBuffer);
+
+ Debug ("ProcessRead - read user done: {0} - {1} {2}", this, ret, wantMore);
+
+ if (ret < 0) {
+ UserResult = -1;
+ return AsyncOperationStatus.Complete;
+ }
+
+ CurrentSize += ret;
+ UserBuffer.Offset += ret;
+ UserBuffer.Size -= ret;
+
+ Debug ("Process Read - read user done #1: {0} - {1} {2}", this, CurrentSize, wantMore);
+
+ if (wantMore && CurrentSize == 0)
return AsyncOperationStatus.Continue;
- } else if (status == AsyncOperationStatus.Initialize || status == AsyncOperationStatus.Continue) {
- Debug ("ProcessOperation - continue");
- status = Operation (this, status);
- Debug ("ProcessOperation - continue done: {0}", status);
- return status;
- } else if (status == AsyncOperationStatus.ReadDone) {
- Debug ("ProcessOperation - read done");
- status = Operation (this, status);
- Debug ("ProcessOperation - read done: {0}", status);
- return status;
- } else if (status == AsyncOperationStatus.FinishWrite) {
- Debug ("ProcessOperation - finish write");
- Parent.InnerWrite ();
- Debug ("ProcessOperation - finish write done");
+
+ UserResult = CurrentSize;
+ return AsyncOperationStatus.Complete;
+ }
+ }
+
+ class AsyncWriteRequest : AsyncReadOrWriteRequest
+ {
+ public AsyncWriteRequest (MobileAuthenticatedStream parent, bool sync, byte[] buffer, int offset, int size)
+ : base (parent, sync, buffer, offset, size)
+ {
+ }
+
+ protected override AsyncOperationStatus Run (AsyncOperationStatus status)
+ {
+ Debug ("ProcessWrite - write user: {0} {1}", this, status);
+
+ if (UserBuffer.Size == 0) {
+ UserResult = CurrentSize;
+ return AsyncOperationStatus.Complete;
+ }
+
+ var (ret, wantMore) = Parent.ProcessWrite (UserBuffer);
+
+ Debug ("ProcessWrite - write user done: {0} - {1} {2}", this, ret, wantMore);
+
+ if (ret < 0) {
+ UserResult = -1;
return AsyncOperationStatus.Complete;
}
- throw new InvalidOperationException ();
+ CurrentSize += ret;
+ UserBuffer.Offset += ret;
+ UserBuffer.Size -= ret;
+
+ if (wantMore)
+ return AsyncOperationStatus.Continue;
+
+ UserResult = CurrentSize;
+ return AsyncOperationStatus.Complete;
+ }
+ }
+
+ class AsyncShutdownRequest : AsyncProtocolRequest
+ {
+ public AsyncShutdownRequest (MobileAuthenticatedStream parent)
+ : base (parent, false)
+ {
+ }
+
+ protected override AsyncOperationStatus Run (AsyncOperationStatus status)
+ {
+ return Parent.ProcessShutdown (status);
}
}
+
}
#endif
#region IMonoSslStream
+ Task IMonoSslStream.ShutdownAsync ()
+ {
+ return Task.CompletedTask;
+ }
+
AuthenticatedStream IMonoSslStream.AuthenticatedStream {
get { return this; }
}
using System.Net;
using System.Net.Security;
using System.Globalization;
+using System.Security.Authentication;
using System.Runtime.ExceptionServices;
using System.Threading;
using System.Threading.Tasks;
{
abstract class MobileAuthenticatedStream : AuthenticatedStream, MSI.IMonoSslStream
{
+ /*
+ * This is intentionally called `xobileTlsContext'. It is a "dangerous" object
+ * that must not be touched outside the `ioLock' and we need to be very careful
+ * where we access it.
+ */
MobileTlsContext xobileTlsContext;
- Exception lastException;
+ ExceptionDispatchInfo lastException;
AsyncProtocolRequest asyncHandshakeRequest;
AsyncProtocolRequest asyncReadRequest;
object ioLock = new object ();
int closeRequested;
+ bool shutdown;
static int uniqueNameInteger = 123;
public MobileAuthenticatedStream (Stream innerStream, bool leaveInnerStreamOpen, SslStream owner,
- MSI.MonoTlsSettings settings, MSI.MonoTlsProvider provider)
+ MSI.MonoTlsSettings settings, MSI.MonoTlsProvider provider)
: base (innerStream, leaveInnerStreamOpen)
{
SslStream = owner;
get { return xobileTlsContext != null; }
}
- internal MobileTlsContext Context {
- get {
- CheckThrow (true);
- return xobileTlsContext;
- }
- }
-
- internal void CheckThrow (bool authSuccessCheck)
+ internal void CheckThrow (bool authSuccessCheck, bool shutdownCheck = false)
{
- if (closeRequested != 0)
- throw new InvalidOperationException ("Stream is closed.");
if (lastException != null)
- throw lastException;
+ lastException.Throw ();
if (authSuccessCheck && !IsAuthenticated)
- throw new InvalidOperationException ("Must be authenticated.");
+ throw new InvalidOperationException (SR.net_auth_noauth);
+ if (shutdownCheck && shutdown)
+ throw new InvalidOperationException (SR.net_ssl_io_already_shutdown);
}
- Exception SetException (Exception e)
+ internal static Exception GetSSPIException (Exception e)
{
- e = SetException_internal (e);
- if (e != null && xobileTlsContext != null)
- xobileTlsContext.Dispose ();
- return e;
+ if (e is OperationCanceledException || e is IOException || e is ObjectDisposedException || e is AuthenticationException)
+ return e;
+ return new AuthenticationException (SR.net_auth_SSPI, e);
}
- Exception SetException_internal (Exception e)
+ internal static Exception GetIOException (Exception e, string message)
{
- if (lastException == null)
- lastException = e;
- return lastException;
+ if (e is OperationCanceledException || e is IOException || e is ObjectDisposedException || e is AuthenticationException)
+ return e;
+ return new IOException (message, e);
+ }
+
+ internal ExceptionDispatchInfo SetException (Exception e)
+ {
+ var info = ExceptionDispatchInfo.Capture (e);
+ var old = Interlocked.CompareExchange (ref lastException, info, null);
+ return old ?? info;
}
SslProtocols DefaultProtocols {
get { return SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls; }
}
+ enum OperationType {
+ Read,
+ Write,
+ Shutdown
+ }
+
public void AuthenticateAsClient (string targetHost)
{
AuthenticateAsClient (targetHost, new X509CertificateCollection (), DefaultProtocols, false);
public void AuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
{
- ValidateCreateContext (false, targetHost, enabledSslProtocols, null, clientCertificates, false);
- ProcessAuthentication (null);
+ var task = ProcessAuthentication (true, false, targetHost, enabledSslProtocols, null, clientCertificates, false);
+ task.Wait ();
}
public IAsyncResult BeginAuthenticateAsClient (string targetHost, AsyncCallback asyncCallback, object asyncState)
public IAsyncResult BeginAuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
{
- ValidateCreateContext (false, targetHost, enabledSslProtocols, null, clientCertificates, false);
- var result = new LazyAsyncResult (this, asyncState, asyncCallback);
- ProcessAuthentication (result);
- return result;
+ var task = ProcessAuthentication (false, false, targetHost, enabledSslProtocols, null, clientCertificates, false);
+ return TaskToApm.Begin (task, asyncCallback, asyncState);
}
public void EndAuthenticateAsClient (IAsyncResult asyncResult)
{
- EndProcessAuthentication (asyncResult);
+ TaskToApm.End (asyncResult);
}
public void AuthenticateAsServer (X509Certificate serverCertificate)
public void AuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
{
- ValidateCreateContext (true, string.Empty, enabledSslProtocols, serverCertificate, null, clientCertificateRequired);
- ProcessAuthentication (null);
+ var task = ProcessAuthentication (true, true, string.Empty, enabledSslProtocols, serverCertificate, null, clientCertificateRequired);
+ task.Wait ();
}
public IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, AsyncCallback asyncCallback, object asyncState)
public IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
{
- ValidateCreateContext (true, string.Empty, enabledSslProtocols, serverCertificate, null, clientCertificateRequired);
- var result = new LazyAsyncResult (this, asyncState, asyncCallback);
- ProcessAuthentication (result);
- return result;
+ var task = ProcessAuthentication (false, true, string.Empty, enabledSslProtocols, serverCertificate, null, clientCertificateRequired);
+ return TaskToApm.Begin (task, asyncCallback, asyncState);
}
public void EndAuthenticateAsServer (IAsyncResult asyncResult)
{
- EndProcessAuthentication (asyncResult);
+ TaskToApm.End (asyncResult);
}
public Task AuthenticateAsClientAsync (string targetHost)
{
- return Task.Factory.FromAsync (BeginAuthenticateAsClient, EndAuthenticateAsClient, targetHost, null);
+ return ProcessAuthentication (false, false, targetHost, DefaultProtocols, null, null, false);
}
public Task AuthenticateAsClientAsync (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
{
- return Task.Factory.FromAsync ((callback, state) => BeginAuthenticateAsClient (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation, callback, state), EndAuthenticateAsClient, null);
+ return ProcessAuthentication (false, false, targetHost, enabledSslProtocols, null, clientCertificates, false);
}
public Task AuthenticateAsServerAsync (X509Certificate serverCertificate)
{
- return Task.Factory.FromAsync (BeginAuthenticateAsServer, EndAuthenticateAsServer, serverCertificate, null);
+ return AuthenticateAsServerAsync (serverCertificate, false, DefaultProtocols, false);
}
public Task AuthenticateAsServerAsync (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
{
- return Task.Factory.FromAsync ((callback, state) => BeginAuthenticateAsServer (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation, callback, state), EndAuthenticateAsServer, null);
+ return ProcessAuthentication (false, true, string.Empty, enabledSslProtocols, serverCertificate, null, clientCertificateRequired);
+ }
+
+ public Task ShutdownAsync ()
+ {
+ Debug ("ShutdownAsync");
+
+ /*
+ * SSLClose() is a little bit tricky as it might attempt to send a close_notify alert
+ * and thus call our write callback.
+ *
+ * It is also not thread-safe with SSLRead() or SSLWrite(), so we need to take the I/O lock here.
+ */
+ var asyncRequest = new AsyncShutdownRequest (this);
+ var task = StartOperation (OperationType.Shutdown, asyncRequest, CancellationToken.None);
+ return task;
}
public AuthenticatedStream AuthenticatedStream {
get { return this; }
}
- internal void ProcessAuthentication (LazyAsyncResult lazyResult)
+ async Task ProcessAuthentication (
+ bool runSynchronously, bool serverMode, string targetHost, SslProtocols enabledProtocols,
+ X509Certificate serverCertificate, X509CertificateCollection clientCertificates, bool clientCertRequired)
{
- var asyncRequest = new AsyncProtocolRequest (this, lazyResult);
+ if (serverMode) {
+ if (serverCertificate == null)
+ throw new ArgumentException (nameof (serverCertificate));
+ } else {
+ if (targetHost == null)
+ throw new ArgumentException (nameof (targetHost));
+ if (targetHost.Length == 0)
+ targetHost = "?" + Interlocked.Increment (ref uniqueNameInteger).ToString (NumberFormatInfo.InvariantInfo);
+ }
+
+ if (lastException != null)
+ lastException.Throw ();
+
+ var asyncRequest = new AsyncHandshakeRequest (this, runSynchronously);
if (Interlocked.CompareExchange (ref asyncHandshakeRequest, asyncRequest, null) != null)
throw new InvalidOperationException ("Invalid nested call.");
+ // Make sure no other async requests can be started during the handshake.
+ if (Interlocked.CompareExchange (ref asyncReadRequest, asyncRequest, null) != null)
+ throw new InvalidOperationException ("Invalid nested call.");
+ if (Interlocked.CompareExchange (ref asyncWriteRequest, asyncRequest, null) != null)
+ throw new InvalidOperationException ("Invalid nested call.");
+
+ AsyncProtocolResult result;
try {
- if (lastException != null)
- throw lastException;
- if (xobileTlsContext == null)
- throw new InvalidOperationException ();
+ lock (ioLock) {
+ if (xobileTlsContext != null)
+ throw new InvalidOperationException ();
+ readBuffer.Reset ();
+ writeBuffer.Reset ();
- readBuffer.Reset ();
- writeBuffer.Reset ();
+ xobileTlsContext = CreateContext (
+ serverMode, targetHost, enabledProtocols, serverCertificate,
+ clientCertificates, clientCertRequired);
+ }
try {
- asyncRequest.StartOperation (ProcessHandshake);
+ result = await asyncRequest.StartOperation (CancellationToken.None).ConfigureAwait (false);
} catch (Exception ex) {
- ExceptionDispatchInfo.Capture (SetException (ex)).Throw ();
+ result = new AsyncProtocolResult (SetException (GetSSPIException (ex)));
}
} finally {
- if (lazyResult == null || lastException != null) {
+ lock (ioLock) {
readBuffer.Reset ();
writeBuffer.Reset ();
+ asyncWriteRequest = null;
+ asyncReadRequest = null;
asyncHandshakeRequest = null;
}
}
- }
-
- internal void EndProcessAuthentication (IAsyncResult result)
- {
- if (result == null)
- throw new ArgumentNullException ("asyncResult");
-
- var lazyResult = (LazyAsyncResult)result;
- if (Interlocked.Exchange (ref asyncHandshakeRequest, null) == null)
- throw new InvalidOperationException ("Invalid end call.");
-
- lazyResult.InternalWaitForCompletion ();
-
- readBuffer.Reset ();
- writeBuffer.Reset ();
-
- var e = lazyResult.Result as Exception;
- if (e != null)
- ExceptionDispatchInfo.Capture (SetException (e)).Throw ();
- }
-
- internal void ValidateCreateContext (bool serverMode, string targetHost, SslProtocols enabledProtocols, X509Certificate serverCertificate, X509CertificateCollection clientCertificates, bool clientCertRequired)
- {
- if (xobileTlsContext != null)
- throw new InvalidOperationException ();
-
- if (serverMode) {
- if (serverCertificate == null)
- throw new ArgumentException ("serverCertificate");
- } else {
- if (targetHost == null)
- throw new ArgumentException ("targetHost");
- if (targetHost.Length == 0)
- targetHost = "?" + Interlocked.Increment (ref uniqueNameInteger).ToString (NumberFormatInfo.InvariantInfo);
- }
- xobileTlsContext = CreateContext (this, serverMode, targetHost, enabledProtocols, serverCertificate, clientCertificates, clientCertRequired);
+ if (result.Error != null)
+ result.Error.Throw ();
}
protected abstract MobileTlsContext CreateContext (
- MobileAuthenticatedStream parent, bool serverMode, string targetHost,
- SSA.SslProtocols enabledProtocols, X509Certificate serverCertificate,
- X509CertificateCollection clientCertificates, bool askForClientCert);
+ bool serverMode, string targetHost, SSA.SslProtocols enabledProtocols,
+ X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
+ bool askForClientCert);
public override IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
{
- return BeginReadOrWrite (ref asyncReadRequest, ref readBuffer, ProcessRead, new BufferOffsetSize (buffer, offset, count), asyncCallback, asyncState);
+ var asyncRequest = new AsyncReadRequest (this, false, buffer, offset, count);
+ var task = StartOperation (OperationType.Read, asyncRequest, CancellationToken.None);
+ return TaskToApm.Begin (task, asyncCallback, asyncState);
}
public override int EndRead (IAsyncResult asyncResult)
{
- return (int)EndReadOrWrite (asyncResult, ref asyncReadRequest);
+ return TaskToApm.End<int> (asyncResult);
}
public override IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
{
- return BeginReadOrWrite (ref asyncWriteRequest, ref writeBuffer, ProcessWrite, new BufferOffsetSize (buffer, offset, count), asyncCallback, asyncState);
+ var asyncRequest = new AsyncWriteRequest (this, false, buffer, offset, count);
+ var task = StartOperation (OperationType.Write, asyncRequest, CancellationToken.None);
+ return TaskToApm.Begin (task, asyncCallback, asyncState);
}
public override void EndWrite (IAsyncResult asyncResult)
{
- EndReadOrWrite (asyncResult, ref asyncWriteRequest);
+ TaskToApm.End (asyncResult);
}
public override int Read (byte[] buffer, int offset, int count)
{
- return ProcessReadOrWrite (ref asyncReadRequest, ref readBuffer, ProcessRead, new BufferOffsetSize (buffer, offset, count), null);
+ var asyncRequest = new AsyncReadRequest (this, true, buffer, offset, count);
+ var task = StartOperation (OperationType.Read, asyncRequest, CancellationToken.None);
+ return task.Result;
}
public void Write (byte[] buffer)
{
Write (buffer, 0, buffer.Length);
}
+
public override void Write (byte[] buffer, int offset, int count)
{
- ProcessReadOrWrite (ref asyncWriteRequest, ref writeBuffer, ProcessWrite, new BufferOffsetSize (buffer, offset, count), null);
+ var asyncRequest = new AsyncWriteRequest (this, true, buffer, offset, count);
+ var task = StartOperation (OperationType.Write, asyncRequest, CancellationToken.None);
+ task.Wait ();
}
- IAsyncResult BeginReadOrWrite (ref AsyncProtocolRequest nestedRequest, ref BufferOffsetSize2 internalBuffer, AsyncOperation operation, BufferOffsetSize userBuffer, AsyncCallback asyncCallback, object asyncState)
+ public override Task<int> ReadAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
- LazyAsyncResult lazyResult = new LazyAsyncResult (this, asyncState, asyncCallback);
- ProcessReadOrWrite (ref nestedRequest, ref internalBuffer, operation, userBuffer, lazyResult);
- return lazyResult;
+ var asyncRequest = new AsyncReadRequest (this, false, buffer, offset, count);
+ return StartOperation (OperationType.Read, asyncRequest, cancellationToken);
}
- object EndReadOrWrite (IAsyncResult asyncResult, ref AsyncProtocolRequest nestedRequest)
+ public override Task WriteAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
- if (asyncResult == null)
- throw new ArgumentNullException("asyncResult");
-
- var lazyResult = (LazyAsyncResult)asyncResult;
-
- if (Interlocked.Exchange (ref nestedRequest, null) == null)
- throw new InvalidOperationException ("Invalid end call.");
-
- // No "artificial" timeouts implemented so far, InnerStream controls timeout.
- lazyResult.InternalWaitForCompletion ();
-
- Debug ("EndReadOrWrite");
-
- var e = lazyResult.Result as Exception;
- if (e != null) {
- var ioEx = e as IOException;
- if (ioEx != null)
- throw ioEx;
- throw new IOException ("read failed", e);
- }
-
- return lazyResult.Result;
+ var asyncRequest = new AsyncWriteRequest (this, false, buffer, offset, count);
+ return StartOperation (OperationType.Write, asyncRequest, cancellationToken);
}
- int ProcessReadOrWrite (ref AsyncProtocolRequest nestedRequest, ref BufferOffsetSize2 internalBuffer, AsyncOperation operation, BufferOffsetSize userBuffer, LazyAsyncResult lazyResult)
+ async Task<int> StartOperation (OperationType type, AsyncProtocolRequest asyncRequest, CancellationToken cancellationToken)
{
- if (userBuffer == null || userBuffer.Buffer == null)
- throw new ArgumentNullException ("buffer");
- if (userBuffer.Offset < 0)
- throw new ArgumentOutOfRangeException ("offset");
- if (userBuffer.Size < 0 || userBuffer.Offset + userBuffer.Size > userBuffer.Buffer.Length)
- throw new ArgumentOutOfRangeException ("count");
-
- CheckThrow (true);
+ CheckThrow (true, type != OperationType.Read);
+ Debug ("StartOperationAsync: {0} {1}", asyncRequest, type);
- var name = internalBuffer == readBuffer ? "read" : "write";
- Debug ("ProcessReadOrWrite: {0} {1}", name, userBuffer);
+ if (type == OperationType.Read) {
+ if (Interlocked.CompareExchange (ref asyncReadRequest, asyncRequest, null) != null)
+ throw new InvalidOperationException ("Invalid nested call.");
+ } else {
+ if (Interlocked.CompareExchange (ref asyncWriteRequest, asyncRequest, null) != null)
+ throw new InvalidOperationException ("Invalid nested call.");
+ }
- var asyncRequest = new AsyncProtocolRequest (this, lazyResult, userBuffer);
- return StartOperation (ref nestedRequest, ref internalBuffer, operation, asyncRequest, name);
- }
+ AsyncProtocolResult result;
- int StartOperation (ref AsyncProtocolRequest nestedRequest, ref BufferOffsetSize2 internalBuffer, AsyncOperation operation, AsyncProtocolRequest asyncRequest, string name)
- {
- if (Interlocked.CompareExchange (ref nestedRequest, asyncRequest, null) != null)
- throw new InvalidOperationException ("Invalid nested call.");
-
- bool failed = false;
try {
- internalBuffer.Reset ();
- asyncRequest.StartOperation (operation);
- return asyncRequest.UserResult;
+ lock (ioLock) {
+ if (type == OperationType.Read)
+ readBuffer.Reset ();
+ else
+ writeBuffer.Reset ();
+ }
+ result = await asyncRequest.StartOperation (cancellationToken).ConfigureAwait (false);
} catch (Exception e) {
- failed = true;
- if (e is IOException)
- throw;
- throw new IOException (name + " failed", e);
+ var info = SetException (GetIOException (e, asyncRequest.Name + " failed"));
+ result = new AsyncProtocolResult (info);
} finally {
- if (asyncRequest.UserAsyncResult == null || failed) {
- internalBuffer.Reset ();
- nestedRequest = null;
+ lock (ioLock) {
+ if (type == OperationType.Read) {
+ readBuffer.Reset ();
+ asyncReadRequest = null;
+ } else {
+ writeBuffer.Reset ();
+ asyncWriteRequest = null;
+ }
}
}
+
+ if (result.Error != null)
+ result.Error.Throw ();
+ return result.UserResult;
}
static int nextId;
Console.Error.WriteLine ("MobileAuthenticatedStream({0}): {1}", ID, string.Format (message, args));
}
- #region Called back from native code via SslConnection
+#region Called back from native code via SslConnection
/*
* Called from within SSLRead() and SSLHandshake(). We only access tha managed byte[] here.
*/
- internal int InternalRead (byte[] buffer, int offset, int size, out bool wantMore)
+ internal int InternalRead (byte[] buffer, int offset, int size, out bool outWantMore)
{
try {
- Debug ("InternalRead: {0} {1} {2} {3}", offset, size, asyncReadRequest != null, readBuffer != null);
+ Debug ("InternalRead: {0} {1} {2} {3} {4}", offset, size,
+ asyncHandshakeRequest != null ? "handshake" : "",
+ asyncReadRequest != null ? "async" : "",
+ readBuffer != null ? readBuffer.ToString () : "");
var asyncRequest = asyncHandshakeRequest ?? asyncReadRequest;
- return InternalRead (asyncRequest, readBuffer, buffer, offset, size, out wantMore);
+ var (ret, wantMore) = InternalRead (asyncRequest, readBuffer, buffer, offset, size);
+ outWantMore = wantMore;
+ return ret;
} catch (Exception ex) {
Debug ("InternalRead failed: {0}", ex);
- SetException_internal (ex);
- wantMore = false;
+ SetException (GetIOException (ex, "InternalRead() failed"));
+ outWantMore = false;
return -1;
}
}
- int InternalRead (AsyncProtocolRequest asyncRequest, BufferOffsetSize internalBuffer, byte[] buffer, int offset, int size, out bool wantMore)
+ (int, bool) InternalRead (AsyncProtocolRequest asyncRequest, BufferOffsetSize internalBuffer, byte[] buffer, int offset, int size)
{
if (asyncRequest == null)
throw new InvalidOperationException ();
* native function again.
*/
if (internalBuffer.Size == 0 && !internalBuffer.Complete) {
- Debug ("InternalRead #1: {0} {1}", internalBuffer.Offset, internalBuffer.TotalBytes);
+ Debug ("InternalRead #1: {0} {1} {2}", internalBuffer.Offset, internalBuffer.TotalBytes, size);
internalBuffer.Offset = internalBuffer.Size = 0;
asyncRequest.RequestRead (size);
- wantMore = true;
- return 0;
+ return (0, true);
}
/*
Buffer.BlockCopy (internalBuffer.Buffer, internalBuffer.Offset, buffer, offset, len);
internalBuffer.Offset += len;
internalBuffer.Size -= len;
- wantMore = !internalBuffer.Complete && len < size;
- return len;
+ return (len, !internalBuffer.Complete && len < size);
}
/*
return InternalWrite (asyncRequest, writeBuffer, buffer, offset, size);
} catch (Exception ex) {
Debug ("InternalWrite failed: {0}", ex);
- SetException_internal (ex);
+ SetException (GetIOException (ex, "InternalWrite() failed"));
return false;
}
}
return true;
}
- #endregion
+#endregion
- #region Inner Stream
+#region Inner Stream
/*
* Read / write data from the inner stream; we're only called from managed code and only manipulate
* the internal buffers.
*/
- internal int InnerRead (int requestedSize)
+ internal async Task<int> InnerRead (bool sync, int requestedSize, CancellationToken cancellationToken)
{
+ cancellationToken.ThrowIfCancellationRequested ();
Debug ("InnerRead: {0} {1} {2} {3}", readBuffer.Offset, readBuffer.Size, readBuffer.Remaining, requestedSize);
var len = System.Math.Min (readBuffer.Remaining, requestedSize);
if (len == 0)
throw new InvalidOperationException ();
- var ret = InnerStream.Read (readBuffer.Buffer, readBuffer.EndOffset, len);
+
+ Task<int> task;
+ if (sync)
+ task = Task.Run (() => InnerStream.Read (readBuffer.Buffer, readBuffer.EndOffset, len));
+ else
+ task = InnerStream.ReadAsync (readBuffer.Buffer, readBuffer.EndOffset, len, cancellationToken);
+
+ var ret = await task.ConfigureAwait (false);
Debug ("InnerRead done: {0} {1} - {2}", readBuffer.Remaining, len, ret);
if (ret >= 0) {
return ret;
}
- internal void InnerWrite ()
+ internal async Task InnerWrite (bool sync, CancellationToken cancellationToken)
{
+ cancellationToken.ThrowIfCancellationRequested ();
Debug ("InnerWrite: {0} {1}", writeBuffer.Offset, writeBuffer.Size);
- InnerFlush ();
- }
- internal void InnerFlush ()
- {
- if (writeBuffer.Size > 0) {
- InnerStream.Write (writeBuffer.Buffer, writeBuffer.Offset, writeBuffer.Size);
- writeBuffer.TotalBytes += writeBuffer.Size;
- writeBuffer.Offset = writeBuffer.Size = 0;
- }
+ if (writeBuffer.Size == 0)
+ return;
+
+ Task task;
+ if (sync)
+ task = Task.Run (() => InnerStream.Write (writeBuffer.Buffer, writeBuffer.Offset, writeBuffer.Size));
+ else
+ task = InnerStream.WriteAsync (writeBuffer.Buffer, writeBuffer.Offset, writeBuffer.Size);
+
+ await task.ConfigureAwait (false);
+
+ writeBuffer.TotalBytes += writeBuffer.Size;
+ writeBuffer.Offset = writeBuffer.Size = 0;
}
- #endregion
+#endregion
- #region Main async I/O loop
+#region Main async I/O loop
- AsyncOperationStatus ProcessHandshake (AsyncProtocolRequest asyncRequest, AsyncOperationStatus status)
+ internal AsyncOperationStatus ProcessHandshake (AsyncOperationStatus status)
{
Debug ("ProcessHandshake: {0}", status);
- /*
- * The first time we're called (AsyncOperationStatus.Initialize), we need to setup the SslContext and
- * start the handshake.
- */
- if (status == AsyncOperationStatus.Initialize) {
- xobileTlsContext.StartHandshake ();
- return AsyncOperationStatus.Continue;
- } else if (status == AsyncOperationStatus.ReadDone) {
- // remote prematurely closed connection.
- throw new IOException ("Remote prematurely closed connection.");
- } else if (status != AsyncOperationStatus.Continue) {
- throw new InvalidOperationException ();
- }
+ lock (ioLock) {
+ /*
+ * The first time we're called (AsyncOperationStatus.Initialize), we need to setup the SslContext and
+ * start the handshake.
+ */
+ if (status == AsyncOperationStatus.Initialize) {
+ xobileTlsContext.StartHandshake ();
+ return AsyncOperationStatus.Continue;
+ } else if (status == AsyncOperationStatus.ReadDone) {
+ throw new IOException (SR.net_auth_eof);
+ } else if (status != AsyncOperationStatus.Continue) {
+ throw new InvalidOperationException ();
+ }
- /*
- * SSLHandshake() will return repeatedly with 'SslStatus.WouldBlock', we then need
- * to take care of I/O and call it again.
- */
- if (!xobileTlsContext.ProcessHandshake ()) {
/*
- * Flush the internal write buffer.
- */
- InnerFlush ();
+ * SSLHandshake() will return repeatedly with 'SslStatus.WouldBlock', we then need
+ * to take care of I/O and call it again.
+ */
+ if (xobileTlsContext.ProcessHandshake ()) {
+ xobileTlsContext.FinishHandshake ();
+ return AsyncOperationStatus.Complete;
+ }
return AsyncOperationStatus.Continue;
}
-
- xobileTlsContext.FinishHandshake ();
- return AsyncOperationStatus.Complete;
}
- AsyncOperationStatus ProcessRead (AsyncProtocolRequest asyncRequest, AsyncOperationStatus status)
+ internal (int, bool) ProcessRead (BufferOffsetSize userBuffer)
{
- Debug ("ProcessRead - read user: {0} {1}", status, asyncRequest.UserBuffer);
-
- int ret;
- bool wantMore;
lock (ioLock) {
- ret = Context.Read (asyncRequest.UserBuffer.Buffer, asyncRequest.UserBuffer.Offset, asyncRequest.UserBuffer.Size, out wantMore);
+ // This operates on the internal buffer and will never block.
+ var ret = xobileTlsContext.Read (userBuffer.Buffer, userBuffer.Offset, userBuffer.Size, out bool wantMore);
+ return (ret, wantMore);
}
- Debug ("ProcessRead - read user done: {0} - {1} {2}", asyncRequest.UserBuffer, ret, wantMore);
-
- if (ret < 0) {
- asyncRequest.UserResult = -1;
- return AsyncOperationStatus.Complete;
- }
-
- asyncRequest.CurrentSize += ret;
- asyncRequest.UserBuffer.Offset += ret;
- asyncRequest.UserBuffer.Size -= ret;
-
- Debug ("Process Read - read user done #1: {0} - {1} {2}", asyncRequest.UserBuffer, asyncRequest.CurrentSize, wantMore);
-
- if (wantMore && asyncRequest.CurrentSize == 0)
- return AsyncOperationStatus.WantRead;
-
- asyncRequest.ResetRead ();
- asyncRequest.UserResult = asyncRequest.CurrentSize;
- return AsyncOperationStatus.Complete;
}
- AsyncOperationStatus ProcessWrite (AsyncProtocolRequest asyncRequest, AsyncOperationStatus status)
+ internal (int, bool) ProcessWrite (BufferOffsetSize userBuffer)
{
- Debug ("ProcessWrite - write user: {0} {1}", status, asyncRequest.UserBuffer);
-
- if (asyncRequest.UserBuffer.Size == 0) {
- asyncRequest.UserResult = asyncRequest.CurrentSize;
- return AsyncOperationStatus.Complete;
- }
-
- int ret;
- bool wantMore;
lock (ioLock) {
- ret = Context.Write (asyncRequest.UserBuffer.Buffer, asyncRequest.UserBuffer.Offset, asyncRequest.UserBuffer.Size, out wantMore);
- }
- Debug ("ProcessWrite - write user done: {0} - {1} {2}", asyncRequest.UserBuffer, ret, wantMore);
-
- if (ret < 0) {
- asyncRequest.UserResult = -1;
- return AsyncOperationStatus.Complete;
+ // This operates on the internal buffer and will never block.
+ var ret = xobileTlsContext.Write (userBuffer.Buffer, userBuffer.Offset, userBuffer.Size, out bool wantMore);
+ return (ret, wantMore);
}
-
- asyncRequest.CurrentSize += ret;
- asyncRequest.UserBuffer.Offset += ret;
- asyncRequest.UserBuffer.Size -= ret;
-
- if (wantMore || writeBuffer.Size > 0)
- return AsyncOperationStatus.WantWrite;
-
- asyncRequest.ResetWrite ();
- asyncRequest.UserResult = asyncRequest.CurrentSize;
- return AsyncOperationStatus.Complete;
}
- AsyncOperationStatus ProcessClose (AsyncProtocolRequest asyncRequest, AsyncOperationStatus status)
+ internal AsyncOperationStatus ProcessShutdown (AsyncOperationStatus status)
{
- Debug ("ProcessClose: {0}", status);
+ Debug ("ProcessShutdown: {0}", status);
lock (ioLock) {
- if (xobileTlsContext == null)
- return AsyncOperationStatus.Complete;
-
- xobileTlsContext.Close ();
- xobileTlsContext = null;
- return AsyncOperationStatus.Continue;
+ xobileTlsContext.Shutdown ();
+ shutdown = true;
+ return AsyncOperationStatus.Complete;
}
}
- AsyncOperationStatus ProcessFlush (AsyncProtocolRequest asyncRequest, AsyncOperationStatus status)
- {
- Debug ("ProcessFlush: {0}", status);
- return AsyncOperationStatus.Complete;
- }
-
- #endregion
+#endregion
public override bool IsServer {
- get { return xobileTlsContext != null && xobileTlsContext.IsServer; }
+ get {
+ CheckThrow (false);
+ return xobileTlsContext != null && xobileTlsContext.IsServer;
+ }
}
public override bool IsAuthenticated {
- get { return xobileTlsContext != null && lastException == null && xobileTlsContext.IsAuthenticated; }
+ get {
+ lock (ioLock) {
+ // Don't use CheckThrow(), we want to return false if we're not authenticated.
+ return xobileTlsContext != null && lastException == null && xobileTlsContext.IsAuthenticated;
+ }
+ }
}
public override bool IsMutuallyAuthenticated {
get {
- return IsAuthenticated &&
- (Context.IsServer? Context.LocalServerCertificate: Context.LocalClientCertificate) != null &&
- Context.IsRemoteCertificateAvailable;
+ lock (ioLock) {
+ // Don't use CheckThrow() here.
+ if (!IsAuthenticated)
+ return false;
+ if ((xobileTlsContext.IsServer ? xobileTlsContext.LocalServerCertificate : xobileTlsContext.LocalClientCertificate) == null)
+ return false;
+ return xobileTlsContext.IsRemoteCertificateAvailable;
+ }
}
}
protected override void Dispose (bool disposing)
{
try {
- lastException = new ObjectDisposedException ("MobileAuthenticatedStream");
lock (ioLock) {
+ Debug ("Dispose: {0}", xobileTlsContext != null);
+ lastException = ExceptionDispatchInfo.Capture (new ObjectDisposedException ("MobileAuthenticatedStream"));
if (xobileTlsContext != null) {
xobileTlsContext.Dispose ();
xobileTlsContext = null;
public override void Flush ()
{
- CheckThrow (true);
- var asyncRequest = new AsyncProtocolRequest (this, null);
- StartOperation (ref asyncWriteRequest, ref writeBuffer, ProcessFlush, asyncRequest, "flush");
+ // Write() automatically flushes the underlying stream.
}
- public override void Close ()
- {
- /*
- * SSLClose() is a little bit tricky as it might attempt to send a close_notify alert
- * and thus call our write callback.
- *
- * It is also not thread-safe with SSLRead() or SSLWrite(), so we need to take the I/O lock here.
- */
- if (Interlocked.Exchange (ref closeRequested, 1) == 1)
- return;
- if (xobileTlsContext == null)
- return;
+ public SslProtocols SslProtocol {
+ get {
+ lock (ioLock) {
+ CheckThrow (true);
+ return (SslProtocols)xobileTlsContext.NegotiatedProtocol;
+ }
+ }
+ }
+
+ public X509Certificate RemoteCertificate {
+ get {
+ lock (ioLock) {
+ CheckThrow (true);
+ return xobileTlsContext.RemoteCertificate;
+ }
+ }
+ }
+
+ public X509Certificate LocalCertificate {
+ get {
+ lock (ioLock) {
+ CheckThrow (true);
+ return InternalLocalCertificate;
+ }
+ }
+ }
+
+ public X509Certificate InternalLocalCertificate {
+ get {
+ lock (ioLock) {
+ CheckThrow (false);
+ if (xobileTlsContext == null)
+ return null;
+ return xobileTlsContext.IsServer ? xobileTlsContext.LocalServerCertificate : xobileTlsContext.LocalClientCertificate;
+ }
+ }
+ }
- var asyncRequest = new AsyncProtocolRequest (this, null);
- StartOperation (ref asyncWriteRequest, ref writeBuffer, ProcessClose, asyncRequest, "close");
+ public MSI.MonoTlsConnectionInfo GetConnectionInfo ()
+ {
+ lock (ioLock) {
+ CheckThrow (true);
+ return xobileTlsContext.ConnectionInfo;
+ }
}
//
}
public override bool CanWrite {
- get { return IsAuthenticated & InnerStream.CanWrite; }
+ get { return IsAuthenticated & InnerStream.CanWrite && !shutdown; }
}
public override bool CanSeek {
set { InnerStream.WriteTimeout = value; }
}
- public SslProtocols SslProtocol {
- get {
- CheckThrow (true);
- return (SslProtocols)Context.NegotiatedProtocol;
- }
- }
-
- public X509Certificate RemoteCertificate {
- get {
- CheckThrow (true);
- return Context.RemoteCertificate;
- }
- }
-
- public X509Certificate LocalCertificate {
- get {
- CheckThrow (true);
- return InternalLocalCertificate;
- }
- }
-
- public X509Certificate InternalLocalCertificate {
- get {
- CheckThrow (false);
- if (!HasContext)
- return null;
- return Context.IsServer ? Context.LocalServerCertificate : Context.LocalClientCertificate;
- }
- }
-
- public MSI.MonoTlsConnectionInfo GetConnectionInfo ()
- {
- CheckThrow (true);
- return Context.ConnectionInfo;
- }
-
public SSA.CipherAlgorithmType CipherAlgorithm {
get {
CheckThrow (true);
- var info = Context.ConnectionInfo;
+ var info = GetConnectionInfo ();
if (info == null)
return SSA.CipherAlgorithmType.None;
switch (info.CipherAlgorithmType) {
public SSA.HashAlgorithmType HashAlgorithm {
get {
CheckThrow (true);
- var info = Context.ConnectionInfo;
+ var info = GetConnectionInfo ();
if (info == null)
return SSA.HashAlgorithmType.None;
switch (info.HashAlgorithmType) {
public SSA.ExchangeAlgorithmType KeyExchangeAlgorithm {
get {
CheckThrow (true);
- var info = Context.ConnectionInfo;
+ var info = GetConnectionInfo ();
if (info == null)
return SSA.ExchangeAlgorithmType.None;
switch (info.ExchangeAlgorithmType) {
}
}
- #region Need to Implement
+#region Need to Implement
public int CipherStrength {
get {
throw new NotImplementedException ();
}
}
- #endregion
+#endregion
}
}
#endif
public abstract int Write (byte[] buffer, int offset, int count, out bool wantMore);
- public abstract void Close ();
+ public abstract void Shutdown ();
protected bool ValidateCertificate (X509Certificate leaf, X509Chain chain)
{
if (initialized)
return;
+ InitializeProviderRegistration ();
+
MSI.MonoTlsProvider provider;
try {
provider = CreateDefaultProviderImpl ();
{
public const string mono_net_io_shutdown = "mono_net_io_shutdown";
public const string mono_net_io_renegotiate = "mono_net_io_renegotiate";
+
+ public const string net_ssl_io_already_shutdown = "Write operations are not allowed after the channel was shutdown.";
public const string net_log_set_socketoption_reuseport_default_on = "net_log_set_socketoption_reuseport_default_on";
public const string net_log_set_socketoption_reuseport_not_supported = "net_log_set_socketoption_reuseport_not_supported";
return Impl.AuthenticateAsServerAsync (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation);
}
+ public virtual Task ShutdownAsync ()
+ {
+ return Impl.ShutdownAsync ();
+ }
+
public override bool IsAuthenticated {
get { return Impl.IsAuthenticated; }
}
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
}
+ public virtual Task ShutdownAsync ()
+ {
+ throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+ }
+
public override bool IsAuthenticated {
get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
}
ReferenceSources/SecureStringHelper.cs
ReferenceSources/Socket.cs
ReferenceSources/SR.cs
+ReferenceSources/SR2.cs
ReferenceSources/SRCategoryAttribute.cs
ReferenceSources/Win32Exception.cs
Mono.Net.Dns/SimpleResolverEventArgs.cs
ReferenceSources/BinaryCompatibility.cs
ReferenceSources/ConfigurationManagerInternalFactory.cs
-ReferenceSources/SR2.cs
../referencesource/System/misc/PrivilegedConfigurationManager.cs
}
internal FieldInfo RuntimeResolve () {
- return typeb.CreateType ().GetField (this);
+ // typeb.CreateType() populates this.handle
+ var type_handle = new RuntimeTypeHandle (typeb.CreateType () as RuntimeType);
+ return FieldInfo.GetFieldFromHandle (handle, type_handle);
}
public override Module Module {
Assert.AreSame (buildX, defX);
}
+
+ [Test]
+ public void FieldsWithSameName () {
+ // Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=57222
+ string fileName = CreateTempAssembly ();
+
+ var assemblyName = new AssemblyName { Name = "test" };
+ var dynamicAssembly = AssemblyBuilder.DefineDynamicAssembly (assemblyName, AssemblyBuilderAccess.RunAndSave);
+ var dynamicModule = dynamicAssembly.DefineDynamicModule (assemblyName.Name, fileName);
+ var typeBuilder = dynamicModule.DefineType ("type1", TypeAttributes.Public | TypeAttributes.Class);
+
+ var mainMethod = typeBuilder.DefineMethod ("Main", MethodAttributes.Public | MethodAttributes.Static, typeof (int), new Type[0]);
+ var mainMethodIl = mainMethod.GetILGenerator ();
+
+ var f1 = typeBuilder.DefineField ("x", typeof (byte), FieldAttributes.Private | FieldAttributes.Static);
+ var f2 = typeBuilder.DefineField ("x", typeof (sbyte), FieldAttributes.Private | FieldAttributes.Static);
+
+ mainMethodIl.Emit (OpCodes.Ldsflda, f1);
+ mainMethodIl.Emit (OpCodes.Ldsflda, f2);
+ mainMethodIl.Emit (OpCodes.Pop);
+ mainMethodIl.Emit (OpCodes.Pop);
+ mainMethodIl.Emit (OpCodes.Ldc_I4_0);
+ mainMethodIl.Emit (OpCodes.Ret);
+
+ typeBuilder.CreateType ();
+ dynamicAssembly.SetEntryPoint (mainMethod);
+
+ dynamicAssembly.Save (fileName);
+ }
+ [Test]
+ public void FieldsWithSameNameAndType () {
+ // https://bugzilla.xamarin.com/show_bug.cgi?id=57222
+ string fileName = CreateTempAssembly ();
+
+ var assemblyName = new AssemblyName { Name = "test" };
+ var dynamicAssembly = AssemblyBuilder.DefineDynamicAssembly (assemblyName, AssemblyBuilderAccess.RunAndSave);
+ var dynamicModule = dynamicAssembly.DefineDynamicModule (assemblyName.Name, fileName);
+ var typeBuilder = dynamicModule.DefineType ("type1", TypeAttributes.Public | TypeAttributes.Class);
+
+ var mainMethod = typeBuilder.DefineMethod ("Main", MethodAttributes.Public | MethodAttributes.Static, typeof (int), new Type[0]);
+ var mainMethodIl = mainMethod.GetILGenerator ();
+
+ var f1 = typeBuilder.DefineField ("x", typeof (sbyte), FieldAttributes.Private | FieldAttributes.Static);
+ var f2 = typeBuilder.DefineField ("x", typeof (sbyte), FieldAttributes.Private | FieldAttributes.Static);
+
+ mainMethodIl.Emit (OpCodes.Ldsflda, f1);
+ mainMethodIl.Emit (OpCodes.Ldsflda, f2);
+ mainMethodIl.Emit (OpCodes.Pop);
+ mainMethodIl.Emit (OpCodes.Pop);
+ mainMethodIl.Emit (OpCodes.Ldc_I4_0);
+ mainMethodIl.Emit (OpCodes.Ret);
+
+ typeBuilder.CreateType ();
+ dynamicAssembly.SetEntryPoint (mainMethod);
+
+ dynamicAssembly.Save (fileName);
+ }
+
+ [Test]
+ public void MethodsWithSameNameAndSig () {
+ // https://bugzilla.xamarin.com/show_bug.cgi?id=57222
+ string fileName = CreateTempAssembly ();
+
+ var assemblyName = new AssemblyName { Name = "test" };
+ var dynamicAssembly = AssemblyBuilder.DefineDynamicAssembly (assemblyName, AssemblyBuilderAccess.RunAndSave);
+ var dynamicModule = dynamicAssembly.DefineDynamicModule (assemblyName.Name, fileName);
+ var typeBuilder = dynamicModule.DefineType ("type1", TypeAttributes.Public | TypeAttributes.Class);
+
+ var mainMethod = typeBuilder.DefineMethod ("Main", MethodAttributes.Public | MethodAttributes.Static, typeof (int), new Type[0]);
+ var mainMethodIl = mainMethod.GetILGenerator ();
+
+ var m1 = typeBuilder.DefineMethod ("X", MethodAttributes.Private | MethodAttributes.Static, typeof (void), new Type [0]);
+ var m2 = typeBuilder.DefineMethod ("X", MethodAttributes.Private | MethodAttributes.Static, typeof (void), new Type [0]);
+ m1.GetILGenerator ().Emit (OpCodes.Ret);
+ m2.GetILGenerator ().Emit (OpCodes.Ret);
+
+ mainMethodIl.Emit (OpCodes.Call, m1);
+ mainMethodIl.Emit (OpCodes.Call, m2);
+ mainMethodIl.Emit (OpCodes.Ldc_I4_0);
+ mainMethodIl.Emit (OpCodes.Ret);
+
+ typeBuilder.CreateType ();
+ dynamicAssembly.SetEntryPoint (mainMethod);
+
+ dynamicAssembly.Save (fileName);
+ }
}
}
}
}
#endif // MONO_FEATURE_THREAD_SUSPEND_RESUME
+
+ [Test]
+ public static void SignalAndWait()
+ {
+ using (var eventToSignal = new AutoResetEvent (false))
+ using (var eventToWait = new AutoResetEvent (false))
+ {
+ eventToWait.Set ();
+
+ Assert.IsTrue (WaitHandle.SignalAndWait (eventToSignal, eventToWait), "#1");
+ Assert.IsTrue (eventToSignal.WaitOne (), "#2");
+ }
+ }
}
}
--- /dev/null
+// CS0128: A local variable named `x' is already defined in this scope
+// Line: 9
+
+class X
+{
+ public static void Main ()
+ {
+ Foo (out int x);
+ Foo (out int x);
+ }
+
+ static void Foo (out int arg)
+ {
+ arg = 2;
+ }
+}
\ No newline at end of file
+++ /dev/null
-// CS0815: An implicitly typed local variable declaration cannot be initialized with `void'
-// Line: 8
-// Compiler options: -langversion:experimental
-
-class X
-{
- public static void Main ()
- {
- Foo (out var x = Main ());
- }
-
- static void Foo (out int i)
- {
- i = 0;
- }
-}
\ No newline at end of file
+++ /dev/null
-// CS1501: Argument `#1' cannot convert `ref string' expression to type `ref int'
-// Line: 8
-// Compiler options: -langversion:experimental
-
-class C
-{
- public static void Main ()
- {
- Foo (ref var x = "");
- }
-
- static void Foo (ref int i)
- {
- }
-}
\ No newline at end of file
-// CS1644: Feature `declaration expression' cannot be used because it is not part of the C# 5.0 language specification
-// Line: 12
+// CS1644: Feature `out variable declaration' cannot be used because it is not part of the C# 5.0 language specification
+// Line: 9
// Compiler options: -langversion:5
class C
+++ /dev/null
-// CS8046: An expression tree cannot contain a declaration expression
-// Line: 11
-// Compiler options: -langversion:experimental
-
-using System;
-using System.Linq.Expressions;
-
-class C
-{
- static void Main()
- {
- Expression<Func<bool>> e = () => Out (out int x);
- }
-
- static bool Out (out int value)
- {
- value = 3;
- return true;
- }
-}
\ No newline at end of file
+++ /dev/null
-// CS8047: Declaration expression cannot be used in this context
-// Line: 8
-// Compiler options: -langversion:experimental
-
-public class C
-{
- public static void Main ()
- {
- dynamic target = 3;
- var x = new Test (target, out var y);
- }
-}
-
-class Test
-{
- public Test (int x, out int y)
- {
- y = 0;
- }
-}
\ No newline at end of file
--- /dev/null
+// CS8196: Reference to an implicitly typed out variable `x1' is not permitted in the same argument list
+// Line: 8
+
+public class C
+{
+ public static void Main ()
+ {
+ Test (out var x1, out x1);
+ }
+
+ static void Test (out int x, out int x2)
+ {
+ x = 1;
+ x2 = 2;
+ }
+}
\ No newline at end of file
--- /dev/null
+// CS8196: Reference to an implicitly typed out variable `x1' is not permitted in the same argument list
+// Line: 8
+
+public class C
+{
+ public static void Main ()
+ {
+ Test (out var x1, out x1);
+ }
+
+ static void Test (out int x, out int x2)
+ {
+ x = 1;
+ x2 = 2;
+ }
+}
\ No newline at end of file
--- /dev/null
+// CS8197: Cannot infer the type of implicitly-typed out variable `y'
+// Line: 9
+
+public class C
+{
+ public static void Main ()
+ {
+ dynamic target = 3;
+ var x = new Test (target, out var y);
+ }
+}
+
+class Test
+{
+ public Test (int x, out int y)
+ {
+ y = 0;
+ }
+}
\ No newline at end of file
--- /dev/null
+// CS8198: An expression tree cannot contain out variable declaration
+// Line: 11
+
+using System;
+using System.Linq.Expressions;
+
+class C
+{
+ static void Main()
+ {
+ Expression<Func<bool>> e = () => Out (out int x);
+ }
+
+ static bool Out (out int value)
+ {
+ value = 3;
+ return true;
+ }
+}
\ No newline at end of file
--- /dev/null
+// CS8200: Out variable and pattern variable declarations are not allowed within constructor initializers, field initializers, or property initializers
+// Line: 6
+
+public class C
+{
+ bool res = Foo (out int arg);
+
+ static bool Foo (out int arg)
+ {
+ arg = 2;
+ return false;
+ }
+}
\ No newline at end of file
--- /dev/null
+// CS8200: Out variable and pattern variable declarations are not allowed within constructor initializers, field initializers, or property initializers
+// Line: 11
+
+public class C
+{
+ bool Prop { get; } = Foo (out int arg);
+
+ static bool Foo (out int arg)
+ {
+ arg = 2;
+ return false;
+ }
+}
\ No newline at end of file
--- /dev/null
+// CS8200: Out variable and pattern variable declarations are not allowed within constructor initializers, field initializers, or property initializers
+// Line: 11
+
+public class C
+{
+ public C (bool value)
+ {
+ }
+
+ public C ()
+ : this (Foo (out int arg))
+ {
+ }
+
+ static bool Foo (out int arg)
+ {
+ arg = 2;
+ return false;
+ }
+}
\ No newline at end of file
--- /dev/null
+// CS8201: Out variable and pattern variable declarations are not allowed within a query clause
+// Line: 11
+
+using System.Linq;
+
+class Program
+{
+ public static void Main ()
+ {
+ var a = "abcdef";
+ var res = from x in a from y in M (a, out var z) select x;
+ }
+
+ public static T M<T>(T x, out T z) => z = x;
+}
\ No newline at end of file
//
// Returns dynamic when at least one argument is of dynamic type
//
- public void Resolve (ResolveContext ec, out bool dynamic)
+ public void Resolve (ResolveContext rc, out bool dynamic)
{
dynamic = false;
+
+ List<LocalVariable> var_locals = null;
foreach (Argument a in args) {
- a.Resolve (ec);
- if (a.Type.BuiltinType == BuiltinTypeSpec.Type.Dynamic && !a.IsByRef)
+ a.Resolve (rc);
+
+ if (a.Type.BuiltinType == BuiltinTypeSpec.Type.Dynamic && !a.IsByRef) {
dynamic = true;
+ continue;
+ }
+
+ if (a.Type == InternalType.VarOutType) {
+ var de = a.Expr as DeclarationExpression;
+ if (de != null) {
+ if (var_locals == null)
+ var_locals = new List<LocalVariable> ();
+
+ var_locals.Add (de.Variable);
+ continue;
+ }
+
+ var lvr = a.Expr as LocalVariableReference;
+ if (lvr != null && var_locals != null && var_locals.Contains (lvr.local_info)) {
+ rc.Report.Error (8196, lvr.Location, "Reference to an implicitly typed out variable `{0}' is not permitted in the same argument list", lvr.Name);
+ lvr.Type = InternalType.ErrorType;
+ }
+ }
}
}
if (rc.HasSet (ResolveContext.Options.BaseInitializer))
flags |= ResolveContext.Options.BaseInitializer;
+
+ if (rc.HasSet (ResolveContext.Options.QueryClauseScope))
+ flags |= ResolveContext.Options.QueryClauseScope;
}
public ExceptionStatement CurrentTryBlock { get; set; }
NameOfScope = 1 << 17,
+ QueryClauseScope = 1 << 18,
+
///
/// Indicates the current context is in probing mode, no errors are reported.
///
$$ = new NamedArgument (lt.Value, lt.Location, (Expression) $4, arg_mod);
lbag.AddLocation ($$, GetLocation($2));
}
+ | identifier_inside_body COLON OUT named_argument_expr_or_out_variable_declaration
+ {
+ if (lang_version <= LanguageVersion.V_3)
+ FeatureIsNotAvailable (GetLocation ($1), "named argument");
+
+ var lt = (LocatedToken) $1;
+ $$ = new NamedArgument (lt.Value, lt.Location, (Expression) $4, Argument.AType.Out);
+ lbag.AddLocation ($$, GetLocation($2));
+ }
+
;
named_argument_expr
: expression_or_error
-// | declaration_expression
+ ;
+
+named_argument_expr_or_out_variable_declaration
+ : expression_or_error
+ | out_variable_declaration
;
opt_named_modifier
{
$$ = Argument.AType.Ref;
}
- | OUT
- {
- $$ = Argument.AType.Out;
- }
;
opt_class_member_declarations
$$ = new Argument ((Expression) $2, Argument.AType.Ref);
lbag.AddLocation ($$, GetLocation ($1));
}
- | REF declaration_expression
- {
- $$ = new Argument ((Expression) $2, Argument.AType.Ref);
- }
| OUT variable_reference
{
$$ = new Argument ((Expression) $2, Argument.AType.Out);
lbag.AddLocation ($$, GetLocation ($1));
}
- | OUT declaration_expression
+ | OUT out_variable_declaration
{
$$ = new Argument ((Expression) $2, Argument.AType.Out);
}
}
;
-declaration_expression
- : OPEN_PARENS declaration_expression CLOSE_PARENS
- {
- $$ = new ParenthesizedExpression ((Expression) $2, GetLocation ($1));
- lbag.AddLocation ($$, GetLocation ($1), GetLocation ($3));
- }
-/*
- | CHECKED open_parens_any declaration_expression CLOSE_PARENS
- {
- $$ = new CheckedExpr ((Expression) $3, GetLocation ($1));
- lbag.AddLocation ($$, GetLocation ($2), GetLocation ($4));
- }
- | UNCHECKED open_parens_any declaration_expression CLOSE_PARENS
- {
- $$ = new UnCheckedExpr ((Expression) $3, GetLocation ($1));
- lbag.AddLocation ($$, GetLocation ($2), GetLocation ($4));
- }
-*/
- | variable_type identifier_inside_body
+out_variable_declaration
+ : variable_type identifier_inside_body
{
- if (lang_version != LanguageVersion.Experimental)
- FeatureIsNotAvailable (GetLocation ($1), "declaration expression");
+ if (lang_version < LanguageVersion.V_7)
+ FeatureIsNotAvailable (GetLocation ($1), "out variable declaration");
var lt = (LocatedToken) $2;
var lv = new LocalVariable (current_block, lt.Value, lt.Location);
current_block.AddLocalName (lv);
$$ = new DeclarationExpression ((FullNamedExpression) $1, lv);
}
- | variable_type identifier_inside_body ASSIGN expression
- {
- if (lang_version != LanguageVersion.Experimental)
- FeatureIsNotAvailable (GetLocation ($1), "declaration expression");
-
- var lt = (LocatedToken) $2;
- var lv = new LocalVariable (current_block, lt.Value, lt.Location);
- current_block.AddLocalName (lv);
- $$ = new DeclarationExpression ((FullNamedExpression) $1, lv) {
- Initializer = (Expression) $4
- };
- }
;
variable_reference
}
if (d == '.') {
- return Token.INTERR_OPERATOR;
+ d = reader.Peek ();
+ return d >= '0' && d <= '9' ? Token.INTERR : Token.INTERR_OPERATOR;
}
if (d != ' ') {
foreach (var arg in arguments) {
if (arg.Type == InternalType.VarOutType) {
// Should be special error message about dynamic dispatch
- rc.Report.Error (8047, arg.Expr.Location, "Declaration expression cannot be used in this context");
+ rc.Report.Error (8197, arg.Expr.Location, "Cannot infer the type of implicitly-typed out variable `{0}'", ((DeclarationExpression) arg.Expr).Variable.Name);
}
}
public override Expression CreateExpressionTree (ResolveContext rc)
{
- rc.Report.Error (8046, loc, "An expression tree cannot contain a declaration expression");
+ rc.Report.Error (8198, loc, "An expression tree cannot contain out variable declaration");
return null;
}
bool DoResolveCommon (ResolveContext rc)
{
+ if (rc.HasAny (ResolveContext.Options.BaseInitializer | ResolveContext.Options.FieldInitializerScope)) {
+ rc.Report.Error (8200, loc, "Out variable and pattern variable declarations are not allowed within constructor initializers, field initializers, or property initializers");
+ } else if (rc.HasSet (ResolveContext.Options.QueryClauseScope)) {
+ rc.Report.Error (8201, loc, "Out variable and pattern variable declarations are not allowed within a query clause");
+ }
+
var var_expr = VariableType as VarExpr;
if (var_expr != null) {
type = InternalType.VarOutType;
{
}
- protected override MethodGroupExpr DoResolveOverload (ResolveContext ec)
+ protected override MethodGroupExpr DoResolveOverload (ResolveContext rc)
{
- MethodGroupExpr rmg = mg.OverloadResolve (ec, ref arguments, this, OverloadResolver.Restrictions.None);
- return rmg;
+ using (rc.Set (ResolveContext.Options.QueryClauseScope)) {
+ return mg.OverloadResolve (rc, ref arguments, this, OverloadResolver.Restrictions.None);
+ }
}
protected override Expression DoResolveDynamic (ResolveContext ec, Expression memberExpr)
var t = (Int32)sbyte.MaxValue;
}
+ void Test_22 (bool args)
+ {
+ var x = args ?.2f : -.2f;
+ }
+
static void Helper<T> (T arg)
{
}
-// Compiler options: -langversion:experimental
using System;
class DeclarationExpression
return 2;
}
- Out (out int o2 = 2);
- if (o2 != 3)
- return 3;
-
Out (out var o3);
if (o3 != 3)
return 4;
- Ref (ref int r = 2);
- if (r != 7)
- return 5;
-
- Ref (ref ((var r2 = 3)));
- if (r2 != 8)
- return 6;
-
-// Out2 (str: "b", v: out var o5);
-// if (o5 != 9)
-// return 7;
-
- Out3 (out var o6 = 9m);
- if (o6.GetType () != typeof (decimal))
- return 8;
+ Out2 (str: "b", v: out var o5);
+ if (o5 != 9)
+ return 7;
Console.WriteLine ("ok");
return 0;
v = 9;
return true;
}
-
- static void Out3<T> (out T t)
- {
- t = default (T);
- }
-
- static void Ref (ref int arg)
- {
- arg += 5;
- }
}
\ No newline at end of file
-// Compiler options: -langversion:experimental
+using System;
-using static System.Console;
-
-public class DeclarationExpressions
+public class C
{
- public static void Main()
- {
- // TODO:
- //Test (int value = 5);
- //WriteLine (value);
- }
-
- void M2 ()
+ public static void Main ()
{
-// for (int i = 0; int v = 2; ++i) {
-
-// }
-
}
- static int Test (int x)
- {
- WriteLine (x);
- return x;
- }
+ bool Test1 => int.TryParse ("1", out int x);
+ int Test2 => int.TryParse ("2", out int x) ? x : 0;
}
\ No newline at end of file
--- /dev/null
+using System;
+using System.Linq;
+
+public class C
+{
+ public static void Main ()
+ {
+ var a = "abcdef";
+
+ var t1 = from x in Foo (a, out var q1) select x;
+ var t2 = from x in a join y in Foo (a, out var q2) on x equals y select x;
+ }
+
+ public static T Foo<T> (T x, out T z) => z = x;
+}
\ No newline at end of file
--- /dev/null
+public class C
+{
+ public static void Main ()
+ {
+ Test2 (Test (out var x1), x1);
+ }
+
+ static int Test (out int x)
+ {
+ x = 1;
+ return 2;
+ }
+
+ static int Test2 (int x, int y)
+ {
+ return 2;
+ }
+}
\ No newline at end of file
<method name="Void Test_21()" attrs="129">
<size>5</size>
</method>
+ <method name="Void Test_22(Boolean)" attrs="129">
+ <size>24</size>
+ </method>
</type>
</test>
<test name="gtest-410.cs">
<test name="test-decl-expr-01.cs">
<type name="DeclarationExpression">
<method name="Int32 Main()" attrs="150">
- <size>223</size>
+ <size>121</size>
</method>
<method name="Boolean Out(Int32 ByRef)" attrs="145">
<size>13</size>
<method name="Boolean Out2(Int32 ByRef, System.String)" attrs="145">
<size>14</size>
</method>
- <method name="Void Out3[T](T ByRef)" attrs="145">
- <size>17</size>
- </method>
- <method name="Void Ref(Int32 ByRef)" attrs="145">
- <size>8</size>
- </method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</method>
</type>
</test>
<test name="test-decl-expr-02.cs">
- <type name="DeclarationExpressions">
+ <type name="C">
<method name="Void Main()" attrs="150">
<size>2</size>
</method>
- <method name="Void M2()" attrs="129">
- <size>2</size>
+ <method name="Boolean get_Test1()" attrs="2177">
+ <size>20</size>
</method>
- <method name="Int32 Test(Int32)" attrs="145">
+ <method name="Int32 get_Test2()" attrs="2177">
+ <size>32</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
+ <test name="test-decl-expr-03.cs">
+ <type name="C">
+ <method name="Void Main()" attrs="150">
+ <size>153</size>
+ </method>
+ <method name="T Foo[T](T, T ByRef)" attrs="150">
+ <size>18</size>
+ </method>
+ <method name="Char <Main>m__0(Char)" attrs="145">
+ <size>10</size>
+ </method>
+ <method name="Char <Main>m__1(Char)" attrs="145">
+ <size>10</size>
+ </method>
+ <method name="Char <Main>m__2(Char)" attrs="145">
+ <size>10</size>
+ </method>
+ <method name="Char <Main>m__3(Char, Char)" attrs="145">
+ <size>10</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
+ <test name="test-decl-expr-04.cs">
+ <type name="C">
+ <method name="Void Main()" attrs="150">
<size>16</size>
</method>
+ <method name="Int32 Test(Int32 ByRef)" attrs="145">
+ <size>13</size>
+ </method>
+ <method name="Int32 Test2(Int32, Int32)" attrs="145">
+ <size>10</size>
+ </method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</method>
static readonly Universe universe = new Universe ();
static readonly Dictionary<string, string> loaded_assemblies = new Dictionary<string, string> ();
- static readonly string resourcePathSeparator = (Path.DirectorySeparatorChar == '\\') ? $"\\{Path.DirectorySeparatorChar}" : $"{Path.DirectorySeparatorChar}";
public static string GetAssemblyName (string path)
{
+ string resourcePathSeparator = style == "windows" ? "\\\\" : "/";
string name = Path.GetFileName (path);
// A bit of a hack to support satellite assemblies. They all share the same name but
ret = mono->read_func (mono->instance, out, outl, &wantMore);
- if (ret < 0)
+ if (ret < 0) {
+ errno = EIO;
return -1;
+ }
if (ret > 0)
return ret;
;
}
+MONO_API int
+mono_btls_ssl_shutdown (MonoBtlsSsl *ptr)
+{
+ return SSL_shutdown (ptr->ssl);
+}
+
+MONO_API void
+mono_btls_ssl_set_quiet_shutdown (MonoBtlsSsl *ptr, int mode)
+{
+ SSL_set_quiet_shutdown (ptr->ssl, mode);
+}
+
MONO_API void
mono_btls_ssl_set_bio (MonoBtlsSsl *ptr, BIO *bio)
{
void
mono_btls_ssl_close (MonoBtlsSsl *ptr);
+int
+mono_btls_ssl_shutdown (MonoBtlsSsl *ptr);
+
+MONO_API void
+mono_btls_ssl_set_quiet_shutdown (MonoBtlsSsl *ptr, int mode);
+
int
mono_btls_ssl_get_error (MonoBtlsSsl *ptr, int ret_code);
extern gboolean substitute_with_mscorlib_p;
+static char *
+get_token_comment (const char *prefix, guint32 token);
+
static MonoGenericContainer *
get_memberref_container (MonoImage *m, guint32 mrp_token, MonoGenericContainer *container);
/* Check if this is a nested type */
token = MONO_TOKEN_TYPE_DEF | (idx);
token = mono_metadata_nested_in_typedef (m, token);
- tstring = show_tokens ? g_strdup_printf ("/*%08x*/", token) : NULL;
+ tstring = get_token_comment (NULL, token);
if (token) {
char *outer;
if (show_tokens) {
int token = mono_metadata_make_token (MONO_TABLE_TYPESPEC, idx);
- result = g_strdup_printf ("%s/*%08x*/", res->str, token);
- } else
+ result = get_token_comment (res->str, token);
+ g_string_free (res, TRUE);
+ } else {
result = res->str;
-
- g_string_free (res, FALSE);
+ g_string_free (res, FALSE);
+ }
return result;
}
if (show_tokens) {
int token = mono_metadata_make_token (MONO_TABLE_TYPEREF, idx);
- char *temp = g_strdup_printf ("%s/*%08x*/", ret, token);
+ char *temp = get_token_comment (ret, token);
g_free (ret);
ret = temp;
}
}
if (show_tokens) {
- *result = g_strdup_printf ("%s/*%08x*/", temp, token);
+ *result = get_token_comment (temp, token);
g_free (temp);
} else
*result = temp;
return full_sig;
}
+/**
+ * get_token_comment:
+ *
+ * If show_tokens is TRUE, return "prefix""token(table)".
+ * If show_tokens is FALSE, return "prefix" or NULL if prefix is NULL.
+ * Caller is responsible for freeing.
+ */
+char *
+get_token_comment (const char *prefix, guint32 token)
+{
+ if (!show_tokens)
+ return prefix ? g_strdup_printf ("%s", prefix) : NULL;
+ gint32 tableidx = mono_metadata_token_table (token);
+ if ((tableidx < 0) || (tableidx > MONO_TABLE_LAST))
+ return g_strdup_printf ("%s/*%08x*/", prefix ? prefix : "", token);
+ else
+ return g_strdup_printf ("%s/*%08x(%s)*/", prefix ? prefix : "", token, mono_meta_table_name (tableidx));
+}
+
/**
* get_field:
* @m: metadata context
{
int idx = mono_metadata_token_index (token);
guint32 cols [MONO_FIELD_SIZE];
- char *sig, *res, *type, *estype, *esname;
+ char *sig, *res, *type, *estype, *esname, *token_comment;
guint32 type_idx;
/*
type = get_typedef (m, type_idx);
estype = get_escaped_name (type);
esname = get_escaped_name (mono_metadata_string_heap (m, cols [MONO_FIELD_NAME]));
- res = g_strdup_printf ("%s %s%s%s",
+ token_comment = get_token_comment (NULL, token);
+ res = g_strdup_printf ("%s %s%s%s%s",
sig,
estype ? estype : "",
estype ? "::" : "",
- esname);
+ esname,
+ token_comment ? token_comment : ""
+ );
g_free (type);
g_free (sig);
g_free (estype);
g_free (esname);
+ g_free (token_comment);
return res;
}
container = mono_method_get_generic_container (((MonoMethodInflated *) mh)->declaring);
esname = get_escaped_name (mh->name);
sig = dis_stringify_type (m, &mh->klass->byval_arg, TRUE);
- if (show_tokens)
- name = g_strdup_printf ("%s/*%08x*/%s%s", sig ? sig : "", token, sig ? "::" : "", esname);
- else
- name = g_strdup_printf ("%s%s%s", sig ? sig : "", sig ? "::" : "", esname);
+ char *token_comment = get_token_comment (NULL, token);
+ name = g_strdup_printf ("%s%s%s%s", sig ? sig : "", token_comment ? token_comment : "", sig ? "::" : "", esname);
g_free (sig);
g_free (esname);
+ g_free (token_comment);
} else {
name = NULL;
mono_error_cleanup (&error);
}
if (show_tokens) {
- char *retval = g_strdup_printf ("%s /* %08x */", sig, token);
+ char *retval = get_token_comment (sig, token);
g_free (sig);
return retval;
} else
static void
usage (void)
{
- GString *args = g_string_new ("[--output=filename] [--filter=filename] [--help] [--mscorlib]\n");
+ GString *args = g_string_new ("[--output=filename] [--filter=filename]\n");
int i;
+
+ g_string_append (args, "[--help] [--mscorlib] [--show-tokens] [--show-method-tokens]\n");
for (i = 0; table_list [i].name != NULL; i++){
g_string_append (args, "[");
.TP
.I "--show-method-tokens"
Display tokens for disassembled methods.
+.TP
+.I "--show-tokens"
+Display tokens for strings, types, methods, fields, etc.
.SH OPTIONS TO DISPLAY METADATA TABLES
The following options are used to display metadata tables instead of
disassembling the CIL image.
#define MONO_HANDLE_DOMAIN(HANDLE) (mono_object_domain (MONO_HANDLE_RAW (MONO_HANDLE_CAST (MonoObject, HANDLE))))
+/* Given an object and a MonoClassField, return the value (must be non-object)
+ * of the field. It's the caller's responsibility to check that the object is
+ * of the correct class. */
+#define MONO_HANDLE_GET_FIELD_VAL(HANDLE,TYPE,FIELD) *(TYPE *)(mono_handle_unsafe_field_addr (MONO_HANDLE_CAST (MonoObject, (HANDLE)), (FIELD)))
+
+#define MONO_HANDLE_NEW_GET_FIELD(HANDLE,TYPE,FIELD) MONO_HANDLE_NEW (TYPE, *(TYPE**)(mono_handle_unsafe_field_addr (MONO_HANDLE_CAST (MonoObject, (HANDLE)), (FIELD))))
+
+#define MONO_HANDLE_SET_FIELD_VAL(HANDLE,TYPE,FIELD,VAL) do { \
+ MonoObjectHandle __obj = (HANDLE); \
+ MonoClassField *__field = (FIELD); \
+ TYPE __value = (VAL); \
+ *(TYPE*)(mono_handle_unsafe_field_addr (__obj, __field)) = __value; \
+ } while (0)
/* Baked typed handles we all want */
TYPED_HANDLE_DECL (MonoString);
TYPED_HANDLE_DECL (MonoException);
TYPED_HANDLE_DECL (MonoAppContext);
+/* Unfortunately MonoThreadHandle is already a typedef used for something unrelated. So
+ * the coop handle for MonoThread* is MonoThreadObjectHandle.
+ */
+typedef MonoThread MonoThreadObject;
+TYPED_HANDLE_DECL (MonoThreadObject);
+
#define NULL_HANDLE_STRING MONO_HANDLE_CAST(MonoString, NULL_HANDLE)
/*
mono_gc_wbarrier_generic_store (&dest->__raw, src ? MONO_HANDLE_RAW(src) : NULL);
}
+/* It is unsafe to call this function directly - it does not pin the handle! Use MONO_HANDLE_GET_FIELD_VAL(). */
+static inline gchar*
+mono_handle_unsafe_field_addr (MonoObjectHandle h, MonoClassField *field)
+{
+ return ((gchar *)MONO_HANDLE_RAW (h)) + field->offset;
+}
+
//FIXME this should go somewhere else
MonoStringHandle mono_string_new_handle (MonoDomain *domain, const char *data, MonoError *error);
MonoArrayHandle mono_array_new_handle (MonoDomain *domain, MonoClass *eclass, uintptr_t n, MonoError *error);
void
mono_context_set_handle (MonoAppContextHandle new_context);
-
G_END_DECLS
#endif /* __MONO_HANDLE_H__ */
#endif
ICALL_TYPE(SOCK, "System.Net.Sockets.Socket", SOCK_1)
-ICALL(SOCK_1, "Accept_internal(intptr,int&,bool)", ves_icall_System_Net_Sockets_Socket_Accept_internal)
-ICALL(SOCK_2, "Available_internal(intptr,int&)", ves_icall_System_Net_Sockets_Socket_Available_internal)
-ICALL(SOCK_3, "Bind_internal(intptr,System.Net.SocketAddress,int&)", ves_icall_System_Net_Sockets_Socket_Bind_internal)
-ICALL(SOCK_4, "Blocking_internal(intptr,bool,int&)", ves_icall_System_Net_Sockets_Socket_Blocking_internal)
-ICALL(SOCK_5, "Close_internal(intptr,int&)", ves_icall_System_Net_Sockets_Socket_Close_internal)
-ICALL(SOCK_6, "Connect_internal(intptr,System.Net.SocketAddress,int&,bool)", ves_icall_System_Net_Sockets_Socket_Connect_internal)
-ICALL (SOCK_6a, "Disconnect_internal(intptr,bool,int&)", ves_icall_System_Net_Sockets_Socket_Disconnect_internal)
-ICALL(SOCK_7, "GetSocketOption_arr_internal(intptr,System.Net.Sockets.SocketOptionLevel,System.Net.Sockets.SocketOptionName,byte[]&,int&)", ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal)
-ICALL(SOCK_8, "GetSocketOption_obj_internal(intptr,System.Net.Sockets.SocketOptionLevel,System.Net.Sockets.SocketOptionName,object&,int&)", ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal)
-ICALL(SOCK_21, "IOControl_internal(intptr,int,byte[],byte[],int&)", ves_icall_System_Net_Sockets_Socket_IOControl_internal)
-ICALL(SOCK_9, "Listen_internal(intptr,int,int&)", ves_icall_System_Net_Sockets_Socket_Listen_internal)
-ICALL(SOCK_10, "LocalEndPoint_internal(intptr,int,int&)", ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal)
-ICALL(SOCK_11, "Poll_internal", ves_icall_System_Net_Sockets_Socket_Poll_internal)
-ICALL(SOCK_13, "ReceiveFrom_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,System.Net.SocketAddress&,int&,bool)", ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal)
-ICALL(SOCK_11a, "Receive_internal(intptr,System.Net.Sockets.Socket/WSABUF[],System.Net.Sockets.SocketFlags,int&,bool)", ves_icall_System_Net_Sockets_Socket_Receive_array_internal)
-ICALL(SOCK_12, "Receive_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,int&,bool)", ves_icall_System_Net_Sockets_Socket_Receive_internal)
-ICALL(SOCK_14, "RemoteEndPoint_internal(intptr,int,int&)", ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal)
-ICALL(SOCK_15, "Select_internal(System.Net.Sockets.Socket[]&,int,int&)", ves_icall_System_Net_Sockets_Socket_Select_internal)
-ICALL(SOCK_15a, "SendFile_internal(intptr,string,byte[],byte[],System.Net.Sockets.TransmitFileOptions,int&,bool)", ves_icall_System_Net_Sockets_Socket_SendFile_internal)
-ICALL(SOCK_16, "SendTo_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,System.Net.SocketAddress,int&,bool)", ves_icall_System_Net_Sockets_Socket_SendTo_internal)
-ICALL(SOCK_16a, "Send_internal(intptr,System.Net.Sockets.Socket/WSABUF[],System.Net.Sockets.SocketFlags,int&,bool)", ves_icall_System_Net_Sockets_Socket_Send_array_internal)
-ICALL(SOCK_17, "Send_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,int&,bool)", ves_icall_System_Net_Sockets_Socket_Send_internal)
-ICALL(SOCK_18, "SetSocketOption_internal(intptr,System.Net.Sockets.SocketOptionLevel,System.Net.Sockets.SocketOptionName,object,byte[],int,int&)", ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal)
-ICALL(SOCK_19, "Shutdown_internal(intptr,System.Net.Sockets.SocketShutdown,int&)", ves_icall_System_Net_Sockets_Socket_Shutdown_internal)
-ICALL(SOCK_20, "Socket_internal(System.Net.Sockets.AddressFamily,System.Net.Sockets.SocketType,System.Net.Sockets.ProtocolType,int&)", ves_icall_System_Net_Sockets_Socket_Socket_internal)
-ICALL(SOCK_20a, "SupportsPortReuse", ves_icall_System_Net_Sockets_Socket_SupportPortReuse)
-ICALL(SOCK_21a, "cancel_blocking_socket_operation", icall_cancel_blocking_socket_operation)
+HANDLES(ICALL(SOCK_1, "Accept_internal(intptr,int&,bool)", ves_icall_System_Net_Sockets_Socket_Accept_internal))
+HANDLES(ICALL(SOCK_2, "Available_internal(intptr,int&)", ves_icall_System_Net_Sockets_Socket_Available_internal))
+HANDLES(ICALL(SOCK_3, "Bind_internal(intptr,System.Net.SocketAddress,int&)", ves_icall_System_Net_Sockets_Socket_Bind_internal))
+HANDLES(ICALL(SOCK_4, "Blocking_internal(intptr,bool,int&)", ves_icall_System_Net_Sockets_Socket_Blocking_internal))
+HANDLES(ICALL(SOCK_5, "Close_internal(intptr,int&)", ves_icall_System_Net_Sockets_Socket_Close_internal))
+HANDLES(ICALL(SOCK_6, "Connect_internal(intptr,System.Net.SocketAddress,int&,bool)", ves_icall_System_Net_Sockets_Socket_Connect_internal))
+HANDLES(ICALL (SOCK_6a, "Disconnect_internal(intptr,bool,int&)", ves_icall_System_Net_Sockets_Socket_Disconnect_internal))
+HANDLES(ICALL(SOCK_7, "GetSocketOption_arr_internal(intptr,System.Net.Sockets.SocketOptionLevel,System.Net.Sockets.SocketOptionName,byte[]&,int&)", ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal))
+HANDLES(ICALL(SOCK_8, "GetSocketOption_obj_internal(intptr,System.Net.Sockets.SocketOptionLevel,System.Net.Sockets.SocketOptionName,object&,int&)", ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal))
+HANDLES(ICALL(SOCK_21, "IOControl_internal(intptr,int,byte[],byte[],int&)", ves_icall_System_Net_Sockets_Socket_IOControl_internal))
+HANDLES(ICALL(SOCK_9, "Listen_internal(intptr,int,int&)", ves_icall_System_Net_Sockets_Socket_Listen_internal))
+HANDLES(ICALL(SOCK_10, "LocalEndPoint_internal(intptr,int,int&)", ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal))
+HANDLES(ICALL(SOCK_11, "Poll_internal", ves_icall_System_Net_Sockets_Socket_Poll_internal))
+HANDLES(ICALL(SOCK_13, "ReceiveFrom_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,System.Net.SocketAddress&,int&,bool)", ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal))
+HANDLES(ICALL(SOCK_11a, "Receive_internal(intptr,System.Net.Sockets.Socket/WSABUF[],System.Net.Sockets.SocketFlags,int&,bool)", ves_icall_System_Net_Sockets_Socket_Receive_array_internal))
+HANDLES(ICALL(SOCK_12, "Receive_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,int&,bool)", ves_icall_System_Net_Sockets_Socket_Receive_internal))
+HANDLES(ICALL(SOCK_14, "RemoteEndPoint_internal(intptr,int,int&)", ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal))
+HANDLES(ICALL(SOCK_15, "Select_internal(System.Net.Sockets.Socket[]&,int,int&)", ves_icall_System_Net_Sockets_Socket_Select_internal))
+HANDLES(ICALL(SOCK_15a, "SendFile_internal(intptr,string,byte[],byte[],System.Net.Sockets.TransmitFileOptions,int&,bool)", ves_icall_System_Net_Sockets_Socket_SendFile_internal))
+HANDLES(ICALL(SOCK_16, "SendTo_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,System.Net.SocketAddress,int&,bool)", ves_icall_System_Net_Sockets_Socket_SendTo_internal))
+HANDLES(ICALL(SOCK_16a, "Send_internal(intptr,System.Net.Sockets.Socket/WSABUF[],System.Net.Sockets.SocketFlags,int&,bool)", ves_icall_System_Net_Sockets_Socket_Send_array_internal))
+HANDLES(ICALL(SOCK_17, "Send_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,int&,bool)", ves_icall_System_Net_Sockets_Socket_Send_internal))
+HANDLES(ICALL(SOCK_18, "SetSocketOption_internal(intptr,System.Net.Sockets.SocketOptionLevel,System.Net.Sockets.SocketOptionName,object,byte[],int,int&)", ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal))
+HANDLES(ICALL(SOCK_19, "Shutdown_internal(intptr,System.Net.Sockets.SocketShutdown,int&)", ves_icall_System_Net_Sockets_Socket_Shutdown_internal))
+HANDLES(ICALL(SOCK_20, "Socket_internal(System.Net.Sockets.AddressFamily,System.Net.Sockets.SocketType,System.Net.Sockets.ProtocolType,int&)", ves_icall_System_Net_Sockets_Socket_Socket_internal))
+HANDLES(ICALL(SOCK_20a, "SupportsPortReuse", ves_icall_System_Net_Sockets_Socket_SupportPortReuse))
+HANDLES(ICALL(SOCK_21a, "cancel_blocking_socket_operation", icall_cancel_blocking_socket_operation))
ICALL_TYPE(SOCKEX, "System.Net.Sockets.SocketException", SOCKEX_1)
ICALL(SOCKEX_1, "WSAGetLastError_internal", ves_icall_System_Net_Sockets_SocketException_WSAGetLastError_internal)
return result;
}
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
/*
* mono_mb_emit_exception_marshal_directive:
}
mono_mb_emit_exception_full (mb, "System.Runtime.InteropServices", "MarshalDirectiveException", s);
}
-
-#endif /* !DISABLE_JIT */
+#endif /* HAVE_ONLINE_VES */
guint
mono_type_to_ldind (MonoType *type)
return -1;
}
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
static void
emit_ptr_to_object_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv conv, MonoMarshalSpec *mspec)
emit_thread_force_interrupt_checkpoint (mb);
}
-#endif /* DISABLE_JIT */
+#endif /* HAVE_ONLINE_VES */
/* This is a JIT icall, it sets the pending exception and returns NULL on error. */
static MonoAsyncResult *
return result;
}
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
int
mono_mb_emit_save_args (MonoMethodBuilder *mb, MonoMethodSignature *sig, gboolean save_this)
return params_var;
}
-#endif /* DISABLE_JIT */
+#endif /* HAVE_ONLINE_VES */
static char*
mono_signature_to_name (MonoMethodSignature *sig, const char *prefix)
mb = mono_mb_new (get_wrapper_target_class (method->klass->image), name, MONO_WRAPPER_DELEGATE_BEGIN_INVOKE);
g_free (name);
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
params_var = mono_mb_emit_save_args (mb, sig, FALSE);
mono_mb_emit_ldarg (mb, 0);
return res;
}
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
void
mono_mb_emit_restore_result (MonoMethodBuilder *mb, MonoType *return_type)
mono_mb_emit_byte (mb, CEE_RET);
}
-#endif /* DISABLE_JIT */
+#endif /* HAVE_ONLINE_VES */
/**
* mono_marshal_get_delegate_end_invoke:
mb = mono_mb_new (get_wrapper_target_class (method->klass->image), name, MONO_WRAPPER_DELEGATE_END_INVOKE);
g_free (name);
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
params_var = mono_mb_emit_save_args (mb, sig, FALSE);
mono_mb_emit_ldarg (mb, 0);
mb = mono_mb_new (get_wrapper_target_class (method->klass->image), name, MONO_WRAPPER_DELEGATE_INVOKE);
g_free (name);
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
void_ret = sig->ret->type == MONO_TYPE_VOID && !method->string_ctor;
/* allocate local 0 (object) */
mono_mb_emit_byte (mb, CEE_RET);
mb->skip_visibility = 1;
-#endif /* DISABLE_JIT */
+#endif /* HAVE_ONLINE_VES */
info = mono_wrapper_info_create (mb, subtype);
info->d.delegate_invoke.method = method;
return mono_metadata_signature_equal (sig1, sig2);
}
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
/*
* emit_invoke_call:
/* to make it work with our special string constructors */
if (!string_dummy) {
+ MonoError error;
MONO_GC_REGISTER_ROOT_SINGLE (string_dummy, MONO_ROOT_SOURCE_MARSHAL, "dummy marshal string");
- string_dummy = mono_string_new_wrapper ("dummy");
+ string_dummy = mono_string_new_checked (mono_get_root_domain (), "dummy", &error);
+ mono_error_assert_ok (&error);
}
if (virtual_) {
mb = mono_mb_new (target_klass, name, MONO_WRAPPER_RUNTIME_INVOKE);
g_free (name);
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
param_names [0] = "this";
param_names [1] = "params";
param_names [2] = "exc";
#endif
if (need_direct_wrapper) {
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
mb->skip_visibility = 1;
#endif
info = mono_wrapper_info_create (mb, virtual_ ? WRAPPER_SUBTYPE_RUNTIME_INVOKE_VIRTUAL : WRAPPER_SUBTYPE_RUNTIME_INVOKE_DIRECT);
mb = mono_mb_new (mono_defaults.object_class, name, MONO_WRAPPER_RUNTIME_INVOKE);
g_free (name);
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
/* allocate local 0 (object) tmp */
mono_mb_add_local (mb, &mono_defaults.object_class->byval_arg);
/* allocate local 1 (object) exc */
mono_mb_patch_branch (mb, pos);
//mono_mb_emit_ldloc (mb, 0);
mono_mb_emit_byte (mb, CEE_RET);
-#endif /* DISABLE_JIT */
+#endif /* HAVE_ONLINE_VES */
info = mono_wrapper_info_create (mb, WRAPPER_SUBTYPE_RUNTIME_INVOKE_DYNAMIC);
mb = mono_mb_new (mono_defaults.object_class, name, MONO_WRAPPER_RUNTIME_INVOKE);
g_free (name);
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
param_names [0] = "this";
param_names [1] = "params";
param_names [2] = "exc";
return res;
}
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
static void
mono_mb_emit_auto_layout_exception (MonoMethodBuilder *mb, MonoClass *klass)
{
else
csig2 = mono_metadata_signature_dup_full (mono_defaults.corlib, sig);
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
if (sig->hasthis)
mono_mb_emit_byte (mb, CEE_LDARG_0);
int conv_arg, MonoType **conv_arg_type,
MarshalAction action)
{
-#ifdef DISABLE_JIT
+#ifndef HAVE_ONLINE_VES
if (action == MARSHAL_ACTION_CONV_IN && t->type == MONO_TYPE_VALUETYPE)
*conv_arg_type = &mono_defaults.int_class->byval_arg;
return conv_arg;
int conv_arg, MonoType **conv_arg_type,
MarshalAction action)
{
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
MonoMethodBuilder *mb = m->mb;
switch (action) {
int conv_arg, MonoType **conv_arg_type,
MarshalAction action)
{
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
MonoMethodBuilder *mb = m->mb;
MonoClass *klass, *date_time_class;
int pos = 0, pos2;
int conv_arg, MonoType **conv_arg_type,
MarshalAction action)
{
-#ifdef DISABLE_JIT
+#ifndef HAVE_ONLINE_VES
switch (action) {
case MARSHAL_ACTION_CONV_IN:
*conv_arg_type = &mono_defaults.int_class->byval_arg;
MonoMarshalSpec *spec, int conv_arg,
MonoType **conv_arg_type, MarshalAction action)
{
-#ifdef DISABLE_JIT
+#ifndef HAVE_ONLINE_VES
if (action == MARSHAL_ACTION_CONV_IN)
*conv_arg_type = &mono_defaults.int_class->byval_arg;
#else
MonoMarshalSpec *spec, int conv_arg,
MonoType **conv_arg_type, MarshalAction action)
{
-#ifdef DISABLE_JIT
+#ifndef HAVE_ONLINE_VES
if (action == MARSHAL_ACTION_CONV_IN)
*conv_arg_type = &mono_defaults.int_class->byval_arg;
#else
int conv_arg, MonoType **conv_arg_type,
MarshalAction action)
{
-#ifdef DISABLE_JIT
+#ifndef HAVE_ONLINE_VES
if (action == MARSHAL_ACTION_CONV_IN)
*conv_arg_type = &mono_defaults.int_class->byval_arg;
#else
return conv_arg;
}
-#ifndef DISABLE_JIT
-
+#ifdef HAVE_ONLINE_VES
#ifndef DISABLE_COM
static int
}
#endif /* DISABLE_COM */
-#endif /* DISABLE_JIT */
+#endif /* HAVE_ONLINE_VES */
static gboolean
mono_pinvoke_is_unicode (MonoMethodPInvoke *piinfo)
int conv_arg, MonoType **conv_arg_type,
MarshalAction action)
{
-#ifdef DISABLE_JIT
+#ifndef HAVE_ONLINE_VES
switch (action) {
case MARSHAL_ACTION_CONV_IN:
*conv_arg_type = &mono_defaults.object_class->byval_arg;
int conv_arg, MonoType **conv_arg_type,
MarshalAction action)
{
-#ifdef DISABLE_JIT
+#ifndef HAVE_ONLINE_VES
switch (action) {
case MARSHAL_ACTION_CONV_IN:
if (t->byref)
MonoMarshalSpec *spec, int conv_arg,
MonoType **conv_arg_type, MarshalAction action)
{
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
MonoMethodBuilder *mb = m->mb;
switch (action) {
MonoMarshalSpec *spec, int conv_arg,
MonoType **conv_arg_type, MarshalAction action)
{
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
MonoMethodBuilder *mb = m->mb;
switch (action) {
MonoMarshalSpec *spec, int conv_arg,
MonoType **conv_arg_type, MarshalAction action)
{
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
MonoMethodBuilder *mb = m->mb;
switch (action) {
return emit_marshal_string (m, argnum, t, spec, conv_arg, conv_arg_type, action);
case MONO_TYPE_CLASS:
case MONO_TYPE_OBJECT:
-#if !defined(DISABLE_COM) && !defined(DISABLE_JIT)
+#if !defined(DISABLE_COM) && defined(HAVE_ONLINE_VES)
if (spec && spec->native == MONO_NATIVE_STRUCT)
return emit_marshal_variant (m, argnum, t, spec, conv_arg, conv_arg_type, action);
#endif
/* Wrap the argument in an object handle, pass the handle to the icall,
write the value out from the handle when the icall returns */
ICALL_HANDLES_WRAP_OBJ_INOUT,
+ /* Initialized an object handle to null, pass to the icalls,
+ write the value out from the handle when the icall returns */
+ ICALL_HANDLES_WRAP_OBJ_OUT,
/* Wrap the argument (a valuetype reference) in a handle to pin its enclosing object,
but pass the raw reference to the icall */
ICALL_HANDLES_WRAP_VALUETYPE_REF,
signature_param_uses_handles (MonoMethodSignature *sig, int param)
{
if (MONO_TYPE_IS_REFERENCE (sig->params [param])) {
- return mono_signature_param_is_out (sig, param) ? ICALL_HANDLES_WRAP_OBJ_INOUT : ICALL_HANDLES_WRAP_OBJ;
+ if (mono_signature_param_is_out (sig, param))
+ return ICALL_HANDLES_WRAP_OBJ_OUT;
+ else if (mono_type_is_byref (sig->params [param]))
+ return ICALL_HANDLES_WRAP_OBJ_INOUT;
+ else
+ return ICALL_HANDLES_WRAP_OBJ;
} else if (mono_type_is_byref (sig->params [param]))
return ICALL_HANDLES_WRAP_VALUETYPE_REF;
else
}
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
/**
* mono_marshal_emit_native_wrapper:
* \param image the image to use for looking up custom marshallers
mono_mb_emit_byte (mb, CEE_RET);
}
-#endif /* DISABLE_JIT */
+#endif /* HAVE_ONLINE_VES */
/**
* mono_marshal_get_native_wrapper:
/* create a wrapper to preserve .ctor in stack trace */
mb = mono_mb_new (method->klass, method->name, MONO_WRAPPER_MANAGED_TO_MANAGED);
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
mono_mb_emit_byte (mb, CEE_LDARG_0);
for (i = 1; i <= csig->param_count; i++)
mono_mb_emit_ldarg (mb, i);
* registered in the runtime doing the AOT compilation.
*/
if (!piinfo->addr && !aot) {
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
mono_mb_emit_exception (mb, exc_class, exc_arg);
#endif
info = mono_wrapper_info_create (mb, WRAPPER_SUBTYPE_NONE);
if (method->string_ctor)
csig->ret = &mono_defaults.string_class->byval_arg;
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
// FIXME:
MonoClass *handle_stack_mark_class;
MonoClass *error_class;
switch (w) {
case ICALL_HANDLES_WRAP_OBJ:
case ICALL_HANDLES_WRAP_OBJ_INOUT:
+ case ICALL_HANDLES_WRAP_OBJ_OUT:
ret->params [i] = mono_class_get_byref_type (mono_class_from_mono_type(csig->params[i]));
- if (w == ICALL_HANDLES_WRAP_OBJ_INOUT)
+ if (w == ICALL_HANDLES_WRAP_OBJ_OUT || w == ICALL_HANDLES_WRAP_OBJ_INOUT)
save_handles_to_locals = TRUE;
break;
case ICALL_HANDLES_WRAP_NONE:
handles_locals [j].handle = -1;
break;
case ICALL_HANDLES_WRAP_OBJ_INOUT:
+ case ICALL_HANDLES_WRAP_OBJ_OUT:
handles_locals [j].handle = mono_mb_add_local (mb, sig->params [i]);
break;
default:
mono_mb_emit_icall (mb, mono_icall_handle_new);
break;
case ICALL_HANDLES_WRAP_OBJ_INOUT:
- /* handleI = argI = mono_handle_new (NULL) */
- mono_mb_emit_byte (mb, CEE_LDNULL);
+ case ICALL_HANDLES_WRAP_OBJ_OUT:
+ /* if inout:
+ * handleI = argI = mono_handle_new (*argI_raw)
+ * otherwise:
+ * handleI = argI = mono_handle_new (NULL)
+ */
+ if (handles_locals[j].wrap == ICALL_HANDLES_WRAP_OBJ_INOUT) {
+ mono_mb_emit_ldarg (mb, j);
+ mono_mb_emit_byte (mb, CEE_LDIND_REF);
+ } else
+ mono_mb_emit_byte (mb, CEE_LDNULL);
mono_mb_emit_icall (mb, mono_icall_handle_new);
/* tmp = argI */
mono_mb_emit_byte (mb, CEE_DUP);
case ICALL_HANDLES_WRAP_VALUETYPE_REF:
break;
case ICALL_HANDLES_WRAP_OBJ_INOUT:
+ case ICALL_HANDLES_WRAP_OBJ_OUT:
/* *argI_raw = MONO_HANDLE_RAW (handleI) */
/* argI_raw */
if (!aot)
g_assert (piinfo->addr);
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
mspecs = g_new (MonoMarshalSpec*, sig->param_count + 1);
mono_method_get_marshal_info (method, mspecs);
info, NULL);
mono_mb_free (mb);
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
for (i = sig->param_count; i >= 0; i--)
if (mspecs [i])
mono_metadata_free_marshal_spec (mspecs [i]);
mb = mono_mb_new (mono_defaults.object_class, name, MONO_WRAPPER_MANAGED_TO_NATIVE);
mb->method->save_lmf = 1;
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
mono_marshal_emit_native_wrapper (image, mb, sig, piinfo, mspecs, func, FALSE, TRUE, FALSE);
#endif
mb = mono_mb_new (invoke->klass, name, MONO_WRAPPER_MANAGED_TO_NATIVE);
mb->method->save_lmf = 1;
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
mono_marshal_emit_native_wrapper (image, mb, sig, piinfo, mspecs, NULL, FALSE, TRUE, TRUE);
#endif
void
mono_marshal_emit_managed_wrapper (MonoMethodBuilder *mb, MonoMethodSignature *invoke_sig, MonoMarshalSpec **mspecs, EmitMarshalContext* m, MonoMethod *method, uint32_t target_handle)
{
-#ifdef DISABLE_JIT
+#ifndef HAVE_ONLINE_VES
MonoMethodSignature *sig, *csig;
int i;
mb, csig, sig->param_count + 16,
info, NULL);
} else {
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
mb->dynamic = TRUE;
#endif
res = mono_mb_create (mb, csig, sig->param_count + 16, NULL);
mono_marshal_emit_managed_wrapper (mb, sig, mspecs, &m, method, 0);
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
mb->dynamic = TRUE;
#endif
method = mono_mb_create (mb, csig, sig->param_count + 16, NULL);
mb = mono_mb_new (method->klass, method->name, MONO_WRAPPER_MANAGED_TO_MANAGED);
param_count = sig->param_count + sig->hasthis;
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
for (i = 0; i < param_count; i++)
mono_mb_emit_ldarg (mb, i);
return compiled_ptr;
}
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
/*
* The code directly following this is the cache hit, value positive branch
mono_mb_emit_icall (mb, mono_marshal_isinst_with_cache);
}
-#endif /* DISABLE_JIT */
+#endif /* HAVE_ONLINE_VES */
/**
* mono_marshal_get_castclass_with_cache:
sig->ret = &mono_defaults.object_class->byval_arg;
sig->pinvoke = 0;
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
generate_check_cache (obj_arg_position, class_arg_position, cache_arg_position,
&return_null_pos, &negative_cache_hit_pos, &positive_cache_hit_pos, mb);
invalid_cast_pos = mono_mb_emit_branch (mb, CEE_BRFALSE);
mono_mb_patch_branch (mb, return_null_pos);
mono_mb_emit_byte (mb, CEE_LDNULL);
mono_mb_emit_byte (mb, CEE_RET);
-#endif /* DISABLE_JIT */
+#endif /* HAVE_ONLINE_VES */
info = mono_wrapper_info_create (mb, WRAPPER_SUBTYPE_CASTCLASS_WITH_CACHE);
res = mono_mb_create (mb, sig, 8, info);
sig->ret = &mono_defaults.object_class->byval_arg;
sig->pinvoke = 0;
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
generate_check_cache (obj_arg_position, class_arg_position, cache_arg_position,
&return_null_pos, &negative_cache_hit_pos, &positive_cache_hit_pos, mb);
// Return the object gotten via the slow path.
mb = mono_mb_new (klass, stoptr->name, MONO_WRAPPER_UNKNOWN);
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
if (klass->blittable) {
mono_mb_emit_byte (mb, CEE_LDARG_1);
mono_mb_emit_byte (mb, CEE_LDARG_0);
mb = mono_mb_new (klass, "PtrToStructure", MONO_WRAPPER_UNKNOWN);
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
if (klass->blittable) {
mono_mb_emit_byte (mb, CEE_LDARG_1);
mono_mb_emit_ldflda (mb, sizeof (MonoObject));
}
mb = mono_mb_new (method->klass, method->name, MONO_WRAPPER_UNKNOWN);
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
mono_mb_emit_exception_full (mb, "System", "ExecutionEngineException", "Shouldn't be called.");
mono_mb_emit_byte (mb, CEE_RET);
#endif
info = mono_wrapper_info_create (mb, WRAPPER_SUBTYPE_NONE);
info->d.synchronized.method = method;
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
mb->skip_visibility = 1;
/* result */
if (!MONO_TYPE_IS_VOID (sig->ret))
if (method->klass->valuetype && !(method->flags & MONO_METHOD_ATTR_STATIC)) {
/* FIXME Is this really the best way to signal an error here? Isn't this called much later after class setup? -AK */
mono_class_set_type_load_failure (method->klass, "");
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
/* This will throw the type load exception when the wrapper is compiled */
mono_mb_emit_byte (mb, CEE_LDNULL);
mono_mb_emit_op (mb, CEE_ISINST, method->klass);
return res;
}
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
/* this */
this_local = mono_mb_add_local (mb, &mono_defaults.object_class->byval_arg);
taken_local = mono_mb_add_local (mb, &mono_defaults.boolean_class->byval_arg);
mono_marshal_unlock ();
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
/* Push this or the type object */
if (method->flags & METHOD_ATTRIBUTE_STATIC) {
/* We have special handling for this in the JIT */
g_assert (sig->hasthis);
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
mono_mb_emit_ldarg (mb, 0);
mono_mb_emit_icon (mb, sizeof (MonoObject));
mono_mb_emit_byte (mb, CEE_ADD);
return STELEMREF_CLASS;
}
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
static void
load_array_element_address (MonoMethodBuilder *mb)
signature = sig;
}
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
param_names [0] = "index";
param_names [1] = "value";
mono_mb_set_param_names (mb, param_names);
mono_mb_emit_byte (mb, CEE_RET);
g_assert (0);
}
-#endif /* DISABLE_JIT */
+#endif /* HAVE_ONLINE_VES */
info = mono_wrapper_info_create (mb, WRAPPER_SUBTYPE_VIRTUAL_STELEMREF);
info->d.virtual_stelemref.kind = kind;
res = mono_mb_create (mb, signature, 4, info);
sig->params [1] = &mono_defaults.int_class->byval_arg; /* this is a natural sized int */
sig->params [2] = &mono_defaults.object_class->byval_arg;
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
aklass = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
vklass = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
array_slot_addr = mono_mb_add_local (mb, &mono_defaults.object_class->this_arg);
sig = mono_metadata_signature_alloc (mono_defaults.corlib, 0);
sig->ret = &mono_defaults.void_class->byval_arg;
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
/*
* The body is generated by the JIT, we use a wrapper instead of a trampoline so EH works.
*/
sig = mono_metadata_signature_alloc (mono_defaults.corlib, 0);
sig->ret = &mono_defaults.void_class->byval_arg;
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
/*
* The body is generated by the JIT, we use a wrapper instead of a trampoline so EH works.
*/
mb = mono_mb_new (mono_defaults.object_class, name, MONO_WRAPPER_MANAGED_TO_MANAGED);
g_free (name);
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
bounds = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
ind = mono_mb_add_local (mb, &mono_defaults.int32_class->byval_arg);
realidx = mono_mb_add_local (mb, &mono_defaults.int32_class->byval_arg);
mono_mb_emit_exception (mb, "IndexOutOfRangeException", NULL);
g_free (branch_positions);
-#endif /* DISABLE_JIT */
+#endif /* HAVE_ONLINE_VES */
info = mono_wrapper_info_create (mb, WRAPPER_SUBTYPE_ELEMENT_ADDR);
info->d.element_addr.rank = rank;
mb = mono_mb_new (method->klass, method->name, MONO_WRAPPER_UNKNOWN);
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
/* Call the method */
if (sig->hasthis)
mono_mb_emit_ldarg (mb, 0);
csig = mono_metadata_signature_dup_full (method->klass->image, sig);
csig->generic_param_count = 0;
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
mono_mb_emit_ldarg (mb, 0);
for (i = 0; i < csig->param_count; i++)
mono_mb_emit_ldarg (mb, i + 1);
if (MONO_TYPE_ISSTRUCT (sig->ret))
csig->ret = &mono_defaults.object_class->byval_arg;
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
/* local 0 (temp for exception object) */
mono_mb_add_local (mb, &mono_defaults.object_class->byval_arg);
m->inline_info = 1;
m->wrapper_type = type;
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
mb->code_size = 40;
mb->code = (unsigned char *)g_malloc (mb->code_size);
mb->init_locals = TRUE;
void
mono_mb_free (MonoMethodBuilder *mb)
{
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
GList *l;
for (l = mb->locals_list; l; l = l->next) {
MonoMethod *
mono_mb_create_method (MonoMethodBuilder *mb, MonoMethodSignature *signature, int max_stack)
{
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
MonoMethodHeader *header;
#endif
MonoMethodWrapper *mw;
image = mb->method->klass->image;
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
if (mb->dynamic) {
method = mb->method;
mw = (MonoMethodWrapper*)method;
else
method->name = mono_image_strdup (image, mb->name);
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
mw->header = header = (MonoMethodHeader *)
mono_image_alloc0 (image, MONO_SIZEOF_METHOD_HEADER + mb->locals * sizeof (MonoType *));
#endif
}
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
/* Free the locals list so mono_mb_free () doesn't free the types twice */
g_list_free (mb->locals_list);
mb->locals_list = NULL;
if (!signature->hasthis)
method->flags |= METHOD_ATTRIBUTE_STATIC;
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
if (max_stack < 8)
max_stack = 8;
mw->method_data = data;
}
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
/*{
static int total_code = 0;
static int total_alloc = 0;
return g_list_length ((GList *)mw->method_data);
}
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
/**
* mono_mb_add_local:
MonoMethod *method;
char *name;
gboolean no_dup_name;
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
GList *locals_list;
int locals;
gboolean dynamic;
guint32
mono_mb_add_data (MonoMethodBuilder *mb, gpointer data);
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
void
mono_mb_patch_addr (MonoMethodBuilder *mb, int pos, int value);
CallType_OneWay = 3
} MonoCallType;
+/* MonoSafeHandle is in class-internals.h. */
+/* Safely access System.Net.Sockets.SafeSocketHandle from native code */
+TYPED_HANDLE_DECL (MonoSafeHandle);
+
/* This corresponds to System.Type */
struct _MonoReflectionType {
MonoObject object;
gpointer last;
};
+/* It's safe to access System.Threading.InternalThread from native code via a
+ * raw pointer because all instances should be pinned. But for uniformity of
+ * icall wrapping, let's declare a MonoInternalThreadHandle anyway.
+ */
+TYPED_HANDLE_DECL (MonoInternalThread);
+
struct _MonoThread {
MonoObject obj;
struct _MonoInternalThread *internal_thread;
MonoProperty *prop;
} CattrNamedArg;
+/* All MonoInternalThread instances should be pinned, so it's safe to use the raw ptr. However
+ * for uniformity, icall wrapping will make handles anyway. So this is the method for getting the payload.
+ */
+static inline MonoInternalThread*
+mono_internal_thread_handle_ptr (MonoInternalThreadHandle h)
+{
+ return MONO_HANDLE_RAW (h); /* Safe */
+}
+
gboolean mono_image_create_pefile (MonoReflectionModuleBuilder *module, gpointer file, MonoError *error);
guint32 mono_image_insert_string (MonoReflectionModuleBuilderHandle module, MonoStringHandle str, MonoError *error);
guint32 mono_image_create_token (MonoDynamicImage *assembly, MonoObjectHandle obj, gboolean create_methodspec, gboolean register_token, MonoError *error);
DECL_OFFSET(SeqPointInfo, bp_addrs)
#endif
+#ifdef ENABLE_INTERPRETER
+DECL_OFFSET(InterpMethodArguments, ilen)
+DECL_OFFSET(InterpMethodArguments, iargs)
+DECL_OFFSET(InterpMethodArguments, flen)
+DECL_OFFSET(InterpMethodArguments, fargs)
+DECL_OFFSET(InterpMethodArguments, retval)
+DECL_OFFSET(InterpMethodArguments, is_float_ret)
+#endif
+
#endif //DISABLE_JIT_OFFSETS
#endif //USED_CROSS_COMPILER_OFFSETS
return sgen_is_critical_method (method);
}
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
static void
emit_nursery_check (MonoMethodBuilder *mb, int *nursery_check_return_labels, gboolean is_concurrent)
else
mb = mono_mb_new (mono_defaults.object_class, "wbarrier_noconc", MONO_WRAPPER_WRITE_BARRIER);
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
#ifdef MANAGED_WBARRIER
emit_nursery_check (mb, nursery_check_labels, is_concurrent);
/*
mb = mono_mb_new (mono_defaults.object_class, name, MONO_WRAPPER_ALLOC);
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
if (slowpath) {
switch (atype) {
case ATYPE_NORMAL:
info->d.alloc.gc_name = "sgen";
info->d.alloc.alloc_type = atype;
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
mb->init_locals = FALSE;
#endif
MonoW32HandleNamespace sharedns;
};
+static void event_handle_signal (gpointer handle, MonoW32HandleType type, MonoW32HandleEvent *event_handle)
+{
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: signalling %s handle %p",
+ __func__, mono_w32handle_get_typename (type), handle);
+
+ if (!event_handle->manual) {
+ event_handle->set_count = 1;
+ mono_w32handle_set_signal_state (handle, TRUE, FALSE);
+ } else {
+ mono_w32handle_set_signal_state (handle, TRUE, TRUE);
+ }
+}
+
static gboolean event_handle_own (gpointer handle, MonoW32HandleType type, gboolean *abandoned)
{
MonoW32HandleEvent *event_handle;
return TRUE;
}
-static void event_signal(gpointer handle)
+static void event_signal(gpointer handle, gpointer handle_specific)
{
- ves_icall_System_Threading_Events_SetEvent_internal (handle);
+ event_handle_signal (handle, MONO_W32HANDLE_EVENT, (MonoW32HandleEvent*) handle_specific);
}
static gboolean event_own (gpointer handle, gboolean *abandoned)
return event_handle_own (handle, MONO_W32HANDLE_EVENT, abandoned);
}
-static void namedevent_signal (gpointer handle)
+static void namedevent_signal (gpointer handle, gpointer handle_specific)
{
- ves_icall_System_Threading_Events_SetEvent_internal (handle);
+ event_handle_signal (handle, MONO_W32HANDLE_NAMEDEVENT, (MonoW32HandleEvent*) handle_specific);
}
/* NB, always called with the shared handle lock held */
type = handle_data->type;
if (handle_ops[type] != NULL && handle_ops[type]->signal != NULL) {
- handle_ops[type]->signal (handle);
+ handle_ops[type]->signal (handle, handle_data->specific);
}
}
void (*close)(gpointer handle, gpointer data);
/* mono_w32handle_signal_and_wait */
- void (*signal)(gpointer signal);
+ void (*signal)(gpointer signal, gpointer data);
/* Called by mono_w32handle_wait_one and mono_w32handle_wait_multiple,
* with the handle locked (shared handles aren't locked.)
mono_w32handle_unref (handle);
}
+static void
+mutex_handle_signal (gpointer handle, MonoW32HandleType type, MonoW32HandleMutex *mutex_handle)
+{
+ pthread_t tid;
+
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: signalling %s handle %p, tid: %p recursion: %d",
+ __func__, mono_w32handle_get_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion);
+
+ tid = pthread_self ();
+
+ if (mutex_handle->abandoned) {
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p is abandoned",
+ __func__, mono_w32handle_get_typename (type), handle);
+ } else if (!pthread_equal (mutex_handle->tid, tid)) {
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: we don't own %s handle %p (owned by %ld, me %ld)",
+ __func__, mono_w32handle_get_typename (type), handle, (long)mutex_handle->tid, (long)tid);
+ } else {
+ /* OK, we own this mutex */
+ mutex_handle->recursion--;
+
+ if (mutex_handle->recursion == 0) {
+ thread_disown_mutex (mono_thread_internal_current (), handle);
+
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unlocking %s handle %p, tid: %p recusion : %d",
+ __func__, mono_w32handle_get_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion);
+
+ mutex_handle->tid = 0;
+ mono_w32handle_set_signal_state (handle, TRUE, FALSE);
+ }
+ }
+}
+
static gboolean
mutex_handle_own (gpointer handle, MonoW32HandleType type, gboolean *abandoned)
{
}
}
-static void mutex_signal(gpointer handle)
+static void mutex_signal(gpointer handle, gpointer handle_specific)
{
- ves_icall_System_Threading_Mutex_ReleaseMutex_internal (handle);
+ mutex_handle_signal (handle, MONO_W32HANDLE_MUTEX, (MonoW32HandleMutex*) handle_specific);
}
static gboolean mutex_own (gpointer handle, gboolean *abandoned)
static gboolean mutex_is_owned (gpointer handle)
{
-
return mutex_handle_is_owned (handle, MONO_W32HANDLE_MUTEX);
}
-static void namedmutex_signal (gpointer handle)
+static void namedmutex_signal (gpointer handle, gpointer handle_specific)
{
- ves_icall_System_Threading_Mutex_ReleaseMutex_internal (handle);
+ mutex_handle_signal (handle, MONO_W32HANDLE_NAMEDMUTEX, (MonoW32HandleMutex*) handle_specific);
}
/* NB, always called with the shared handle lock held */
MonoW32HandleNamespace sharedns;
};
+static void sem_handle_signal (gpointer handle, MonoW32HandleType type, MonoW32HandleSemaphore *sem_handle)
+{
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: signalling %s handle %p",
+ __func__, mono_w32handle_get_typename (type), handle);
+
+ /* No idea why max is signed, but thats the spec :-( */
+ if (sem_handle->val + 1 > (guint32)sem_handle->max) {
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p val %d count %d max %d, max value would be exceeded",
+ __func__, mono_w32handle_get_typename (type), handle, sem_handle->val, 1, sem_handle->max);
+ } else {
+ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p val %d count %d max %d",
+ __func__, mono_w32handle_get_typename (type), handle, sem_handle->val, 1, sem_handle->max);
+
+ sem_handle->val += 1;
+ mono_w32handle_set_signal_state (handle, TRUE, TRUE);
+ }
+}
+
static gboolean sem_handle_own (gpointer handle, MonoW32HandleType type, gboolean *abandoned)
{
MonoW32HandleSemaphore *sem_handle;
return TRUE;
}
-static void sema_signal(gpointer handle)
+static void sema_signal(gpointer handle, gpointer handle_specific)
{
- ves_icall_System_Threading_Semaphore_ReleaseSemaphore_internal(handle, 1, NULL);
+ sem_handle_signal (handle, MONO_W32HANDLE_SEM, (MonoW32HandleSemaphore*) handle_specific);
}
static gboolean sema_own (gpointer handle, gboolean *abandoned)
return sem_handle_own (handle, MONO_W32HANDLE_SEM, abandoned);
}
-static void namedsema_signal (gpointer handle)
+static void namedsema_signal (gpointer handle, gpointer handle_specific)
{
- ves_icall_System_Threading_Semaphore_ReleaseSemaphore_internal (handle, 1, NULL);
+ sem_handle_signal (handle, MONO_W32HANDLE_NAMEDSEM, (MonoW32HandleSemaphore*) handle_specific);
}
/* NB, always called with the shared handle lock held */
}
gboolean
-ves_icall_System_Net_Sockets_Socket_SupportPortReuse (MonoProtocolType proto)
+ves_icall_System_Net_Sockets_Socket_SupportPortReuse (MonoProtocolType proto, MonoError *error)
{
+ error_init (error);
#if defined (SO_REUSEPORT)
return TRUE;
#else
}
gboolean
-ves_icall_System_Net_Sockets_Socket_SupportPortReuse (MonoProtocolType proto)
+ves_icall_System_Net_Sockets_Socket_SupportPortReuse (MonoProtocolType proto, MonoError *error)
{
+ error_init (error);
return TRUE;
}
static gboolean
addrinfo_to_IPHostEntry_handles (MonoAddressInfo *info, MonoStringHandleOut h_name, MonoArrayHandleOut h_aliases, MonoArrayHandleOut h_addr_list, gboolean add_local_ips, MonoError *error);
+static MonoObjectHandle
+create_object_handle_from_sockaddr (struct sockaddr *saddr, int sa_size, gint32 *werror, MonoError *error);
+
+static struct sockaddr*
+create_sockaddr_from_handle (MonoObjectHandle saddr_obj, socklen_t *sa_size, gint32 *werror, MonoError *error);
+
#ifdef HOST_WIN32
static SOCKET
}
gpointer
-ves_icall_System_Net_Sockets_Socket_Socket_internal (MonoObject *this_obj, gint32 family, gint32 type, gint32 proto, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_Socket_internal (MonoObjectHandle this_obj, gint32 family, gint32 type, gint32 proto, gint32 *werror, MonoError *error)
{
SOCKET sock;
gint32 sock_family;
gint32 sock_proto;
gint32 sock_type;
+ error_init (error);
*werror = 0;
sock_family = convert_family ((MonoAddressFamily)family);
* file) is really an IntPtr which needs to be converted to a guint32.
*/
void
-ves_icall_System_Net_Sockets_Socket_Close_internal (gsize sock, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_Close_internal (gsize sock, gint32 *werror, MonoError *error)
{
LOGDEBUG (g_message ("%s: closing 0x%x", __func__, sock));
+ error_init (error);
*werror = 0;
/* Clear any pending work item from this socket if the underlying
}
gint32
-ves_icall_System_Net_Sockets_Socket_Available_internal (gsize sock, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_Available_internal (gsize sock, gint32 *werror, MonoError *error)
{
int ret;
guint64 amount;
+ error_init (error);
*werror = 0;
/* FIXME: this might require amount to be unsigned long. */
}
void
-ves_icall_System_Net_Sockets_Socket_Blocking_internal (gsize sock, gboolean block, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_Blocking_internal (gsize sock, gboolean block, gint32 *werror, MonoError *error)
{
int ret;
+ error_init (error);
*werror = 0;
ret = mono_w32socket_set_blocking (sock, block);
}
gpointer
-ves_icall_System_Net_Sockets_Socket_Accept_internal (gsize sock, gint32 *werror, gboolean blocking)
+ves_icall_System_Net_Sockets_Socket_Accept_internal (gsize sock, gint32 *werror, gboolean blocking, MonoError *error)
{
gboolean interrupted;
SOCKET newsock;
+ error_init (error);
*werror = 0;
mono_thread_info_install_interrupt (abort_syscall, (gpointer) (gsize) mono_native_thread_id_get (), &interrupted);
}
void
-ves_icall_System_Net_Sockets_Socket_Listen_internal(gsize sock, guint32 backlog, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_Listen_internal(gsize sock, guint32 backlog, gint32 *werror, MonoError *error)
{
int ret;
+ error_init (error);
*werror = 0;
MONO_ENTER_GC_SAFE;
}
#endif
-static MonoObject*
-create_object_from_sockaddr (struct sockaddr *saddr, int sa_size, gint32 *werror, MonoError *error)
+static MonoObjectHandle
+create_object_handle_from_sockaddr (struct sockaddr *saddr, int sa_size, gint32 *werror, MonoError *error)
{
MonoDomain *domain = mono_domain_get ();
- MonoObject *sockaddr_obj;
- MonoArray *data;
MonoAddressFamily family;
error_init (error);
/* Build a System.Net.SocketAddress object instance */
if (!domain->sockaddr_class)
domain->sockaddr_class = mono_class_load_from_name (get_socket_assembly (), "System.Net", "SocketAddress");
- sockaddr_obj = mono_object_new_checked (domain, domain->sockaddr_class, error);
- return_val_if_nok (error, NULL);
+ MonoObjectHandle sockaddr_obj = MONO_HANDLE_NEW (MonoObject, mono_object_new_checked (domain, domain->sockaddr_class, error));
+ return_val_if_nok (error, MONO_HANDLE_NEW (MonoObject, NULL));
/* Locate the SocketAddress data buffer in the object */
if (!domain->sockaddr_data_field) {
* the length of the entire sockaddr_in/in6, including
* sizeof (unsigned short) of the family */
/* We can't really avoid the +2 as all code below depends on this size - INCLUDING unix domain sockets.*/
- data = mono_array_new_cached (domain, mono_get_byte_class (), sa_size + 2, error);
- return_val_if_nok (error, NULL);
+ MonoArrayHandle data = mono_array_new_handle (domain, mono_get_byte_class (), sa_size + 2, error);
+ return_val_if_nok (error, MONO_HANDLE_NEW (MonoObject, NULL));
/* The data buffer is laid out as follows:
* bytes 0 and 1 are the address family
family = convert_to_mono_family (saddr->sa_family);
if (family == AddressFamily_Unknown) {
*werror = WSAEAFNOSUPPORT;
- return NULL;
+ return MONO_HANDLE_NEW (MonoObject, NULL);
}
- mono_array_set (data, guint8, 0, family & 0x0FF);
- mono_array_set (data, guint8, 1, (family >> 8) & 0x0FF);
+ MONO_HANDLE_ARRAY_SETVAL (data, guint8, 0, family & 0x0FF);
+ MONO_HANDLE_ARRAY_SETVAL (data, guint8, 1, (family >> 8) & 0x0FF);
if (saddr->sa_family == AF_INET) {
struct sockaddr_in *sa_in = (struct sockaddr_in *)saddr;
int buffer_size = 8;
if (sa_size < buffer_size) {
- mono_error_set_exception_instance (error, mono_exception_from_name (mono_get_corlib (), "System", "SystemException"));
- return NULL;
+ mono_error_set_generic_error (error, "System", "SystemException", "");
+ return MONO_HANDLE_NEW (MonoObject, NULL);
}
- mono_array_set (data, guint8, 2, (port>>8) & 0xff);
- mono_array_set (data, guint8, 3, (port) & 0xff);
- mono_array_set (data, guint8, 4, (address>>24) & 0xff);
- mono_array_set (data, guint8, 5, (address>>16) & 0xff);
- mono_array_set (data, guint8, 6, (address>>8) & 0xff);
- mono_array_set (data, guint8, 7, (address) & 0xff);
+ MONO_HANDLE_ARRAY_SETVAL (data, guint8, 2, (port>>8) & 0xff);
+ MONO_HANDLE_ARRAY_SETVAL (data, guint8, 3, (port) & 0xff);
+ MONO_HANDLE_ARRAY_SETVAL (data, guint8, 4, (address>>24) & 0xff);
+ MONO_HANDLE_ARRAY_SETVAL (data, guint8, 5, (address>>16) & 0xff);
+ MONO_HANDLE_ARRAY_SETVAL (data, guint8, 6, (address>>8) & 0xff);
+ MONO_HANDLE_ARRAY_SETVAL (data, guint8, 7, (address) & 0xff);
- mono_field_set_value (sockaddr_obj, domain->sockaddr_data_field, data);
- mono_field_set_value (sockaddr_obj, domain->sockaddr_data_length_field, &buffer_size);
+ mono_field_set_value (MONO_HANDLE_RAW (sockaddr_obj), domain->sockaddr_data_field, MONO_HANDLE_RAW (data)); /* FIXME: use handles for mono_field_set_value */
+ mono_field_set_value (MONO_HANDLE_RAW (sockaddr_obj), domain->sockaddr_data_length_field, &buffer_size); /* FIXME: use handles for mono_field_set_value */
return sockaddr_obj;
}
guint16 port = ntohs (sa_in->sin6_port);
if (sa_size < buffer_size) {
- mono_error_set_exception_instance (error, mono_exception_from_name (mono_get_corlib (), "System", "SystemException"));
- return NULL;
+ mono_error_set_generic_error (error, "System", "SystemException", "");
+ return MONO_HANDLE_NEW (MonoObject, NULL);
}
- mono_array_set (data, guint8, 2, (port>>8) & 0xff);
- mono_array_set (data, guint8, 3, (port) & 0xff);
+ MONO_HANDLE_ARRAY_SETVAL (data, guint8, 2, (port>>8) & 0xff);
+ MONO_HANDLE_ARRAY_SETVAL (data, guint8, 3, (port) & 0xff);
if (is_ipv4_mapped_any (&sa_in->sin6_addr)) {
// Map ::ffff:0:0 to :: (bug #5502)
for (i = 0; i < 16; i++)
- mono_array_set (data, guint8, 8 + i, 0);
+ MONO_HANDLE_ARRAY_SETVAL (data, guint8, 8 + i, 0);
} else {
for (i = 0; i < 16; i++) {
- mono_array_set (data, guint8, 8 + i,
- sa_in->sin6_addr.s6_addr [i]);
+ MONO_HANDLE_ARRAY_SETVAL (data, guint8, 8 + i,
+ sa_in->sin6_addr.s6_addr [i]);
}
}
- mono_array_set (data, guint8, 24, sa_in->sin6_scope_id & 0xff);
- mono_array_set (data, guint8, 25,
- (sa_in->sin6_scope_id >> 8) & 0xff);
- mono_array_set (data, guint8, 26,
- (sa_in->sin6_scope_id >> 16) & 0xff);
- mono_array_set (data, guint8, 27,
- (sa_in->sin6_scope_id >> 24) & 0xff);
+ MONO_HANDLE_ARRAY_SETVAL (data, guint8, 24, sa_in->sin6_scope_id & 0xff);
+ MONO_HANDLE_ARRAY_SETVAL (data, guint8, 25,
+ (sa_in->sin6_scope_id >> 8) & 0xff);
+ MONO_HANDLE_ARRAY_SETVAL (data, guint8, 26,
+ (sa_in->sin6_scope_id >> 16) & 0xff);
+ MONO_HANDLE_ARRAY_SETVAL (data, guint8, 27,
+ (sa_in->sin6_scope_id >> 24) & 0xff);
- mono_field_set_value (sockaddr_obj, domain->sockaddr_data_field, data);
- mono_field_set_value (sockaddr_obj, domain->sockaddr_data_length_field, &buffer_size);
+ mono_field_set_value (MONO_HANDLE_RAW (sockaddr_obj), domain->sockaddr_data_field, MONO_HANDLE_RAW (data)); /* FIXME: use handles for mono_field_set_value */
+ mono_field_set_value (MONO_HANDLE_RAW (sockaddr_obj), domain->sockaddr_data_length_field, &buffer_size); /* FIXME: use handles for mono_field_set_value */
return sockaddr_obj;
}
int buffer_size = sa_size + 2;
for (i = 0; i < sa_size; i++)
- mono_array_set (data, guint8, i + 2, saddr->sa_data [i]);
+ MONO_HANDLE_ARRAY_SETVAL (data, guint8, i + 2, saddr->sa_data [i]);
- mono_field_set_value (sockaddr_obj, domain->sockaddr_data_field, data);
- mono_field_set_value (sockaddr_obj, domain->sockaddr_data_length_field, &buffer_size);
+ mono_field_set_value (MONO_HANDLE_RAW (sockaddr_obj), domain->sockaddr_data_field, MONO_HANDLE_RAW (data)); /* FIXME: use handles for mono_field_set_value */
+ mono_field_set_value (MONO_HANDLE_RAW (sockaddr_obj), domain->sockaddr_data_length_field, &buffer_size); /* FIXME: use handles for mono_field_set_value */
return sockaddr_obj;
}
#endif
else {
*werror = WSAEAFNOSUPPORT;
- return NULL;
+ return MONO_HANDLE_NEW (MonoObject, NULL);
}
}
return size;
}
-MonoObject*
-ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal (gsize sock, gint32 af, gint32 *werror)
+MonoObjectHandle
+ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal (gsize sock, gint32 af, gint32 *werror, MonoError *error)
{
gchar *sa;
socklen_t salen;
int ret;
- MonoObject *result;
- MonoError error;
*werror = 0;
*werror = mono_w32socket_get_last_error ();
if (salen > 128)
g_free (sa);
- return NULL;
+ return NULL_HANDLE;
}
LOGDEBUG (g_message("%s: bound to %s port %d", __func__, inet_ntoa (((struct sockaddr_in *)&sa)->sin_addr), ntohs (((struct sockaddr_in *)&sa)->sin_port)));
- result = create_object_from_sockaddr ((struct sockaddr *)sa, salen, werror, &error);
+ MonoObjectHandle result = create_object_handle_from_sockaddr ((struct sockaddr *)sa, salen, werror, error);
if (salen > 128)
g_free (sa);
- if (!mono_error_ok (&error))
- mono_error_set_pending_exception (&error);
return result;
}
-MonoObject*
-ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal (gsize sock, gint32 af, gint32 *werror)
+MonoObjectHandle
+ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal (gsize sock, gint32 af, gint32 *werror, MonoError *error)
{
gchar *sa;
socklen_t salen;
int ret;
- MonoObject *result;
- MonoError error;
+ error_init (error);
*werror = 0;
salen = get_sockaddr_size (convert_family ((MonoAddressFamily)af));
if (salen == 0) {
*werror = WSAEAFNOSUPPORT;
- return NULL;
+ return MONO_HANDLE_NEW (MonoObject, NULL);
}
sa = (salen <= 128) ? (gchar *)alloca (salen) : (gchar *)g_malloc0 (salen);
/* Note: linux returns just 2 for AF_UNIX. Always. */
*werror = mono_w32socket_get_last_error ();
if (salen > 128)
g_free (sa);
- return NULL;
+ return MONO_HANDLE_NEW (MonoObject, NULL);
}
LOGDEBUG (g_message("%s: connected to %s port %d", __func__, inet_ntoa (((struct sockaddr_in *)&sa)->sin_addr), ntohs (((struct sockaddr_in *)&sa)->sin_port)));
- result = create_object_from_sockaddr ((struct sockaddr *)sa, salen, werror, &error);
+ MonoObjectHandle result = create_object_handle_from_sockaddr ((struct sockaddr *)sa, salen, werror, error);
if (salen > 128)
g_free (sa);
- if (!mono_error_ok (&error))
- mono_error_set_pending_exception (&error);
return result;
}
static struct sockaddr*
-create_sockaddr_from_object (MonoObject *saddr_obj, socklen_t *sa_size, gint32 *werror, MonoError *error)
+create_sockaddr_from_handle (MonoObjectHandle saddr_obj, socklen_t *sa_size, gint32 *werror, MonoError *error)
{
MonoDomain *domain = mono_domain_get ();
- MonoArray *data;
gint32 family;
int len;
g_assert (domain->sockaddr_data_length_field);
}
- data = *(MonoArray **)(((char *)saddr_obj) + domain->sockaddr_data_field->offset);
+ MonoArrayHandle data = MONO_HANDLE_NEW_GET_FIELD (saddr_obj, MonoArray, domain->sockaddr_data_field);
/* The data buffer is laid out as follows:
* byte 0 is the address family low byte
* UNIX:
* the rest is the file name
*/
- len = *(int *)(((char *)saddr_obj) + domain->sockaddr_data_length_field->offset);
+ len = MONO_HANDLE_GET_FIELD_VAL (saddr_obj, int, domain->sockaddr_data_length_field);
g_assert (len >= 2);
- family = convert_family ((MonoAddressFamily)(mono_array_get (data, guint8, 0) + (mono_array_get (data, guint8, 1) << 8)));
+ uint32_t gchandle;
+ guint8 *buf = MONO_ARRAY_HANDLE_PIN (data, guint8, 0, &gchandle);
+ family = convert_family ((MonoAddressFamily)(buf[0] + (buf[1] << 8)));
if (family == AF_INET) {
struct sockaddr_in *sa;
guint16 port;
guint32 address;
if (len < 8) {
- mono_error_set_exception_instance (error, mono_exception_from_name (mono_get_corlib (), "System", "SystemException"));
+ mono_error_set_generic_error (error, "System", "SystemException", "");
+ mono_gchandle_free (gchandle);
return NULL;
}
sa = g_new0 (struct sockaddr_in, 1);
- port = (mono_array_get (data, guint8, 2) << 8) +
- mono_array_get (data, guint8, 3);
- address = (mono_array_get (data, guint8, 4) << 24) +
- (mono_array_get (data, guint8, 5) << 16 ) +
- (mono_array_get (data, guint8, 6) << 8) +
- mono_array_get (data, guint8, 7);
+ port = (buf[2] << 8) + buf[3];
+ address = (buf[4] << 24) + (buf[5] << 16) + (buf[6] << 8) + buf[7];
sa->sin_family = family;
sa->sin_addr.s_addr = htonl (address);
sa->sin_port = htons (port);
*sa_size = sizeof (struct sockaddr_in);
+ mono_gchandle_free (gchandle);
return (struct sockaddr *)sa;
}
#ifdef HAVE_STRUCT_SOCKADDR_IN6
guint32 scopeid;
if (len < 28) {
- mono_error_set_exception_instance (error, mono_exception_from_name (mono_get_corlib (), "System", "SystemException"));
+ mono_error_set_generic_error (error, "System", "SystemException", "");
+ mono_gchandle_free (gchandle);
return NULL;
}
sa = g_new0 (struct sockaddr_in6, 1);
- port = mono_array_get (data, guint8, 3) +
- (mono_array_get (data, guint8, 2) << 8);
- scopeid = mono_array_get (data, guint8, 24) +
- (mono_array_get (data, guint8, 25) << 8) +
- (mono_array_get (data, guint8, 26) << 16) +
- (mono_array_get (data, guint8, 27) << 24);
+ port = buf[3] + (buf[2] << 8);
+ scopeid = buf[24] + (buf[25] << 8) + (buf[26] << 16) + (buf[27] << 24);
sa->sin6_family = family;
sa->sin6_port = htons (port);
sa->sin6_scope_id = scopeid;
for (i = 0; i < 16; i++)
- sa->sin6_addr.s6_addr [i] = mono_array_get (data, guint8, 8 + i);
+ sa->sin6_addr.s6_addr [i] = buf[8 + i];
*sa_size = sizeof (struct sockaddr_in6);
+ mono_gchandle_free (gchandle);
return (struct sockaddr *)sa;
}
#endif
*/
if (len - 2 >= sizeof (sock_un->sun_path)) {
mono_error_set_exception_instance (error, mono_get_exception_index_out_of_range ());
+ mono_gchandle_free (gchandle);
return NULL;
}
sock_un->sun_family = family;
for (i = 0; i < len - 2; i++)
- sock_un->sun_path [i] = mono_array_get (data, guint8, i + 2);
+ sock_un->sun_path [i] = buf[i + 2];
*sa_size = len;
+ mono_gchandle_free (gchandle);
return (struct sockaddr *)sock_un;
}
#endif
else {
*werror = WSAEAFNOSUPPORT;
+ mono_gchandle_free (gchandle);
return 0;
}
}
void
-ves_icall_System_Net_Sockets_Socket_Bind_internal (gsize sock, MonoObject *sockaddr, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_Bind_internal (gsize sock, MonoObjectHandle sockaddr, gint32 *werror, MonoError *error)
{
- MonoError error;
struct sockaddr *sa;
socklen_t sa_size;
int ret;
+ error_init (error);
*werror = 0;
- sa = create_sockaddr_from_object (sockaddr, &sa_size, werror, &error);
+ sa = create_sockaddr_from_handle (sockaddr, &sa_size, werror, error);
if (*werror != 0)
return;
- if (!mono_error_ok (&error)) {
- mono_error_set_pending_exception (&error);
- return;
- }
+ return_if_nok (error);
LOGDEBUG (g_message("%s: binding to %s port %d", __func__, inet_ntoa (((struct sockaddr_in *)sa)->sin_addr), ntohs (((struct sockaddr_in *)sa)->sin_port)));
MonoBoolean
ves_icall_System_Net_Sockets_Socket_Poll_internal (gsize sock, gint mode,
- gint timeout, gint32 *werror)
+ gint timeout, gint32 *werror, MonoError *error)
{
MonoInternalThread *thread = mono_thread_internal_current ();
mono_pollfd *pfds;
gboolean interrupted;
time_t start;
+ error_init (error);
*werror = 0;
pfds = g_new0 (mono_pollfd, 1);
}
void
-ves_icall_System_Net_Sockets_Socket_Connect_internal (gsize sock, MonoObject *sockaddr, gint32 *werror, gboolean blocking)
+ves_icall_System_Net_Sockets_Socket_Connect_internal (gsize sock, MonoObjectHandle sockaddr, gint32 *werror, gboolean blocking, MonoError *error)
{
- MonoError error;
struct sockaddr *sa;
socklen_t sa_size;
int ret;
gboolean interrupted;
+ error_init (error);
*werror = 0;
- sa = create_sockaddr_from_object (sockaddr, &sa_size, werror, &error);
+ sa = create_sockaddr_from_handle (sockaddr, &sa_size, werror, error);
if (*werror != 0)
return;
- if (!mono_error_ok (&error)) {
- mono_error_set_pending_exception (&error);
- return;
- }
+ return_if_nok (error);
LOGDEBUG (g_message("%s: connecting to %s port %d", __func__, inet_ntoa (((struct sockaddr_in *)sa)->sin_addr), ntohs (((struct sockaddr_in *)sa)->sin_port)));
#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT)
void
-ves_icall_System_Net_Sockets_Socket_Disconnect_internal (gsize sock, MonoBoolean reuse, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_Disconnect_internal (gsize sock, MonoBoolean reuse, gint32 *werror, MonoError *error)
{
gboolean interrupted;
+ error_init (error);
+
LOGDEBUG (g_message("%s: disconnecting from socket %p (reuse %d)", __func__, sock, reuse));
mono_thread_info_install_interrupt (abort_syscall, (gpointer) (gsize) mono_native_thread_id_get (), &interrupted);
#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT) */
gint32
-ves_icall_System_Net_Sockets_Socket_Receive_internal (gsize sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, gint32 *werror, gboolean blocking)
+ves_icall_System_Net_Sockets_Socket_Receive_internal (gsize sock, MonoArrayHandle buffer, gint32 offset, gint32 count, gint32 flags, gint32 *werror, gboolean blocking, MonoError *error)
{
int ret;
- gchar *buf;
gint32 alen;
int recvflags = 0;
gboolean interrupted;
MonoInternalThread* curthread G_GNUC_UNUSED = mono_thread_internal_current ();
+ error_init (error);
*werror = 0;
- alen = mono_array_length (buffer);
+ alen = mono_array_handle_length (buffer);
if (offset > alen - count)
return 0;
- buf = mono_array_addr (buffer, gchar, offset);
-
recvflags = convert_socketflags (flags);
if (recvflags == -1) {
*werror = WSAEOPNOTSUPP;
if (interrupted)
return 0;
+ uint32_t gchandle;
+ gchar *buf = MONO_ARRAY_HANDLE_PIN (buffer, gchar, offset, &gchandle);
+
MONO_ENTER_GC_SAFE;
ret = mono_w32socket_recv (sock, buf, count, recvflags, blocking);
MONO_EXIT_GC_SAFE;
+ mono_gchandle_free (gchandle);
+
if (ret == SOCKET_ERROR)
*werror = mono_w32socket_get_last_error ();
}
gint32
-ves_icall_System_Net_Sockets_Socket_Receive_array_internal (gsize sock, MonoArray *buffers, gint32 flags, gint32 *werror, gboolean blocking)
+ves_icall_System_Net_Sockets_Socket_Receive_array_internal (gsize sock, MonoArrayHandle buffers, gint32 flags, gint32 *werror, gboolean blocking, MonoError *error)
{
int ret, count;
gboolean interrupted;
guint32 recv;
- WSABUF *wsabufs;
guint32 recvflags = 0;
+ error_init (error);
*werror = 0;
- wsabufs = mono_array_addr (buffers, WSABUF, 0);
- count = mono_array_length (buffers);
+ count = mono_array_handle_length (buffers);
recvflags = convert_socketflags (flags);
if (recvflags == -1) {
return 0;
}
+ uint32_t gchandle;
+ WSABUF *wsabufs = MONO_ARRAY_HANDLE_PIN (buffers, WSABUF, 0, &gchandle);
+
MONO_ENTER_GC_SAFE;
ret = mono_w32socket_recvbuffers (sock, wsabufs, count, &recv, &recvflags, NULL, NULL, blocking);
MONO_EXIT_GC_SAFE;
+ mono_gchandle_free (gchandle);
+
if (ret == SOCKET_ERROR)
*werror = mono_w32socket_get_last_error ();
}
gint32
-ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal (gsize sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, MonoObject **sockaddr, gint32 *werror, gboolean blocking)
+ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal (gsize sock, MonoArrayHandle buffer, gint32 offset, gint32 count, gint32 flags, MonoObjectHandle sockaddr, gint32 *werror, gboolean blocking, MonoError *error)
{
- MonoError error;
int ret;
gchar *buf;
gint32 alen;
socklen_t sa_size;
gboolean interrupted;
+ error_init (error);
*werror = 0;
- alen = mono_array_length (buffer);
+ alen = mono_array_handle_length (buffer);
if (offset > alen - count)
return 0;
- sa = create_sockaddr_from_object (*sockaddr, &sa_size, werror, &error);
+ sa = create_sockaddr_from_handle (sockaddr, &sa_size, werror, error);
if (*werror != 0)
return 0;
- if (!mono_error_ok (&error)) {
- mono_error_set_pending_exception (&error);
+ if (!is_ok (error))
return 0;
- }
-
- buf = mono_array_addr (buffer, gchar, offset);
recvflags = convert_socketflags (flags);
if (recvflags == -1) {
return 0;
}
+ uint32_t gchandle;
+ buf = MONO_ARRAY_HANDLE_PIN (buffer, gchar, offset, &gchandle);
+
MONO_ENTER_GC_SAFE;
ret = mono_w32socket_recvfrom (sock, buf, count, recvflags, sa, &sa_size, blocking);
MONO_EXIT_GC_SAFE;
+ mono_gchandle_free (gchandle);
+
if (ret == SOCKET_ERROR)
*werror = mono_w32socket_get_last_error ();
* returned the remote address. All we can do is return null.
*/
if (sa_size) {
- *sockaddr = create_object_from_sockaddr (sa, sa_size, werror, &error);
- if (!mono_error_ok (&error)) {
- mono_error_set_pending_exception (&error);
+ MONO_HANDLE_ASSIGN (sockaddr, create_object_handle_from_sockaddr (sa, sa_size, werror, error));
+ if (!is_ok (error)) {
g_free (sa);
return 0;
}
} else {
- *sockaddr = NULL;
+ MONO_HANDLE_ASSIGN (sockaddr, MONO_HANDLE_NEW (MonoObject, NULL));
}
g_free (sa);
}
gint32
-ves_icall_System_Net_Sockets_Socket_Send_internal (gsize sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, gint32 *werror, gboolean blocking)
+ves_icall_System_Net_Sockets_Socket_Send_internal (gsize sock, MonoArrayHandle buffer, gint32 offset, gint32 count, gint32 flags, gint32 *werror, gboolean blocking, MonoError *error)
{
int ret;
- gchar *buf;
gint32 alen;
int sendflags = 0;
gboolean interrupted;
+ error_init (error);
*werror = 0;
- alen = mono_array_length (buffer);
+ alen = mono_array_handle_length (buffer);
if (offset > alen - count)
return 0;
LOGDEBUG (g_message("%s: alen: %d", __func__, alen));
- buf = mono_array_addr (buffer, gchar, offset);
-
LOGDEBUG (g_message("%s: Sending %d bytes", __func__, count));
sendflags = convert_socketflags (flags);
return 0;
}
+ uint32_t gchandle;
+ gchar *buf = MONO_ARRAY_HANDLE_PIN (buffer, gchar, offset, &gchandle);
+
MONO_ENTER_GC_SAFE;
ret = mono_w32socket_send (sock, buf, count, sendflags, blocking);
MONO_EXIT_GC_SAFE;
+ mono_gchandle_free (gchandle);
+
if (ret == SOCKET_ERROR)
*werror = mono_w32socket_get_last_error ();
}
gint32
-ves_icall_System_Net_Sockets_Socket_Send_array_internal (gsize sock, MonoArray *buffers, gint32 flags, gint32 *werror, gboolean blocking)
+ves_icall_System_Net_Sockets_Socket_Send_array_internal (gsize sock, MonoArrayHandle buffers, gint32 flags, gint32 *werror, gboolean blocking, MonoError *error)
{
int ret, count;
guint32 sent;
- WSABUF *wsabufs;
guint32 sendflags = 0;
gboolean interrupted;
+ error_init (error);
*werror = 0;
- wsabufs = mono_array_addr (buffers, WSABUF, 0);
- count = mono_array_length (buffers);
+ count = mono_array_handle_length (buffers);
sendflags = convert_socketflags (flags);
if (sendflags == -1) {
return 0;
}
+ uint32_t gchandle;
+ WSABUF *wsabufs = MONO_ARRAY_HANDLE_PIN (buffers, WSABUF, 0, &gchandle);
+
MONO_ENTER_GC_SAFE;
ret = mono_w32socket_sendbuffers (sock, wsabufs, count, &sent, sendflags, NULL, NULL, blocking);
MONO_EXIT_GC_SAFE;
+ mono_gchandle_free (gchandle);
+
if (ret == SOCKET_ERROR)
*werror = mono_w32socket_get_last_error ();
}
gint32
-ves_icall_System_Net_Sockets_Socket_SendTo_internal (gsize sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, MonoObject *sockaddr, gint32 *werror, gboolean blocking)
+ves_icall_System_Net_Sockets_Socket_SendTo_internal (gsize sock, MonoArrayHandle buffer, gint32 offset, gint32 count, gint32 flags, MonoObjectHandle sockaddr, gint32 *werror, gboolean blocking, MonoError *error)
{
- MonoError error;
int ret;
- gchar *buf;
gint32 alen;
int sendflags = 0;
struct sockaddr *sa;
*werror = 0;
- alen = mono_array_length (buffer);
+ alen = mono_array_handle_length (buffer);
if (offset > alen - count) {
return 0;
}
- sa = create_sockaddr_from_object(sockaddr, &sa_size, werror, &error);
+ sa = create_sockaddr_from_handle (sockaddr, &sa_size, werror, error);
if (*werror != 0)
return 0;
- if (!mono_error_ok (&error)) {
- mono_error_set_pending_exception (&error);
- return 0;
- }
+ return_val_if_nok (error, 0);
LOGDEBUG (g_message ("%s: alen: %d", __func__, alen));
- buf = mono_array_addr (buffer, gchar, offset);
-
LOGDEBUG (g_message("%s: Sending %d bytes", __func__, count));
sendflags = convert_socketflags (flags);
return 0;
}
+ uint32_t gchandle;
+ gchar *buf = MONO_ARRAY_HANDLE_PIN (buffer, gchar, offset, &gchandle);
+
MONO_ENTER_GC_SAFE;
ret = mono_w32socket_sendto (sock, buf, count, sendflags, sa, sa_size, blocking);
MONO_EXIT_GC_SAFE;
+ mono_gchandle_free (gchandle);
+
if (ret == SOCKET_ERROR)
*werror = mono_w32socket_get_last_error ();
}
static SOCKET
-Socket_to_SOCKET (MonoObject *sockobj)
+Socket_to_SOCKET (MonoObjectHandle sockobj)
{
- MonoSafeHandle *safe_handle;
MonoClassField *field;
- field = mono_class_get_field_from_name (sockobj->vtable->klass, "m_Handle");
- safe_handle = ((MonoSafeHandle *)(*(gpointer *)(((char *)sockobj) + field->offset)));
+ field = mono_class_get_field_from_name (mono_handle_class (sockobj), "m_Handle");
+ MonoSafeHandleHandle safe_handle = MONO_HANDLE_NEW_GET_FIELD(sockobj, MonoSafeHandle, field);
- if (safe_handle == NULL)
+ if (MONO_HANDLE_IS_NULL (safe_handle))
return -1;
- return (SOCKET)safe_handle->handle;
+ return (SOCKET)MONO_HANDLE_GETVAL (safe_handle, handle);
}
#define POLL_ERRORS (MONO_POLLERR | MONO_POLLHUP | MONO_POLLNVAL)
+static gboolean
+collect_pollfds_from_array (MonoArrayHandle sockets, int i, int nfds, mono_pollfd *pfds, int *idx, int *mode)
+{
+ HANDLE_FUNCTION_ENTER ();
+ gboolean result = TRUE;
+ MonoObjectHandle obj = MONO_HANDLE_NEW (MonoObject, NULL);
+ MONO_HANDLE_ARRAY_GETREF (obj, sockets, i);
+ if (MONO_HANDLE_IS_NULL (obj)) {
+ (*mode)++;
+ goto leave;
+ }
+
+ if (*idx >= nfds) {
+ result = FALSE;
+ goto leave;
+ }
+
+ pfds [*idx].fd = Socket_to_SOCKET (obj);
+ pfds [*idx].events = (*mode == 0) ? MONO_POLLIN : (*mode == 1) ? MONO_POLLOUT : POLL_ERRORS;
+ (*idx)++;
+leave:
+ HANDLE_FUNCTION_RETURN_VAL (result);
+}
+
+static void
+set_socks_array_from_pollfds (MonoArrayHandle sockets, int i, mono_pollfd *pfds, int *ret, int *mode, MonoArrayHandle socks, int *idx)
+{
+ HANDLE_FUNCTION_ENTER ();
+ mono_pollfd *pfd;
+
+ MonoObjectHandle obj = MONO_HANDLE_NEW (MonoObject, NULL);
+ MONO_HANDLE_ARRAY_GETREF (obj, sockets, i);
+ if (MONO_HANDLE_IS_NULL (obj)) {
+ (*mode)++;
+ (*idx)++;
+ goto leave;
+ }
+
+ pfd = &pfds [i - *mode];
+ if (pfd->revents == 0)
+ goto leave;
+
+ (*ret)--;
+ if (((*mode == 0 && (pfd->revents & (MONO_POLLIN | POLL_ERRORS)) != 0)) ||
+ ((*mode == 1 && (pfd->revents & (MONO_POLLOUT | POLL_ERRORS)) != 0)) ||
+ ((pfd->revents & POLL_ERRORS) != 0)) {
+ MONO_HANDLE_ARRAY_SETREF (socks, *idx, obj);
+ (*idx)++;
+ }
+leave:
+ HANDLE_FUNCTION_RETURN ();
+}
+
void
-ves_icall_System_Net_Sockets_Socket_Select_internal (MonoArray **sockets, gint32 timeout, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_Select_internal (MonoArrayHandle sockets, gint32 timeout, gint32 *werror, MonoError *error)
{
- MonoError error;
MonoInternalThread *thread = mono_thread_internal_current ();
- MonoObject *obj;
mono_pollfd *pfds;
int nfds, idx;
int ret;
int i, count;
int mode;
MonoClass *sock_arr_class;
- MonoArray *socks;
time_t start;
uintptr_t socks_size;
gboolean interrupted;
+ error_init (error);
*werror = 0;
/* *sockets -> READ, null, WRITE, null, ERROR, null */
- count = mono_array_length (*sockets);
+ count = mono_array_handle_length (sockets);
nfds = count - 3; /* NULL separators */
pfds = g_new0 (mono_pollfd, nfds);
mode = idx = 0;
for (i = 0; i < count; i++) {
- obj = mono_array_get (*sockets, MonoObject *, i);
- if (obj == NULL) {
- mode++;
- continue;
- }
-
- if (idx >= nfds) {
+ if (!collect_pollfds_from_array (sockets, i, nfds, pfds, &idx, &mode)) {
/* The socket array was bogus */
g_free (pfds);
*werror = WSAEFAULT;
return;
}
-
- pfds [idx].fd = Socket_to_SOCKET (obj);
- pfds [idx].events = (mode == 0) ? MONO_POLLIN : (mode == 1) ? MONO_POLLOUT : POLL_ERRORS;
- idx++;
}
timeout = (timeout >= 0) ? (timeout / 1000) : -1;
if (ret == -1 && errno == EINTR) {
if (mono_thread_test_state (thread, ThreadState_AbortRequested)) {
g_free (pfds);
- *sockets = NULL;
+ MONO_HANDLE_ASSIGN (sockets, MONO_HANDLE_NEW (MonoObject, NULL));
return;
}
if (ret == 0) {
g_free (pfds);
- *sockets = NULL;
+ MONO_HANDLE_ASSIGN (sockets, MONO_HANDLE_NEW (MonoObject, NULL));
return;
}
- sock_arr_class = ((MonoObject *)*sockets)->vtable->klass;
+ sock_arr_class = mono_handle_class (sockets);
socks_size = ((uintptr_t)ret) + 3; /* space for the NULL delimiters */
- socks = mono_array_new_full_checked (mono_domain_get (), sock_arr_class, &socks_size, NULL, &error);
- if (!mono_error_ok (&error)) {
- mono_error_set_pending_exception (&error);
+ MonoArrayHandle socks = MONO_HANDLE_NEW (MonoArray, mono_array_new_full_checked (mono_domain_get (), sock_arr_class, &socks_size, NULL, error));
+ if (!is_ok (error)) {
g_free (pfds);
return;
}
mode = idx = 0;
for (i = 0; i < count && ret > 0; i++) {
- mono_pollfd *pfd;
-
- obj = mono_array_get (*sockets, MonoObject *, i);
- if (obj == NULL) {
- mode++;
- idx++;
- continue;
- }
-
- pfd = &pfds [i - mode];
- if (pfd->revents == 0)
- continue;
-
- ret--;
- if (mode == 0 && (pfd->revents & (MONO_POLLIN | POLL_ERRORS)) != 0) {
- mono_array_setref (socks, idx++, obj);
- } else if (mode == 1 && (pfd->revents & (MONO_POLLOUT | POLL_ERRORS)) != 0) {
- mono_array_setref (socks, idx++, obj);
- } else if ((pfd->revents & POLL_ERRORS) != 0) {
- mono_array_setref (socks, idx++, obj);
- }
+ set_socks_array_from_pollfds (sockets, i, pfds, &ret, &mode, socks, &idx);
}
- *sockets = socks;
+ MONO_HANDLE_ASSIGN (sockets, socks);
g_free (pfds);
}
-static MonoObject*
-int_to_object (MonoDomain *domain, int val, MonoError *error)
+static MonoObjectHandle
+int_to_object_handle (MonoDomain *domain, int val, MonoError *error)
{
- return mono_value_box_checked (domain, mono_get_int32_class (), &val, error);
+ return MONO_HANDLE_NEW (MonoObject, mono_value_box_checked (domain, mono_get_int32_class (), &val, error));
}
void
-ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal (gsize sock, gint32 level, gint32 name, MonoObject **obj_val, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal (gsize sock, gint32 level, gint32 name, MonoObjectHandle obj_val, gint32 *werror, MonoError *error)
{
int system_level = 0;
int system_name = 0;
# endif
socklen_t credsize = sizeof (cred);
#endif
- MonoError error;
MonoDomain *domain = mono_domain_get ();
- MonoObject *obj;
MonoClass *obj_class;
MonoClassField *field;
+ error_init (error);
*werror = 0;
#if !defined(SO_EXCLUSIVEADDRUSE) && defined(SO_REUSEADDR)
return;
}
if (ret == -2) {
- *obj_val = int_to_object (domain, 0, &error);
- mono_error_set_pending_exception (&error);
+ MONO_HANDLE_ASSIGN (obj_val, int_to_object_handle (domain, 0, error));
return;
}
}
switch (name) {
- case SocketOptionName_Linger:
+ case SocketOptionName_Linger: {
/* build a System.Net.Sockets.LingerOption */
obj_class = mono_class_load_from_name (get_socket_assembly (),
"System.Net.Sockets",
"LingerOption");
- obj = mono_object_new_checked (domain, obj_class, &error);
- if (!mono_error_ok (&error)) {
- mono_error_set_pending_exception (&error);
- return;
- }
+ MonoObjectHandle obj = MONO_HANDLE_NEW (MonoObject, mono_object_new_checked (domain, obj_class, error));
+ return_if_nok (error);
/* Locate and set the fields "bool enabled" and "int
* lingerTime"
*/
field = mono_class_get_field_from_name(obj_class, "enabled");
- *(guint8 *)(((char *)obj)+field->offset) = linger.l_onoff;
+ MONO_HANDLE_SET_FIELD_VAL (obj, guint8, field, linger.l_onoff);
field = mono_class_get_field_from_name(obj_class, "lingerTime");
- *(guint32 *)(((char *)obj)+field->offset)=linger.l_linger;
+ MONO_HANDLE_SET_FIELD_VAL (obj, guint32, field, linger.l_linger);
+
+ MONO_HANDLE_ASSIGN (obj_val, obj);
break;
- case SocketOptionName_DontLinger:
+ }
+ case SocketOptionName_DontLinger: {
/* construct a bool int in val - true if linger is off */
- obj = int_to_object (domain, !linger.l_onoff, &error);
- mono_error_set_pending_exception (&error);
+ MonoObjectHandle obj = int_to_object_handle (domain, !linger.l_onoff, error);
+ return_if_nok (error);
+
+ MONO_HANDLE_ASSIGN (obj_val, obj);
break;
+ }
case SocketOptionName_SendTimeout:
- case SocketOptionName_ReceiveTimeout:
- obj = int_to_object (domain, time_ms, &error);
- mono_error_set_pending_exception (&error);
+ case SocketOptionName_ReceiveTimeout: {
+ MonoObjectHandle obj = int_to_object_handle (domain, time_ms, error);
+ return_if_nok (error);
+
+ MONO_HANDLE_ASSIGN (obj_val, obj);
break;
+ }
#ifdef SO_PEERCRED
case SocketOptionName_PeerCred: {
* possible
*/
static MonoImage *mono_posix_image = NULL;
- MonoPeerCredData *cred_data;
if (mono_posix_image == NULL) {
mono_posix_image = mono_image_loaded ("Mono.Posix");
obj_class = mono_class_load_from_name (mono_posix_image,
"Mono.Posix",
"PeerCredData");
- obj = mono_object_new_checked (domain, obj_class, &error);
- if (!mono_error_ok (&error)) {
- mono_error_set_pending_exception (&error);
- return;
- }
- cred_data = (MonoPeerCredData *)obj;
- cred_data->pid = cred.pid;
- cred_data->uid = cred.uid;
- cred_data->gid = cred.gid;
+ MonoPeerCredDataHandle cred_data = MONO_HANDLE_NEW (MonoPeerCredData, mono_object_new_checked (domain, obj_class, error));
+ return_if_nok (error);
+
+ MONO_HANDLE_SETVAL (cred_data, pid, gint, cred.pid);
+ MONO_HANDLE_SETVAL (cred_data, uid, gint, cred.uid);
+ MONO_HANDLE_SETVAL (cred_data, gid, gint, cred.gid);
+
+ MONO_HANDLE_ASSIGN (obj_val, cred_data);
break;
}
#endif
- default:
+ default: {
#if !defined(SO_EXCLUSIVEADDRUSE) && defined(SO_REUSEADDR)
if (level == SocketOptionLevel_Socket && name == SocketOptionName_ExclusiveAddressUse)
val = val ? 0 : 1;
#endif
- obj = int_to_object (domain, val, &error);
- mono_error_set_pending_exception (&error);
- }
+ MonoObjectHandle obj = int_to_object_handle (domain, val, error);
+ return_if_nok (error);
- *obj_val = obj;
+ MONO_HANDLE_ASSIGN (obj_val, obj);
+ }
+ }
}
void
-ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal (gsize sock, gint32 level, gint32 name, MonoArray **byte_val, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal (gsize sock, gint32 level, gint32 name, MonoArrayHandle byte_val, gint32 *werror, MonoError *error)
{
int system_level = 0;
int system_name = 0;
int ret;
- guchar *buf;
socklen_t valsize;
+ error_init (error);
*werror = 0;
ret = convert_sockopt_level_and_name((MonoSocketOptionLevel)level, (MonoSocketOptionName)name, &system_level,
if (ret == -2)
return;
- valsize = mono_array_length (*byte_val);
- buf = mono_array_addr (*byte_val, guchar, 0);
+ valsize = mono_array_handle_length (byte_val);
+
+ uint32_t gchandle;
+ guchar *buf = MONO_ARRAY_HANDLE_PIN (byte_val, guchar, 0, &gchandle);
MONO_ENTER_GC_SAFE;
MONO_EXIT_GC_SAFE;
+ mono_gchandle_free (gchandle);
+
if (ret == SOCKET_ERROR)
*werror = mono_w32socket_get_last_error ();
}
#if defined(HAVE_STRUCT_IP_MREQN) || defined(HAVE_STRUCT_IP_MREQ)
static struct in_addr
-ipaddress_to_struct_in_addr (MonoObject *ipaddr)
+ipaddress_handle_to_struct_in_addr (MonoObjectHandle ipaddr)
{
struct in_addr inaddr;
MonoClassField *field;
- field = mono_class_get_field_from_name (ipaddr->vtable->klass, "m_Address");
+ field = mono_class_get_field_from_name (mono_handle_class (ipaddr), "m_Address");
+ g_assert (field);
/* No idea why .net uses a 64bit type to hold a 32bit value...
*
* Internal value of IPAddess is in little-endian order
*/
- inaddr.s_addr = GUINT_FROM_LE ((guint32)*(guint64 *)(((char *)ipaddr) + field->offset));
+ inaddr.s_addr = GUINT_FROM_LE ((guint32)MONO_HANDLE_GET_FIELD_VAL (ipaddr, guint64, field));
return inaddr;
}
#ifdef HAVE_STRUCT_SOCKADDR_IN6
static struct in6_addr
-ipaddress_to_struct_in6_addr (MonoObject *ipaddr)
+ipaddress_handle_to_struct_in6_addr (MonoObjectHandle ipaddr)
{
struct in6_addr in6addr;
MonoClassField *field;
- MonoArray *data;
int i;
- field = mono_class_get_field_from_name (ipaddr->vtable->klass, "m_Numbers");
+ field = mono_class_get_field_from_name (mono_handle_class (ipaddr), "m_Numbers");
g_assert (field);
- data = *(MonoArray **)(((char *)ipaddr) + field->offset);
+ MonoArrayHandle data = MONO_HANDLE_NEW_GET_FIELD (ipaddr, MonoArray, field);
for (i = 0; i < 8; i++) {
- const guint16 s = GUINT16_TO_BE (mono_array_get (data, guint16, i));
+ guint16 v;
+ MONO_HANDLE_ARRAY_GETVAL (v, data, guint16, i);
+ const guint16 s = GUINT16_TO_BE (v);
/* Solaris/MacOS have only the 8 bit version. */
#ifndef s6_addr16
#endif /* defined(__APPLE__) || defined(__FreeBSD__) */
void
-ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal (gsize sock, gint32 level, gint32 name, MonoObject *obj_val, MonoArray *byte_val, gint32 int_val, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal (gsize sock, gint32 level, gint32 name, MonoObjectHandle obj_val, MonoArrayHandle byte_val, gint32 int_val, gint32 *werror, MonoError *error)
{
struct linger linger;
int system_level = 0;
int sol_ip;
int sol_ipv6;
+ error_init (error);
*werror = 0;
sol_ipv6 = mono_networking_get_ipv6_protocol ();
return;
/* Only one of obj_val, byte_val or int_val has data */
- if (obj_val) {
+ if (!MONO_HANDLE_IS_NULL (obj_val)) {
+ MonoClass *obj_class = mono_handle_class (obj_val);
MonoClassField *field;
int valsize;
/* Dig out "bool enabled" and "int lingerTime"
* fields
*/
- field = mono_class_get_field_from_name (obj_val->vtable->klass, "enabled");
- linger.l_onoff = *(guint8 *)(((char *)obj_val) + field->offset);
- field = mono_class_get_field_from_name (obj_val->vtable->klass, "lingerTime");
- linger.l_linger = *(guint32 *)(((char *)obj_val) + field->offset);
+ field = mono_class_get_field_from_name (obj_class, "enabled");
+ linger.l_onoff = MONO_HANDLE_GET_FIELD_VAL (obj_val, guint8, field);
+ field = mono_class_get_field_from_name (obj_class, "lingerTime");
+ linger.l_linger = MONO_HANDLE_GET_FIELD_VAL (obj_val, guint32, field);
valsize = sizeof (linger);
ret = mono_w32socket_setsockopt (sock, system_level, system_name, &linger, valsize);
case SocketOptionName_DropMembership:
#if defined(HAVE_STRUCT_IP_MREQN) || defined(HAVE_STRUCT_IP_MREQ)
{
- MonoObject *address = NULL;
+ MonoObjectHandle address = MONO_HANDLE_NEW (MonoObject, NULL);
#ifdef HAVE_STRUCT_SOCKADDR_IN6
if (system_level == sol_ipv6) {
struct ipv6_mreq mreq6;
/*
* Get group address
*/
- field = mono_class_get_field_from_name (obj_val->vtable->klass, "m_Group");
+ field = mono_class_get_field_from_name (obj_class, "m_Group");
g_assert (field);
- address = *(MonoObject **)(((char *)obj_val) + field->offset);
+ MONO_HANDLE_ASSIGN (address, MONO_HANDLE_NEW_GET_FIELD (obj_val, MonoObject, field));
- if (address)
- mreq6.ipv6mr_multiaddr = ipaddress_to_struct_in6_addr (address);
+ if (!MONO_HANDLE_IS_NULL (address))
+ mreq6.ipv6mr_multiaddr = ipaddress_handle_to_struct_in6_addr (address);
- field = mono_class_get_field_from_name (obj_val->vtable->klass, "m_Interface");
- mreq6.ipv6mr_interface = *(guint64 *)(((char *)obj_val) + field->offset);
+ field = mono_class_get_field_from_name (obj_class, "m_Interface");
+ mreq6.ipv6mr_interface = MONO_HANDLE_GET_FIELD_VAL (obj_val, guint64, field);
#if defined(__APPLE__) || defined(__FreeBSD__)
/*
* members, so I have to dig the value out of
* those :-(
*/
- field = mono_class_get_field_from_name (obj_val->vtable->klass, "group");
- address = *(MonoObject **)(((char *)obj_val) + field->offset);
+ field = mono_class_get_field_from_name (obj_class, "group");
+ MONO_HANDLE_ASSIGN (address, MONO_HANDLE_NEW_GET_FIELD (obj_val, MonoObject, field));
/* address might not be defined and if so, set the address to ADDR_ANY.
*/
- if (address)
- mreq.imr_multiaddr = ipaddress_to_struct_in_addr (address);
+ if (!MONO_HANDLE_IS_NULL (address))
+ mreq.imr_multiaddr = ipaddress_handle_to_struct_in_addr (address);
- field = mono_class_get_field_from_name (obj_val->vtable->klass, "localAddress");
- address = *(MonoObject **)(((char *)obj_val) + field->offset);
+ field = mono_class_get_field_from_name (obj_class, "localAddress");
+ MONO_HANDLE_ASSIGN (address, MONO_HANDLE_NEW_GET_FIELD (obj_val, MonoObject, field));
#ifdef HAVE_STRUCT_IP_MREQN
- if (address)
- mreq.imr_address = ipaddress_to_struct_in_addr (address);
+ if (!MONO_HANDLE_IS_NULL (address))
+ mreq.imr_address = ipaddress_handle_to_struct_in_addr (address);
- field = mono_class_get_field_from_name (obj_val->vtable->klass, "ifIndex");
- mreq.imr_ifindex = *(gint32 *)(((char *)obj_val) + field->offset);
+ field = mono_class_get_field_from_name (obj_class, "ifIndex");
+ mreq.imr_ifindex = MONO_HANDLE_GET_FIELD_VAL (obj_val, gint32, field);
#else
- if (address)
- mreq.imr_interface = ipaddress_to_struct_in_addr (address);
+ if (!MONO_HANDLE_IS_NULL (address))
+ mreq.imr_interface = ipaddress_handle_to_struct_in_addr (address);
#endif /* HAVE_STRUCT_IP_MREQN */
ret = mono_w32socket_setsockopt (sock, system_level, system_name, &mreq, sizeof (mreq));
*werror = WSAEINVAL;
return;
}
- } else if (byte_val!=NULL) {
- int valsize = mono_array_length (byte_val);
- guchar *buf = mono_array_addr (byte_val, guchar, 0);
+ } else if (!MONO_HANDLE_IS_NULL (byte_val)) {
+ int valsize = mono_array_handle_length (byte_val);
+ uint32_t gchandle;
+ guchar *buf = MONO_ARRAY_HANDLE_PIN (byte_val, guchar, 0, &gchandle);
switch(name) {
case SocketOptionName_DontLinger:
ret = mono_w32socket_setsockopt (sock, system_level, system_name, buf, valsize);
break;
}
+ mono_gchandle_free (gchandle);
} else {
/* ReceiveTimeout/SendTimeout get here */
switch (name) {
}
void
-ves_icall_System_Net_Sockets_Socket_Shutdown_internal (gsize sock, gint32 how, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_Shutdown_internal (gsize sock, gint32 how, gint32 *werror, MonoError *error)
{
int ret;
gboolean interrupted;
+ error_init (error);
*werror = 0;
mono_thread_info_install_interrupt (abort_syscall, (gpointer) (gsize) mono_native_thread_id_get (), &interrupted);
}
gint
-ves_icall_System_Net_Sockets_Socket_IOControl_internal (gsize sock, gint32 code, MonoArray *input, MonoArray *output, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_IOControl_internal (gsize sock, gint32 code, MonoArrayHandle input, MonoArrayHandle output, gint32 *werror, MonoError *error)
{
glong output_bytes = 0;
gchar *i_buffer, *o_buffer;
gint i_len, o_len;
+ uint32_t i_gchandle, o_gchandle;
gint ret;
+ error_init (error);
*werror = 0;
if ((guint32)code == FIONBIO)
/* Invalid command. Must use Socket.Blocking */
return -1;
- if (input == NULL) {
+ if (MONO_HANDLE_IS_NULL (input)) {
i_buffer = NULL;
i_len = 0;
+ i_gchandle = 0;
} else {
- i_buffer = mono_array_addr (input, gchar, 0);
- i_len = mono_array_length (input);
+ i_len = mono_array_handle_length (input);
+ i_buffer = MONO_ARRAY_HANDLE_PIN (input, gchar, 0, &i_gchandle);
}
- if (output == NULL) {
+ if (MONO_HANDLE_IS_NULL (output)) {
o_buffer = NULL;
o_len = 0;
+ o_gchandle = 0;
} else {
- o_buffer = mono_array_addr (output, gchar, 0);
- o_len = mono_array_length (output);
+ o_len = mono_array_handle_length (output);
+ o_buffer = MONO_ARRAY_HANDLE_PIN (output, gchar, 0, &o_gchandle);
}
MONO_ENTER_GC_SAFE;
MONO_EXIT_GC_SAFE;
+ if (i_gchandle)
+ mono_gchandle_free (i_gchandle);
+ if (o_gchandle)
+ mono_gchandle_free (o_gchandle);
+
if (ret == SOCKET_ERROR) {
*werror = mono_w32socket_get_last_error ();
return -1;
#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT)
gboolean
-ves_icall_System_Net_Sockets_Socket_SendFile_internal (gsize sock, MonoString *filename, MonoArray *pre_buffer, MonoArray *post_buffer, gint flags, gint32 *werror, gboolean blocking)
+ves_icall_System_Net_Sockets_Socket_SendFile_internal (gsize sock, MonoStringHandle filename, MonoArrayHandle pre_buffer, MonoArrayHandle post_buffer, gint flags, gint32 *werror, gboolean blocking, MonoError *error)
{
HANDLE file;
gboolean ret;
gboolean interrupted;
TRANSMIT_FILE_BUFFERS buffers;
+ uint32_t pre_buffer_gchandle = 0;
+ uint32_t post_buffer_gchandle = 0;
+ error_init (error);
*werror = 0;
- if (filename == NULL)
+ if (MONO_HANDLE_IS_NULL (filename))
return FALSE;
/* FIXME: replace file by a proper fd that we can call open and close on, as they are interruptible */
- file = mono_w32file_create (mono_string_chars (filename), GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, 0);
+ uint32_t filename_gchandle;
+ gunichar2 *filename_chars = mono_string_handle_pin_chars (filename, &filename_gchandle);
+ file = mono_w32file_create (filename_chars, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, 0);
+ mono_gchandle_free (filename_gchandle);
if (file == INVALID_HANDLE_VALUE) {
*werror = mono_w32error_get_last ();
return FALSE;
}
- memset (&buffers, 0, sizeof (buffers));
- if (pre_buffer != NULL) {
- buffers.Head = mono_array_addr (pre_buffer, guchar, 0);
- buffers.HeadLength = mono_array_length (pre_buffer);
- }
- if (post_buffer != NULL) {
- buffers.Tail = mono_array_addr (post_buffer, guchar, 0);
- buffers.TailLength = mono_array_length (post_buffer);
- }
-
mono_thread_info_install_interrupt (abort_syscall, (gpointer) (gsize) mono_native_thread_id_get (), &interrupted);
if (interrupted) {
mono_w32file_close (file);
return FALSE;
}
+
+ memset (&buffers, 0, sizeof (buffers));
+ if (!MONO_HANDLE_IS_NULL (pre_buffer)) {
+ buffers.Head = MONO_ARRAY_HANDLE_PIN (pre_buffer, guchar, 0, &pre_buffer_gchandle);
+ buffers.HeadLength = mono_array_handle_length (pre_buffer);
+ }
+ if (!MONO_HANDLE_IS_NULL (post_buffer)) {
+ buffers.Tail = MONO_ARRAY_HANDLE_PIN (post_buffer, guchar, 0, &post_buffer_gchandle);
+ buffers.TailLength = mono_array_handle_length (post_buffer);
+ }
+
MONO_ENTER_GC_SAFE;
ret = mono_w32socket_transmit_file (sock, file, &buffers, flags, blocking);
MONO_EXIT_GC_SAFE;
+ if (pre_buffer_gchandle)
+ mono_gchandle_free (pre_buffer_gchandle);
+ if (post_buffer_gchandle)
+ mono_gchandle_free (post_buffer_gchandle);
+
if (!ret)
*werror = mono_w32socket_get_last_error ();
}
void
-icall_cancel_blocking_socket_operation (MonoThread *thread)
+icall_cancel_blocking_socket_operation (MonoThreadObjectHandle thread, MonoError *error)
{
- MonoInternalThread *internal;
-
- internal = thread->internal_thread;
- g_assert (internal);
+ error_init (error);
+ MonoInternalThreadHandle internal = MONO_HANDLE_NEW_GET (MonoInternalThread, thread, internal_thread);
+ g_assert (!MONO_HANDLE_IS_NULL (internal));
- mono_thread_info_abort_socket_syscall_for_close (MONO_UINT_TO_NATIVE_THREAD_ID (internal->tid));
+ guint64 tid = mono_internal_thread_handle_ptr (internal)->tid;
+ mono_thread_info_abort_socket_syscall_for_close (MONO_UINT_TO_NATIVE_THREAD_ID (tid));
}
#endif /* #ifndef DISABLE_SOCKETS */
gint gid;
} MonoPeerCredData;
+/* Safely access Mono.Posix.PeerCredData from native code */
+TYPED_HANDLE_DECL (MonoPeerCredData);
+
gpointer
-ves_icall_System_Net_Sockets_Socket_Socket_internal (MonoObject *this_obj, gint32 family, gint32 type, gint32 proto,
- gint32 *error);
+ves_icall_System_Net_Sockets_Socket_Socket_internal (MonoObjectHandle this_obj, gint32 family, gint32 type,
+ gint32 proto, gint32 *werror, MonoError *error);
void
-ves_icall_System_Net_Sockets_Socket_Close_internal (gsize sock, gint32 *error);
+ves_icall_System_Net_Sockets_Socket_Close_internal (gsize sock, gint32 *werror, MonoError *error);
gint32
ves_icall_System_Net_Sockets_SocketException_WSAGetLastError_internal (void);
gint32
-ves_icall_System_Net_Sockets_Socket_Available_internal (gsize sock, gint32 *error);
+ves_icall_System_Net_Sockets_Socket_Available_internal (gsize sock, gint32 *werror, MonoError *error);
void
-ves_icall_System_Net_Sockets_Socket_Blocking_internal (gsize sock, gboolean block, gint32 *error);
+ves_icall_System_Net_Sockets_Socket_Blocking_internal (gsize sock, gboolean block, gint32 *werror, MonoError *error);
gpointer
-ves_icall_System_Net_Sockets_Socket_Accept_internal (gsize sock, gint32 *error, gboolean blocking);
+ves_icall_System_Net_Sockets_Socket_Accept_internal (gsize sock, gint32 *werror, gboolean blocking, MonoError *error);
void
-ves_icall_System_Net_Sockets_Socket_Listen_internal (gsize sock, guint32 backlog, gint32 *error);
+ves_icall_System_Net_Sockets_Socket_Listen_internal (gsize sock, guint32 backlog, gint32 *werror, MonoError *error);
-MonoObject*
-ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal (gsize sock, gint32 af, gint32 *error);
+MonoObjectHandle
+ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal (gsize sock, gint32 af, gint32 *werror, MonoError *error);
-MonoObject*
-ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal (gsize sock, gint32 af, gint32 *error);
+MonoObjectHandle
+ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal (gsize sock, gint32 af, gint32 *werror, MonoError *error);
void
-ves_icall_System_Net_Sockets_Socket_Bind_internal (gsize sock, MonoObject *sockaddr, gint32 *error);
+ves_icall_System_Net_Sockets_Socket_Bind_internal (gsize sock, MonoObjectHandle sockaddr, gint32 *werror, MonoError *error);
void
-ves_icall_System_Net_Sockets_Socket_Connect_internal (gsize sock, MonoObject *sockaddr, gint32 *error, gboolean blocking);
+ves_icall_System_Net_Sockets_Socket_Connect_internal (gsize sock, MonoObjectHandle sockaddr, gint32 *werror, gboolean blocking, MonoError *error);
gint32
-ves_icall_System_Net_Sockets_Socket_Receive_internal (gsize sock, MonoArray *buffer, gint32 offset, gint32 count,
- gint32 flags, gint32 *error, gboolean blocking);
+ves_icall_System_Net_Sockets_Socket_Receive_internal (gsize sock, MonoArrayHandle buffer, gint32 offset, gint32 count,
+ gint32 flags, gint32 *werror, gboolean blocking, MonoError *error);
gint32
-ves_icall_System_Net_Sockets_Socket_Receive_array_internal (gsize sock, MonoArray *buffers, gint32 flags, gint32 *error,
- gboolean blocking);
+ves_icall_System_Net_Sockets_Socket_Receive_array_internal (gsize sock, MonoArrayHandle buffers, gint32 flags,
+ gint32 *werror, gboolean blocking, MonoError *error);
+
+/* gint32 */
+/* ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal (gsize sock, MonoArray *buffer, gint32 offset, gint32 count, */
+/* gint32 flags, MonoObject **sockaddr, gint32 *werror, gboolean blocking); */
gint32
-ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal (gsize sock, MonoArray *buffer, gint32 offset, gint32 count,
- gint32 flags, MonoObject **sockaddr, gint32 *error, gboolean blocking);
+ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal (gsize sock, MonoArrayHandle buffer, gint32 offset, gint32 count,
+ gint32 flags, MonoObjectHandle sockaddr, gint32 *werror, gboolean blocking, MonoError *error);
+
gint32
-ves_icall_System_Net_Sockets_Socket_Send_internal (gsize sock, MonoArray *buffer, gint32 offset, gint32 count,
- gint32 flags, gint32 *error, gboolean blocking);
+ves_icall_System_Net_Sockets_Socket_Send_internal (gsize sock, MonoArrayHandle buffer, gint32 offset, gint32 count,
+ gint32 flags, gint32 *werror, gboolean blocking, MonoError *error);
gint32
-ves_icall_System_Net_Sockets_Socket_Send_array_internal (gsize sock, MonoArray *buffers, gint32 flags, gint32 *error,
- gboolean blocking);
+ves_icall_System_Net_Sockets_Socket_Send_array_internal (gsize sock, MonoArrayHandle buffers, gint32 flags,
+ gint32 *werror, gboolean blocking, MonoError *error);
gint32
-ves_icall_System_Net_Sockets_Socket_SendTo_internal (gsize sock, MonoArray *buffer, gint32 offset, gint32 count,
- gint32 flags, MonoObject *sockaddr, gint32 *error, gboolean blocking);
+ves_icall_System_Net_Sockets_Socket_SendTo_internal (gsize sock, MonoArrayHandle buffer, gint32 offset, gint32 count,
+ gint32 flags, MonoObjectHandle sockaddr, gint32 *werror,
+ gboolean blocking, MonoError *error);
void
-ves_icall_System_Net_Sockets_Socket_Select_internal (MonoArray **sockets, gint32 timeout, gint32 *error);
+ves_icall_System_Net_Sockets_Socket_Select_internal (MonoArrayHandle sockets, gint32 timeout, gint32 *werror, MonoError *error);
void
-ves_icall_System_Net_Sockets_Socket_Shutdown_internal (gsize sock, gint32 how, gint32 *error);
+ves_icall_System_Net_Sockets_Socket_Shutdown_internal (gsize sock, gint32 how, gint32 *werror, MonoError *error);
void
ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal (gsize sock, gint32 level, gint32 name,
- MonoObject **obj_val, gint32 *error);
+ MonoObjectHandle obj_val, gint32 *werror,
+ MonoError *error);
void
ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal (gsize sock, gint32 level, gint32 name,
- MonoArray **byte_val, gint32 *error);
+ MonoArrayHandle byte_val, gint32 *werror,
+ MonoError *error);
void
ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal (gsize sock, gint32 level, gint32 name,
- MonoObject *obj_val, MonoArray *byte_val, gint32 int_val, gint32 *error);
+ MonoObjectHandle obj_val, MonoArrayHandle byte_val,
+ gint32 int_val, gint32 *werror, MonoError *error);
int
-ves_icall_System_Net_Sockets_Socket_IOControl_internal (gsize sock, gint32 code, MonoArray *input, MonoArray *output,
- gint32 *error);
+ves_icall_System_Net_Sockets_Socket_IOControl_internal (gsize sock, gint32 code,
+ MonoArrayHandle input, MonoArrayHandle output,
+ gint32 *werror, MonoError *error);
MonoBoolean
ves_icall_System_Net_Dns_GetHostByName_internal (MonoStringHandle host, MonoStringHandleOut h_name,
ves_icall_System_Net_Dns_GetHostName_internal (MonoStringHandleOut h_name, MonoError *error);
MonoBoolean
-ves_icall_System_Net_Sockets_Socket_Poll_internal (gsize sock, gint mode, gint timeout, gint32 *error);
+ves_icall_System_Net_Sockets_Socket_Poll_internal (gsize sock, gint mode, gint timeout, gint32 *werror, MonoError *error);
void
-ves_icall_System_Net_Sockets_Socket_Disconnect_internal (gsize sock, MonoBoolean reuse, gint32 *error);
+ves_icall_System_Net_Sockets_Socket_Disconnect_internal (gsize sock, MonoBoolean reuse, gint32 *werror, MonoError *error);
gboolean
-ves_icall_System_Net_Sockets_Socket_SendFile_internal (gsize sock, MonoString *filename, MonoArray *pre_buffer,
- MonoArray *post_buffer, gint flags, gint32 *error, gboolean blocking);
+ves_icall_System_Net_Sockets_Socket_SendFile_internal (gsize sock, MonoStringHandle filename,
+ MonoArrayHandle pre_buffer, MonoArrayHandle post_buffer,
+ gint flags, gint32 *werror, gboolean blocking, MonoError *error);
void
-icall_cancel_blocking_socket_operation (MonoThread *thread);
+icall_cancel_blocking_socket_operation (MonoThreadObjectHandle thread, MonoError *error);
gboolean
-ves_icall_System_Net_Sockets_Socket_SupportPortReuse (MonoProtocolType proto);
+ves_icall_System_Net_Sockets_Socket_SupportPortReuse (MonoProtocolType proto, MonoError *error);
void
mono_network_init(void);
static
gboolean mono_aot_mode_is_full (MonoAotOptions *opts)
{
- return opts->mode == MONO_AOT_MODE_FULL;
+ return opts->mode == MONO_AOT_MODE_FULL || opts->mode == MONO_AOT_MODE_INTERP;
+}
+
+static
+gboolean mono_aot_mode_is_interp (MonoAotOptions *opts)
+{
+ return opts->mode == MONO_AOT_MODE_INTERP;
}
static
#endif /* #ifdef MONO_ARCH_HAVE_FULL_AOT_TRAMPOLINES */
+ if (mono_aot_mode_is_interp (&acfg->aot_opts)) {
+ mono_arch_get_enter_icall_trampoline (&info);
+ emit_trampoline (acfg, acfg->got_offset, info);
+ }
+
/* Emit trampolines which are numerous */
/*
opts->mode = MONO_AOT_MODE_FULL;
} else if (str_begins_with (arg, "hybrid")) {
opts->mode = MONO_AOT_MODE_HYBRID;
+ } else if (str_begins_with (arg, "interp")) {
+ opts->mode = MONO_AOT_MODE_INTERP;
} else if (str_begins_with (arg, "threads=")) {
opts->nthreads = atoi (arg + strlen ("threads="));
} else if (str_begins_with (arg, "static")) {
}
}
- {
+ if (!mono_aot_mode_is_interp (&acfg->aot_opts)) {
int method_index;
for (method_index = 0; method_index < acfg->image->tables [MONO_TABLE_METHOD].rows; ++method_index) {
if (mono_aot_mode_is_full (&acfg->aot_opts) || mono_aot_mode_is_hybrid (&acfg->aot_opts))
mono_set_partial_sharing_supported (TRUE);
- res = collect_methods (acfg);
- if (!res)
- return 1;
+ if (!mono_aot_mode_is_interp (&acfg->aot_opts)) {
+ res = collect_methods (acfg);
+
+ if (!res)
+ return 1;
+ }
{
GList *l;
}
#endif
+ if (mono_aot_mode_is_interp (&acfg->aot_opts)) {
+ MonoMethod *wrapper;
+ MonoMethodSignature *sig;
+
+ /* object object:interp_in_static (object,intptr,intptr,intptr) */
+ sig = mono_create_icall_signature ("object object ptr ptr ptr");
+ wrapper = mini_get_interp_in_wrapper (sig);
+ add_method (acfg, wrapper);
+
+ /* int object:interp_in_static (intptr,int,intptr) */
+ sig = mono_create_icall_signature ("int32 ptr int32 ptr");
+ wrapper = mini_get_interp_in_wrapper (sig);
+ add_method (acfg, wrapper);
+
+ /* void object:interp_in_static (object,intptr,intptr,intptr) */
+ sig = mono_create_icall_signature ("void object ptr ptr ptr");
+ wrapper = mini_get_interp_in_wrapper (sig);
+ add_method (acfg, wrapper);
+ }
+
TV_GETTIME (atv);
compile_methods (acfg);
ref->method = mono_marshal_get_gsharedvt_in_wrapper ();
} else if (subtype == WRAPPER_SUBTYPE_GSHAREDVT_OUT) {
ref->method = mono_marshal_get_gsharedvt_out_wrapper ();
+ } else if (subtype == WRAPPER_SUBTYPE_INTERP_IN) {
+ ref->method = mini_get_interp_in_wrapper (target->signature);
} else if (subtype == WRAPPER_SUBTYPE_GSHAREDVT_IN_SIG) {
MonoMethodSignature *sig = decode_signature (module, p, &p);
if (!sig)
}
}
if (!sofile) {
- if (mono_aot_only && assembly->image->tables [MONO_TABLE_METHOD].rows) {
+ if (mono_aot_only && !mono_use_interpreter && assembly->image->tables [MONO_TABLE_METHOD].rows) {
aot_name = g_strdup_printf ("%s%s", assembly->image->name, MONO_SOLIB_EXT);
g_error ("Failed to load AOT module '%s' in aot-only mode.\n", aot_name);
g_free (aot_name);
}
if (!usable) {
- if (mono_aot_only) {
+ if (mono_aot_only && !mono_use_interpreter) {
g_error ("Failed to load AOT module '%s' while running in aot-only mode: %s.\n", found_aot_name, msg);
} else {
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT: module %s is unusable: %s.", found_aot_name, msg);
mono_set_generic_sharing_vt_supported (TRUE);
mono_set_partial_sharing_supported (TRUE);
}
+ if (mono_aot_mode == MONO_AOT_MODE_INTERP) {
+ mono_aot_only = TRUE;
+ mono_use_interpreter = TRUE;
+ }
}
/**
g_assert (!frame->runtime_method);
if (!mono_interp_enter_icall_trampoline) {
- MonoTrampInfo *info;
- mono_interp_enter_icall_trampoline = mono_arch_get_enter_icall_trampoline (&info);
- // TODO:
- // mono_tramp_info_register (info, NULL);
+ if (mono_aot_only) {
+ mono_interp_enter_icall_trampoline = mono_aot_get_trampoline ("enter_icall_trampoline");
+ } else {
+ MonoTrampInfo *info;
+ mono_interp_enter_icall_trampoline = mono_arch_get_enter_icall_trampoline (&info);
+ // TODO:
+ // mono_tramp_info_register (info, NULL);
+ }
}
InterpMethodArguments *margs = build_args_from_sig (sig, frame);
return sp;
}
+static stackval *
+do_jit_call (stackval *sp, unsigned char *vt_sp, ThreadContext *context, MonoInvocation *frame, RuntimeMethod *rmethod)
+{
+ MonoMethodSignature *sig;
+ MonoFtnDesc ftndesc;
+ guint8 res_buf [256];
+ MonoType *type;
+ MonoLMFExt ext;
+
+ //printf ("%s\n", mono_method_full_name (rmethod->method, 1));
+
+ /*
+ * Call JITted code through a gsharedvt_out wrapper. These wrappers receive every argument
+ * by ref and return a return value using an explicit return value argument.
+ */
+ if (!rmethod->jit_wrapper) {
+ MonoMethod *method = rmethod->method;
+ MonoError error;
+
+ sig = mono_method_signature (method);
+ g_assert (sig);
+
+ MonoMethod *wrapper = mini_get_gsharedvt_out_sig_wrapper (sig);
+ //printf ("J: %s %s\n", mono_method_full_name (method, 1), mono_method_full_name (wrapper, 1));
+
+ gpointer jit_wrapper = mono_jit_compile_method_jit_only (wrapper, &error);
+ mono_error_assert_ok (&error);
+
+ gpointer addr = mono_jit_compile_method_jit_only (method, &error);
+ g_assert (addr);
+ mono_error_assert_ok (&error);
+
+ rmethod->jit_addr = addr;
+ rmethod->jit_sig = sig;
+ mono_memory_barrier ();
+ rmethod->jit_wrapper = jit_wrapper;
+
+ } else {
+ sig = rmethod->jit_sig;
+ }
+
+ sp -= sig->param_count;
+ if (sig->hasthis)
+ --sp;
+
+ ftndesc.addr = rmethod->jit_addr;
+ ftndesc.arg = NULL;
+
+ // FIXME: Optimize this
+
+ gpointer args [32];
+ int pindex = 0;
+ int stack_index = 0;
+ if (rmethod->hasthis) {
+ args [pindex ++] = sp [0].data.p;
+ stack_index ++;
+ }
+ type = rmethod->rtype;
+ if (type->type != MONO_TYPE_VOID) {
+ if (MONO_TYPE_ISSTRUCT (type))
+ args [pindex ++] = vt_sp;
+ else
+ args [pindex ++] = res_buf;
+ }
+ for (int i = 0; i < rmethod->param_count; ++i) {
+ MonoType *t = rmethod->param_types [i];
+ stackval *sval = &sp [stack_index + i];
+ if (sig->params [i]->byref) {
+ args [pindex ++] = sval->data.p;
+ } else if (MONO_TYPE_ISSTRUCT (t)) {
+ args [pindex ++] = sval->data.p;
+ } else if (MONO_TYPE_IS_REFERENCE (t)) {
+ args [pindex ++] = &sval->data.p;
+ } else {
+ switch (t->type) {
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_VALUETYPE:
+ args [pindex ++] = &sval->data.i;
+ break;
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_FNPTR:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_OBJECT:
+ args [pindex ++] = &sval->data.p;
+ break;
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ args [pindex ++] = &sval->data.l;
+ break;
+ default:
+ printf ("%s\n", mono_type_full_name (t));
+ g_assert_not_reached ();
+ }
+ }
+ }
+
+ interp_push_lmf (&ext, frame);
+
+ switch (pindex) {
+ case 0: {
+ void (*func)(gpointer) = rmethod->jit_wrapper;
+
+ func (&ftndesc);
+ break;
+ }
+ case 1: {
+ void (*func)(gpointer, gpointer) = rmethod->jit_wrapper;
+
+ func (args [0], &ftndesc);
+ break;
+ }
+ case 2: {
+ void (*func)(gpointer, gpointer, gpointer) = rmethod->jit_wrapper;
+
+ func (args [0], args [1], &ftndesc);
+ break;
+ }
+ case 3: {
+ void (*func)(gpointer, gpointer, gpointer, gpointer) = rmethod->jit_wrapper;
+
+ func (args [0], args [1], args [2], &ftndesc);
+ break;
+ }
+ case 4: {
+ void (*func)(gpointer, gpointer, gpointer, gpointer, gpointer) = rmethod->jit_wrapper;
+
+ func (args [0], args [1], args [2], args [3], &ftndesc);
+ break;
+ }
+ case 5: {
+ void (*func)(gpointer, gpointer, gpointer, gpointer, gpointer, gpointer) = rmethod->jit_wrapper;
+
+ func (args [0], args [1], args [2], args [3], args [4], &ftndesc);
+ break;
+ }
+ case 6: {
+ void (*func)(gpointer, gpointer, gpointer, gpointer, gpointer, gpointer, gpointer) = rmethod->jit_wrapper;
+
+ func (args [0], args [1], args [2], args [3], args [4], args [5], &ftndesc);
+ break;
+ }
+ case 7: {
+ void (*func)(gpointer, gpointer, gpointer, gpointer, gpointer, gpointer, gpointer, gpointer) = rmethod->jit_wrapper;
+
+ func (args [0], args [1], args [2], args [3], args [4], args [5], args [6], &ftndesc);
+ break;
+ }
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+
+ interp_pop_lmf (&ext);
+
+ MonoType *rtype = rmethod->rtype;
+ switch (rtype->type) {
+ case MONO_TYPE_VOID:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_STRING:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_ARRAY:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ sp->data.p = *(gpointer*)res_buf;
+ break;
+ case MONO_TYPE_I1:
+ sp->data.i = *(gint8*)res_buf;
+ break;
+ case MONO_TYPE_U1:
+ sp->data.i = *(guint8*)res_buf;
+ break;
+ case MONO_TYPE_I2:
+ sp->data.i = *(gint16*)res_buf;
+ break;
+ case MONO_TYPE_U2:
+ sp->data.i = *(guint16*)res_buf;
+ break;
+ case MONO_TYPE_I4:
+ sp->data.i = *(gint32*)res_buf;
+ break;
+ case MONO_TYPE_U4:
+ sp->data.i = *(guint32*)res_buf;
+ break;
+ case MONO_TYPE_VALUETYPE:
+ /* The result was written to vt_sp */
+ sp->data.p = vt_sp;
+ break;
+ case MONO_TYPE_GENERICINST:
+ if (MONO_TYPE_IS_REFERENCE (rtype)) {
+ sp->data.p = *(gpointer*)res_buf;
+ } else {
+ /* The result was written to vt_sp */
+ sp->data.p = vt_sp;
+ }
+ break;
+ default:
+ printf ("%s\n", mono_type_full_name (rtype));
+ g_assert_not_reached ();
+ break;
+ }
+
+ return sp;
+}
+
+static void
+do_debugger_tramp (void (*tramp) (void), MonoInvocation *frame)
+{
+ MonoLMFExt ext;
+ interp_push_lmf (&ext, frame);
+ tramp ();
+ interp_pop_lmf (&ext);
+}
+
+static void
+do_transform_method (MonoInvocation *frame, ThreadContext *context)
+{
+ MonoLMFExt ext;
+
+ /* Use the parent frame as the current frame is not complete yet */
+ interp_push_lmf (&ext, frame->parent);
+
+ frame->ex = mono_interp_transform_method (frame->runtime_method, context);
+ context->managed_code = 1;
+
+ interp_pop_lmf (&ext);
+}
+
/*
* These functions are the entry points into the interpreter from compiled code.
* They are called by the interp_in wrappers. They have the following signature:
* rgctx register using a trampoline.
*/
- // FIXME: AOT
- g_assert (!mono_aot_only);
- addr = mono_arch_get_static_rgctx_trampoline (ftndesc, jit_wrapper);
+ if (mono_aot_only)
+ addr = mono_aot_get_static_rgctx_trampoline (ftndesc, jit_wrapper);
+ else
+ addr = mono_arch_get_static_rgctx_trampoline (ftndesc, jit_wrapper);
mono_memory_barrier ();
rmethod->jit_entry = addr;
g_free (mn);
#endif
- MonoLMFExt ext;
-
- /* Use the parent frame as the current frame is not complete yet */
- interp_push_lmf (&ext, frame->parent);
-
- frame->ex = mono_interp_transform_method (frame->runtime_method, context);
- context->managed_code = 1;
-
- interp_pop_lmf (&ext);
-
+ do_transform_method (frame, context);
if (frame->ex) {
rtm = NULL;
ip = NULL;
MINT_IN_CASE(MINT_NOP)
++ip;
MINT_IN_BREAK;
- MINT_IN_CASE(MINT_BREAK) {
+ MINT_IN_CASE(MINT_BREAK)
++ip;
-
- MonoLMFExt ext;
-
- interp_push_lmf (&ext, frame);
-
- mono_debugger_agent_user_break ();
-
- interp_pop_lmf (&ext);
+ do_debugger_tramp (mono_debugger_agent_user_break, frame);
MINT_IN_BREAK;
- }
MINT_IN_CASE(MINT_LDNULL)
sp->data.p = NULL;
++ip;
}
MINT_IN_CASE(MINT_JIT_CALL) {
- MonoMethodSignature *sig;
RuntimeMethod *rmethod = rtm->data_items [* (guint16 *)(ip + 1)];
- MonoFtnDesc ftndesc;
- guint8 res_buf [256];
- MonoType *type;
- MonoLMFExt ext;
-
- //printf ("%s\n", mono_method_full_name (rmethod->method, 1));
-
- /*
- * Call JITted code through a gsharedvt_out wrapper. These wrappers receive every argument
- * by ref and return a return value using an explicit return value argument.
- */
- if (!rmethod->jit_wrapper) {
- MonoMethod *method = rmethod->method;
- MonoError error;
-
- sig = mono_method_signature (method);
- g_assert (sig);
-
- MonoMethod *wrapper = mini_get_gsharedvt_out_sig_wrapper (sig);
- //printf ("J: %s %s\n", mono_method_full_name (method, 1), mono_method_full_name (wrapper, 1));
-
- gpointer jit_wrapper = mono_jit_compile_method_jit_only (wrapper, &error);
- mono_error_assert_ok (&error);
-
- gpointer addr = mono_jit_compile_method_jit_only (method, &error);
- g_assert (addr);
- mono_error_assert_ok (&error);
-
- rmethod->jit_addr = addr;
- rmethod->jit_sig = sig;
- mono_memory_barrier ();
- rmethod->jit_wrapper = jit_wrapper;
-
- } else {
- sig = rmethod->jit_sig;
- }
-
frame->ip = ip;
ip += 2;
- sp -= sig->param_count;
- if (sig->hasthis)
- --sp;
-
- ftndesc.addr = rmethod->jit_addr;
- ftndesc.arg = NULL;
-
- // FIXME: Optimize this
-
- gpointer args [32];
- int pindex = 0;
- int stack_index = 0;
- if (rmethod->hasthis) {
- args [pindex ++] = sp [0].data.p;
- stack_index ++;
- }
- type = rmethod->rtype;
- if (type->type != MONO_TYPE_VOID) {
- if (MONO_TYPE_ISSTRUCT (type))
- args [pindex ++] = vt_sp;
- else
- args [pindex ++] = res_buf;
- }
- for (int i = 0; i < rmethod->param_count; ++i) {
- MonoType *t = rmethod->param_types [i];
- stackval *sval = &sp [stack_index + i];
- if (sig->params [i]->byref) {
- args [pindex ++] = sval->data.p;
- } else if (MONO_TYPE_ISSTRUCT (t)) {
- args [pindex ++] = sval->data.p;
- } else if (MONO_TYPE_IS_REFERENCE (t)) {
- args [pindex ++] = &sval->data.p;
- } else {
- switch (t->type) {
- case MONO_TYPE_I1:
- case MONO_TYPE_U1:
- case MONO_TYPE_I2:
- case MONO_TYPE_U2:
- case MONO_TYPE_I4:
- case MONO_TYPE_U4:
- case MONO_TYPE_VALUETYPE:
- args [pindex ++] = &sval->data.i;
- break;
- case MONO_TYPE_PTR:
- case MONO_TYPE_FNPTR:
- case MONO_TYPE_I:
- case MONO_TYPE_U:
- case MONO_TYPE_OBJECT:
- args [pindex ++] = &sval->data.p;
- break;
- case MONO_TYPE_I8:
- case MONO_TYPE_U8:
- args [pindex ++] = &sval->data.l;
- break;
- default:
- printf ("%s\n", mono_type_full_name (t));
- g_assert_not_reached ();
- }
- }
- }
-
- interp_push_lmf (&ext, frame);
-
- switch (pindex) {
- case 0: {
- void (*func)(gpointer) = rmethod->jit_wrapper;
-
- func (&ftndesc);
- break;
- }
- case 1: {
- void (*func)(gpointer, gpointer) = rmethod->jit_wrapper;
-
- func (args [0], &ftndesc);
- break;
- }
- case 2: {
- void (*func)(gpointer, gpointer, gpointer) = rmethod->jit_wrapper;
-
- func (args [0], args [1], &ftndesc);
- break;
- }
- case 3: {
- void (*func)(gpointer, gpointer, gpointer, gpointer) = rmethod->jit_wrapper;
-
- func (args [0], args [1], args [2], &ftndesc);
- break;
- }
- case 4: {
- void (*func)(gpointer, gpointer, gpointer, gpointer, gpointer) = rmethod->jit_wrapper;
-
- func (args [0], args [1], args [2], args [3], &ftndesc);
- break;
- }
- case 5: {
- void (*func)(gpointer, gpointer, gpointer, gpointer, gpointer, gpointer) = rmethod->jit_wrapper;
-
- func (args [0], args [1], args [2], args [3], args [4], &ftndesc);
- break;
- }
- case 6: {
- void (*func)(gpointer, gpointer, gpointer, gpointer, gpointer, gpointer, gpointer) = rmethod->jit_wrapper;
-
- func (args [0], args [1], args [2], args [3], args [4], args [5], &ftndesc);
- break;
- }
- case 7: {
- void (*func)(gpointer, gpointer, gpointer, gpointer, gpointer, gpointer, gpointer, gpointer) = rmethod->jit_wrapper;
-
- func (args [0], args [1], args [2], args [3], args [4], args [5], args [6], &ftndesc);
- break;
- }
- default:
- g_assert_not_reached ();
- break;
- }
-
- interp_pop_lmf (&ext);
+ sp = do_jit_call (sp, vt_sp, context, frame, rmethod);
if (context->has_resume_state) {
/*
else
goto exit_frame;
}
-
- MonoType *rtype = rmethod->rtype;
- switch (rtype->type) {
- case MONO_TYPE_VOID:
- case MONO_TYPE_OBJECT:
- case MONO_TYPE_STRING:
- case MONO_TYPE_CLASS:
- case MONO_TYPE_ARRAY:
- case MONO_TYPE_SZARRAY:
- case MONO_TYPE_I:
- case MONO_TYPE_U:
- sp->data.p = *(gpointer*)res_buf;
- break;
- case MONO_TYPE_I1:
- sp->data.i = *(gint8*)res_buf;
- break;
- case MONO_TYPE_U1:
- sp->data.i = *(guint8*)res_buf;
- break;
- case MONO_TYPE_I2:
- sp->data.i = *(gint16*)res_buf;
- break;
- case MONO_TYPE_U2:
- sp->data.i = *(guint16*)res_buf;
- break;
- case MONO_TYPE_I4:
- sp->data.i = *(gint32*)res_buf;
- break;
- case MONO_TYPE_U4:
- sp->data.i = *(guint32*)res_buf;
- break;
- case MONO_TYPE_VALUETYPE:
- /* The result was written to vt_sp */
- sp->data.p = vt_sp;
- break;
- case MONO_TYPE_GENERICINST:
- if (MONO_TYPE_IS_REFERENCE (rtype)) {
- sp->data.p = *(gpointer*)res_buf;
- } else {
- /* The result was written to vt_sp */
- sp->data.p = vt_sp;
- }
- break;
- default:
- printf ("%s\n", mono_type_full_name (rtype));
- g_assert_not_reached ();
- break;
- }
- if (rtype->type != MONO_TYPE_VOID)
+ if (rmethod->rtype->type != MONO_TYPE_VOID)
sp++;
+
MINT_IN_BREAK;
}
MINT_IN_BREAK;
MINT_IN_CASE(MINT_SDB_INTR_LOC)
if (G_UNLIKELY (ss_enabled)) {
- MonoLMFExt ext;
static void (*ss_tramp) (void);
if (!ss_tramp) {
*/
frame->ip = ip + 1;
- interp_push_lmf (&ext, frame);
/*
* Use the same trampoline as the JIT. This ensures that
* the debugger has the context for the last interpreter
* native frame.
*/
- ss_tramp ();
- interp_pop_lmf (&ext);
+ do_debugger_tramp (ss_tramp, frame);
if (context->has_resume_state) {
if (frame == context->handler_frame)
++ip;
MINT_IN_BREAK;
MINT_IN_CASE(MINT_SDB_BREAKPOINT) {
- MonoLMFExt ext;
-
static void (*bp_tramp) (void);
if (!bp_tramp) {
void *tramp = mini_get_breakpoint_trampoline ();
frame->ip = ip;
- interp_push_lmf (&ext, frame);
/* Use the same trampoline as the JIT */
- bp_tramp ();
- interp_pop_lmf (&ext);
+ do_debugger_tramp (bp_tramp, frame);
if (context->has_resume_state) {
if (frame == context->handler_frame)
* equivalent to mono_jit_set_aot_only (true) */
MONO_AOT_MODE_FULL,
/* Same as full, but use only llvm compiled code */
- MONO_AOT_MODE_LLVMONLY
+ MONO_AOT_MODE_LLVMONLY,
+ /* Uses Interpreter, JIT is disabled and not allowed,
+ * equivalent to "--full-aot --interpreter" */
+ MONO_AOT_MODE_INTERP
} MonoAotMode;
MONO_API void
return method;
}
-MonoClass*
-mini_get_class (MonoMethod *method, guint32 token, MonoGenericContext *context)
-{
- MonoError error;
- MonoClass *klass;
-
- if (method->wrapper_type != MONO_WRAPPER_NONE) {
- klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
- if (context) {
- klass = mono_class_inflate_generic_class_checked (klass, context, &error);
- mono_error_cleanup (&error); /* FIXME don't swallow the error */
- }
- } else {
- klass = mono_class_get_and_inflate_typespec_checked (method->klass->image, token, context, &error);
- mono_error_cleanup (&error); /* FIXME don't swallow the error */
- }
- if (klass)
- mono_class_init (klass);
- return klass;
-}
-
static inline MonoMethodSignature*
mini_get_signature (MonoMethod *method, guint32 token, MonoGenericContext *context, MonoError *error)
{
#if defined(TARGET_WIN32)
need_touch = TRUE;
#elif defined(MONO_ARCH_SIGSEGV_ON_ALTSTACK)
- if (!tree->flags & MONO_INST_INIT)
+ if (!(tree->flags & MONO_INST_INIT))
need_touch = TRUE;
#endif
#define MONO_ARCH_DYN_CALL_SUPPORTED 1
#define MONO_ARCH_DYN_CALL_PARAM_AREA (DYN_CALL_STACK_ARGS * sizeof (mgreg_t))
+#if !(defined(TARGET_ANDROID) && defined(MONO_CROSS_COMPILE))
#define MONO_ARCH_SOFT_DEBUG_SUPPORTED 1
+#endif
#define MONO_ARCH_HAVE_EXCEPTIONS_INIT 1
#define MONO_ARCH_HAVE_GET_TRAMPOLINES 1
#include "config.h"
#include "mini.h"
+#ifdef ENABLE_INTERPRETER
+#include "interp/interp.h"
+#endif
#include "tasklets.h"
#include <mono/metadata/abi-details.h>
#define MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX 1
#define MONO_ARCH_HAVE_SETUP_RESUME_FROM_SIGNAL_HANDLER_CTX 1
#define MONO_ARCH_GSHARED_SUPPORTED 1
+#define MONO_ARCH_HAVE_INIT_LMF_EXT 1
/* set the next to 0 once inssel-mips.brg is updated */
#define MIPS_PASS_STRUCTS_BY_VALUE 1
#define MONO_ARCH_SOFT_DEBUG_SUPPORTED 1
#endif
#define MONO_ARCH_HAVE_OP_TAIL_CALL 1
+#define MONO_ARCH_HAVE_INIT_LMF_EXT 1
#define PPC_NUM_REG_ARGS (PPC_LAST_ARG_REG-PPC_FIRST_ARG_REG+1)
#define PPC_NUM_REG_FPARGS (PPC_LAST_FPARG_REG-PPC_FIRST_FPARG_REG+1)
return lookup_method (domain, method);
}
+MonoClass*
+mini_get_class (MonoMethod *method, guint32 token, MonoGenericContext *context)
+{
+ MonoError error;
+ MonoClass *klass;
+
+ if (method->wrapper_type != MONO_WRAPPER_NONE) {
+ klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
+ if (context) {
+ klass = mono_class_inflate_generic_class_checked (klass, context, &error);
+ mono_error_cleanup (&error); /* FIXME don't swallow the error */
+ }
+ } else {
+ klass = mono_class_get_and_inflate_typespec_checked (method->klass->image, token, context, &error);
+ mono_error_cleanup (&error); /* FIXME don't swallow the error */
+ }
+ if (klass)
+ mono_class_init (klass);
+ return klass;
+}
+
#if ENABLE_JIT_MAP
static FILE* perf_map_file;
#ifdef MONO_USE_AOT_COMPILER
if (opt & MONO_OPT_AOT) {
- MonoDomain *domain = mono_domain_get ();
+ MonoDomain *domain = NULL;
+
+ if (mono_aot_mode == MONO_AOT_MODE_INTERP && method->wrapper_type == MONO_WRAPPER_UNKNOWN) {
+ WrapperInfo *info = mono_marshal_get_wrapper_info (method);
+ g_assert (info);
+ if (info->subtype == WRAPPER_SUBTYPE_INTERP_IN)
+ /* AOT'd wrappers for interp must be owned by root domain */
+ domain = mono_get_root_domain ();
+ }
+
+ if (!domain)
+ domain = mono_domain_get ();
mono_class_init (method->klass);
#define MONO_ARCH_HAVE_DUMMY_INIT 1
#define MONO_ARCH_HAVE_SDB_TRAMPOLINES 1
#define MONO_ARCH_HAVE_PATCH_CODE_NEW 1
+#define MONO_ARCH_HAVE_INIT_LMF_EXT 1
/* Used for optimization, not complete */
#define MONO_ARCH_IS_OP_MEMBASE(opcode) ((opcode) == OP_X86_PUSH_MEMBASE)
void mono_arch_skip_breakpoint (MonoContext *ctx, MonoJitInfo *ji);
void mono_arch_skip_single_step (MonoContext *ctx);
gpointer mono_arch_get_seq_point_info (MonoDomain *domain, guint8 *code);
+#endif
+
+#ifdef MONO_ARCH_HAVE_INIT_LMF_EXT
void mono_arch_init_lmf_ext (MonoLMFExt *ext, gpointer prev_lmf);
#endif
g_assert_not_reached ();
return NULL;
}
-
+
+gpointer
+mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info)
+{
+ g_assert_not_reached ();
+ return NULL;
+}
#endif /* DISABLE_JIT */
guint8*
return NULL;
}
+gpointer
+mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info)
+{
+ g_assert_not_reached ();
+ return NULL;
+}
#endif /* !DISABLE_JIT */
return ((guint32*)plt_entry) [6];
#endif
}
+
+gpointer
+mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info)
+{
+ g_assert_not_reached ();
+ return NULL;
+}
return buf;
}
+gpointer
+mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info)
+{
+ g_assert_not_reached ();
+ return NULL;
+}
+
WorkerData *data = (WorkerData*)data_untyped;
int current_worker = (int) (data - workers_data);
- return started && current_worker < active_workers_num;
+ return started && current_worker < active_workers_num && state_is_working_or_enqueued (data->state);
}
static void
# delegate-invoke.exe depends on 929c6bc9b6d76a273f251e6f5dfacac36e9c38bd which was
# reverted.
# bug-Xamarin-5278.exe got broken by 5d26590e79da139a284459299aee95c25f4cd835
-# bug-45841-fpstack-exceptions.exe: https://bugzilla.xamarin.com/show_bug.cgi?id=47053
# appdomain-thread-abort.exe: https://bugzilla.xamarin.com/show_bug.cgi?id=47054
KNOWN_FAILING_TESTS = \
delegate-async-exception.exe \
bug-459094.exe \
delegate-invoke.exe \
bug-Xamarin-5278.exe \
- bug-45841-fpstack-exceptions.exe \
appdomain-thread-abort.exe
DISABLED_TESTS = \
bug-327438.2.exe \
bug-335131.2.exe \
bug-415577.exe \
+ bug-45841-fpstack-exceptions.exe \
bug-461867.exe \
bug-461941.exe \
bug-46661.exe \
.locals init (valuetype [System.Data]System.Data.SqlTypes.SqlDecimal V_0)
.try
{
- ldc.r8 5
+ ldstr "Exception 1"
newobj instance void [mscorlib]System.OverflowException::.ctor(string)
throw
pop
IL_0021: nop
.try
{
- ldc.r8 5
+ ldstr "Exception 2"
newobj instance void [mscorlib]System.OverflowException::.ctor(string)
throw
pop
IL_0033: nop
.try
{
- ldc.r8 5
+ ldstr "Exception 3"
newobj instance void [mscorlib]System.OverflowException::.ctor(string)
throw
IL_0044: leave.s IL_0049
IL_0049: nop
.try
{
- ldc.r8 5
+ ldstr "Exception 4"
newobj instance void [mscorlib]System.OverflowException::.ctor(string)
throw
pop
IL_005f: nop
.try
{
- ldc.r8 5
+ ldstr "Exception 5"
newobj instance void [mscorlib]System.OverflowException::.ctor(string)
throw
pop
IL_0071: nop
.try
{
- ldc.r8 5
+ ldstr "Exception 6"
newobj instance void [mscorlib]System.OverflowException::.ctor(string)
throw
pop
GitHubTarballPackage(
'mono',
'libgdiplus',
- '2.11',
- '4e7ab0f555a13a6b2f954c714c4ee5213954ff79',
+ '5.4',
+ '350eb49a45ca5a7383c01d49df72438347a5dbc9',
configure='CFLAGS="%{gcc_flags} %{local_gcc_flags} -I/opt/X11/include" ./autogen.sh --prefix="%{package_prefix}"',
override_properties={
'make': 'C_INCLUDE_PATH="" make'})
class MSBuild (GitHubPackage):
def __init__ (self):
- GitHubPackage.__init__ (self, 'mono', 'msbuild', '15.0',
+ GitHubPackage.__init__ (self, 'mono', 'msbuild', '15.3',
git_branch = 'xplat-master')
def build (self):
"SeqPointInfo",
"DynCallArgs",
"MonoLMFTramp",
+ "InterpMethodArguments",
};
DumpClasses(writer, ctx, optionalTypes, optional: true);
/* Using the simple generational GC. */
/* #undef HAVE_SGEN_GC */
+/* Some VES is available at runtime */
+#define HAVE_ONLINE_VES 1
+
/* Have signal */
#define HAVE_SIGNAL 1