Rework profiler argument handling.
[submodule "external/nuget-buildtasks"]
path = external/nuget-buildtasks
url = git://github.com/mono/NuGet.BuildTasks
-[submodule "external/buildtools"]
- path = external/buildtools
- url = git://github.com/mono/buildtools.git
[submodule "external/cecil-legacy"]
path = external/cecil-legacy
url = git://github.com/mono/cecil.git
# Process this file with autoconf to produce a configure script.
#AC_PREREQ([2.62])
-AC_INIT(mono, [5.3.0],
+AC_INIT(mono, [5.5.0],
[http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
AC_CONFIG_SRCDIR([README.md])
with_sgen_default_concurrent=yes
;;
*-*-nacl*)
- CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP"
- if test "x$disable_munmap" != "xyes"; then
- CPPFLAGS="$CPPFLAGS -DUSE_MUNMAP"
- fi
- libmono_cflags="-D_REENTRANT"
- libdl=
- libgc_threads=pthreads
- use_sigposix=yes
- ikvm_native=no
- AC_DEFINE(DISABLE_SOCKETS,1,[Disable sockets support])
- AC_DEFINE(DISABLE_ATTACH, 1, [Disable agent attach support])
+ echo "nacl no longer supported."
+ exit 1
;;
*-*-hpux*)
CPPFLAGS="$CPPFLAGS -DGC_HPUX_THREADS -D_HPUX_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_REENTRANT"
AM_CONDITIONAL(DISABLE_LIBRARIES, test x$enable_libraries = xno)
-case $host in
-*nacl* ) with_shared_mono=yes;;
-esac
-
if test "x$host_win32" = "xyes"; then
# Boehm GC requires the runtime to be in its own dll
with_static_mono=no
AC_DEFINE_UNQUOTED(MONO_ZERO_LEN_ARRAY, 1, [Length of zero length arrays])
])
-AC_CHECK_HEADERS(nacl/nacl_dyncode.h)
-
dnl ***********************************
dnl *** Checks for signals
dnl ***********************************
dnl **********************************
dnl *** epoll ***
dnl **********************************
- if test "x$ac_cv_header_nacl_nacl_dyncode_h" = "xno"; then
- AC_CHECK_HEADERS(sys/epoll.h)
- haveepoll=no
- AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], )
- if test "x$haveepoll" = "xyes" -a "x$ac_cv_header_sys_epoll_h" = "xyes"; then
- AC_DEFINE(HAVE_EPOLL, 1, [epoll supported])
- fi
+ AC_CHECK_HEADERS(sys/epoll.h)
+ haveepoll=no
+ AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], )
+ if test "x$haveepoll" = "xyes" -a "x$ac_cv_header_sys_epoll_h" = "xyes"; then
+ AC_DEFINE(HAVE_EPOLL, 1, [epoll supported])
fi
havekqueue=no
AM_CONDITIONAL(ENABLE_DTRACE, [test x$enable_dtrace = xyes])
AM_CONDITIONAL(DTRACE_G_REQUIRED, [test x$dtrace_g = xyes])
-dnl **************
-dnl *** NaCl ***
-dnl **************
-
-AC_ARG_ENABLE(nacl_codegen, [ --enable-nacl-codegen Enable Native Client code generation], enable_nacl_codegen=$enableval, enable_nacl_codegen=no)
-AC_ARG_ENABLE(nacl_gc, [ --enable-nacl-gc Enable Native Client garbage collection], enable_nacl_gc=$enableval, enable_nacl_gc=no)
-
-AM_CONDITIONAL(NACL_CODEGEN, test x$enable_nacl_codegen != xno)
-
-dnl
-dnl Hack to use system mono for operations in build/install not allowed in NaCl.
-dnl
-nacl_self_host=""
-if test "x$ac_cv_header_nacl_nacl_dyncode_h" = "xyes"; then
- nacl_self_host="nacl_self_host"
-fi
-AC_SUBST(nacl_self_host)
-
-if test "x$enable_nacl_codegen" = "xyes"; then
- MONO_NACL_ALIGN_MASK_OFF=1
- AC_DEFINE(TARGET_NACL, 1, [...])
- AC_DEFINE(__native_client_codegen__, 1, [...])
-fi
-if test "x$enable_nacl_gc" = "xyes"; then
- if test "x$TARGET" = "xAMD64" -o "x$TARGET" = "xX86"; then
- INSTRUMENT_CFLAG="-finstrument-for-thread-suspension"
- else
- # Not yet implemented
- INSTRUMENT_CFLAG=""
- fi
- CPPFLAGS="$CPPFLAGS $INSTRUMENT_CFLAG -D__native_client_gc__"
-fi
-AC_SUBST(MONO_NACL_ALIGN_MASK_OFF)
-
dnl **************************
dnl *** AOT cross offsets ***
dnl **************************
mingw*)
;;
esac
- case "$host" in
- x86_64-*-nacl*)
- AC_DEFINE(__mono_ilp32__, 1, [64 bit mode with 4 byte longs and pointers])
- sizeof_register=8
- ;;
- esac
;;
sparc*-*-*)
if test "x$ac_cv_sizeof_void_p" = "x8"; then
ACCESS_UNALIGNED="no"
CPPFLAGS="$CPPFLAGS -D__ARM_EABI__"
;;
-# TODO: make proper support for NaCl host.
-# arm*-*nacl)
-# TARGET=ARM;
-# arch_target=arm;
-# ACCESS_UNALIGNED="no"
-# AOT_SUPPORTED="no"
-# ;;
aarch64-*)
# https://lkml.org/lkml/2012/7/15/133
TARGET=ARM64
sizeof_register=8
target_byte_order=G_BIG_ENDIAN
;;
- x86_64-*-nacl)
- TARGET=AMD64
- arch_target=amd64
- AC_DEFINE(TARGET_AMD64, 1, [...])
- AC_DEFINE(__mono_ilp32__, 1, [64 bit mode with 4 byte longs and pointers])
- sizeof_register=8
- ;;
-# TODO: make proper support for NaCl target.
-# arm*-*nacl)
-# TARGET=ARM
-# arch_target=arm
-# AC_DEFINE(TARGET_ARM, 1, [...])
-# ACCESS_UNALIGNED="no"
-# sizeof_register=4
-# CPPFLAGS="$CPPFLAGS \
-# -D__ARM_EABI__ \
-# -D__arm__ \
-# -D__portable_native_client__ \
-# -Dtimezone=_timezone \
-# -DDISABLE_SOCKETS \
-# -DDISABLE_ATTACH \
-# -DUSE_NEWLIB"
- # Can't use tls, since it depends on the runtime detection of tls offsets
- # in mono-compiler.h
-# with_tls=pthread
-# ;;
- i686-*-nacl)
- TARGET=X86
- arch_target=x86
- AC_DEFINE(TARGET_X86, 1, [...])
- sizeof_register=4
- ;;
arm*-linux-*)
TARGET=ARM;
arch_target=arm;
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)
#define G_HAVE_ISO_VARARGS
#endif
-#if defined (__native_client__) || defined (HOST_WATCHOS)
+#if defined (HOST_WATCHOS)
#undef G_BREAKPOINT
#define G_BREAKPOINT()
#endif
gchar *
g_get_current_dir (void)
{
-#ifdef __native_client__
- char *buffer;
- if ((buffer = g_getenv("NACL_PWD"))) {
- buffer = g_strdup(buffer);
- } else {
- buffer = g_strdup(".");
- }
- return buffer;
-#else
int s = 32;
char *buffer = NULL, *r;
gboolean fail;
* so we return the buffer here since it has a pointer to the valid string
*/
return buffer;
-#endif
}
-Subproject commit bb16afac3deaa1cd8f798668b04b5510cfcd53ba
+Subproject commit 1563f6ea5ba2f4c6f3e9c6e625ee8b16e3a1d39e
-Subproject commit 4f39b930ed66009c54f2326451644ca9d06e4d30
+Subproject commit fe467c0593d199e5d4d29be9c69c5d487449dd8b
+++ /dev/null
-Subproject commit b5cc6e6ab5f71f6c0be7b730058b426e92528479
-Subproject commit e49886bd091487abfbf5de934a451c5a8fe7f4c5
+Subproject commit bc22b1f08545261b7dc18f312dcd5b4f04768ecb
-Subproject commit 814f76de6a972c5c3dd3ec6b10dc900fd73d08d2
+Subproject commit 48dba73801e804e89f00311da99d873f9c550278
-Subproject commit 88b67c42ca8b7d58141c176b46749819bfcef166
+Subproject commit 1d7d43603791e0236b56d076578657bee44fef6b
-Subproject commit b8e20d265b368dd6252703d5afd038d0b028e388
+Subproject commit d4433b0972f40cb3efaa3fbba52869bde5df8fa8
.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
ifndef NO_TEST
test_nunit_lib = nunitlite.dll
-xunit_core := xunit.core xunit.abstractions xunit.assert
+xunit_core := xunit.core xunit.abstractions xunit.assert Xunit.NetCore.Extensions
xunit_deps := System.Runtime
-xunit_class_deps := Xunit.NetCore.Extensions
+xunit_src := $(patsubst %,$(topdir)/../external/xunit-binaries/%,BenchmarkAttribute.cs BenchmarkDiscover.cs)
+xunit_class_deps :=
xunit_libs_ref = $(patsubst %,-r:$(topdir)/../external/xunit-binaries/%.dll,$(xunit_core))
xunit_libs_ref += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE)/Facades/%.dll,$(xunit_deps))
tests_CLEAN_FILES += $(topdir)/build/deps/nunit-$(PROFILE).stamp
-$(topdir)/class/lib/$(PROFILE)/$(PARENT_PROFILE)Xunit.NetCore.Extensions.dll:
- $(MAKE) -C $(topdir)/class/Xunit.NetCore.Extensions
-
endif
test_assemblies :=
$$ok
@rm -f xunit.execution.desktop.dll
-$(xunit_test_lib): $(the_assembly) $(xtest_response) $(xunit_libs_dep)
- $(TEST_COMPILE) $(LIBRARY_FLAGS) $(XTEST_LIB_FLAGS) -target:library -out:$@ $(xtest_flags) @$(xtest_response)
+$(xunit_test_lib): $(the_assembly) $(xtest_response) $(xunit_libs_dep) $(xunit_src)
+ $(TEST_COMPILE) $(LIBRARY_FLAGS) $(XTEST_LIB_FLAGS) -target:library -out:$@ $(xtest_flags) @$(xtest_response) $(xunit_src)
xtest_response_preprocessed = $(xtest_response)_preprocessed
return 42;
}
+ public int invoke_pass_nullable (int? i) {
+ return (int)i;
+ }
+
public int? invoke_return_nullable_null () {
return null;
}
+ public int invoke_pass_nullable_null (int? i) {
+ return i.HasValue ? 1 : 2;
+ }
+
public void invoke_type_load () {
new Class3 ();
}
m = s.Type.GetMethod ("ToString");
v = s.InvokeMethod (e.Thread, m, null);
+ // pass nullable as argument
+ m = t.GetMethod ("invoke_pass_nullable");
+ v = this_obj.InvokeMethod (e.Thread, m, new Value [] { s });
+ AssertValue (42, v);
+
// return nullable null
m = t.GetMethod ("invoke_return_nullable_null");
v = this_obj.InvokeMethod (e.Thread, m, null);
m = s.Type.GetMethod ("ToString");
v = s.InvokeMethod (e.Thread, m, null);
+ // pass nullable null as argument
+ m = t.GetMethod ("invoke_pass_nullable_null");
+ v = this_obj.InvokeMethod (e.Thread, m, new Value [] { s });
+ AssertValue (2, v);
+
+ return;
+
// pass primitive
m = t.GetMethod ("invoke_pass_primitive");
Value[] args = new Value [] {
e.Run = (args) => e.CommandSet.Out.WriteLine (string.Join (" ", args));
var o = new StringWriter ();
- var c = new CommandSet ("set", output:o) {
+ var c = new CommandSet ("set", output:o, error: Console.Error) {
e,
};
Assert.AreEqual (0, c.Run (new [] { "help", "echo" }));
c, v => { string ignore = v.OptionValues [0]; });
c.Option = p [0];
Utils.AssertException (typeof(ArgumentOutOfRangeException),
- "Specified argument was out of the range of valid values.\nParameter name: index",
+ $"Specified argument was out of the range of valid values.{Environment.NewLine}Parameter name: index",
c, v => { string ignore = v.OptionValues [2]; });
c.OptionName = "-a";
Utils.AssertException (typeof(OptionException),
p, v => { v.Parse (_("-a", "-b")); });
Assert.AreEqual (a, "-b");
Utils.AssertException (typeof(ArgumentNullException),
- "Value cannot be null.\nParameter name: option",
+ $"Value cannot be null.{Environment.NewLine}Parameter name: option",
p, v => { v.Add ((Option) null); });
Utils.AssertException (typeof(ArgumentNullException),
- "Value cannot be null.\nParameter name: header",
+ $"Value cannot be null.{Environment.NewLine}Parameter name: header",
p, v => { v.Add ((string) null); });
// bad type
p, v => { v.Parse (_("-cz", "extra")); });
Utils.AssertException (typeof(ArgumentNullException),
- "Value cannot be null.\nParameter name: action",
+ $"Value cannot be null.{Environment.NewLine}Parameter name: action",
p, v => { v.Add ("foo", (Action<string>) null); });
Utils.AssertException (typeof(ArgumentException),
- "Cannot provide maxValueCount of 2 for OptionValueType.None.\nParameter name: maxValueCount",
+ $"Cannot provide maxValueCount of 2 for OptionValueType.None.{Environment.NewLine}Parameter name: maxValueCount",
p, v => { v.Add ("foo", (k, val) => {/* ignore */}); });
}
Utils.AssertException (typeof(ArgumentException), "prototypes must be null!",
p, v => { v.Add ("N|NUM=", (int n) => {}); });
Utils.AssertException (typeof(ArgumentNullException),
- "Value cannot be null.\nParameter name: option",
+ $"Value cannot be null.{Environment.NewLine}Parameter name: option",
p, v => { v.GetOptionForName (null); });
}
{
object p = null;
Utils.AssertException (typeof(ArgumentNullException),
- "Value cannot be null.\nParameter name: prototype",
+ $"Value cannot be null.{Environment.NewLine}Parameter name: prototype",
p, v => { new DefaultOption (null, null); });
Utils.AssertException (typeof(ArgumentException),
- "Cannot be the empty string.\nParameter name: prototype",
+ $"Cannot be the empty string.{Environment.NewLine}Parameter name: prototype",
p, v => { new DefaultOption ("", null); });
Utils.AssertException (typeof(ArgumentException),
- "Empty option names are not supported.\nParameter name: prototype",
+ $"Empty option names are not supported.{Environment.NewLine}Parameter name: prototype",
p, v => { new DefaultOption ("a|b||c=", null); });
Utils.AssertException (typeof(ArgumentException),
- "Conflicting option types: '=' vs. ':'.\nParameter name: prototype",
+ $"Conflicting option types: '=' vs. ':'.{Environment.NewLine}Parameter name: prototype",
p, v => { new DefaultOption ("a=|b:", null); });
Utils.AssertException (typeof(ArgumentException),
- "The default option handler '<>' cannot require values.\nParameter name: prototype",
+ $"The default option handler '<>' cannot require values.{Environment.NewLine}Parameter name: prototype",
p, v => { new DefaultOption ("<>=", null); });
Utils.AssertException (typeof(ArgumentException),
- "The default option handler '<>' cannot require values.\nParameter name: prototype",
+ $"The default option handler '<>' cannot require values.{Environment.NewLine}Parameter name: prototype",
p, v => { new DefaultOption ("<>:", null); });
Utils.AssertException (null, null,
p, v => { new DefaultOption ("t|<>=", null, 1); });
Utils.AssertException (typeof(ArgumentException),
- "The default option handler '<>' cannot require values.\nParameter name: prototype",
+ $"The default option handler '<>' cannot require values.{Environment.NewLine}Parameter name: prototype",
p, v => { new DefaultOption ("t|<>=", null, 2); });
Utils.AssertException (null, null,
p, v => { new DefaultOption ("a|b=", null, 2); });
Utils.AssertException (typeof(ArgumentOutOfRangeException),
- "Specified argument was out of the range of valid values.\nParameter name: maxValueCount",
+ $"Specified argument was out of the range of valid values.{Environment.NewLine}Parameter name: maxValueCount",
p, v => { new DefaultOption ("a", null, -1); });
Utils.AssertException (typeof(ArgumentException),
"Cannot provide maxValueCount of 0 for OptionValueType.Required or " +
- "OptionValueType.Optional.\nParameter name: maxValueCount",
+ $"OptionValueType.Optional.{Environment.NewLine}Parameter name: maxValueCount",
p, v => { new DefaultOption ("a=", null, 0); });
Utils.AssertException (typeof(ArgumentException),
- "Ill-formed name/value separator found in \"a={\".\nParameter name: prototype",
+ "Ill-formed name/value separator found in \"a={\"." + Environment.NewLine + "Parameter name: prototype",
p, v => { new DefaultOption ("a={", null); });
Utils.AssertException (typeof(ArgumentException),
- "Ill-formed name/value separator found in \"a=}\".\nParameter name: prototype",
+ "Ill-formed name/value separator found in \"a=}\"." + Environment.NewLine + "Parameter name: prototype",
p, v => { new DefaultOption ("a=}", null); });
Utils.AssertException (typeof(ArgumentException),
- "Ill-formed name/value separator found in \"a={{}}\".\nParameter name: prototype",
+ "Ill-formed name/value separator found in \"a={{}}\"." + Environment.NewLine + "Parameter name: prototype",
p, v => { new DefaultOption ("a={{}}", null); });
Utils.AssertException (typeof(ArgumentException),
- "Ill-formed name/value separator found in \"a={}}\".\nParameter name: prototype",
+ "Ill-formed name/value separator found in \"a={}}\"." + Environment.NewLine + "Parameter name: prototype",
p, v => { new DefaultOption ("a={}}", null); });
Utils.AssertException (typeof(ArgumentException),
- "Ill-formed name/value separator found in \"a={}{\".\nParameter name: prototype",
+ "Ill-formed name/value separator found in \"a={}{\"." + Environment.NewLine + "Parameter name: prototype",
p, v => { new DefaultOption ("a={}{", null); });
Utils.AssertException (typeof(ArgumentException),
- "Cannot provide key/value separators for Options taking 1 value(s).\nParameter name: prototype",
+ $"Cannot provide key/value separators for Options taking 1 value(s).{Environment.NewLine}Parameter name: prototype",
p, v => { new DefaultOption ("a==", null); });
Utils.AssertException (typeof(ArgumentException),
- "Cannot provide key/value separators for Options taking 1 value(s).\nParameter name: prototype",
+ $"Cannot provide key/value separators for Options taking 1 value(s).{Environment.NewLine}Parameter name: prototype",
p, v => { new DefaultOption ("a={}", null); });
Utils.AssertException (typeof(ArgumentException),
- "Cannot provide key/value separators for Options taking 1 value(s).\nParameter name: prototype",
+ $"Cannot provide key/value separators for Options taking 1 value(s).{Environment.NewLine}Parameter name: prototype",
p, v => { new DefaultOption ("a=+-*/", null); });
Utils.AssertException (null, null,
p, v => { new DefaultOption ("a", null, 0); });
throw new ArgumentOutOfRangeException ("byteIndex", _("ArgRange_Array"));
}
+ unsafe {
+ fixed (char* p = s) {
+ fixed (byte* b = bytes) {
+ return GetBytes (p + charIndex, charCount, b + byteIndex, bytes.Length - byteIndex);
+ }
+ }
+ }
+ }
+
+ public unsafe override int GetBytes(char* chars, int charCount, byte* bytes, int byteCount)
+ {
+ if (bytes == null || chars == null)
+ throw new ArgumentNullException (bytes == null ? "bytes" : "chars");
+
+ if (charCount < 0 || byteCount < 0)
+ throw new ArgumentOutOfRangeException (charCount < 0 ? "charCount" : "byteCount");
+
// Convert the characters into bytes.
char ch;
- int length = bytes.Length;
+ int length = byteCount;
uint pair;
- int posn = byteIndex;
+ int posn = 0;
+ int charIndex = 0;
while (charCount > 0) {
// Fetch the next UTF-16 character pair value.
- ch = s[charIndex++];
+ ch = chars [charIndex++];
if (ch >= '\uD800' && ch <= '\uDBFF' && charCount > 1) {
// This may be the start of a surrogate pair.
- pair = (uint)(s[charIndex]);
+ pair = (uint)(chars[charIndex]);
if (pair >= (uint)0xDC00 && pair <= (uint)0xDFFF) {
pair = (pair - (uint)0xDC00) +
((((uint)ch) - (uint)0xD800) << 10) +
}
charCount -= 2;
if (charCount >= 0) {
- bytes[posn++] = (byte) s [charIndex++];
+ bytes[posn++] = (byte)chars [charIndex++];
}
continue;
} else {
}
// Return the final count to the caller.
- return posn - byteIndex;
+ return posn;
}
// Internal version of "GetCharCount" which can handle a rolling
uint leftSoFar = (leftOverCount & (uint)0x0F);
uint leftSize = ((leftOverCount >> 4) & (uint)0x0F);
while (count > 0) {
- ch = (uint)(bytes[index++]);
+ ch = (uint)(bytes [index++]);
++next_raw;
--count;
if (leftSize == 0) {
if (encoding == null)
throw new ArgumentNullException ("encoding");
- int min_byte_count = encoding.GetMaxByteCount(1);
- char[] copy = s.ToCharArray (index, count);
- byte[] marshal = new byte [encoding.GetByteCount (copy) + min_byte_count];
+ if (index < 0 || count < 0)
+ throw new ArgumentOutOfRangeException ((index < 0 ? "index" : "count"),
+ "Non - negative number required.");
- int bytes_copied = encoding.GetBytes (copy, 0, copy.Length, marshal, 0);
+ if (s.Length - index < count)
+ throw new ArgumentOutOfRangeException ("s", "Index and count must refer to a location within the string.");
- if (bytes_copied != (marshal.Length-min_byte_count))
- throw new NotSupportedException ("encoding.GetBytes() doesn't equal encoding.GetByteCount()!");
+ int null_terminator_count = encoding.GetMaxByteCount (1);
+ int length_without_null = encoding.GetByteCount (s);
+ int marshalLength = checked (length_without_null + null_terminator_count);
- IntPtr mem = AllocHeap (marshal.Length);
+ IntPtr mem = AllocHeap (marshalLength);
if (mem == IntPtr.Zero)
throw new UnixIOException (Native.Errno.ENOMEM);
- bool copied = false;
- try {
- Marshal.Copy (marshal, 0, mem, marshal.Length);
- copied = true;
- }
- finally {
- if (!copied)
- FreeHeap (mem);
+ unsafe {
+ fixed (char* p = s) {
+ byte* marshal = (byte*)mem;
+ int bytes_copied;
+
+ try {
+ bytes_copied = encoding.GetBytes (p + index, count, marshal, marshalLength);
+ } catch {
+ FreeHeap (mem);
+ throw;
+ }
+
+ if (bytes_copied != length_without_null) {
+ FreeHeap (mem);
+ throw new NotSupportedException ("encoding.GetBytes() doesn't equal encoding.GetByteCount()!");
+ }
+
+ marshal += length_without_null;
+ for (int i = 0; i < null_terminator_count; ++i)
+ marshal[i] = 0;
+ }
}
return mem;
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,
- }
-}
+../../../external/corefx/src/Common/tests/System/AssertExtensions.cs
../../../external/corefx/src/Common/tests/System/PlatformDetection.cs
# ../../../external/corefx/src/System.Runtime.Numerics/tests/*.cs
{
string fullPath = (string) hostInitConfigurationParams [1];
map = (WebConfigurationFileMap) hostInitConfigurationParams [0];
- bool inAnotherApp = (bool) hostInitConfigurationParams [7];
+ bool inAnotherApp = false;
+
+ if ((hostInitConfigurationParams.Length > 7)
+ && (hostInitConfigurationParams[7] is bool))
+ inAnotherApp = (bool) hostInitConfigurationParams[7];
if (inAnotherApp)
appVirtualPath = fullPath;
*/
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); }
}
EndPoint = remoteEP,
};
- // Bug #75154: Connect() should not succeed for .Any addresses.
- if (remoteEP is IPEndPoint) {
- IPEndPoint ep = (IPEndPoint) remoteEP;
- if (ep.Address.Equals (IPAddress.Any) || ep.Address.Equals (IPAddress.IPv6Any)) {
- sockares.Complete (new SocketException ((int) SocketError.AddressNotAvailable), true);
- return sockares;
- }
-
- sockares.EndPoint = remoteEP = RemapIPEndPoint (ep);
- }
-
- int error = 0;
-
- if (connect_in_progress) {
- // This could happen when multiple IPs are used
- // Calling connect() again will reset the connection attempt and cause
- // an error. Better to just close the socket and move on.
- connect_in_progress = false;
- m_Handle.Dispose ();
- m_Handle = new SafeSocketHandle (Socket_internal (addressFamily, socketType, protocolType, out error), true);
- if (error != 0)
- throw new SocketException (error);
- }
-
- bool blk = is_blocking;
- if (blk)
- Blocking = false;
- Connect_internal (m_Handle, remoteEP.Serialize (), out error, false);
- if (blk)
- Blocking = true;
-
- if (error == 0) {
- // succeeded synch
- is_connected = true;
- is_bound = true;
- sockares.Complete (true);
- return sockares;
- }
-
- if (error != (int) SocketError.InProgress && error != (int) SocketError.WouldBlock) {
- // error synch
- is_connected = false;
- is_bound = false;
- sockares.Complete (new SocketException (error), true);
- return sockares;
- }
-
- // continue asynch
- is_connected = false;
- is_bound = false;
- connect_in_progress = true;
-
- IOSelector.Add (sockares.Handle, new IOSelectorJob (IOOperation.Write, BeginConnectCallback, sockares));
-
+ BeginSConnect (sockares);
return sockares;
}
is_connected = false;
- return BeginMConnect (sockares);
+ BeginMConnect (sockares);
+ return sockares;
}
- internal IAsyncResult BeginMConnect (SocketAsyncResult sockares)
+ static void BeginMConnect (SocketAsyncResult sockares)
{
- SocketAsyncResult ares = null;
Exception exc = null;
- AsyncCallback callback;
for (int i = sockares.CurrentAddress; i < sockares.Addresses.Length; i++) {
try {
sockares.CurrentAddress++;
+ sockares.EndPoint = new IPEndPoint (sockares.Addresses [i], sockares.Port);
- ares = (SocketAsyncResult) BeginConnect (new IPEndPoint (sockares.Addresses [i], sockares.Port), null, sockares);
- if (ares.IsCompleted && ares.CompletedSynchronously) {
- ares.CheckIfThrowDelayedException ();
-
- callback = ares.AsyncCallback;
- if (callback != null)
- ThreadPool.UnsafeQueueUserWorkItem (_ => callback (ares), null);
- }
-
- break;
+ BeginSConnect (sockares);
+ return;
} catch (Exception e) {
exc = e;
- ares = null;
}
}
- if (ares == null)
- throw exc;
+ throw exc;
+ }
- return sockares;
+ static void BeginSConnect (SocketAsyncResult sockares)
+ {
+ EndPoint remoteEP = sockares.EndPoint;
+ // Bug #75154: Connect() should not succeed for .Any addresses.
+ if (remoteEP is IPEndPoint) {
+ IPEndPoint ep = (IPEndPoint) remoteEP;
+ if (ep.Address.Equals (IPAddress.Any) || ep.Address.Equals (IPAddress.IPv6Any)) {
+ sockares.Complete (new SocketException ((int) SocketError.AddressNotAvailable), true);
+ return;
+ }
+
+ sockares.EndPoint = remoteEP = sockares.socket.RemapIPEndPoint (ep);
+ }
+
+ int error = 0;
+
+ if (sockares.socket.connect_in_progress) {
+ // This could happen when multiple IPs are used
+ // Calling connect() again will reset the connection attempt and cause
+ // an error. Better to just close the socket and move on.
+ sockares.socket.connect_in_progress = false;
+ sockares.socket.m_Handle.Dispose ();
+ sockares.socket.m_Handle = new SafeSocketHandle (sockares.socket.Socket_internal (sockares.socket.addressFamily, sockares.socket.socketType, sockares.socket.protocolType, out error), true);
+ if (error != 0)
+ throw new SocketException (error);
+ }
+
+ bool blk = sockares.socket.is_blocking;
+ if (blk)
+ sockares.socket.Blocking = false;
+ Connect_internal (sockares.socket.m_Handle, remoteEP.Serialize (), out error, false);
+ if (blk)
+ sockares.socket.Blocking = true;
+
+ if (error == 0) {
+ // succeeded synch
+ sockares.socket.is_connected = true;
+ sockares.socket.is_bound = true;
+ sockares.Complete (true);
+ return;
+ }
+
+ if (error != (int) SocketError.InProgress && error != (int) SocketError.WouldBlock) {
+ // error synch
+ sockares.socket.is_connected = false;
+ sockares.socket.is_bound = false;
+ sockares.Complete (new SocketException (error), true);
+ return;
+ }
+
+ // continue asynch
+ sockares.socket.is_connected = false;
+ sockares.socket.is_bound = false;
+ sockares.socket.connect_in_progress = true;
+
+ IOSelector.Add (sockares.Handle, new IOSelectorJob (IOOperation.Write, BeginConnectCallback, sockares));
}
static IOAsyncCallback BeginConnectCallback = new IOAsyncCallback (ares => {
return;
}
- SocketAsyncResult mconnect = sockares.AsyncState as SocketAsyncResult;
- bool is_mconnect = mconnect != null && mconnect.Addresses != null;
-
try {
- EndPoint ep = sockares.EndPoint;
- int error_code = (int) sockares.socket.GetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Error);
-
- if (error_code == 0) {
- if (is_mconnect)
- sockares = mconnect;
+ int error = (int) sockares.socket.GetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Error);
- sockares.socket.seed_endpoint = ep;
+ if (error == 0) {
+ sockares.socket.seed_endpoint = sockares.EndPoint;
sockares.socket.is_connected = true;
sockares.socket.is_bound = true;
sockares.socket.connect_in_progress = false;
return;
}
- if (!is_mconnect) {
+ if (sockares.Addresses == null) {
sockares.socket.connect_in_progress = false;
- sockares.Complete (new SocketException (error_code));
+ sockares.Complete (new SocketException (error));
return;
}
- if (mconnect.CurrentAddress >= mconnect.Addresses.Length) {
- mconnect.Complete (new SocketException (error_code));
+ if (sockares.CurrentAddress >= sockares.Addresses.Length) {
+ sockares.Complete (new SocketException (error));
return;
}
- mconnect.socket.BeginMConnect (mconnect);
+ BeginMConnect (sockares);
} catch (Exception e) {
sockares.socket.connect_in_progress = false;
-
- if (is_mconnect)
- sockares = mconnect;
-
sockares.Complete (e);
- return;
}
});
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
+++ /dev/null
-thisdir = class/Xunit.NetCore.Extensions
-SUBDIRS =
-include ../../build/rules.make
-
-XUNIT_LIBS := xunit.core xunit.abstractions xunit.execution.desktop xunit.assert
-
-LIBRARY = Xunit.NetCore.Extensions.dll
-LIB_REFS = System System.Core Facades/System.Runtime.InteropServices.RuntimeInformation Facades/System.Runtime Facades/System.Threading.Tasks
-LIB_MCS_FLAGS = $(patsubst %,-r:$(topdir)/../external/xunit-binaries/%.dll,$(XUNIT_LIBS))
-
-EXTRA_DISTFILES =
-
-NO_TEST = yes
-NO_INSTALL = yes
-NO_SIGN_ASSEMBLY = yes
-
-include ../../build/library.make
+++ /dev/null
-using System;
-using Xunit;
-using Xunit.Sdk;
-
-namespace Microsoft.Xunit.Performance
-{
- [TraitDiscoverer("Microsoft.Xunit.Performance.BenchmarkDiscoverer", "Xunit.NetCore.Extensions")]
- [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
- public class BenchmarkAttribute : Attribute, ITraitAttribute
- {
- public long InnerIterationCount { get; set; }
- }
-}
+++ /dev/null
-using System.Collections.Generic;
-using Xunit.Sdk;
-using Xunit.Abstractions;
-
-namespace Xunit.NetCore.Extensions
-{
- public class BenchmarkDiscoverer : ITraitDiscoverer
- {
- public IEnumerable<KeyValuePair<string, string>> GetTraits(IAttributeInfo traitAttribute)
- {
- yield return new KeyValuePair<string, string>("Benchmark", "True");
- }
- }
-}
+++ /dev/null
-../../../external/buildtools/src/xunit.netcore.extensions/*.cs
-../../../external/buildtools/src/xunit.netcore.extensions/Attributes/*.cs
-../../../external/buildtools/src/xunit.netcore.extensions/Discoverers/*.cs
-
-Microsoft.Xunit.Performance/BenchmarkAttribute.cs
-Microsoft.Xunit.Performance/BenchmarkDiscover.cs
namespace System.Diagnostics.Tracing
{
- public abstract class EventListener : IDisposable
+ public class EventListener : IDisposable
{
- protected EventListener ()
+ public EventListener ()
{
}
+ //public event System.EventHandler<EventSourceCreatedEventArgs> EventSourceCreated;
+ //public event System.EventHandler<EventWrittenEventArgs> EventWritten;
+
public static int EventSourceIndex(EventSource eventSource)
{
return 0;
{
}
- protected internal abstract void OnEventWritten (EventWrittenEventArgs eventData);
+ protected internal virtual void OnEventWritten (EventWrittenEventArgs eventData)
+ {
+ }
public virtual void Dispose()
{
}
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 {
+++ /dev/null
-//
-// System.Runtime.InteropServices.CALLCONV.cs
-//
-// Author:
-// Andreas Nahr (ClassDevelopment@A-SoftTech.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.
-//
-
-namespace System.Runtime.InteropServices
-{
- [Obsolete]
- [Serializable]
- public enum CALLCONV
- {
- CC_CDECL = 1,
- CC_PASCAL = 2,
- CC_MSCPASCAL = 2,
- CC_MACPASCAL = 3,
- CC_STDCALL = 4,
- CC_RESERVED = 5,
- CC_SYSCALL = 6,
- CC_MPWCDECL = 7,
- CC_MPWPASCAL = 8,
- CC_MAX = 9
- }
-}
+++ /dev/null
-
-//
-// 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.
-//
-
-// System.Runtime.InteropServices/DISPPARAMS.cs
-//
-// Paolo Molaro (lupus@ximian.com)
-//
-// (C) 2002 Ximian, Inc.
-
-using System;
-
-namespace System.Runtime.InteropServices
-{
- [Obsolete]
- [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Unicode)]
- public struct DISPPARAMS {
- public IntPtr rgvarg;
- public IntPtr rgdispidNamedArgs;
- public int cArgs;
- public int cNamedArgs;
- }
-}
-
+++ /dev/null
-//
-// System.Runtime.InteropServices.ELEMDESC.cs
-//
-// Author:
-// Andreas Nahr (ClassDevelopment@A-SoftTech.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.
-//
-
-namespace System.Runtime.InteropServices
-{
- [Obsolete]
- [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Unicode)]
- public struct ELEMDESC
- {
- public TYPEDESC tdesc;
- public DESCUNION desc;
-
- [ComVisible (false)]
- [StructLayout (LayoutKind.Explicit, CharSet = CharSet.Unicode)]
- public struct DESCUNION
- {
- [FieldOffset (0)]
- public IDLDESC idldesc;
- [FieldOffset (0)]
- public PARAMDESC paramdesc;
- }
- }
-}
+++ /dev/null
-
-//
-// 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.
-//
-
-// System.Runtime.InteropServices/EXCEPINFO.cs
-//
-// Paolo Molaro (lupus@ximian.com)
-//
-// (C) 2002 Ximian, Inc.
-
-using System;
-
-#if !FULL_AOT_RUNTIME
-namespace System.Runtime.InteropServices
-{
- [Obsolete]
- [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Unicode)]
- public struct EXCEPINFO {
- public short wCode;
- public short wReserved;
- [MarshalAs (UnmanagedType.BStr)]
- public string bstrSource;
- [MarshalAs (UnmanagedType.BStr)]
- public string bstrDescription;
- [MarshalAs (UnmanagedType.BStr)]
- public string bstrHelpFile;
- public int dwHelpContext;
- public IntPtr pvReserved;
- public IntPtr pfnDeferredFillIn;
- }
-}
-
-#endif
+++ /dev/null
-//
-// System.Runtime.InteropServices.FUNCDESC.cs
-//
-// Author:
-// Andreas Nahr (ClassDevelopment@A-SoftTech.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.
-//
-
-namespace System.Runtime.InteropServices
-{
- [Obsolete]
- [StructLayout (LayoutKind.Sequential)]
- public struct FUNCDESC
- {
- public int memid;
- public IntPtr lprgscode;
- public IntPtr lprgelemdescParam;
- public FUNCKIND funckind;
- public INVOKEKIND invkind;
- public CALLCONV callconv;
- public short cParams;
- public short cParamsOpt;
- public short oVft;
- public short cScodes;
- public ELEMDESC elemdescFunc;
- public short wFuncFlags;
- }
-}
+++ /dev/null
-//
-// System.Runtime.InteropServices.FUNCFLAGS.cs
-//
-// Author:
-// Andreas Nahr (ClassDevelopment@A-SoftTech.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.Runtime.InteropServices
-{
- [Obsolete]
- [Flags, Serializable]
- public enum FUNCFLAGS
- {
- FUNCFLAG_FRESTRICTED = 1,
- FUNCFLAG_FSOURCE = 2,
- FUNCFLAG_FBINDABLE = 4,
- FUNCFLAG_FREQUESTEDIT = 8,
- FUNCFLAG_FDISPLAYBIND = 16,
- FUNCFLAG_FDEFAULTBIND = 32,
- FUNCFLAG_FHIDDEN = 64,
- FUNCFLAG_FUSESGETLASTERROR = 128,
- FUNCFLAG_FDEFAULTCOLLELEM = 256,
- FUNCFLAG_FUIDEFAULT = 512,
- FUNCFLAG_FNONBROWSABLE = 1024,
- FUNCFLAG_FREPLACEABLE = 2048,
- FUNCFLAG_FIMMEDIATEBIND = 4096
- }
-}
+++ /dev/null
-//
-// System.Runtime.InteropServices.FUNCKIND.cs
-//
-// Author:
-// Andreas Nahr (ClassDevelopment@A-SoftTech.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.
-//
-
-namespace System.Runtime.InteropServices
-{
- [Obsolete]
- [Serializable]
- public enum FUNCKIND
- {
- FUNC_VIRTUAL = 0,
- FUNC_PUREVIRTUAL = 1,
- FUNC_NONVIRTUAL = 2,
- FUNC_STATIC = 3,
- FUNC_DISPATCH = 4
- }
-}
+++ /dev/null
-//
-// System.Runtime.InteropServices.IDLDESC.cs
-//
-// Author:
-// Andreas Nahr (ClassDevelopment@A-SoftTech.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.
-//
-
-namespace System.Runtime.InteropServices
-{
- [Obsolete]
- [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Unicode)]
- public struct IDLDESC
- {
- public int dwReserved;
- public IDLFLAG wIDLFlags;
- }
-}
+++ /dev/null
-//
-// System.Runtime.InteropServices.IDLFLAG.cs
-//
-// Author:
-// Andreas Nahr (ClassDevelopment@A-SoftTech.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.Runtime.InteropServices
-{
- [Obsolete]
- [Flags, Serializable]
- public enum IDLFLAG
- {
- IDLFLAG_NONE = 0,
- IDLFLAG_FIN = 1,
- IDLFLAG_FOUT = 2,
- IDLFLAG_FLCID = 4,
- IDLFLAG_FRETVAL = 8
- }
-}
+++ /dev/null
-//
-// System.Runtime.InteropServices.IMPLTYPEFLAGS.cs
-//
-// Author:
-// Andreas Nahr (ClassDevelopment@A-SoftTech.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.Runtime.InteropServices
-{
- [Obsolete]
- [Flags, Serializable]
- public enum IMPLTYPEFLAGS
- {
- IMPLTYPEFLAG_FDEFAULT = 1,
- IMPLTYPEFLAG_FSOURCE = 2,
- IMPLTYPEFLAG_FRESTRICTED = 4,
- IMPLTYPEFLAG_FDEFAULTVTABLE = 8
- }
-}
+++ /dev/null
-
-//
-// 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.
-//
-
-// System.Runtime.InteropServices/INVOKEKIND.cs
-//
-// Paolo Molaro (lupus@ximian.com)
-//
-// (C) 2002 Ximian, Inc.
-
-using System;
-
-namespace System.Runtime.InteropServices
-{
- [Obsolete]
- [Serializable]
- public enum INVOKEKIND {
- INVOKE_FUNC = 1,
- INVOKE_PROPERTYGET = 2,
- INVOKE_PROPERTYPUT = 4,
- INVOKE_PROPERTYPUTREF = 8
- }
-}
-
+++ /dev/null
-//
-// System.Runtime.InteropServices.PARAMDESC.cs
-//
-// Author:
-// Andreas Nahr (ClassDevelopment@A-SoftTech.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.
-//
-
-namespace System.Runtime.InteropServices
-{
- [Obsolete]
- [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Unicode)]
- public struct PARAMDESC
- {
- public IntPtr lpVarValue;
- public PARAMFLAG wParamFlags;
- }
-}
+++ /dev/null
-//
-// System.Runtime.InteropServices.PARAMFLAG.cs
-//
-// Author:
-// Andreas Nahr (ClassDevelopment@A-SoftTech.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.Runtime.InteropServices
-{
- [Obsolete]
- [Serializable]
- [Flags]
- public enum PARAMFLAG
- {
- PARAMFLAG_NONE = 0,
- PARAMFLAG_FIN = 1,
- PARAMFLAG_FOUT = 2,
- PARAMFLAG_FLCID = 4,
- PARAMFLAG_FRETVAL = 8,
- PARAMFLAG_FOPT = 16,
- PARAMFLAG_FHASDEFAULT = 32,
- PARAMFLAG_FHASCUSTDATA = 64
- }
-}
+++ /dev/null
-//
-// System.Runtime.InteropServices.TYPEATTR.cs
-//
-// Author:
-// Andreas Nahr (ClassDevelopment@A-SoftTech.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.
-//
-
-namespace System.Runtime.InteropServices
-{
- [Obsolete]
- [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Unicode)]
- public struct TYPEATTR
- {
- public const int MEMBER_ID_NIL = -1;
-
- public Guid guid;
- public int lcid;
- public int dwReserved;
- public int memidConstructor;
- public int memidDestructor;
- public IntPtr lpstrSchema;
- public int cbSizeInstance;
- public TYPEKIND typekind;
- public short cFuncs;
- public short cVars;
- public short cImplTypes;
- public short cbSizeVft;
- public short cbAlignment;
- public TYPEFLAGS wTypeFlags;
- public short wMajorVerNum;
- public short wMinorVerNum;
- public TYPEDESC tdescAlias;
- public IDLDESC idldescType;
- }
-}
+++ /dev/null
-//
-// System.Runtime.InteropServices.TYPEDESC.cs
-//
-// Author:
-// Andreas Nahr (ClassDevelopment@A-SoftTech.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.
-//
-
-namespace System.Runtime.InteropServices
-{
- [Obsolete]
- [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Unicode)]
- public struct TYPEDESC
- {
- public IntPtr lpValue;
- public short vt;
- }
-}
[Serializable]
internal class CADMethodRef
{
- internal string FullTypeName;
- internal IntPtr MethodHandlePtr;
+ Type[] GetTypes (string[] typeArray)
+ {
+ Type[] res = new Type [typeArray.Length];
+ for (int i = 0; i < typeArray.Length; ++i)
+ res [i] = Type.GetType (typeArray [i], true);
+ return res;
+ }
- public RuntimeMethodHandle MethodHandle {
- get {
- return new RuntimeMethodHandle (MethodHandlePtr);
- }
+ bool ctor;
+ string typeName;
+ string methodName;
+ string[] param_names;
+ string[] generic_arg_names;
+
+ public MethodBase Resolve ()
+ {
+ Type type = Type.GetType (typeName, true);
+ MethodBase sig_cand = null;
+ Type[] param_types = GetTypes (param_names);
+ if (ctor)
+ sig_cand = type.GetConstructor (BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Instance, null, param_types, null);
+ else
+ sig_cand = type.GetMethod (methodName, BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Instance, null, param_types, null);
+
+ if (sig_cand != null && generic_arg_names != null)
+ sig_cand = ((MethodInfo)sig_cand).MakeGenericMethod (GetTypes (generic_arg_names));
+
+ if (sig_cand == null)
+ throw new RemotingException ($"Method '{methodName}' not found in type '{typeName}'");
+
+ return sig_cand;
}
public CADMethodRef (IMethodMessage msg)
{
- MethodHandlePtr = msg.MethodBase.MethodHandle.Value;
- FullTypeName = msg.MethodBase.DeclaringType.AssemblyQualifiedName;
+ MethodBase method = msg.MethodBase;
+ typeName = method.DeclaringType.AssemblyQualifiedName;
+ ctor = method.IsConstructor;
+ methodName = method.Name;
+
+ if (!ctor && method.IsGenericMethod) {
+ var ga = method.GetGenericArguments ();
+ generic_arg_names = new string [ga.Length];
+ for (int i = 0; i < ga.Length; ++i)
+ generic_arg_names [i] = ga [i].AssemblyQualifiedName;
+
+ method = ((MethodInfo)method).GetGenericMethodDefinition ();
+ }
+
+ var param_types = method.GetParameters ();
+ param_names = new string [param_types.Length];
+ for (int i = 0; i < param_types.Length; ++i)
+ param_names [i] = param_types [i].ParameterType.AssemblyQualifiedName;
}
}
serializedMethod = CADSerializer.SerializeObject (methodRef).GetBuffer ();
}
- internal MethodBase method {
- get { return GetMethod (); }
- }
-
internal MethodBase GetMethod ()
{
CADMethodRef methRef = (CADMethodRef)CADSerializer.DeserializeObjectSafe (serializedMethod);
- MethodBase _method;
-
- Type tt = Type.GetType (methRef.FullTypeName, true);
- if (tt.IsGenericType || tt.IsGenericTypeDefinition) {
- _method = MethodBase.GetMethodFromHandleNoGenericCheck (methRef.MethodHandle);
- } else {
- _method = MethodBase.GetMethodFromHandle (methRef.MethodHandle);
- }
-
- if (tt != _method.DeclaringType) {
- // The target domain has loaded the type from a different assembly.
- // We need to locate the correct type and get the method from it
- Type [] signature = GetSignature (_method, true);
- if (_method.IsGenericMethod) {
- MethodBase [] methods = tt.GetMethods (BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Instance);
- Type [] base_args = _method.GetGenericArguments ();
- foreach (MethodBase method in methods) {
- if (!method.IsGenericMethod || method.Name != _method.Name)
- continue;
- Type [] method_args = method.GetGenericArguments ();
- if (base_args.Length != method_args.Length)
- continue;
-
- MethodInfo method_instance = ((MethodInfo) method).MakeGenericMethod (base_args);
- Type [] base_sig = GetSignature (method_instance, false);
- if (base_sig.Length != signature.Length) {
- continue;
- }
- bool dont = false;
- for (int i = base_sig.Length - 1; i >= 0; i--) {
- if (base_sig [i] != signature [i]) {
- dont = true;
- break;
- }
- }
- if (dont)
- continue;
- return method_instance;
- }
- return _method;
- }
-
- MethodBase mb = tt.GetMethod (_method.Name, BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Instance, null, signature, null);
- if (mb == null)
- throw new RemotingException ("Method '" + _method.Name + "' not found in type '" + tt + "'");
- return mb;
- }
- return _method;
+ return methRef.Resolve ();
}
static protected Type [] GetSignature (MethodBase methodBase, bool load)
}
return signature;
}
+
// Helper to marshal properties
internal static int MarshalProperties (IDictionary dict, ref ArrayList args) {
IDictionary serDict = dict;
_returnValue = MarshalArgument ( retMsg.ReturnValue, ref serializeList);
_args = MarshalArguments ( retMsg.Args, ref serializeList);
- _sig = GetSignature (method, true);
+ _sig = GetSignature (GetMethod (), true);
if (null != retMsg.Exception) {
if (null == serializeList)
//
namespace System.Security.AccessControl {
- public enum AceType {
+ public enum AceType : byte {
AccessAllowed = 0,
AccessDenied = 1,
SystemAudit = 2,
[Serializable]
[ComVisible (true)]
- public class PolicyException : SystemException, _Exception {
+ public class PolicyException : SystemException {
// Constructors
public PolicyException ()
: base (Locale.GetText ("Cannot run because of policy."))
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");
+ }
+ }
}
}
System.Reflection/ParameterInfo.cs
System.Reflection/PortableExecutableKinds.cs
System.Reflection/PropertyInfo.cs
-System.Reflection/ReflectionTypeLoadException.cs
System.Reflection/StrongNameKeyPair.cs
System.Reflection.Emit/AssemblyBuilder.cs
System.Reflection.Emit/AssemblyBuilderAccess.cs
System.Runtime.InteropServices/_TypeBuilder.cs
System.Runtime.InteropServices/BIND_OPTS.cs
System.Runtime.InteropServices/BINDPTR.cs
-System.Runtime.InteropServices/CALLCONV.cs
System.Runtime.InteropServices/DESCKIND.cs
-System.Runtime.InteropServices/DISPPARAMS.cs
-System.Runtime.InteropServices/ELEMDESC.cs
-System.Runtime.InteropServices/EXCEPINFO.cs
System.Runtime.InteropServices/ExporterEventKind.cs
System.Runtime.InteropServices/ExtensibleClassFactory.cs
System.Runtime.InteropServices/FILETIME.cs
-System.Runtime.InteropServices/FUNCDESC.cs
-System.Runtime.InteropServices/FUNCFLAGS.cs
-System.Runtime.InteropServices/FUNCKIND.cs
System.Runtime.InteropServices/GCHandle.cs
System.Runtime.InteropServices/GCHandleType.cs
-System.Runtime.InteropServices/IDLDESC.cs
-System.Runtime.InteropServices/IDLFLAG.cs
System.Runtime.InteropServices/IErrorInfo.cs
-System.Runtime.InteropServices/IMPLTYPEFLAGS.cs
-System.Runtime.InteropServices/INVOKEKIND.cs
System.Runtime.InteropServices/ITypeLibConverter.cs
System.Runtime.InteropServices/ITypeLibExporterNameProvider.cs
System.Runtime.InteropServices/ITypeLibExporterNotifySink.cs
System.Runtime.InteropServices/ManagedErrorInfo.cs
System.Runtime.InteropServices/Marshal.cs
System.Runtime.InteropServices/MarshalAsAttribute.cs
-System.Runtime.InteropServices/PARAMDESC.cs
-System.Runtime.InteropServices/PARAMFLAG.cs
System.Runtime.InteropServices/RegistrationClassContext.cs
System.Runtime.InteropServices/RegistrationConnectionType.cs
System.Runtime.InteropServices/STATSTG.cs
System.Runtime.InteropServices/SafeBuffer.cs
System.Runtime.InteropServices/SafeHandle.cs
System.Runtime.InteropServices/SYSKIND.cs
-System.Runtime.InteropServices/TYPEATTR.cs
-System.Runtime.InteropServices/TYPEDESC.cs
-System.Runtime.InteropServices/TYPEFLAGS.cs
-System.Runtime.InteropServices/TYPEKIND.cs
System.Runtime.InteropServices/TYPELIBATTR.cs
System.Runtime.InteropServices/TypeLibConverter.cs
System.Runtime.InteropServices/TypeLibExporterFlags.cs
System.Runtime.InteropServices/UCOMIRunningObjectTable.cs
System.Runtime.InteropServices/UCOMIStream.cs
System.Runtime.InteropServices/UCOMITypeComp.cs
-System.Runtime.InteropServices/UCOMITypeInfo.cs
System.Runtime.InteropServices/UCOMITypeLib.cs
-System.Runtime.InteropServices/VARDESC.cs
-System.Runtime.InteropServices/VARFLAGS.cs
System.Runtime.InteropServices/CustomQueryInterfaceMode.cs
System.Runtime.InteropServices/ComEventsHelper.cs
../referencesource/mscorlib/system/reflection/pointer.cs
../referencesource/mscorlib/system/reflection/propertyattributes.cs
../referencesource/mscorlib/system/reflection/reflectioncontext.cs
+../referencesource/mscorlib/system/reflection/reflectiontypeloadexception.cs
../referencesource/mscorlib/system/reflection/resourceattributes.cs
../referencesource/mscorlib/system/reflection/RuntimeReflectionExtensions.cs
../referencesource/mscorlib/system/reflection/targetexception.cs
../referencesource/mscorlib/system/runtime/interopservices/safearraytypemismatchexception.cs
../referencesource/mscorlib/system/runtime/interopservices/safehandle.cs
../referencesource/mscorlib/system/runtime/interopservices/sehexception.cs
+../referencesource/mscorlib/system/runtime/interopservices/ucomitypeinfo.cs
../referencesource/mscorlib/system/runtime/interopservices/ucomienumconnections.cs
../referencesource/mscorlib/system/runtime/interopservices/unknownwrapper.cs
../referencesource/mscorlib/system/runtime/interopservices/variantWrapper.cs
../../../external/corert/src/System.Private.CoreLib/shared/System/Diagnostics/Debug.cs
../../../external/corert/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/IsReadOnlyAttribute.cs
+../../../external/corert/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/IsByRefLikeAttribute.cs
../../../external/corert/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/ITuple.cs
../../../external/corert/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/RuntimeFeature.cs
../../../external/corert/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TupleElementNamesAttribute.cs
corefx/SR.cs
+../../../external/corefx/src/System.Collections/src/System/Collections/Generic/CollectionExtensions.cs
+
../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/CDSCollectionETWBCLProvider.cs
../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentDictionary.cs
../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentQueue.cs
VARFLAG_FIMMEDIATEBIND =0x1000
}
+#if !FULL_AOT_RUNTIME
[Obsolete("Use System.Runtime.InteropServices.ComTypes.ITypeInfo instead. http://go.microsoft.com/fwlink/?linkid=14202", false)]
[Guid("00020401-0000-0000-C000-000000000046")]
[InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
void ReleaseFuncDesc(IntPtr pFuncDesc);
void ReleaseVarDesc(IntPtr pVarDesc);
}
+#endif
}
--- /dev/null
+// CS0019: Operator `??' cannot be applied to operands of type `void' and `throw expression'
+// Line: 20
+
+class C
+{
+ public static void Main ()
+ {
+ var s = Main () ?? throw null;
+ }
+}
\ No newline at end of file
--- /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
+// CS0128: A local variable named `s' is already defined in this scope
+// Line: 12
+
+class C
+{
+ public static void Main ()
+ {
+ object o = null;
+
+ var x1 = o is string s;
+ var x2 = o is string s;
+ }
+}
--- /dev/null
+// CS0136: A local variable named `s' cannot be declared in this scope because it would give a different meaning to `s', which is already used in a `parent or current' scope to denote something else
+// Line: 10
+
+internal class Program
+{
+ public static void Main ()
+ {
+ object o = null;
+ if (o is string s) {
+ int s = 1;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+// CS0155: The type caught or thrown must be derived from System.Exception
+// Line: 9
+
+class X
+{
+ public int Test () => throw "";
+}
--- /dev/null
+// CS0162: Unreachable code detected
+// Line: 12
+// Compiler options: -warnaserror -warn:2
+
+using System;
+
+class X
+{
+ void Test ()
+ {
+ var x = true ? throw new NullReferenceException () : 1;
+ x = 2;
+ return;
+ }
+
+ static void Main ()
+ {
+ }
+}
--- /dev/null
+// CS0165: Use of unassigned local variable `s'
+// Line: 12
+
+class X
+{
+ static string Foo (object arg)
+ {
+ if (arg is string s) {
+
+ }
+
+ return s;
+ }
+}
\ No newline at end of file
--- /dev/null
+// CS0173: Type of conditional expression cannot be determined because there is no implicit conversion between `throw expression' and `throw expression'
+// Line: 8
+
+class C
+{
+ public static void Test (bool b)
+ {
+ var s = b ? throw null : throw null;
+ }
+}
\ No newline at end of file
--- /dev/null
+// CS0411: The type arguments for method `C.Foo<T>(System.Func<T>)' cannot be inferred from the usage. Try specifying the type arguments explicitly
+// Line: 10
+
+using System;
+
+public class C
+{
+ public static void Main ()
+ {
+ Foo (() => throw null);
+ }
+
+ static void Foo<T> (Func<T> arg)
+ {
+ }
+}
\ 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
-// CS1061: Type `int' does not contain a definition for `GetValueOrDefault' and no extension method `GetValueOrDefault' of type `int' could be found. Are you missing an assembly reference?
+// CS1061: Type `int' does not contain a definition for `GetValueOrDefault' and no extension method `GetValueOrDefault' of type `int' could be found. Are you missing `System.Collections.Generic' using directive?
// Line: 9
class C
+++ /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
-// CS1617: Invalid -langversion option `ISO'. It must be `ISO-1', `ISO-2', Default or value in range 1 to 6
+// CS1617: Invalid -langversion option `ISO'. It must be `ISO-1', `ISO-2', Default or value in range 1 to 7
// Line: 0
// Compiler options: -langversion:ISO
-// 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
+// CS1644: Feature `throw expression' cannot be used because it is not part of the C# 6.0 language specification
+// Line: 5
+// Compiler options: -langversion:6
+
+static class Class
+{
+ int Prop => throw null;
+}
--- /dev/null
+// CS1644: Feature `pattern matching' cannot be used because it is not part of the C# 6.0 language specification
+// Line: 9
+// Compiler options: -langversion:6
+
+class Class
+{
+ static void Foo (object arg)
+ {
+ if (arg is Type v) {
+ return;
+ }
+ }
+}
+++ /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
+// CS8116: The nullable type `byte?' pattern matching is not allowed. Consider using underlying type `byte'
+// Line: 11
+
+using System;
+
+class C
+{
+ public static void Main ()
+ {
+ object o2 = null;
+ bool r2 = o2 is Nullable<byte> t3;
+ }
+}
\ No newline at end of file
--- /dev/null
+// CS8117: Cannot use null as pattern matching operand
+// Line: 8
+
+class C
+{
+ static object Test ()
+ {
+ return null is object res;
+ }
+}
\ No newline at end of file
--- /dev/null
+// CS8122: An expression tree cannot contain a pattern matching operator
+// Line: 12
+
+using System;
+using System.Linq.Expressions;
+
+class X
+{
+ public static void Main ()
+ {
+ object o = 1;
+ Expression<Func<bool>> e = () => o is int y;
+ }
+}
\ No newline at end of file
--- /dev/null
+// CS8188: An expression tree cannot not contain a throw expression
+// Line: 11
+
+using System;
+using System.Linq.Expressions;
+
+class C
+{
+ public static void Main ()
+ {
+ Expression<Func<object>> l = () => throw null;
+ }
+}
\ 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: 8
+
+using System;
+
+public class C
+{
+ event Action H = Foo (out var res);
+
+ static Action Foo (out int arg)
+ {
+ arg = 2;
+ return null;
+ }
+}
--- /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 () is string s;
+
+ static object Foo ()
+ {
+ return null;
+ }
+}
\ 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
+
+class X
+{
+ public static bool Test { get; } = Foo () is bool x;
+
+ static object Foo ()
+ {
+ 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
--- /dev/null
+// CS8208: The type `dynamic' pattern matching is not allowed
+// Line: 9
+
+static class Program
+{
+ public static void Main ()
+ {
+ object o = null;
+ if (o is dynamic res) {
+ }
+ }
+}
fc.TryFinally = prev_tf;
}
- public override void MarkReachable (Reachability rc)
+ public override Reachability MarkReachable (Reachability rc)
{
block.MarkReachable (rc);
+ return rc;
}
public void SetHasThisAccess ()
//
// 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;
+ }
+ }
}
}
}
}
- public override void MarkReachable (Reachability rc)
+ public override Reachability MarkReachable (Reachability rc)
{
- var es = source as ExpressionStatement;
- if (es != null)
- es.MarkReachable (rc);
+ return source.MarkReachable (rc);
}
}
stmt.EmitStatement (ec);
}
- public override void MarkReachable (Reachability rc)
+ public override Reachability MarkReachable (Reachability rc)
{
- base.MarkReachable (rc);
- stmt.MarkReachable (rc);
+ return stmt.MarkReachable (rc);
}
public override object Accept (StructuralVisitor visitor)
ec.Emit (OpCodes.Ret);
}
- public override void MarkReachable (Reachability rc)
+ public override Reachability MarkReachable (Reachability rc)
{
//
// Reachability has been done in AsyncInitializerStatement
//
+ return rc;
}
}
//
lc = left as EnumConstant;
rc = right as EnumConstant;
- if (lc != null || rc != null){
+ if (lc != null || rc != null) {
+ TypeSpec res_type;
if (lc == null) {
- lc = rc;
- lt = lc.Type;
- right = left;
- }
+ res_type = right.Type;
- // U has to be implicitly convetible to E.base
- right = right.ConvertImplicitly (lc.Child.Type);
- if (right == null)
- return null;
+ // Y has to be implicitly convertible to E.base
+ left = left.ConvertImplicitly (rc.Child.Type);
+ if (left == null)
+ return null;
- result = BinaryFold (ec, oper, lc.Child, right, loc);
+ right = rc.Child;
+ } else {
+ res_type = left.Type;
+
+ // U has to be implicitly convertible to E.base
+ right = right.ConvertImplicitly (lc.Child.Type);
+ if (right == null)
+ return null;
+
+ left = lc.Child;
+ }
+
+ result = BinaryFold (ec, oper, left, right, loc);
if (result == null)
return null;
- result = result.Reduce (ec, lt);
+ result = result.Reduce (ec, res_type);
if (result == null)
return null;
- return new EnumConstant (result, lt);
+ return new EnumConstant (result, res_type);
}
if (left is NullLiteral && right is NullLiteral) {
{
Normal = 0,
Probing = 1,
- IgnoreAccessibility = 2
+ IgnoreAccessibility = 2,
+ IgnoreStaticUsing = 1 << 10
}
//
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.
///
variable.SetAssigned (DefiniteAssignment, generatedAssignment);
}
+ public void SetVariableAssigned (VariableInfo variable, DefiniteAssignmentBitSet da)
+ {
+ variable.SetAssigned (da, false);
+ }
+
public void SetStructFieldAssigned (VariableInfo variable, string name)
{
variable.SetStructFieldAssigned (DefiniteAssignment, name);
if (expr_type == target_type)
return true;
+ if (expr_type == InternalType.ThrowExpr)
+ return target_type.Kind != MemberKind.InternalCompilerType;
+
if (target_type.IsNullableType)
return ImplicitNulableConversion (null, expr, target_type) != null;
Expression e;
if (expr_type == target_type) {
- if (expr_type != InternalType.NullLiteral && expr_type != InternalType.AnonymousMethod)
+ if (expr_type != InternalType.NullLiteral && expr_type != InternalType.AnonymousMethod && expr_type != InternalType.ThrowExpr)
return expr;
return null;
}
return null;
}
+ if (expr_type == InternalType.ThrowExpr) {
+ return target_type.Kind == MemberKind.InternalCompilerType ? null : EmptyCast.Create (expr, target_type);
+ }
+
if (target_type.IsNullableType)
return ImplicitNulableConversion (ec, expr, target_type);
%token STRUCT
%token SWITCH
%token THIS
-%token THROW
+%token THROW
%token TRUE
%token TRY
%token TYPEOF
%token WHEN
%token INTERPOLATED_STRING
%token INTERPOLATED_STRING_END
+%token THROW_EXPR
/* C# keywords which are not really keywords */
%token GET
$$ = 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 FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), null);
lbag.AddLocation ($$, GetLocation ($1));
}
- | COMMA IDENTIFIER ASSIGN
- {
- ++lexer.parsing_block;
- }
- event_variable_initializer
+ | COMMA IDENTIFIER ASSIGN event_variable_initializer
{
- --lexer.parsing_block;
var lt = (LocatedToken) $2;
- $$ = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), (Expression) $5);
+ $$ = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), (Expression) $4);
lbag.AddLocation ($$, GetLocation ($1), GetLocation ($3));
}
;
if ((current_event_field.ModFlags & Modifiers.ABSTRACT) != 0) {
report.Error (74, lexer.Location, "`{0}': abstract event cannot have an initializer",
current_event_field.GetSignatureForError ());
- }
+ }
+
+ ++lexer.parsing_block;
+ current_local_parameters = ParametersCompiled.EmptyReadOnlyParameters;
+ start_block (lexer.Location);
}
variable_initializer
{
$$ = $2;
+
+ --lexer.parsing_block;
+ end_block (lexer.Location);
+ current_local_parameters = null;
}
;
$$ = 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
$$ = new Await ((Expression) $2, GetLocation ($1));
}
+ | THROW_EXPR prefixed_unary_expression
+ {
+ if (lang_version < LanguageVersion.V_7)
+ FeatureIsNotAvailable (lexer.Location, "throw expression");
+
+ $$ = new ThrowExpression ((Expression) $2, GetLocation ($1));
+ }
| BANG error
{
Error_SyntaxError (yyToken);
{
var is_expr = new Is ((Expression) $1, (Expression) $3, GetLocation ($2));
if ($4 != null) {
- if (lang_version != LanguageVersion.Experimental)
- FeatureIsNotAvailable (GetLocation ($4), "type pattern matching");
+ if (lang_version < LanguageVersion.V_7)
+ FeatureIsNotAvailable (GetLocation ($4), "pattern matching");
var lt = (LocatedToken) $4;
- is_expr.Variable = new LocalVariable (current_block, lt.Value, lt.Location);
- current_block.AddLocalName (is_expr.Variable);
+ var lv = new LocalVariable (current_block, lt.Value, lt.Location);
+ is_expr.Variable = lv;
+ current_block.AddLocalName (lv);
}
$$ = is_expr;
$$ = new Conditional (new BooleanExpression ((Expression) $1), (Expression) $3, (Expression) $5, GetLocation ($2));
lbag.AddLocation ($$, GetLocation ($4));
}
+ | null_coalescing_expression INTERR expression COLON THROW prefixed_unary_expression
+ {
+ if (lang_version < LanguageVersion.V_7)
+ FeatureIsNotAvailable (lexer.Location, "throw expression");
+
+ var expr = new ThrowExpression ((Expression) $6, GetLocation ($5));
+ $$ = new Conditional (new BooleanExpression ((Expression) $1), (Expression) $3, expr, GetLocation ($2));
+ lbag.AddLocation ($$, GetLocation ($4));
+ }
| null_coalescing_expression INTERR expression error
{
Error_SyntaxError (yyToken);
;
throw_statement
- : THROW opt_expression SEMICOLON
+ : THROW expression SEMICOLON
{
$$ = new Throw ((Expression) $2, GetLocation ($1));
lbag.AddStatement ($$, GetLocation ($3));
}
+ | THROW SEMICOLON
+ {
+ $$ = new Throw (null, GetLocation ($1));
+ lbag.AddStatement ($$, GetLocation ($2));
+ }
| THROW expression error
{
Error_SyntaxError (yyToken);
}
}
-Block
-end_block (Location loc)
+Block end_block (Location loc)
{
Block retval = current_block.Explicit;
retval.SetEndLocation (loc);
case Token.THIS:
return "this";
case Token.THROW:
+ case Token.THROW_EXPR:
return "throw";
case Token.TRUE:
return "true";
if (parsing_block == 0)
res = -1;
+ break;
+ case Token.THROW:
+ switch (current_token) {
+ case Token.ARROW:
+ case Token.OP_COALESCING:
+ case Token.INTERR:
+ res = Token.THROW_EXPR;
+ break;
+ }
+
break;
}
}
if (d == '.') {
- return Token.INTERR_OPERATOR;
+ d = reader.Peek ();
+ return d >= '0' && d <= '9' ? Token.INTERR : Token.INTERR_OPERATOR;
}
if (d != ' ') {
case Token.THIS:
case Token.NEW:
case Token.INTERPOLATED_STRING:
+ case Token.THROW:
next_token = Token.INTERR;
break;
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);
}
}
return null;
}
+ protected void CheckExpressionVariable (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");
+ }
+ }
+
public static void ErrorIsInaccesible (IMemberContext rc, string member, Location loc)
{
rc.Module.Compiler.Report.Error (122, loc, "`{0}' is inaccessible due to its protection level", member);
ec.Emit (OpCodes.Pop);
}
+ public virtual void EmitPrepare (EmitContext ec)
+ {
+ }
+
//
// Emits the expression into temporary field variable. The method
// should be used for await expressions only
{
}
+ public virtual Reachability MarkReachable (Reachability rc)
+ {
+ return rc;
+ }
+
//
// Special version of flow analysis for expressions which can return different
// on-true and on-false result. Used by &&, ||, ?: expressions
/// </summary>
public abstract class ExpressionStatement : Expression
{
- public virtual void MarkReachable (Reachability rc)
- {
- }
-
public virtual ExpressionStatement ResolveStatement (BlockContext ec)
{
Expression e = Resolve (ec);
#endif
}
+ public override Reachability MarkReachable (Reachability rc)
+ {
+ return child.MarkReachable (rc);
+ }
+
protected override void CloneTo (CloneContext clonectx, Expression t)
{
// Nothing to clone
{
return orig_expr.MakeExpression (ctx);
}
+
+ public override Reachability MarkReachable (Reachability rc)
+ {
+ return expr.MarkReachable (rc);
+ }
}
//
return null;
}
- public bool IsPossibleTypeOrNamespace (IMemberContext mc)
+ bool IsPossibleTypeOrNamespace (IMemberContext mc)
{
- return mc.LookupNamespaceOrType (Name, Arity, LookupMode.Probing, loc) != null;
+ //
+ // Has to ignore static usings because we are looking for any member not just type
+ // in this context
+ //
+ return mc.LookupNamespaceOrType (Name, Arity, LookupMode.Probing | LookupMode.IgnoreStaticUsing, loc) != null;
}
public bool IsPossibleType (IMemberContext mc)
return me;
}
+ //
+ // Stage 3: Lookup nested types, namespaces and type parameters in the context
+ //
+ if ((restrictions & MemberLookupRestrictions.InvocableOnly) == 0 && !variable_found) {
+ if (IsPossibleTypeOrNamespace (rc)) {
+ return ResolveAsTypeOrNamespace (rc, false);
+ }
+ }
+
var expr = NamespaceContainer.LookupStaticUsings (rc, Name, Arity, loc);
if (expr != null) {
if (Arity > 0) {
return expr;
}
- //
- // Stage 3: Lookup nested types, namespaces and type parameters in the context
- //
- if ((restrictions & MemberLookupRestrictions.InvocableOnly) == 0 && !variable_found) {
- if (IsPossibleTypeOrNamespace (rc)) {
- return ResolveAsTypeOrNamespace (rc, false);
- }
- }
-
if ((restrictions & MemberLookupRestrictions.NameOfExcluded) == 0 && Name == "nameof")
return new NameOf (this);
expr.EmitSideEffect (ec);
}
+ public override void EmitPrepare (EmitContext ec)
+ {
+ expr.EmitPrepare (ec);
+ }
+
public override void FlowAnalysis (FlowAnalysisContext fc)
{
expr.FlowAnalysis (fc);
public override Expression CreateExpressionTree (ResolveContext ec)
{
if (Variable != null)
- throw new NotSupportedException ();
+ ec.Report.Error (8122, loc, "An expression tree cannot contain a pattern matching operator");
Arguments args = Arguments.CreateForExpressionTree (ec, null,
expr.CreateExpressionTree (ec),
ec.Emit (on_true ? OpCodes.Brtrue : OpCodes.Brfalse, target);
}
+ public override void EmitPrepare (EmitContext ec)
+ {
+ base.EmitPrepare (ec);
+
+ if (Variable != null)
+ Variable.CreateBuilder (ec);
+ }
+
void EmitPatternMatch (EmitContext ec)
{
var no_match = ec.DefineLabel ();
value_on_stack = false;
}
- Variable.CreateBuilder (ec);
+ //
+ // It's ok to have variable builder create out of order. It simplified emit
+ // of statements like while (condition) { }
+ //
+ if (!Variable.Created)
+ Variable.CreateBuilder (ec);
+
Variable.EmitAssign (ec);
if (expr_unwrap != null) {
fc.SetVariableAssigned (Variable.VariableInfo, true);
}
+ public override void FlowAnalysisConditional (FlowAnalysisContext fc)
+ {
+ if (Variable == null) {
+ base.FlowAnalysisConditional (fc);
+ return;
+ }
+
+ expr.FlowAnalysis (fc);
+
+ fc.DefiniteAssignmentOnTrue = fc.BranchDefiniteAssignment ();
+ fc.DefiniteAssignmentOnFalse = fc.DefiniteAssignment;
+
+ fc.SetVariableAssigned (Variable.VariableInfo, fc.DefiniteAssignmentOnTrue);
+ }
+
protected override void ResolveProbeType (ResolveContext rc)
{
if (!(ProbeType is TypeExpr) && rc.Module.Compiler.Settings.Version == LanguageVersion.Experimental) {
Expression ResolveResultExpression (ResolveContext ec)
{
+ if (Variable != null) {
+ if (expr is NullLiteral) {
+ ec.Report.Error (8117, loc, "Cannot use null as pattern matching operand");
+ return this;
+ }
+
+ CheckExpressionVariable (ec);
+ }
+
TypeSpec d = expr.Type;
bool d_is_nullable = false;
// If E is a method group or the null literal, or if the type of E is a reference
// type or a nullable type and the value of E is null, the result is false
//
- if (expr.IsNull || expr.eclass == ExprClass.MethodGroup)
+ if (expr.IsNull)
return CreateConstantResult (ec, false);
if (d.IsNullableType) {
TypeSpec t = probe_type_expr;
bool t_is_nullable = false;
if (t.IsNullableType) {
+ if (Variable != null) {
+ ec.Report.Error (8116, loc, "The nullable type `{0}' pattern matching is not allowed. Consider using underlying type `{1}'",
+ t.GetSignatureForError (), Nullable.NullableInfo.GetUnderlyingType (t).GetSignatureForError ());
+ }
+
var ut = Nullable.NullableInfo.GetUnderlyingType (t);
if (!ut.IsGenericParameter) {
t = ut;
return ResolveGenericParameter (ec, d, tps);
if (t.BuiltinType == BuiltinTypeSpec.Type.Dynamic) {
- ec.Report.Warning (1981, 3, loc,
- "Using `{0}' to test compatibility with `{1}' is identical to testing compatibility with `object'",
- OperatorName, t.GetSignatureForError ());
+ if (Variable != null) {
+ ec.Report.Error (8208, loc, "The type `{0}' pattern matching is not allowed", t.GetSignatureForError ());
+ } else {
+ ec.Report.Warning (1981, 3, loc,
+ "Using `{0}' to test compatibility with `{1}' is identical to testing compatibility with `object'",
+ OperatorName, t.GetSignatureForError ());
+ }
}
if (TypeManager.IsGenericParameter (d))
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)
{
+ CheckExpressionVariable (rc);
+
var var_expr = VariableType as VarExpr;
if (var_expr != null) {
type = InternalType.VarOutType;
return value;
}
}
+
+ class ThrowExpression : ExpressionStatement
+ {
+ Expression expr;
+
+ public ThrowExpression (Expression expr, Location loc)
+ {
+ this.expr = expr;
+ this.loc = loc;
+ }
+
+ protected override void CloneTo (CloneContext clonectx, Expression t)
+ {
+ var target = (ThrowExpression)t;
+ target.expr = expr.Clone (clonectx);
+ }
+
+ public override bool ContainsEmitWithAwait ()
+ {
+ return expr.ContainsEmitWithAwait ();
+ }
+
+ public override Expression CreateExpressionTree (ResolveContext rc)
+ {
+ rc.Report.Error (8188, loc, "An expression tree cannot not contain a throw expression");
+ return expr;
+ }
+
+ protected override Expression DoResolve (ResolveContext rc)
+ {
+ expr = expr.Resolve (rc, ResolveFlags.Type | ResolveFlags.VariableOrValue);
+
+ if (expr == null)
+ return null;
+
+ expr = Throw.ConvertType (rc, expr);
+
+ eclass = ExprClass.Value;
+ type = InternalType.ThrowExpr;
+ return this;
+ }
+
+ public override void Emit (EmitContext ec)
+ {
+ EmitStatement (ec);
+ }
+
+ public override void EmitStatement (EmitContext ec)
+ {
+ expr.Emit (ec);
+
+ ec.Emit (OpCodes.Throw);
+ }
+
+ public override void FlowAnalysis (FlowAnalysisContext fc)
+ {
+ expr.FlowAnalysis (fc);
+ }
+
+ public override Reachability MarkReachable (Reachability rc)
+ {
+ return Reachability.CreateUnreachable ();
+ }
+ }
}
// Some types cannot be used as type arguments
//
if ((bound.Type.Kind == MemberKind.Void && !voidAllowed) || bound.Type.IsPointer || bound.Type.IsSpecialRuntimeType ||
- bound.Type == InternalType.MethodGroup || bound.Type == InternalType.AnonymousMethod || bound.Type == InternalType.VarOutType)
+ bound.Type == InternalType.MethodGroup || bound.Type == InternalType.AnonymousMethod || bound.Type == InternalType.VarOutType ||
+ bound.Type == InternalType.ThrowExpr)
return;
var a = bounds [index];
{
}
- 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)
match = texpr_fne;
}
- if (types_using_table != null) {
+ if (types_using_table != null && (mode & LookupMode.IgnoreStaticUsing) == 0) {
foreach (var using_type in types_using_table) {
var type = MemberCache.FindNestedType (using_type, name, arity, true);
if (type == null)
type = ltype;
return this;
}
+ } else if (ltype == InternalType.ThrowExpr) {
+ //
+ // LAMESPEC: I am not really sure what's point of allowing throw on left side
+ //
+ return ReducedExpression.Create (right, this, false).Resolve (ec);
} else {
return null;
}
case LanguageVersion.V_6:
version = "6.0";
break;
+ case LanguageVersion.V_7:
+ version = "7.0";
+ break;
default:
throw new InternalErrorException ("Invalid feature version", compiler.Settings.Version);
}
V_4 = 4,
V_5 = 5,
V_6 = 6,
+ V_7 = 7,
Experimental = 100,
- Default = LanguageVersion.V_6,
+ Default = V_7,
}
public enum RuntimeVersion
case "6":
settings.Version = LanguageVersion.V_6;
return ParseResult.Success;
+ case "7":
+ settings.Version = LanguageVersion.V_7;
+ return ParseResult.Success;
case "experimental":
settings.Version = LanguageVersion.Experimental;
return ParseResult.Success;
- case "future":
- report.Warning (8000, 1, "Language version `future' is no longer supported");
- goto case "6";
}
- report.Error (1617, "Invalid -langversion option `{0}'. It must be `ISO-1', `ISO-2', Default or value in range 1 to 6", value);
+ report.Error (1617, "Invalid -langversion option `{0}'. It must be `ISO-1', `ISO-2', Default or value in range 1 to 7", value);
return ParseResult.Error;
case "/codepage":
ec.Emit (OpCodes.Br, ec.LoopBegin);
ec.MarkLabel (while_loop);
+ expr.EmitPrepare (ec);
+
Statement.Emit (ec);
ec.MarkLabel (ec.LoopBegin);
public class Return : ExitStatement
{
Expression expr;
+ bool expr_returns;
public Return (Expression expr, Location l)
{
if (expr != null)
expr.FlowAnalysis (fc);
- base.DoFlowAnalysis (fc);
+ if (!expr_returns)
+ base.DoFlowAnalysis (fc);
+
return true;
}
public override Reachability MarkReachable (Reachability rc)
{
base.MarkReachable (rc);
+
+ if (Expr != null) {
+ rc = Expr.MarkReachable (rc);
+ expr_returns = rc.IsUnreachable;
+ }
+
return Reachability.CreateUnreachable ();
}
}
}
+ public static Expression ConvertType (ResolveContext rc, Expression expr)
+ {
+ var et = rc.BuiltinTypes.Exception;
+ if (Convert.ImplicitConversionExists (rc, expr, et))
+ expr = Convert.ImplicitConversion (rc, expr, et, expr.Location);
+ else {
+ rc.Report.Error (155, expr.Location, "The type caught or thrown must be derived from System.Exception");
+ expr = EmptyCast.Create (expr, et);
+ }
+
+ return expr;
+ }
+
public override bool Resolve (BlockContext ec)
{
if (expr == null) {
if (expr == null)
return false;
- var et = ec.BuiltinTypes.Exception;
- if (Convert.ImplicitConversionExists (ec, expr, et))
- expr = Convert.ImplicitConversion (ec, expr, et, loc);
- else
- ec.Report.Error (155, expr.Location, "The type caught or thrown must be derived from System.Exception");
+ expr = ConvertType (ec, expr);
return true;
}
public override Reachability MarkReachable (Reachability rc)
{
- var init = initializer as ExpressionStatement;
- if (init != null)
- init.MarkReachable (rc);
-
- return base.MarkReachable (rc);
+ base.MarkReachable (rc);
+ return initializer == null ? rc : initializer.MarkReachable (rc);
}
protected override void CloneTo (CloneContext clonectx, Statement target)
}
}
+ public bool Created {
+ get {
+ return builder != null;
+ }
+ }
+
public bool IsDeclared {
get {
return type != null;
public static readonly InternalType Namespace = new InternalType ("<namespace>");
public static readonly InternalType ErrorType = new InternalType ("<error>");
public static readonly InternalType VarOutType = new InternalType ("var out");
+ public static readonly InternalType ThrowExpr = new InternalType ("throw expression");
readonly string name;
var t = (Int32)sbyte.MaxValue;
}
+ void Test_22 (bool args)
+ {
+ var x = args ?.2f : -.2f;
+ }
+
static void Helper<T> (T arg)
{
}
# csXXXX.cs IGNORE : adds test to ignore list
gtest-230.cs
+test-pattern-02.cs
--- /dev/null
+using System;
+
+class X
+{
+ public static void Main ()
+ {
+
+ }
+
+ int ImportScope (int scope)
+ {
+ switch (scope) {
+ case 200:
+ throw new NotImplementedException ();
+ }
+
+ throw new NotSupportedException ();
+ }
+}
\ No newline at end of file
return 3;
if (Test.A == Test.B)
return 4;
+
+ const A e2 = 3 - A.b;
+ if (e2 != A.a)
+ return 5;
return 0;
}
-// 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
-// Compiler options: -langversion:experimental
-
using System;
class TypePattern
{
object o = 3;
bool r = o is System.String t1;
- if (t1 != null)
- return 1;
-
if (r)
return 2;
if (o is string t2)
return 3;
- if (t2 != null)
- return 4;
-
- object o2 = (int?) 4;
- bool r2 = o2 is byte? t3;
-
- if (t3 != null)
- return 5;
-
- if (r2)
- return 6;
-
long? l = 5;
bool r3 = l is long t4;
- if (t4 != 5)
- return 7;
if (!r3)
return 8;
Console.WriteLine ("ok");
return 0;
}
+
+ static void Test1 (object arg)
+ {
+ while (arg is int b) {
+ b = 2;
+ }
+ }
+
+ static string Test2 (object arg)
+ {
+ if (arg is string s) {
+ return s;
+ } else {
+ s = "";
+ }
+
+ return s;
+ }
}
\ No newline at end of file
object o4 = (byte?)255;
var ggg = o4 is 255;
- if (!ggg)
+ if (ggg)
return 8;
if (o4 is null)
return 9;
object o5 = (double)-255;
- if (!(o5 is -byte.MaxValue))
+ if (o5 is -byte.MaxValue)
return 10;
object o6 = MyEnum.V_4;
--- /dev/null
+using System;
+using static TestClass;
+
+internal class Program
+{
+ public static void Main (string[] args)
+ {
+ var res = Directions.Up;
+ }
+}
+
+public enum Directions
+{
+ Up,
+ NotUp,
+}
+
+public static class TestClass
+{
+ public static int Directions;
+}
--- /dev/null
+using System;
+
+class X
+{
+ public static void Main ()
+ {
+ Func<object> f = () => throw null;
+ }
+
+ public int Test () => throw null;
+
+ object Foo ()
+ {
+ return null;
+ }
+
+ public object Test2 () => Foo () ?? throw null;
+
+ static void Test3 (out int z) => throw null;
+
+ int this [int x] {
+ get => throw null;
+ }
+
+ public event Action Event {
+ add => throw null;
+ remove => throw null;
+ }
+
+ void TestExpr_1 (bool b)
+ {
+ int x = b ? throw new NullReferenceException () : 1;
+ }
+
+ void TestExpr_2 (bool b)
+ {
+ int x = b ? 2 : throw new NullReferenceException ();
+ }
+
+ void TestExpr_3 (string s)
+ {
+ s = s ?? throw new NullReferenceException ();
+ }
+
+ void TestExpr_4 ()
+ {
+ throw new ApplicationException () ?? throw new NullReferenceException() ?? throw null;
+ }
+
+ void TestExpr_5 ()
+ {
+ Action a = () => throw new ApplicationException () ?? throw new NullReferenceException() ?? throw null;
+ }
+
+ static int TestExpr_6 (out int z) => throw null;
+
+ int TestExpr_7 (out int z)
+ {
+ return true ? throw new NullReferenceException () : 1;
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+class Program
+{
+ public static int Main ()
+ {
+ Console.WriteLine (M (1));
+ try {
+ Console.WriteLine (M (null));
+ } catch (Exception) {
+ Console.WriteLine ("thrown");
+ return 0;
+ }
+
+ return 1;
+ }
+
+ static string M (object data)
+ {
+ return data?.ToString () ?? throw null;
+ }
+}
\ 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">
</method>
</type>
</test>
+ <test name="test-946.cs">
+ <type name="X">
+ <method name="Void Main()" attrs="150">
+ <size>2</size>
+ </method>
+ <method name="Int32 ImportScope(Int32)" attrs="129">
+ <size>29</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="test-95.cs">
<type name="X">
<method name="Int32 Main()" attrs="150">
<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>
<test name="test-pattern-01.cs">
<type name="TypePattern">
<method name="Int32 Main()" attrs="150">
- <size>227</size>
- </method>
- <method name="Void .ctor()" attrs="6278">
- <size>7</size>
- </method>
- </type>
- </test>
- <test name="test-pattern-02.cs">
- <type name="ConstantPattern">
- <method name="Int32 Main()" attrs="150">
- <size>609</size>
+ <size>118</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</method>
- </type>
- <type name="<PatternMatchingHelper>">
- <method name="Boolean NumberMatcher(System.Object, System.Object, Boolean)" attrs="150">
- <size>69</size>
+ <method name="Void Test1(System.Object)" attrs="145">
+ <size>24</size>
</method>
- </type>
- <type name="ConstantPattern">
- <method name="Boolean Generic[T](T)" attrs="145">
- <size>28</size>
+ <method name="System.String Test2(System.Object)" attrs="145">
+ <size>39</size>
</method>
</type>
</test>
</method>
</type>
</test>
+ <test name="test-static-using-13.cs">
+ <type name="Program">
+ <method name="Void Main(System.String[])" attrs="150">
+ <size>4</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
+ <test name="test-throw-expr-01.cs">
+ <type name="X">
+ <method name="Void Main()" attrs="150">
+ <size>32</size>
+ </method>
+ <method name="Int32 Test()" attrs="134">
+ <size>10</size>
+ </method>
+ <method name="System.Object Foo()" attrs="129">
+ <size>10</size>
+ </method>
+ <method name="System.Object Test2()" attrs="134">
+ <size>23</size>
+ </method>
+ <method name="Void Test3(Int32 ByRef)" attrs="145">
+ <size>3</size>
+ </method>
+ <method name="Int32 get_Item(Int32)" attrs="2177">
+ <size>10</size>
+ </method>
+ <method name="Void add_Event(System.Action)" attrs="2182">
+ <size>3</size>
+ </method>
+ <method name="Void remove_Event(System.Action)" attrs="2182">
+ <size>3</size>
+ </method>
+ <method name="Void TestExpr_1(Boolean)" attrs="129">
+ <size>21</size>
+ </method>
+ <method name="Void TestExpr_2(Boolean)" attrs="129">
+ <size>21</size>
+ </method>
+ <method name="Void TestExpr_3(System.String)" attrs="129">
+ <size>18</size>
+ </method>
+ <method name="Void TestExpr_4()" attrs="129">
+ <size>16</size>
+ </method>
+ <method name="Void TestExpr_5()" attrs="129">
+ <size>32</size>
+ </method>
+ <method name="System.Object <Main>m__0()" attrs="145">
+ <size>10</size>
+ </method>
+ <method name="Void <TestExpr_5>m__1()" attrs="145">
+ <size>3</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ <method name="Int32 TestExpr_6(Int32 ByRef)" attrs="145">
+ <size>10</size>
+ </method>
+ <method name="Int32 TestExpr_7(Int32 ByRef)" attrs="129">
+ <size>15</size>
+ </method>
+ </type>
+ </test>
+ <test name="test-throw-expr-02.cs">
+ <type name="Program">
+ <method name="Int32 Main()" attrs="150">
+ <size>63</size>
+ </method>
+ <method name="System.String M(System.Object)" attrs="145">
+ <size>33</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="test-var-01.cs">
<type name="Test">
<method name="Int32 Main()" attrs="150">
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);
#include "mono/metadata/class-internals.h"
#include "mono/utils/mono-compiler.h"
-#if defined(__native_client__) && defined(__GLIBC__)
-volatile int __nacl_thread_suspension_needed = 0;
-void __nacl_suspend_thread_if_needed() {}
-#endif
-
void
dump_table_assembly (MonoImage *m)
{
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.
mono-route.c \
mono-route.h \
monitor.h \
- nacl-stub.c \
normalization-tables.h \
number-formatter.h \
number-ms.c \
if (g_hasenv ("MONO_NO_UNLOAD"))
return;
-#ifdef __native_client__
- return;
-#endif
-
MonoException *exc = NULL;
mono_domain_try_unload (domain, (MonoObject**)&exc);
if (exc)
static GList *loaded_assemblies = NULL;
static MonoAssembly *corlib;
-#if defined(__native_client__)
-
-/* On Native Client, allow mscorlib to be loaded from memory */
-/* instead of loaded off disk. If these are not set, default */
-/* mscorlib loading will take place */
-
-/* NOTE: If mscorlib data is passed to mono in this way then */
-/* it needs to remain allocated during the use of mono. */
-
-static void *corlibData = NULL;
-static size_t corlibSize = 0;
-
-void
-mono_set_corlib_data (void *data, size_t size)
-{
- corlibData = data;
- corlibSize = size;
-}
-
-#endif
-
static char* unquote (const char *str);
/* This protects loaded_assemblies and image->references */
}
}
-/* Native Client can't get this info from an environment variable so */
-/* it's passed in to the runtime, or set manually by embedding code. */
-#ifdef __native_client__
-char* nacl_mono_path = NULL;
-#endif
-
static void
check_path_env (void)
{
return;
char* path = g_getenv ("MONO_PATH");
-#ifdef __native_client__
- if (!path)
- path = strdup (nacl_mono_path);
-#endif
if (!path)
return;
return corlib;
}
- // In native client, Corlib is embedded in the executable as static variable corlibData
-#if defined(__native_client__)
- if (corlibData != NULL && corlibSize != 0) {
- int status = 0;
- /* First "FALSE" instructs mono not to make a copy. */
- /* Second "FALSE" says this is not just a ref. */
- MonoImage* image = mono_image_open_from_data_full (corlibData, corlibSize, FALSE, &status, FALSE);
- if (image == NULL || status != 0)
- g_print("mono_image_open_from_data_full failed: %d\n", status);
- corlib = mono_assembly_load_from_full (image, "mscorlib", &status, FALSE);
- if (corlib == NULL || status != 0)
- g_print ("mono_assembly_load_from_full failed: %d\n", status);
- if (corlib)
- return corlib;
- }
-#endif
-
// A nonstandard preload hook may provide a special mscorlib assembly
aname = mono_assembly_name_new ("mscorlib.dll");
corlib = invoke_assembly_preload_hook (aname, assemblies_path);
* we used to do this only when running on valgrind,
* but it happens also in other setups.
*/
-#if defined(HAVE_PTHREAD_GETATTR_NP) && defined(HAVE_PTHREAD_ATTR_GETSTACK) && !defined(__native_client__)
+#if defined(HAVE_PTHREAD_GETATTR_NP) && defined(HAVE_PTHREAD_ATTR_GETSTACK)
{
size_t size;
void *sstart;
GC_stackbottom = (char*)ss.ss_sp;
}
-#elif defined(__native_client__)
- /* Do nothing, GC_stackbottom is set correctly in libgc */
#else
{
int dummy;
* Copyright (C) 2005-2009 Novell, Inc. (http://www.novell.com)
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
-#if defined(__native_client__)
-#include "console-null.c"
-#else
-
#include <config.h>
#include <glib.h>
#include <stdio.h>
return TRUE;
}
-#endif /* #if defined(__native_client__) */
-
gboolean ret;
gint64 start;
-#if defined(__native_client__)
- return FALSE;
-#endif
-
if (mono_thread_internal_current () == gc_thread)
/* We are called from inside a finalizer, not much we can do here */
return FALSE;
#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)
{
mono_environment_exitcode_set (result);
-/* FIXME: There are some cleanup hangs that should be worked out, but
- * if the program is going to exit, everything will be cleaned up when
- * NaCl exits anyway.
- */
-#ifndef __native_client__
if (!mono_runtime_try_shutdown ())
mono_thread_exit ();
mono_thread_suspend_all_other_threads ();
mono_runtime_quit ();
-#endif
/* we may need to do some cleanup here... */
exit (result);
iter->args = (guint8*)(((gsize)iter->args + (align) - 1) & ~(align - 1));
#endif
res.value = iter->args;
-#if defined(__native_client__) && SIZEOF_REGISTER == 8
- /* Values are stored as 8 byte register sized objects, but 'value'
- * is dereferenced as a pointer in other routines.
- */
- res.value = (char*)res.value + 4;
-#endif
#if G_BYTE_ORDER != G_LITTLE_ENDIAN
if (arg_size <= sizeof (gpointer)) {
int dummy;
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);
mono_config_parse_file (mono_cfg);
g_free (mono_cfg);
-#if !defined(TARGET_WIN32) && !defined(__native_client__)
+#if !defined(TARGET_WIN32)
home = g_get_home_dir ();
user_cfg = g_strconcat (home, G_DIR_SEPARATOR_S, ".mono/config", NULL);
mono_config_parse_file (user_cfg);
+++ /dev/null
-/**
- * \file
- */
-
-#if defined(__native_client__)
-
-#include "nacl-stub.h"
-
-struct group *getgrnam(const char *name)
-{
- return NULL;
-}
-
-struct group *getgrgid(gid_t gid)
-{
- errno = EIO;
- return NULL;
-}
-
-int fsync(int fd)
-{
- errno = EINVAL;
- return -1;
-}
-
-#ifdef USE_NEWLIB
-dev_t makedev(int maj, int min)
-{
- return (maj)*256+(min);
-}
-
-int utime(const char *filename, const void *times)
-{
- errno = EACCES;
- return -1;
-}
-
-int kill(pid_t pid, int sig)
-{
- errno = EACCES;
- return -1;
-}
-
-int getrusage(int who, void *usage)
-{
- errno = EACCES;
- return -1;
-}
-
-int lstat(const char *path, struct stat *buf)
-{
- return stat (path, buf);
-}
-
-int getdtablesize(void)
-{
-#ifdef OPEN_MAX
- return OPEN_MAX;
-#else
- return 256;
-#endif
-}
-
-size_t getpagesize(void)
-{
-#ifdef PAGE_SIZE
- return PAGE_SIZE;
-#else
- return 4096;
-#endif
-}
-
-int sem_trywait(sem_t *sem) {
- g_assert_not_reached ();
- return -1;
-}
-
-int sem_timedwait(sem_t *sem, const struct timespec *abs_timeout) {
- g_assert_not_reached ();
- return -1;
-}
-
-#endif
-
-#endif
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
gboolean
mono_threads_abort_appdomain_threads (MonoDomain *domain, int timeout)
{
-#ifdef __native_client__
- return FALSE;
-#endif
-
abort_appdomain_data user_data;
gint64 start_time;
int orig_timeout = timeout;
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 */
static gboolean
_wapi_lock_file_region (gint fd, off_t offset, off_t length)
{
-#if defined(__native_client__)
- printf("WARNING: %s: fcntl() not available on Native Client!\n", __func__);
- // behave as below -- locks are not available
- return TRUE;
-#else
struct flock lock_data;
gint ret;
}
return TRUE;
-#endif /* __native_client__ */
}
static gboolean
_wapi_unlock_file_region (gint fd, off_t offset, off_t length)
{
-#if defined(__native_client__)
- printf("WARNING: %s: fcntl() not available on Native Client!\n", __func__);
- return TRUE;
-#else
struct flock lock_data;
gint ret;
}
return TRUE;
-#endif /* __native_client__ */
}
static void file_close (gpointer handle, gpointer data);
}
#endif
-/* Native Client has no ftruncate function, even in standalone sel_ldr. */
-#ifndef __native_client__
/* always truncate, because the extend write() adds an extra
* byte to the end of the file
*/
_wapi_set_last_error_from_errno ();
return(FALSE);
}
-#endif
return(TRUE);
}
return(INVALID_HANDLE_VALUE);
}
-#ifdef __native_client__
- /* Workaround: Native Client currently returns the same fake inode
- * for all files, so do a simple hash on the filename so we don't
- * use the same share info for each file.
- */
- statbuf.st_ino = g_str_hash(filename);
-#endif
if (share_allows_open (&statbuf, sharemode, fileaccess,
&file_handle.share_info) == FALSE) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating standard handle type %s, fd %d", __func__, name, fd);
-#if !defined(__native_client__)
/* Check if fd is valid */
do {
flags = fcntl(fd, F_GETFL);
file_handle.fileaccess = 0;
break;
}
-#else
- /*
- * fcntl will return -1 in nacl, as there is no real file system API.
- * Yet, standard streams are available.
- */
- file_handle.fileaccess = (fd == STDIN_FILENO) ? GENERIC_READ : GENERIC_WRITE;
-#endif
file_handle.fd = fd;
file_handle.filename = g_strdup(name);
goto retry;
}
-#ifndef __native_client__
result = _wapi_lstat (filename, &linkbuf);
if (result != 0) {
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: lstat failed: %s", __func__, filename);
g_free (filename);
goto retry;
}
-#endif
utf8_filename = mono_utf8_from_external (filename);
if (utf8_filename == NULL) {
else
create_time = buf.st_ctime;
-#ifdef __native_client__
- find_data->dwFileAttributes = _wapi_stat_to_file_attributes (utf8_filename, &buf, NULL);
-#else
find_data->dwFileAttributes = _wapi_stat_to_file_attributes (utf8_filename, &buf, &linkbuf);
-#endif
time_t_to_filetime (create_time, &find_data->ftCreationTime);
time_t_to_filetime (buf.st_atime, &find_data->ftLastAccessTime);
return (INVALID_FILE_ATTRIBUTES);
}
-#ifndef __native_client__
result = _wapi_lstat (utf8_name, &linkbuf);
if (result != 0) {
_wapi_set_last_path_error_from_errno (NULL, utf8_name);
g_free (utf8_name);
return (INVALID_FILE_ATTRIBUTES);
}
-#endif
-#ifdef __native_client__
- ret = _wapi_stat_to_file_attributes (utf8_name, &buf, NULL);
-#else
ret = _wapi_stat_to_file_attributes (utf8_name, &buf, &linkbuf);
-#endif
g_free (utf8_name);
glong count;
gsize bytes;
-#ifdef __native_client__
- gchar *path = g_get_current_dir ();
- if (length < strlen(path) + 1 || path == NULL)
- return 0;
- memcpy (buffer, path, strlen(path) + 1);
-#else
if (getcwd ((gchar*)buffer, length) == NULL) {
if (errno == ERANGE) { /*buffer length is not big enough */
gchar *path = g_get_current_dir (); /*FIXME g_get_current_dir doesn't work with broken paths and calling it just to know the path length is silly*/
_wapi_set_last_error_from_errno ();
return 0;
}
-#endif
utf16_path = mono_unicode_from_external ((gchar*)buffer, &bytes);
count = (bytes/2)+1;
return (drive_type);
}
-#if defined (PLATFORM_MACOSX) || defined (__linux__) || defined(PLATFORM_BSD) || defined(__native_client__) || defined(__FreeBSD_kernel__) || defined(__HAIKU__)
+#if defined (PLATFORM_MACOSX) || defined (__linux__) || defined(PLATFORM_BSD) || defined(__FreeBSD_kernel__) || defined(__HAIKU__)
static gchar*
get_fstypename (gchar *utfpath)
{
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);
MemoryIntrinsics.il \
mixed.cs
-if NACL_CODEGEN
-test_sources += nacl.cs
-endif
-
regtests_UNIVERSAL = \
basic.exe \
basic-float.exe \
unaligned.exe \
basic-vectors.exe
-if NACL_CODEGEN
-regtests_UNIVERSAL += nacl.exe
-endif
-
regtests_DISABLED =
if FULL_AOT_TESTS
MemoryIntrinsics.dll: MemoryIntrinsics.il
$(ILASM) -dll -output=$@ $<
-if NACL_CODEGEN
-GENMDESC_OPTS=--nacl
-else !NACL_CODEGEN
GENMDESC_OPTS=
-endif !NACL_CODEGEN
# we don't always use the perl impl because it's an additional
# build dependency for the poor windows users
if CROSS_COMPILING
GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
else !CROSS_COMPILING
-if NACL_CODEGEN
-GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
-else
GENMDESC_PRG=./genmdesc $(GENMDESC_OPTS)
-endif
endif !CROSS_COMPILING
cpu-x86.h: cpu-x86.md genmdesc$(EXEEXT)
#define TARGET_WIN32_MSVC
#endif
-#if defined(__linux__) || defined(__native_client_codegen__)
+#if defined(__linux__)
#define RODATA_SECT ".rodata"
#elif defined(TARGET_MACH)
#define RODATA_SECT ".section __TEXT, __const"
#ifdef TARGET_X86
#ifdef TARGET_WIN32
#define AOT_TARGET_STR "X86 (WIN32)"
-#elif defined(__native_client_codegen__)
-#define AOT_TARGET_STR "X86 (native client codegen)"
#else
-#define AOT_TARGET_STR "X86 (!native client codegen)"
+#define AOT_TARGET_STR "X86"
#endif
#endif
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")) {
{
int status = 0;
-#if defined(HOST_WIN32) && defined(HAVE_SYSTEM)
+#if defined(HOST_WIN32)
// We need an extra set of quotes around the whole command to properly handle commands
// with spaces since internally the command is called through "cmd /c.
char * quoted_command = g_strdup_printf ("\"%s\"", command);
#define AS_OPTIONS "-a64 -mppc64"
#elif defined(sparc) && SIZEOF_VOID_P == 8
#define AS_OPTIONS "-xarch=v9"
-#elif defined(TARGET_X86) && defined(TARGET_MACH) && !defined(__native_client_codegen__)
+#elif defined(TARGET_X86) && defined(TARGET_MACH)
#define AS_OPTIONS "-arch i386"
#else
#define AS_OPTIONS ""
#endif
-#ifdef __native_client_codegen__
-#if defined(TARGET_AMD64)
-#define AS_NAME "nacl64-as"
-#else
-#define AS_NAME "nacl-as"
-#endif
-#elif defined(TARGET_OSX)
+#if defined(TARGET_OSX)
#define AS_NAME "clang"
#elif defined(TARGET_WIN32_MSVC)
#define AS_NAME "clang.exe"
#elif defined(TARGET_WIN32) && !defined(TARGET_ANDROID)
#define LD_NAME "gcc"
#define LD_OPTIONS "-shared"
-#elif defined(TARGET_X86) && defined(TARGET_MACH) && !defined(__native_client_codegen__)
+#elif defined(TARGET_X86) && defined(TARGET_MACH)
#define LD_NAME "clang"
#define LD_OPTIONS "-m32 -dynamiclib"
#elif defined(TARGET_ARM) && !defined(TARGET_ANDROID)
}
}
- {
+ 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);
* non-lazily, since we can't handle out-of-date errors later.
* The cached class info also depends on the exact assemblies.
*/
-#if defined(__native_client__)
- /* TODO: Don't 'load_image' on mscorlib due to a */
- /* recursive loading problem. This should be */
- /* removed if mscorlib is loaded from disk. */
- if (strncmp(assembly->aname.name, "mscorlib", 8)) {
- do_load_image = TRUE;
- } else {
- do_load_image = FALSE;
- }
-#endif
if (do_load_image) {
for (i = 0; i < amodule->image_table_len; ++i) {
MonoError error;
mono_os_mutex_init_recursive (&aot_page_mutex);
aot_modules = g_hash_table_new (NULL, NULL);
-#ifndef __native_client__
mono_install_assembly_load_hook (load_aot_module, NULL);
-#endif
mono_counters_register ("Async JIT info size", MONO_COUNTER_INT|MONO_COUNTER_JIT, &async_jit_info_size);
char *lastaot = g_getenv ("MONO_LASTAOT");
}
static void
-replace_out_block_in_code (MonoBasicBlock *bb, MonoBasicBlock *orig, MonoBasicBlock *repl) {
+replace_out_block_in_code (MonoBasicBlock *bb, MonoBasicBlock *orig, MonoBasicBlock *repl)
+{
MonoInst *ins;
-
-#if defined(__native_client_codegen__)
- /* Need to maintain this flag for the new block because */
- /* we can't jump indirectly to a non-aligned block. */
- if (orig->flags & BB_INDIRECT_JUMP_TARGET)
- {
- repl->flags |= BB_INDIRECT_JUMP_TARGET;
- }
-#endif
for (ins = bb->code; ins != NULL; ins = ins->next) {
switch (ins->opcode) {
args [i] = arg_buf [i];
}
} else {
- arg_buf [i] = (guint8 *)g_alloca (mono_class_instance_size (mono_class_from_mono_type (sig->params [i])));
+ MonoClass *arg_class = mono_class_from_mono_type (sig->params [i]);
+ arg_buf [i] = (guint8 *)g_alloca (mono_class_instance_size (arg_class));
err = decode_value (sig->params [i], domain, arg_buf [i], p, &p, end);
if (err != ERR_NONE)
break;
- args [i] = arg_buf [i];
+ if (mono_class_is_nullable (arg_class)) {
+ args [i] = mono_nullable_box (arg_buf [i], arg_class, &error);
+ mono_error_assert_ok (&error);
+ } else {
+ args [i] = arg_buf [i];
+ }
}
}
#endif
-#ifdef __native_client__
-extern char *nacl_mono_path;
-#endif
-
#define DEFAULT_OPTIMIZATIONS ( \
MONO_OPT_PEEPHOLE | \
MONO_OPT_CFOLD | \
#ifdef HOST_WIN32
int mixed_mode = FALSE;
#endif
-#ifdef __native_client__
- gboolean nacl_null_checks_off = FALSE;
-#endif
#ifdef MOONLIGHT
#ifndef HOST_WIN32
#else
fprintf (stderr, "Mono Warning: --interp= not enabled in this runtime.\n");
#endif
-
-#ifdef __native_client__
- } else if (strcmp (argv [i], "--nacl-mono-path") == 0){
- nacl_mono_path = g_strdup(argv[++i]);
- } else if (strcmp (argv [i], "--nacl-null-checks-off") == 0){
- nacl_null_checks_off = TRUE;
-#endif
} else if (strncmp (argv [i], "--assembly-loader=", strlen("--assembly-loader=")) == 0) {
gchar *arg = argv [i] + strlen ("--assembly-loader=");
if (strcmp (arg, "strict") == 0)
}
}
-#ifdef __native_client_codegen__
- if (!nacl_null_checks_off) {
- MonoDebugOptions *opt = mini_get_debug_options ();
- opt->explicit_null_checks = TRUE;
- }
-#endif
-
#if defined(DISABLE_HW_TRAPS) || defined(MONO_ARCH_DISABLE_HW_TRAPS)
// Signal handlers not available
{
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;
+ }
}
/**
return 0;
}
- [Category ("NaClDisable")]
public static int test_0_div_zero () {
int d = 1;
int q = 0;
return 0;
}
- [Category ("NaClDisable")]
public static int test_0_long_div_zero () {
long d = 1;
long q = 0;
#include <string.h>
#include <mono/metadata/opcodes.h>
-#if defined(__native_client__) || defined(__native_client_codegen__)
-volatile int __nacl_thread_suspension_needed = 0;
-void __nacl_suspend_thread_if_needed() {}
-#endif
-
#define MINI_OP(a,b,dest,src1,src2) b,
#define MINI_OP3(a,b,dest,src1,src2,src3) b,
/* keep in sync with the enum in mini.h */
void
mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id)
{
-#if defined(__native_client__)
- return;
-#endif
#ifndef DISABLE_LOGGING
GHashTable *offset_to_bb_hash = NULL;
int i, cindex, bb_num;
* TARGET_ASM_GAS == GNU assembler
*/
#if !defined(TARGET_ASM_APPLE) && !defined(TARGET_ASM_GAS)
-#if defined(TARGET_MACH) && !defined(__native_client_codegen__)
+#if defined(TARGET_MACH)
#define TARGET_ASM_APPLE
#else
#define TARGET_ASM_GAS
while (new_size <= new_offset)
new_size *= 2;
data = (guint8 *)g_malloc0 (new_size);
-#ifdef __native_client_codegen__
- /* for Native Client, fill empty space with HLT instruction */
- /* instead of 00. */
- memset(data, 0xf4, new_size);
-#endif
memcpy (data, section->data, section->data_len);
g_free (section->data);
section->data = data;
MonoType *rtype;
MonoType **param_types;
MonoJitInfo *jinfo;
+ MonoDomain *domain;
} RuntimeMethod;
struct _MonoInvocation {
};
typedef struct {
- MonoDomain *domain;
MonoDomain *original_domain;
MonoInvocation *base_frame;
MonoInvocation *current_frame;
rtm = mono_domain_alloc0 (domain, sizeof (RuntimeMethod));
rtm->method = method;
+ rtm->domain = domain;
rtm->param_count = sig->param_count;
rtm->hasthis = sig->hasthis;
rtm->rtype = mini_get_underlying_type (sig->ret);
}
static inline RuntimeMethod*
-get_virtual_method (MonoDomain *domain, RuntimeMethod *runtime_method, MonoObject *obj)
+get_virtual_method (RuntimeMethod *runtime_method, MonoObject *obj)
{
MonoMethod *m = runtime_method->method;
+ MonoDomain *domain = runtime_method->domain;
+ RuntimeMethod *ret = NULL;
MonoError error;
+#ifndef DISABLE_REMOTING
+ if (mono_object_is_transparent_proxy (obj)) {
+ ret = mono_interp_get_runtime_method (domain, mono_marshal_get_remoting_invoke (m), &error);
+ mono_error_assert_ok (&error);
+ return ret;
+ }
+#endif
+
if ((m->flags & METHOD_ATTRIBUTE_FINAL) || !(m->flags & METHOD_ATTRIBUTE_VIRTUAL)) {
- RuntimeMethod *ret = NULL;
- if (mono_object_is_transparent_proxy (obj)) {
- ret = mono_interp_get_runtime_method (domain, mono_marshal_get_remoting_invoke (m), &error);
- mono_error_cleanup (&error); /* FIXME: don't swallow the error */
- } else if (m->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED) {
+ if (m->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED) {
ret = mono_interp_get_runtime_method (domain, mono_marshal_get_synchronized_wrapper (m), &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
} else {
{
MonoError error;
char *stack_trace = dump_frame (frame);
- MonoDomain *domain = mono_domain_get();
+ MonoDomain *domain = frame->runtime_method->domain;
(exception)->stack_trace = mono_string_new_checked (domain, stack_trace, &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
(exception)->trace_ips = get_trace_ips (domain, frame);
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);
interp_pop_lmf (&ext);
context->managed_code = 1;
- /* domain can only be changed by native code */
- context->domain = mono_domain_get ();
if (*mono_thread_interruption_request_flag ()) {
MonoException *exc = mono_thread_interruption_checkpoint ();
if (setjmp(env)) {
if (context != &context_struct) {
- context->domain = mono_domain_get ();
context->current_frame = old_frame;
context->managed_code = 0;
} else
else
old_frame = context->current_frame;
- context->domain = mono_domain_get ();
+ MonoDomain *domain = mono_domain_get ();
switch (sig->ret->type) {
case MONO_TYPE_VOID:
isobject = 1;
break;
case MONO_TYPE_VALUETYPE:
- retval = mono_object_new_checked (context->domain, klass, error);
+ retval = mono_object_new_checked (domain, klass, error);
ret = mono_object_unbox (retval);
if (!sig->ret->data.klass->enumtype)
result.data.vt = ret;
break;
case MONO_TYPE_GENERICINST:
if (!MONO_TYPE_IS_REFERENCE (sig->ret)) {
- retval = mono_object_new_checked (context->domain, klass, error);
+ retval = mono_object_new_checked (domain, klass, error);
ret = mono_object_unbox (retval);
if (!sig->ret->data.klass->enumtype)
result.data.vt = ret;
break;
case MONO_TYPE_PTR:
- retval = mono_object_new_checked (context->domain, mono_defaults.int_class, error);
+ retval = mono_object_new_checked (domain, mono_defaults.int_class, error);
ret = mono_object_unbox (retval);
break;
default:
- retval = mono_object_new_checked (context->domain, klass, error);
+ retval = mono_object_new_checked (domain, klass, error);
ret = mono_object_unbox (retval);
break;
}
if (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)
method = mono_marshal_get_native_wrapper (method, FALSE, FALSE);
- INIT_FRAME (&frame,context->current_frame,args,&result,mono_get_root_domain (),method,error);
+ INIT_FRAME (&frame,context->current_frame,args,&result,domain,method,error);
if (exc)
frame.invoke_trap = 1;
context->managed_code = 1;
} else {
old_frame = context->current_frame;
}
- context->domain = mono_domain_get ();
args = alloca (sizeof (stackval) * (sig->param_count + (sig->hasthis ? 1 : 0)));
if (sig->hasthis)
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:
gpointer addr;
MonoMethodSignature *sig = mono_method_signature (method);
MonoMethod *wrapper;
- RuntimeMethod *rmethod;
+ RuntimeMethod *rmethod = mono_interp_get_runtime_method (mono_domain_get (), method, error);
/* HACK: method_ptr of delegate should point to a runtime method*/
if (method->wrapper_type && method->wrapper_type == MONO_WRAPPER_DYNAMIC_METHOD)
- return mono_interp_get_runtime_method (mono_domain_get (), method, error);
+ return rmethod;
- rmethod = mono_interp_get_runtime_method (mono_domain_get (), method, error);
if (rmethod->jit_entry)
return rmethod->jit_entry;
wrapper = mini_get_interp_in_wrapper (sig);
* 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;
--sp;
child_frame.stack_args = sp;
+#ifndef DISABLE_REMOTING
/* `this' can be NULL for string:.ctor */
if (csignature->hasthis && sp->data.p && mono_object_is_transparent_proxy (sp->data.p)) {
- child_frame.runtime_method = mono_interp_get_runtime_method (context->domain, mono_marshal_get_remoting_invoke (child_frame.runtime_method->method), &error);
+ child_frame.runtime_method = mono_interp_get_runtime_method (rtm->domain, mono_marshal_get_remoting_invoke (child_frame.runtime_method->method), &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
- } else if (child_frame.runtime_method->method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) {
- child_frame.runtime_method = mono_interp_get_runtime_method (context->domain, mono_marshal_get_native_wrapper (child_frame.runtime_method->method, FALSE, FALSE), &error);
+ } else
+#endif
+ if (child_frame.runtime_method->method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) {
+ child_frame.runtime_method = mono_interp_get_runtime_method (rtm->domain, mono_marshal_get_native_wrapper (child_frame.runtime_method->method, FALSE, FALSE), &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
}
--sp;
child_frame.stack_args = sp;
+#ifndef DISABLE_REMOTING
/* `this' can be NULL for string:.ctor */
if (child_frame.runtime_method->hasthis && !child_frame.runtime_method->method->klass->valuetype && sp->data.p && mono_object_is_transparent_proxy (sp->data.p)) {
- child_frame.runtime_method = mono_interp_get_runtime_method (context->domain, mono_marshal_get_remoting_invoke (child_frame.runtime_method->method), &error);
+ child_frame.runtime_method = mono_interp_get_runtime_method (rtm->domain, mono_marshal_get_remoting_invoke (child_frame.runtime_method->method), &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
}
+#endif
ves_exec_method_with_context (&child_frame, context, NULL, NULL, -1);
}
child_frame.stack_args = sp;
+#ifndef DISABLE_REMOTING
if (child_frame.runtime_method->hasthis && !child_frame.runtime_method->method->klass->valuetype && mono_object_is_transparent_proxy (sp->data.p)) {
- child_frame.runtime_method = mono_interp_get_runtime_method (context->domain, mono_marshal_get_remoting_invoke (child_frame.runtime_method->method), &error);
+ child_frame.runtime_method = mono_interp_get_runtime_method (rtm->domain, mono_marshal_get_remoting_invoke (child_frame.runtime_method->method), &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
}
+#endif
ves_exec_method_with_context (&child_frame, context, NULL, NULL, -1);
}
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;
}
this_arg = sp->data.p;
if (!this_arg)
THROW_EX (mono_get_exception_null_reference(), ip - 2);
- child_frame.runtime_method = get_virtual_method (context->domain, child_frame.runtime_method, this_arg);
+ child_frame.runtime_method = get_virtual_method (child_frame.runtime_method, this_arg);
MonoClass *this_class = this_arg->vtable->klass;
if (this_class->valuetype && child_frame.runtime_method->method->klass->valuetype) {
this_arg = sp->data.p;
if (!this_arg)
THROW_EX (mono_get_exception_null_reference(), ip - 2);
- child_frame.runtime_method = get_virtual_method (context->domain, child_frame.runtime_method, this_arg);
+ child_frame.runtime_method = get_virtual_method (child_frame.runtime_method, this_arg);
MonoClass *this_class = this_arg->vtable->klass;
if (this_class->valuetype && child_frame.runtime_method->method->klass->valuetype) {
if (newobj_class->parent == mono_defaults.array_class) {
sp -= csig->param_count;
child_frame.stack_args = sp;
- o = ves_array_create (&child_frame, context->domain, newobj_class, csig, sp);
+ o = ves_array_create (&child_frame, rtm->domain, newobj_class, csig, sp);
if (child_frame.ex)
THROW_EX (child_frame.ex, ip);
goto array_constructed;
} else {
if (newobj_class != mono_defaults.string_class) {
context->managed_code = 0;
- o = mono_object_new_checked (context->domain, newobj_class, &error);
+ o = mono_object_new_checked (rtm->domain, newobj_class, &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
context->managed_code = 1;
if (*mono_thread_interruption_request_flag ())
THROW_EX (mono_get_exception_null_reference (), ip);
field = rtm->data_items[* (guint16 *)(ip + 1)];
ip += 2;
+#ifndef DISABLE_REMOTING
if (mono_object_is_transparent_proxy (o)) {
MonoClass *klass = ((MonoTransparentProxy*)o)->remote_class->proxy_class;
addr = mono_load_remote_field_checked (o, klass, field, &tmp, &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
- } else {
+ } else
+#endif
addr = (char*)o + field->offset;
- }
stackval_from_data (field->type, &sp [-1], addr, FALSE);
MINT_IN_BREAK;
field = rtm->data_items[* (guint16 *)(ip + 1)];
i32 = READ32(ip + 2);
ip += 4;
+#ifndef DISABLE_REMOTING
if (mono_object_is_transparent_proxy (o)) {
MonoClass *klass = ((MonoTransparentProxy*)o)->remote_class->proxy_class;
addr = mono_load_remote_field_checked (o, klass, field, &tmp, &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
- } else {
+ } else
+#endif
addr = (char*)o + field->offset;
- }
sp [-1].data.p = vt_sp;
memcpy(sp [-1].data.p, (char *)o + * (guint16 *)(ip + 1), i32);
field = rtm->data_items[* (guint16 *)(ip + 1)];
ip += 2;
+#ifndef DISABLE_REMOTING
if (mono_object_is_transparent_proxy (o)) {
MonoClass *klass = ((MonoTransparentProxy*)o)->remote_class->proxy_class;
mono_store_remote_field_checked (o, klass, field, &sp [-1].data, &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
} else
+#endif
stackval_to_data (field->type, &sp [-1], (char*)o + field->offset, FALSE);
sp -= 2;
i32 = READ32(ip + 2);
ip += 4;
+#ifndef DISABLE_REMOTING
if (mono_object_is_transparent_proxy (o)) {
MonoClass *klass = ((MonoTransparentProxy*)o)->remote_class->proxy_class;
mono_store_remote_field_checked (o, klass, field, &sp [-1].data, &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
} else
+#endif
memcpy((char*)o + field->offset, sp [-1].data.p, i32);
sp -= 2;
}
MINT_IN_CASE(MINT_LDSFLDA) {
MonoClassField *field = rtm->data_items[*(guint16 *)(ip + 1)];
- sp->data.p = mono_class_static_field_address (context->domain, field);
+ sp->data.p = mono_class_static_field_address (rtm->domain, field);
ip += 2;
++sp;
MINT_IN_BREAK;
}
MINT_IN_CASE(MINT_LDSFLD) {
MonoClassField *field = rtm->data_items [* (guint16 *)(ip + 1)];
- gpointer addr = mono_class_static_field_address (context->domain, field);
+ gpointer addr = mono_class_static_field_address (rtm->domain, field);
stackval_from_data (field->type, sp, addr, FALSE);
ip += 2;
++sp;
}
MINT_IN_CASE(MINT_LDSFLD_VT) {
MonoClassField *field = rtm->data_items [* (guint16 *)(ip + 1)];
- gpointer addr = mono_class_static_field_address (context->domain, field);
+ gpointer addr = mono_class_static_field_address (rtm->domain, field);
int size = READ32 (ip + 2);
ip += 4;
}
MINT_IN_CASE(MINT_STSFLD) {
MonoClassField *field = rtm->data_items [* (guint16 *)(ip + 1)];
- gpointer addr = mono_class_static_field_address (context->domain, field);
+ gpointer addr = mono_class_static_field_address (rtm->domain, field);
ip += 2;
--sp;
stackval_to_data (field->type, sp, addr, FALSE);
}
MINT_IN_CASE(MINT_STSFLD_VT) {
MonoClassField *field = rtm->data_items [* (guint16 *)(ip + 1)];
- gpointer addr = mono_class_static_field_address (context->domain, field);
+ gpointer addr = mono_class_static_field_address (rtm->domain, field);
int size = READ32 (ip + 2);
ip += 4;
if (c->byval_arg.type == MONO_TYPE_VALUETYPE && !c->enumtype) {
int size = mono_class_value_size (c, NULL);
- sp [-1 - offset].data.p = mono_value_box_checked (context->domain, c, sp [-1 - offset].data.p, &error);
+ sp [-1 - offset].data.p = mono_value_box_checked (rtm->domain, c, sp [-1 - offset].data.p, &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
size = (size + 7) & ~7;
vt_sp -= size;
} else {
stackval_to_data (&c->byval_arg, &sp [-1 - offset], (char *) &sp [-1 - offset], FALSE);
- sp [-1 - offset].data.p = mono_value_box_checked (context->domain, c, &sp [-1 - offset], &error);
+ sp [-1 - offset].data.p = mono_value_box_checked (rtm->domain, c, &sp [-1 - offset], &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
}
ip += 3;
MINT_IN_BREAK;
}
MINT_IN_CASE(MINT_NEWARR)
- sp [-1].data.p = (MonoObject*) mono_array_new_checked (context->domain, rtm->data_items[*(guint16 *)(ip + 1)], sp [-1].data.i, &error);
+ sp [-1].data.p = (MonoObject*) mono_array_new_checked (rtm->domain, rtm->data_items[*(guint16 *)(ip + 1)], sp [-1].data.i, &error);
if (!mono_error_ok (&error)) {
THROW_EX (mono_error_convert_to_exception (&error), ip);
}
++sp;
MINT_IN_BREAK;
MINT_IN_CASE(MINT_MONO_NEWOBJ)
- sp->data.p = mono_object_new_checked (context->domain, rtm->data_items [*(guint16 *)(ip + 1)], &error);
+ sp->data.p = mono_object_new_checked (rtm->domain, rtm->data_items [*(guint16 *)(ip + 1)], &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
ip += 2;
sp++;
MonoDomain *tls_domain = (MonoDomain *) ((gpointer (*)()) mono_tls_get_tls_getter (TLS_KEY_DOMAIN, FALSE)) ();
gpointer tls_jit = ((gpointer (*)()) mono_tls_get_tls_getter (TLS_KEY_DOMAIN, FALSE)) ();
- if (tls_domain != context->domain || !tls_jit)
- context->original_domain = mono_jit_thread_attach (context->domain);
+ if (tls_domain != rtm->domain || !tls_jit)
+ context->original_domain = mono_jit_thread_attach (rtm->domain);
MINT_IN_BREAK;
}
MINT_IN_CASE(MINT_MONO_JIT_DETACH)
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)
if (!sp->data.p)
THROW_EX (mono_get_exception_null_reference (), ip - 2);
- sp->data.p = get_virtual_method (context->domain, m, sp->data.p);
+ sp->data.p = get_virtual_method (m, sp->data.p);
++sp;
MINT_IN_BREAK;
}
{
ThreadContext *context = mono_native_tls_get_value (thread_context_id);
ThreadContext context_struct;
+ MonoDomain *domain = frame->runtime_method->domain;
MonoError error;
jmp_buf env;
}
if (context == NULL) {
context = &context_struct;
- context_struct.domain = mono_domain_get ();
context_struct.base_frame = frame;
context_struct.current_frame = NULL;
context_struct.env_frame = frame;
}
frame->ip = NULL;
frame->parent = context->current_frame;
- frame->runtime_method = mono_interp_get_runtime_method (context->domain, frame->method, &error);
+ frame->runtime_method = mono_interp_get_runtime_method (domain, frame->method, &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
context->managed_code = 1;
ves_exec_method_with_context (frame, context, NULL, NULL, -1);
MonoMethodHeader *header = mono_method_get_header (method);
MonoMethodSignature *signature = mono_method_signature (method);
MonoImage *image = method->klass->image;
- MonoDomain *domain = mono_domain_get ();
+ MonoDomain *domain = rtm->domain;
MonoClass *constrained_class = NULL;
MonoError error;
int offset, mt, i, i32;
MonoClass *field_klass = mono_class_from_mono_type (field->type);
mt = mint_type (&field_klass->byval_arg);
+#ifndef DISABLE_REMOTING
if (klass->marshalbyref) {
g_assert (!is_static);
ADD_CODE(&td, mt == MINT_TYPE_VT ? MINT_LDRMFLD_VT : MINT_LDRMFLD);
ADD_CODE(&td, get_data_item_index (&td, field));
- } else {
+ } else
+#endif
+ {
if (is_static) {
ADD_CODE (&td, MINT_POP);
ADD_CODE (&td, 0);
mono_class_init (klass);
mt = mint_type(field->type);
+#ifndef DISABLE_REMOTING
if (klass->marshalbyref) {
g_assert (!is_static);
ADD_CODE(&td, mt == MINT_TYPE_VT ? MINT_STRMFLD_VT : MINT_STRMFLD);
ADD_CODE(&td, get_data_item_index (&td, field));
- } else {
+ } else
+#endif
+ {
if (is_static) {
ADD_CODE (&td, MINT_POP);
ADD_CODE (&td, 1);
const MonoOpcode *opcode;
MonoMethod *m;
MonoClass *class;
- MonoDomain *domain = mono_domain_get ();
unsigned char *is_bb_start;
int in;
MonoVTable *method_class_vt;
int backwards;
MonoGenericContext *generic_context = NULL;
+ MonoDomain *domain = runtime_method->domain;
// g_printerr ("TRANSFORM(0x%016lx): begin %s::%s\n", mono_thread_current (), method->klass->name, method->name);
method_class_vt = mono_class_vtable (domain, runtime_method->method->klass);
}
#endif
-#if defined(__native_client_codegen__) || defined(__native_client__)
-/* When we cross-compile to Native Client we can't directly embed calls */
-/* to the math library on the host. This will use the fmod on the target*/
-double
-mono_fmod(double a, double b)
-{
- return fmod(a, b);
-}
-#endif
-
gpointer
mono_helper_compile_generic_method (MonoObject *obj, MonoMethod *method, gpointer *this_arg)
{
double mono_lconv_to_r8_un (guint64 a);
-#if defined(__native_client_codegen__) || defined(__native_client__)
-double mono_fmod(double a, double b);
-#endif
-
gpointer mono_helper_compile_generic_method (MonoObject *obj, MonoMethod *method, gpointer *this_arg);
MonoString*
* 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
return code;
}
-#if defined(__ARM_EABI__) && defined(__linux__) && !defined(PLATFORM_ANDROID) && !defined(__native_client__) && !defined(MONO_CROSS_COMPILE)
+#if defined(__ARM_EABI__) && defined(__linux__) && !defined(PLATFORM_ANDROID) && !defined(MONO_CROSS_COMPILE)
#define HAVE_AEABI_READ_TP 1
#endif
#define MONO_ARCH_DYN_CALL_SUPPORTED 1
#define MONO_ARCH_DYN_CALL_PARAM_AREA (DYN_CALL_STACK_ARGS * sizeof (mgreg_t))
-#ifndef MONO_CROSS_COMPILE
+#if !(defined(TARGET_ANDROID) && defined(MONO_CROSS_COMPILE))
#define MONO_ARCH_SOFT_DEBUG_SUPPORTED 1
#endif
#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
#include <mach/clock.h>
#endif
-#if defined(__native_client__) || defined(HOST_WATCHOS)
+#if defined(HOST_WATCHOS)
void
mono_runtime_setup_stat_profiler (void)
#endif
-#endif /* defined(__native_client__) || defined(HOST_WATCHOS) */
-
-#if defined(__native_client__)
-
-void
-mono_gdb_render_native_backtraces (pid_t crashed_pid)
-{
-}
-
-#else
+#endif /* defined(HOST_WATCHOS) */
static gboolean
native_stack_with_gdb (pid_t crashed_pid, const char **argv, FILE *commands, char* commands_filename)
#endif // HAVE_EXECV
}
-#endif /* defined(__native_client__) */
-
#if !defined (__MACH__)
gboolean
#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)
mono_jit_unlock ();
}
-#if defined(__native_client_codegen__) && defined(__native_client__)
-void
-mono_nacl_gc()
-{
-#ifdef __native_client_gc__
- __nacl_suspend_thread_if_needed();
-#endif
-}
-#endif /* __native_client__ */
-
/**
* mono_create_unwind_op:
*
break;
}
case MONO_PATCH_INFO_GC_SAFE_POINT_FLAG:
-#if defined(__native_client_codegen__)
- target = (gpointer)&__nacl_thread_suspension_needed;
-#else
g_assert (mono_threads_is_coop_enabled ());
target = (gpointer)&mono_polling_required;
-#endif
break;
case MONO_PATCH_INFO_SWITCH: {
gpointer *jump_table;
int i;
-#if defined(__native_client__) && defined(__native_client_codegen__)
- /* This memory will leak, but we don't care if we're */
- /* not deleting JIT'd methods anyway */
- jump_table = g_malloc0 (sizeof(gpointer) * patch_info->data.table->table_size);
-#else
if (method && method->dynamic) {
jump_table = (void **)mono_code_manager_reserve (mono_dynamic_code_hash_lookup (domain, method)->code_mp, sizeof (gpointer) * patch_info->data.table->table_size);
} else {
jump_table = (void **)mono_domain_code_reserve (domain, sizeof (gpointer) * patch_info->data.table->table_size);
}
}
-#endif
for (i = 0; i < patch_info->data.table->table_size; i++) {
jump_table [i] = code + GPOINTER_TO_INT (patch_info->data.table->table [i]);
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);
CHECKED_MONO_INIT ();
-#if defined(__linux__) && !defined(__native_client__)
+#if defined(__linux__)
if (access ("/proc/self/maps", F_OK) != 0) {
g_print ("Mono requires /proc to be mounted.\n");
exit (1);
register_icall (mono_thread_interruption_checkpoint, "mono_thread_interruption_checkpoint", "object", FALSE);
register_icall (mono_thread_force_interruption_checkpoint_noraise, "mono_thread_force_interruption_checkpoint_noraise", "object", FALSE);
-#if defined(__native_client__) || defined(__native_client_codegen__)
- register_icall (mono_nacl_gc, "mono_nacl_gc", "void", FALSE);
-#endif
-
if (mono_threads_is_coop_enabled ())
register_icall (mono_threads_state_poll, "mono_threads_state_poll", "void", FALSE);
register_opcode_emulation (OP_LCONV_TO_R_UN, "__emul_lconv_to_r8_un", "double long", mono_lconv_to_r8_un, "mono_lconv_to_r8_un", FALSE);
#endif
#ifdef MONO_ARCH_EMULATE_FREM
-#if !defined(__native_client__)
register_opcode_emulation (OP_FREM, "__emul_frem", "double double double", fmod, "fmod", FALSE);
register_opcode_emulation (OP_RREM, "__emul_rrem", "float float float", fmodf, "fmodf", FALSE);
-#else
- register_opcode_emulation (OP_FREM, "__emul_frem", "double double double", mono_fmod, "mono_fmod", FALSE);
-#endif
#endif
#ifdef MONO_ARCH_SOFT_FLOAT_FALLBACK
#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)
}
case MONO_PATCH_INFO_SWITCH: {
gpointer *table;
-#if defined(__native_client__) && defined(__native_client_codegen__)
- /* This memory will leak. */
- /* TODO: can we free this when */
- /* making the final jump table? */
- table = g_malloc0 (sizeof(gpointer) * patch_info->data.table->table_size);
-#else
if (cfg->method->dynamic) {
table = (void **)mono_code_manager_reserve (cfg->dynamic_info->code_mp, sizeof (gpointer) * patch_info->data.table->table_size);
} else {
table = (void **)mono_domain_code_reserve (cfg->domain, sizeof (gpointer) * patch_info->data.table->table_size);
}
-#endif
for (i = 0; i < patch_info->data.table->table_size; i++) {
/* Might be NULL if the switch is eliminated */
} else {
mono_domain_code_commit (code_domain, cfg->native_code, cfg->code_size, cfg->code_len);
}
-#if defined(__native_client_codegen__) && defined(__native_client__)
- cfg->native_code = code_dest;
-#endif
mono_profiler_code_buffer_new (cfg->native_code, cfg->code_len, MONO_PROFILER_CODE_BUFFER_METHOD, cfg->method);
mono_arch_flush_icache (cfg->native_code, cfg->code_len);
if (cfg->verbose_level > 1)
printf ("ADDING SAFE POINT TO BB %d\n", bblock->block_num);
-#if defined(__native_client_codegen__)
- NEW_AOTCONST (cfg, poll_addr, MONO_PATCH_INFO_GC_SAFE_POINT_FLAG, (gpointer)&__nacl_thread_suspension_needed);
-#else
g_assert (mono_threads_is_coop_enabled ());
NEW_AOTCONST (cfg, poll_addr, MONO_PATCH_INFO_GC_SAFE_POINT_FLAG, (gpointer)&mono_polling_required);
-#endif
MONO_INST_NEW (cfg, ins, OP_GC_SAFE_POINT);
ins->sreg1 = poll_addr->dreg;
{
MonoBasicBlock *bb;
-#if !defined(__native_client_codegen__)
if (!mono_threads_is_coop_enabled ())
return;
-#endif
if (cfg->method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE) {
WrapperInfo *info = mono_marshal_get_wrapper_info (cfg->method);
-#if defined(__native_client__) || defined(__native_client_codegen__)
- gpointer poll_func = &mono_nacl_gc;
-#else
g_assert (mono_threads_is_coop_enabled ());
gpointer poll_func = &mono_threads_state_poll;
-#endif
if (info && info->subtype == WRAPPER_SUBTYPE_ICALL_WRAPPER && info->d.icall.func == poll_func) {
if (cfg->verbose_level > 1)
cfg->gen_seq_points = FALSE;
cfg->gen_sdb_seq_points = FALSE;
}
- /* coop / nacl requires loop detection to happen */
-#if defined(__native_client_codegen__)
- cfg->opt |= MONO_OPT_LOOP;
-#else
+ /* coop requires loop detection to happen */
if (mono_threads_is_coop_enabled ())
cfg->opt |= MONO_OPT_LOOP;
-#endif
cfg->explicit_null_checks = debug_options.explicit_null_checks || (flags & JIT_FLAG_EXPLICIT_NULL_CHECKS);
cfg->soft_breakpoints = debug_options.soft_breakpoints;
cfg->check_pinvoke_callconv = debug_options.check_pinvoke_callconv;
}
}
- if (!mono_runtime_class_init_full (vtable, error))
- return NULL;
+ if (!(method->wrapper_type == MONO_WRAPPER_REMOTING_INVOKE ||
+ method->wrapper_type == MONO_WRAPPER_REMOTING_INVOKE_WITH_CHECK ||
+ method->wrapper_type == MONO_WRAPPER_XDOMAIN_INVOKE)) {
+ if (!mono_runtime_class_init_full (vtable, error))
+ return NULL;
+ }
return code;
}
#include "mono/metadata/security-manager.h"
#include "mono/metadata/exception.h"
-#ifdef __native_client_codegen__
-#include <nacl/nacl_dyncode.h>
-#endif
-
-
/*
* The mini code should not have any compile time dependencies on the GC being used, so the same object file from mini/
* can be linked into both mono and mono-sgen.
MonoInst *stack_inbalance_var;
unsigned char *cil_start;
-#ifdef __native_client_codegen__
- /* this alloc is not aligned, native_code */
- /* is the 32-byte aligned version of this */
- unsigned char *native_code_alloc;
-#endif
unsigned char *native_code;
guint code_size;
guint code_len;
/* Native Client functions */
gpointer mono_realloc_native_code(MonoCompile *cfg);
-#if defined(__native_client__) || defined(__native_client_codegen__)
-extern volatile int __nacl_thread_suspension_needed;
-void __nacl_suspend_thread_if_needed(void);
-void mono_nacl_gc(void);
-#endif
-
extern MonoDebugOptions debug_options;
static inline MonoMethod*
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
* \file
*/
-#if defined(__native_client__) && defined(__x86_64__)
-typedef guint64 regmask_t;
-#else
typedef size_t regmask_t;
-#endif
enum {
MONO_REG_INT,
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;
+}
+
# FIXME fix the profiler tests to work with coop.
if !ENABLE_COOP
-if !NACL_CODEGEN
check_targets = testlog
endif
-endif
endif
endif
#define HASH_SIZE 9371
#define SMALL_HASH_SIZE 31
-#if defined(__native_client__) || defined(__native_client_codegen__)
-volatile int __nacl_thread_suspension_needed = 0;
-void __nacl_suspend_thread_if_needed() {}
-#endif
-
static int debug = 0;
static int collect_traces = 0;
static int show_traces = 0;
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
sgen-bridge-xref.exe
endif
-if NACL_CODEGEN
-# Tests that use Thread.Abort()
-PLATFORM_DISABLED_TESTS= abort-stress-1.exe \
- abort-stress-2.exe \
- abort-stress-3.exe \
- appdomain-thread-abort.exe \
- async-exc-compilation.exe \
- bug-561239.exe \
- bug-70561.exe \
- finalizer-abort.exe \
- finally_guard.exe \
- finally_block_ending_in_dead_bb.exe \
- main-returns-abort-resetabort.exe \
- main-returns-background-abort-resetabort.exe \
- thread6.exe \
- threadpool-exceptions5.exe \
- threadpool-exceptions6.exe
-
-PLATFORM_DISABLED_TESTS+= w32message.exe
-
-# Tests that rely on AppDomain.Unload
-PLATFORM_DISABLED_TESTS+= appdomain-async-invoke.exe \
- appdomain-exit.exe \
- appdomain-unload-callback.exe \
- appdomain-unload.exe \
- domain-stress.exe \
- generic-unloading.2.exe \
- monitor.exe \
- remoting4.exe \
- threadpool-exceptions7.exe \
- xdomain-threads.exe
-
-# pinvoke2 attaches a thread to the runtime, but
-# doesn't 'unattach' it and it hangs in GC on exit
-PLATFORM_DISABLED_TESTS+= pinvoke2.exe
-
-# Tests that currently hang waiting for non-main threads
-# to exit in NaCl, need to investigate. Most are AppDomain
-# creation and Delegate tests.
-PLATFORM_DISABLED_TESTS+= appdomain1.exe \
- delegate9.exe \
- marshal-valuetypes.exe \
- cross-domain.exe \
- stackframes-async.2.exe \
- generic-marshalbyref.2.exe \
- generic-xdomain.2.exe \
- bug-415577.exe
-
-# Tests that fail trying to write files (appdomain create mostly)
-PLATFORM_DISABLED_TESTS+= bug-335131.2.exe \
- bug-349190.2.exe \
- bug-80307.exe \
- bug-462592.exe
-
-# FIXME: don't know why delegate2.exe fails, it shouldn't
-PLATFORM_DISABLED_TESTS+= delegate2.exe
-
-# These tests newly fail with the latest revision. pinvoke3 fails because
-# of a thread attach, the others have not been investigated. TODO revisit.
-PLATFORM_DISABLED_TESTS+= pinvoke3.exe \
- async_read.exe \
- async-with-cb-throws.exe \
- appdomain-unload-doesnot-raise-pending-events.exe \
- gsharing-valuetype-layout.exe
-
-if X86
-# FIXME: There are problems with async callbacks and results on NaCl 32-bit
-PLATFORM_DISABLED_TESTS+= delegate1.exe \
- delegate3.exe \
- delegate5.exe \
- delegate8.exe \
- threadpool.exe \
- threadpool1.exe \
- threadpool-exceptions3.exe \
- bug-323114.exe \
- delegate-exit.exe \
- bug-80392.2.exe
-
-# FIXME: These tests hang/fail for unknown reasons, deal with exiting
-PLATFORM_DISABLED_TESTS+= main-returns-background-resetabort.exe \
- main-returns-background.exe \
- main-returns-background-change.exe
-endif
-
-endif
-
if ENABLE_COOP
COOP_DISABLED_TESTS= thunks.exe
else
# 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 \
#
# Test that no symbols are missed in eglib-remap.h
#
-if NACL_CODEGEN
-else
if PLATFORM_LINUX
test-platform: test-eglib-remap
else
test-platform: test-eglib-remap
endif
endif
-endif
# The following regexp describes all symbols that start with "g_" but are not part of eglibc.
# The optional underscore prepending symbol names may or may not appear depending on the
# system and the state of the leading-underscore compiler flag.
test-generic-sharing-managed: test-runner.exe $(TESTS_GSHARED) $(TESTSAOT_GSHARED)
$(Q) $(TOOLS_RUNTIME) $(TEST_RUNNER) -j a --testsuite-name "gshared" --disabled "$(DISABLED_TESTS)" --opt-sets "gshared gshared,shared gshared,-inline gshared,-inline,shared" $(TESTS_GSHARED)
-if NACL_CODEGEN
-test-generic-sharing:
-else
test-generic-sharing:
@if test x$(M) != x0; then $(MAKE) test-generic-sharing-managed; else $(MAKE) test-generic-sharing-normal; fi
-endif
EXTRA_DIST += async-exceptions.cs
async-exceptions.exe : async-exceptions.cs
touch libtest.c
-if NACL_CODEGEN
-test-process-exit:
-else
EXTRA_DIST += threadpool-in-processexit.cs threadpool-in-processexit.exe.stdout.expected
test-process-exit:
@$(MCS) $(srcdir)/threadpool-in-processexit.cs -out:threadpool-in-processexit.exe
@echo "Testing threadpool-in-processexit.exe..."
@$(RUNTIME) threadpool-in-processexit.exe > threadpool-in-processexit.exe.stdout
@diff -w threadpool-in-processexit.exe.stdout $(srcdir)/threadpool-in-processexit.exe.stdout.expected
-endif
# tests that expect a 1 exit code
TESTS_UNHANDLED_EXCEPTION_1_SRC = \
.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
#endif /* HAVE_MORECORE */
#endif /* DARWIN */
-#if defined(__native_client__)
-#undef HAVE_MMAP
-#undef HAVE_MREMAP
-#define HAVE_MMAP 0
-#define HAVE_MREMAP 0
-#endif
-
#ifndef LACKS_SYS_TYPES_H
#include <sys/types.h> /* For size_t */
#endif /* LACKS_SYS_TYPES_H */
void
mono_sigctx_to_monoctx (void *sigctx, MonoContext *mctx)
{
-#if defined (__native_client__) || defined (HOST_WATCHOS)
+#if defined (HOST_WATCHOS)
printf("WARNING: mono_arch_sigctx_to_monoctx() called!\n");
mctx->eax = 0xDEADBEEF;
mctx->ebx = 0xDEADBEEF;
mctx->esi = ctx->SC_ESI;
mctx->edi = ctx->SC_EDI;
mctx->eip = ctx->SC_EIP;
-#endif /* if defined(__native_client__) */
+#endif
}
void
mono_monoctx_to_sigctx (MonoContext *mctx, void *sigctx)
{
-#if defined(__native_client__) || defined(HOST_WATCHOS)
+#if defined(HOST_WATCHOS)
printf("WARNING: mono_arch_monoctx_to_sigctx() called!\n");
#elif MONO_CROSS_COMPILE
g_assert_not_reached ();
ctx->SC_ESI = mctx->esi;
ctx->SC_EDI = mctx->edi;
ctx->SC_EIP = mctx->eip;
-#endif /* __native_client__ */
+#endif
}
#elif (defined(__x86_64__) && !defined(MONO_CROSS_COMPILE)) || (defined(TARGET_AMD64)) /* defined(__i386__) */
void
mono_sigctx_to_monoctx (void *sigctx, MonoContext *mctx)
{
-#if defined(__native_client_codegen__) || defined(__native_client__)
- printf("WARNING: mono_arch_sigctx_to_monoctx() called!\n");
-#endif
-
#ifdef MONO_CROSS_COMPILE
g_assert_not_reached ();
#elif defined(MONO_SIGNAL_USE_UCONTEXT_T)
void
mono_monoctx_to_sigctx (MonoContext *mctx, void *sigctx)
{
-#if defined(__native_client__) || defined(__native_client_codegen__)
- printf("WARNING: mono_arch_monoctx_to_sigctx() called!\n");
-#endif
-
#ifdef MONO_CROSS_COMPILE
g_assert_not_reached ();
#elif defined(MONO_SIGNAL_USE_UCONTEXT_T)
{
#ifdef MONO_CROSS_COMPILE
g_assert_not_reached ();
-#elif defined(__native_client__)
- g_assert_not_reached ();
#else
arm_ucontext *my_uc = sigctx;
{
#ifdef MONO_CROSS_COMPILE
g_assert_not_reached ();
-#elif defined(__native_client__)
- g_assert_not_reached ();
#else
arm_ucontext *my_uc = ctx;
#endif
#endif
-#if defined(__native_client__)
-#undef MONO_SIGNAL_USE_UCONTEXT_T
-#endif
-
#ifdef __HAIKU__
/* sigcontext surrogate */
struct sigcontext {
#include <mono/arch/amd64/amd64-codegen.h>
-#if !defined( HOST_WIN32 ) && !defined(__native_client__) && !defined(__native_client_codegen__)
+#if !defined( HOST_WIN32 )
#if defined(HAVE_SIGACTION) || defined(__APPLE__) // the __APPLE__ check is required for the tvos simulator, which has ucontext_t but not sigaction
#define MONO_SIGNAL_USE_UCONTEXT_T 1
extern void mono_context_get_current (void *);
#define MONO_CONTEXT_GET_CURRENT(ctx) do { mono_context_get_current((void*)&(ctx)); } while (0)
-#elif defined(__native_client__)
-#define MONO_CONTEXT_GET_CURRENT(ctx) \
- __asm__ __volatile__( \
- "movq $0x0, %%nacl:0x00(%%r15, %0, 1)\n" \
- "movq %%rcx, %%nacl:0x08(%%r15, %0, 1)\n" \
- "movq %%rdx, %%nacl:0x10(%%r15, %0, 1)\n" \
- "movq %%rbx, %%nacl:0x18(%%r15, %0, 1)\n" \
- "movq %%rsp, %%nacl:0x20(%%r15, %0, 1)\n" \
- "movq %%rbp, %%nacl:0x28(%%r15, %0, 1)\n" \
- "movq %%rsi, %%nacl:0x30(%%r15, %0, 1)\n" \
- "movq %%rdi, %%nacl:0x38(%%r15, %0, 1)\n" \
- "movq %%r8, %%nacl:0x40(%%r15, %0, 1)\n" \
- "movq %%r9, %%nacl:0x48(%%r15, %0, 1)\n" \
- "movq %%r10, %%nacl:0x50(%%r15, %0, 1)\n" \
- "movq %%r11, %%nacl:0x58(%%r15, %0, 1)\n" \
- "movq %%r12, %%nacl:0x60(%%r15, %0, 1)\n" \
- "movq %%r13, %%nacl:0x68(%%r15, %0, 1)\n" \
- "movq %%r14, %%nacl:0x70(%%r15, %0, 1)\n" \
- "movq %%r15, %%nacl:0x78(%%r15, %0, 1)\n" \
- "leaq (%%rip), %%rdx\n" \
- "movq %%rdx, %%nacl:0x80(%%r15, %0, 1)\n" \
- : \
- : "a" ((int64_t)&(ctx)) \
- : "rdx", "memory")
#else
#define MONO_CONTEXT_GET_CURRENT_GREGS(ctx) \
#define MONO_SOLIB_EXT ".dll"
#elif defined(__ppc__) && defined(TARGET_MACH)
#define MONO_SOLIB_EXT ".dylib"
-#elif defined(TARGET_MACH) && defined(TARGET_X86) && !defined(__native_client_codegen__)
+#elif defined(TARGET_MACH) && defined(TARGET_X86)
#define MONO_SOLIB_EXT ".dylib"
-#elif defined(TARGET_MACH) && defined(TARGET_AMD64) && !defined(__native_client_codegen__)
+#elif defined(TARGET_MACH) && defined(TARGET_AMD64)
#define MONO_SOLIB_EXT ".dylib"
#else
#define MONO_SOLIB_EXT ".so"
* \p length must be a multiple of the page size.
* \returns \c 0 on success.
*/
-#if defined(__native_client__)
-int
-mono_mprotect (void *addr, size_t length, int flags)
-{
- int prot = prot_from_flags (flags);
- void *new_addr;
-
- if (flags & MONO_MMAP_DISCARD) memset (addr, 0, length);
-
- new_addr = mmap(addr, length, prot, MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS, -1, 0);
- if (new_addr == addr) return 0;
- return -1;
-}
-#else
int
mono_mprotect (void *addr, size_t length, int flags)
{
}
return mprotect (addr, length, prot);
}
-#endif // __native_client__
#else
#ifdef HOST_WIN32
// Windows specific implementation in mono-rand-windows.c
-#elif defined (HAVE_SYS_UN_H) && !defined(__native_client__)
+#elif defined (HAVE_SYS_UN_H)
#include <errno.h>
#include <fcntl.h>
#endif
}
-#ifndef __native_client__
-
static int suspend_signal_num = -1;
static int restart_signal_num = -1;
static int abort_signal_num = -1;
return abort_signal_num;
}
-#else
-
-void
-mono_threads_suspend_init_signals (void)
-{
- g_assert_not_reached ();
-}
-
-gint
-mono_threads_suspend_get_suspend_signal (void)
-{
- return -1;
-}
-
-gint
-mono_threads_suspend_get_restart_signal (void)
-{
- return -1;
-}
-
-gint
-mono_threads_suspend_get_abort_signal (void)
-{
- return -1;
-}
-
-#endif /* __native_client__ */
-
-
#endif /* defined(USE_POSIX_BACKEND) */
extern int tkill (pid_t tid, int signal);
#endif
-#if defined(_POSIX_VERSION) || defined(__native_client__)
+#if defined(_POSIX_VERSION)
#include <pthread.h>
errno = old_errno;
}
return result;
-#elif defined(__native_client__)
- /* Workaround pthread_kill abort() in NaCl glibc. */
- return 0;
#elif !defined(HAVE_PTHREAD_KILL)
g_error ("pthread_kill() is not supported by this platform");
#else
return !pthread_join (tid, &res);
}
-#endif /* defined(_POSIX_VERSION) || defined(__native_client__) */
+#endif /* defined(_POSIX_VERSION) */
#if defined(USE_POSIX_BACKEND)
((MonoThreadInfo*)info)->tls [key] = value;
}
-#if defined(__native_client__)
-void nacl_shutdown_gc_thread(void);
-#endif
-
/*
* mono_thread_info_exit:
*
void
mono_thread_info_exit (gsize exit_code)
{
-#if defined(__native_client__)
- nacl_shutdown_gc_thread();
-#endif
-
mono_thread_info_detach ();
mono_threads_platform_exit (0);
/* If this is defined, use the signals backed on Mach. Debug only as signals can't be made usable on OSX. */
// #define USE_SIGNALS_ON_MACH
-#if defined (_POSIX_VERSION) || defined (__native_client__)
+#if defined (_POSIX_VERSION)
#if defined (__MACH__) && !defined (USE_SIGNALS_ON_MACH)
#define USE_MACH_BACKEND
#else
#define USE_WINDOWS_BACKEND
#else
#error "no backend support for current platform"
-#endif /* defined (_POSIX_VERSION) || defined (__native_client__) */
+#endif /* defined (_POSIX_VERSION) */
enum {
STATE_STARTING = 0x00,
if ((mask == 0) || (nth_bit == BITS_PER_CHUNK))
return -1;
-#if defined(__native_client__) && (defined(__i386__) || defined(__x86_64))
-#define USE_X86_32BIT_INSTRUCTIONS 1
-#endif
-
-#if (defined(__i386__) && defined(__GNUC__)) || defined(USE_X86_32BIT_INSTRUCTIONS)
+#if (defined(__i386__) && defined(__GNUC__))
{
int r;
/* This depends on mask != 0 */
my_g_bit_nth_lsf_nomask (gsize mask)
{
/* Mask is expected to be != 0 */
-#if (defined(__i386__) && defined(__GNUC__)) || defined(USE_X86_32BIT_INSTRUCTIONS)
+#if (defined(__i386__) && defined(__GNUC__))
int r;
__asm__("bsfl %1,%0\n\t"
-<?xml version="1.0" encoding="utf-8"?>\r
+<?xml version="1.0" encoding="utf-8"?>\r
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<ItemGroup Label="ProjectConfigurations">\r
<ProjectConfiguration Include="Debug|Win32">\r
<ClCompile Include="..\mono\metadata\mono-conc-hash.c" />\r
<ClCompile Include="..\mono\metadata\mono-mlist.c" />\r
<ClCompile Include="..\mono\metadata\mono-perfcounters.c" />\r
- <ClCompile Include="..\mono\metadata\nacl-stub.c" />\r
<ClCompile Include="..\mono\metadata\null-gc.c" />\r
<ClCompile Include="..\mono\metadata\number-ms.c" />\r
<ClCompile Include="..\mono\metadata\object.c" />\r
-<?xml version="1.0" encoding="utf-8"?>\r
+<?xml version="1.0" encoding="utf-8"?>\r
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<ItemGroup>\r
<ClCompile Include="..\mono\metadata\assembly.c">\r
<ClCompile Include="..\mono\metadata\mono-security.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\mono\metadata\nacl-stub.c">\r
- <Filter>Source Files</Filter>\r
- </ClCompile>\r
<ClCompile Include="..\mono\metadata\null-gc.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
+++ /dev/null
-Building NaCl Mono with glibc (newlib support is eliminated but should still be buildable with small effort) is complex. Instructions live here for the adventurous: https://docs.google.com/a/google.com/document/d/1Jd_4M7mlmxF8daVbepAy_8RKYcRbhifXanRYyBKkVa4/pub
-
+++ /dev/null
-# Copyright (c) 2011 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that be
-# found in the LICENSE file.
-#
-
-set -o nounset
-set -o errexit
-
-# scripts that source this file must be run from within packages tree
-readonly SAVE_PWD=$(pwd)
-
-# Pick platform directory for compiler.
-readonly OS_NAME=$(uname -s)
-if [ $OS_NAME = "Darwin" ]; then
- readonly OS_SUBDIR="mac"
- readonly OS_SUBDIR_SHORT="mac"
-elif [ $OS_NAME = "Linux" ]; then
- readonly OS_SUBDIR="linux"
- readonly OS_SUBDIR_SHORT="linux"
-else
- readonly OS_SUBDIR="windows"
- readonly OS_SUBDIR_SHORT="win"
-fi
-
-readonly MACHINE=$(uname -m)
-if [ $MACHINE = "x86_64" ]; then
- readonly TARGET_BITSIZE=${TARGET_BITSIZE:-"64"}
- readonly HOST_BITSIZE=${HOST_BITSIZE:-"64"}
-else
- # uname -m reports i686 on Linux and i386 on Mac
- readonly TARGET_BITSIZE=${TARGET_BITSIZE:-"32"}
- readonly HOST_BITSIZE=${HOST_BITSIZE:-"32"}
-fi
-
-if [ $TARGET_BITSIZE == "64" ]; then
- readonly TARGET_BIT_PREFIX="64"
- readonly CROSS_ID=x86_64
-else
- readonly TARGET_BIT_PREFIX=""
- readonly CROSS_ID=i686
-fi
-# we might want to override the detected host platform (e.g. on OSX 10.6)
-if [ $HOST_BITSIZE == "64" ]; then
- readonly HOST_BIT_PREFIX="64"
-else
- readonly HOST_BIT_PREFIX=""
-fi
-
-export NACL_CROSS_PREFIX=${CROSS_ID}-nacl
-export NACL_CROSS_PREFIX_DASH=${NACL_CROSS_PREFIX}-
-
-readonly NACL_NEWLIB=${NACL_NEWLIB:-"0"}
-
-if [ $NACL_NEWLIB = "1" ]; then
- readonly NACL_SDK_BASE=${NACL_SDK_ROOT}/toolchain/${OS_SUBDIR_SHORT}_x86_newlib
-else
-case "${NACL_SDK_ROOT}" in
-*pepper_15* | *pepper_16* | *pepper_17*)
- readonly NACL_SDK_BASE=${NACL_SDK_ROOT}/toolchain/${OS_SUBDIR_SHORT}_x86
- ;;
-*)
- readonly NACL_SDK_BASE=${NACL_SDK_ROOT}/toolchain/${OS_SUBDIR_SHORT}_x86_glibc
- ;;
-esac
-fi
-
-readonly NACL_BIN_PATH=${NACL_SDK_BASE}/bin
-export NACLCC=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX_DASH}gcc
-export NACLCXX=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX_DASH}g++
-export NACLAR=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX_DASH}ar
-export NACLRANLIB=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX_DASH}ranlib
-export NACLLD=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX_DASH}ld
-export NACLAS=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX_DASH}as
-
-# NACL_SDK_GCC_SPECS_PATH is where nacl-gcc 'specs' file will be installed
-readonly NACL_SDK_GCC_SPECS_PATH=${NACL_SDK_BASE}/lib/gcc/x86_64-nacl/4.4.3
-
-# NACL_SDK_USR is where the headers, libraries, etc. will be installed
-readonly NACL_SDK_USR=${NACL_SDK_BASE}/${NACL_CROSS_PREFIX}/usr
-readonly NACL_SDK_USR_INCLUDE=${NACL_SDK_USR}/include
-readonly NACL_SDK_USR_LIB=${NACL_SDK_USR}/lib
-
-
-######################################################################
-# Helper functions
-######################################################################
-
-Banner() {
- echo "######################################################################"
- echo $*
- echo "######################################################################"
-}
-
-
-VerifyPath() {
- # make sure path isn't all slashes (possibly from an unset variable)
- local PATH=$1
- local TRIM=${PATH##/}
- if [ ${#TRIM} -ne 0 ]; then
- return 0
- else
- return 1
- fi
-}
-
-
-ChangeDir() {
- local NAME=$1
- if VerifyPath ${NAME}; then
- cd ${NAME}
- else
- echo "ChangeDir called with bad path."
- exit -1
- fi
-}
-
-
-Remove() {
- local NAME=$1
- if VerifyPath ${NAME}; then
- rm -rf ${NAME}
- else
- echo "Remove called with bad path."
- exit -1
- fi
-}
-
-
-MakeDir() {
- local NAME=$1
- if VerifyPath ${NAME}; then
- mkdir -p ${NAME}
- else
- echo "MakeDir called with bad path."
- exit -1
- fi
-}
-
-
-PatchSpecFile() {
- # fix up spaces so gcc sees entire path
- local SED_SAFE_SPACES_USR_INCLUDE=${NACL_SDK_USR_INCLUDE/ /\ /}
- local SED_SAFE_SPACES_USR_LIB=${NACL_SDK_USR_LIB/ /\ /}
- # have nacl-gcc dump specs file & add include & lib search paths
- ${NACL_SDK_BASE}/bin/x86_64-nacl-gcc -dumpspecs |\
- sed "/*cpp:/{
- N
- s|$| -I${SED_SAFE_SPACES_USR_INCLUDE}|
- }" |\
- sed "/*link_libgcc:/{
- N
- s|$| -L${SED_SAFE_SPACES_USR_LIB}|
- }" >${NACL_SDK_GCC_SPECS_PATH}/specs
-}
-
-
-DefaultConfigureStep() {
- Banner "Configuring ${PACKAGE_NAME}"
- # export the nacl tools
- export CC=${NACLCC}
- export CXX=${NACLCXX}
- export AR=${NACLAR}
- export RANLIB=${NACLRANLIB}
- export PKG_CONFIG_PATH=${NACL_SDK_USR_LIB}/pkgconfig
- export PKG_CONFIG_LIBDIR=${NACL_SDK_USR_LIB}
- export PATH=${NACL_BIN_PATH}:${PATH};
- ChangeDir ${NACL_PACKAGES_REPOSITORY}/${PACKAGE_NAME}
- Remove ${PACKAGE_NAME}-build
- MakeDir ${PACKAGE_NAME}-build
- cd ${PACKAGE_NAME}-build
- ../configure \
- --host=nacl \
- --disable-shared \
- --prefix=${NACL_SDK_USR} \
- --exec-prefix=${NACL_SDK_USR} \
- --libdir=${NACL_SDK_USR_LIB} \
- --oldincludedir=${NACL_SDK_USR_INCLUDE} \
- --with-http=off \
- --with-html=off \
- --with-ftp=off \
- --with-x=no
-}
-
-
-DefaultBuildStep() {
- # assumes pwd has makefile
- make clean
-if [ $TARGET_BITSIZE == "64" ]; then
- make -j8
-else
- make
-fi
-}
-
-
-DefaultInstallStep() {
- # assumes pwd has makefile
- make install
-}
-
-
-DefaultCleanUpStep() {
- PatchSpecFile
- ChangeDir ${SAVE_PWD}
-}
-
-
-DefaultPackageInstall() {
- DefaultPreInstallStep
- DefaultDownloadStep
- DefaultExtractStep
- DefaultPatchStep
- DefaultConfigureStep
- DefaultBuildStep
- DefaultInstallStep
- DefaultCleanUpStep
-}
+++ /dev/null
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs, see configure's option --config-cache.
-# It is not useful on other systems. If it contains results you don't
-# want to keep, you may remove or edit it.
-#
-# config.status only pays attention to the cache file if you give it
-# the --recheck option to rerun configure.
-#
-# `ac_cv_env_foo' variables (set or unset) will be overridden when
-# loading this file, other *unset* `ac_cv_foo' will be assigned the
-# following values.
-
-ac_cv_func_mmap=${ac_cv_func_mmap=no}
-ac_cv_var_timezone=${ac_cv_var_timezone=yes}
-ac_cv_host=${ac_cv_host=i686-pc-nacl}
-ac_cv_target=${ac_cv_target=i686-pc-nacl}
-ac_cv_func_backtrace_symbols=${ac_cv_func_backtrace_symbols=no}
-mono_cv_uscore=${mono_cv_uscore=no}
+++ /dev/null
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs, see configure's option --config-cache.
-# It is not useful on other systems. If it contains results you don't
-# want to keep, you may remove or edit it.
-#
-# config.status only pays attention to the cache file if you give it
-# the --recheck option to rerun configure.
-#
-# `ac_cv_env_foo' variables (set or unset) will be overridden when
-# loading this file, other *unset* `ac_cv_foo' will be assigned the
-# following values.
-
-ac_cv_func_mmap=${ac_cv_func_mmap=no}
-ac_cv_var_timezone=${ac_cv_var_timezone=yes}
-ac_cv_host=${ac_cv_host=x86_64-pc-nacl}
-ac_cv_target=${ac_cv_target=x86_64-pc-nacl}
-ac_cv_func_backtrace_symbols=${ac_cv_func_backtrace_symbols=no}
-mono_cv_uscore=${mono_cv_uscore=no}
+++ /dev/null
-#!/bin/bash
-# Copyright (c) 2009 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that be
-# found in the LICENSE file.
-#
-
-# nacl-runtime-mono.sh
-#
-# usage: nacl-runtime-mono.sh
-#
-# this script builds mono runtime for Native Client
-#
-
-readonly MONO_TRUNK_NACL=$(pwd)
-
-source common.sh
-
-readonly PACKAGE_NAME=runtime${TARGET_BIT_PREFIX}-build
-readonly INSTALL_PATH=${MONO_TRUNK_NACL}/naclmono-${CROSS_ID}
-
-
-CustomConfigureStep() {
- Banner "Configuring ${PACKAGE_NAME}"
- # export the nacl tools
- set +e
- if [ -f ${PACKAGE_NAME}/Makefile ]
- then
- cd ${PACKAGE_NAME}
- fi
- make distclean
- cd ${MONO_TRUNK_NACL}
- set -e
- if [ $TARGET_BITSIZE == "32" ]; then
- CONFIG_OPTS="--host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --target=i686-pc-linux-gnu"
- else
- CONFIG_OPTS="--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu"
- fi
- # UGLY hack to allow dynamic linking
- sed -i -e s/elf_i386/elf_nacl/ -e s/elf_x86_64/elf64_nacl/ ../configure
- sed -i -e s/elf_i386/elf_nacl/ -e s/elf_x86_64/elf64_nacl/ ../libgc/configure
- sed -i -e s/elf_i386/elf_nacl/ -e s/elf_x86_64/elf64_nacl/ ../eglib/configure
- Remove ${PACKAGE_NAME}
- MakeDir ${PACKAGE_NAME}
- cd ${PACKAGE_NAME}
- CC=${NACLCC} CXX=${NACLCXX} AR=${NACLAR} RANLIB=${NACLRANLIB} PKG_CONFIG_PATH=${NACL_SDK_USR_LIB}/pkgconfig LD="${NACLLD}" \
- PKG_CONFIG_LIBDIR=${NACL_SDK_USR_LIB} PATH=${NACL_BIN_PATH}:${PATH} LIBS="-lnacl_dyncode -lc -lg -lnosys -lnacl" \
- CFLAGS="-g -O2 -D_POSIX_PATH_MAX=256 -DPATH_MAX=256" ../../configure \
- ${CONFIG_OPTS} \
- --exec-prefix=${INSTALL_PATH} \
- --libdir=${INSTALL_PATH}/lib \
- --prefix=${INSTALL_PATH} \
- --program-prefix="" \
- --oldincludedir=${INSTALL_PATH}/include \
- --with-glib=embedded \
- --with-tls=pthread \
- --enable-threads=posix \
- --without-sigaltstack \
- --without-mmap \
- --with-gc=included \
- --enable-nacl-gc \
- --with-sgen=no \
- --enable-nls=no \
- --enable-nacl-codegen \
- --disable-system-aot \
- --enable-shared \
- --disable-parallel-mark \
- --with-static-mono=no
-
-}
-
-CustomInstallStep() {
- make install
-}
-
-CustomPackageInstall() {
- CustomConfigureStep
- DefaultBuildStep
- CustomInstallStep
-}
-
-CustomPackageInstall
-exit 0
+++ /dev/null
-#!/bin/bash
-# Copyright (c) 2012 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# Usage: nacl_interp_loader.sh PLATFORM NEXE ARGS...
-
-# Assumes this file is sitting in the source tree.
-# This should be changed for some proper SDK installation setup.
-NACL_SDK_ROOT=${NACL_SDK_ROOT:-/path/to/naclsdk/pepper_XX}
-
-case "$1" in
-i?86)
- arch=x86_32
- libdir=lib32
- ;;
-x86_64)
- arch=x86_64
- libdir=lib64
- ;;
-arm|v7l)
- arch=arm
- libdir=lib32
- ;;
-*)
- echo >&2 "$0: Do not recognize architecture \"$1\""
- exit 127
- ;;
-esac
-
-shift
-
-case "${NACL_SDK_ROOT}" in
-*pepper_15* | *pepper_16* | *pepper_17*)
- SEL_LDR="$NACL_SDK_ROOT/toolchain/linux_x86/bin/sel_ldr_${arch}"
- IRT="$NACL_SDK_ROOT/toolchain/linux_x86/runtime/irt_core_${arch}.nexe"
- RTLD="$NACL_SDK_ROOT/toolchain/linux_x86/x86_64-nacl/${libdir}/runnable-ld.so"
- LIBDIR="$NACL_SDK_ROOT/toolchain/linux_x86/x86_64-nacl/${libdir}"
- ;;
-*)
- SEL_LDR="$NACL_SDK_ROOT/tools/sel_ldr_${arch}"
- IRT="$NACL_SDK_ROOT/tools/irt_core_${arch}.nexe"
- RTLD="$NACL_SDK_ROOT/toolchain/linux_x86_glibc/x86_64-nacl/${libdir}/runnable-ld.so"
- LIBDIR="$NACL_SDK_ROOT/toolchain/linux_x86_glibc/x86_64-nacl/${libdir}"
- ;;
-esac
-
-IGNORE_VALIDATOR_ARG=""
-if [ x"$NACL_IGNORE_VALIDATOR" == x"1" ]; then
- IGNORE_VALIDATOR_ARG="-c"
-fi
-
-exec "$SEL_LDR" -E "NACL_PWD=`pwd`" -E "MONO_PATH=$MONO_PATH" \
- -E "MONO_CFG_DIR=$MONO_CFG_DIR" -E "MONO_SHARED_DIR=$MONO_SHARED_DIR" \
- -a $IGNORE_VALIDATOR_ARG -S -B "$IRT" -l /dev/null -- "$RTLD" \
- --library-path $LIBDIR "$@"
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):
Package.__init__(self, 'mono-extensions', None,
sources=['git@github.com:xamarin/mono-extensions.git'],
git_branch=self.profile.release_packages[
- 'mono'].git_branch
+ 'mono'].git_branch,
+ revision='07ad37d63e0e9dcf7c879a72bc14c5d6c794f7b6'
)
self.source_dir_name = 'mono-extensions'
if [ "$$ok" = "false" ]; then echo "<?xml version='1.0' encoding='utf-8'?><test-results failures='1' total='1' not-run='0' name='verify' date='$$(date +%F)' time='$$(date +%T)'><test-suite name='mcs-compileall' success='False' time='0'><results><test-case name='fail' executed='True' success='False' time='0'><failure><message>Verifying framework assemblies failed. Check the log for more details.</message><stack-trace></stack-trace></failure></test-case></results></test-suite></test-results>" > TestResult-verify.xml; fi; \
$$ok
-if NACL_CODEGEN
-check-local:
-else
check-local: mcs-compileall mcs-do-test-profiles
$(MAKE) mcs-do-run-test-profiles
-endif
# Compile all mcs tests
test: mcs-do-test-profiles
PATH="$r/runtime/_tmpinst/bin:$PATH"
MONO_EXECUTABLE=${MONO_EXECUTABLE:-"$r/@mono_runtime@"}
export MONO_CFG_DIR PATH
-if [ -n "@nacl_self_host@" ]; then
- case "$@" in
- # gacutil.exe and mdoc.exe require filesystem functionality not
- # exposed in NaCl.
- # mcs.exe was added to the list recently because mcs under NaCl
- # no longer produces equivalent output. TODO: investigate
- */mcs.exe* | */gacutil.exe* | */mdoc.exe* ) exec /usr/local/bin/mono "$@";;
- esac
-fi
exec "$r/libtool" --mode=execute "${MONO_EXECUTABLE}" --config "@mono_cfg_dir@/mono/config" "$@"
${TESTCMD} --label=Microsoft.Build.Tasks --timeout=5m make -w -C mcs/class/Microsoft.Build.Tasks run-test
${TESTCMD} --label=Microsoft.Build.Utilities --timeout=5m make -w -C mcs/class/Microsoft.Build.Utilities run-test
${TESTCMD} --label=Mono.C5 --timeout=5m make -w -C mcs/class/Mono.C5 run-test
+${TESTCMD} --label=Mono.Options --timeout=5m make -w -C mcs/class/Mono.Options run-test
${TESTCMD} --label=Mono.Tasklets --timeout=5m make -w -C mcs/class/Mono.Tasklets run-test
${TESTCMD} --label=System.Configuration --timeout=5m make -w -C mcs/class/System.Configuration run-test
${TESTCMD} --label=System.Transactions --timeout=5m make -w -C mcs/class/System.Transactions run-test
${TESTCMD} --label=Mono.CSharp --timeout=5m make -w -C mcs/class/Mono.CSharp run-test
${TESTCMD} --label=WindowsBase --timeout=5m make -w -C mcs/class/WindowsBase run-test
${TESTCMD} --label=System.Numerics --timeout=5m make -w -C mcs/class/System.Numerics run-test
+if [[ ${label} == w* ]]; then ${TESTCMD} --label=System.Numerics-xunit --skip; else ${TESTCMD} --label=System.Numerics-xunit --timeout=5m make -w -C mcs/class/System.Numerics run-xunit-test; fi
${TESTCMD} --label=System.Runtime.DurableInstancing --timeout=5m make -w -C mcs/class/System.Runtime.DurableInstancing run-test
${TESTCMD} --label=System.ServiceModel.Discovery --timeout=5m make -w -C mcs/class/System.ServiceModel.Discovery run-test
${TESTCMD} --label=System.Xaml --timeout=5m make -w -C mcs/class/System.Xaml run-test
"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