Merge pull request #4845 from lambdageek/dev-coop-delegates
authorAleksey Kliger (λgeek) <akliger@gmail.com>
Wed, 24 May 2017 19:56:38 +0000 (15:56 -0400)
committerGitHub <noreply@github.com>
Wed, 24 May 2017 19:56:38 +0000 (15:56 -0400)
[marshal] Use coop handles for delegates icalls

18 files changed:
configure.ac
mcs/Makefile
mcs/class/System.Numerics/Makefile
mcs/class/System/System.Net.Sockets/SocketAsyncEventArgs.cs
mcs/class/Xunit.NetCore.Extensions/Makefile
mcs/class/corlib/Mono/RuntimeStructs.cs
mcs/class/corlib/System/TimeZoneInfo.cs
mcs/class/corlib/corert/Debug.cs
mcs/class/referencesource/mscorlib/system/io/filesystemenumerable.cs
mcs/errors/cs1031-3.cs [new file with mode: 0644]
mcs/mcs/cs-tokenizer.cs
mcs/tools/mkbundle/mkbundle.cs
mono/metadata/class.c
mono/metadata/handle.c
mono/metadata/handle.h
mono/metadata/marshal.c
mono/tests/Makefile.am
mono/tests/testing_gac/Makefile.am

index 86a2354b389338d03914c8895349d15b7ba3c0db..c5c7ba58b9e3cfbd99ec0da64a13c1f3872cee0f 100644 (file)
@@ -40,7 +40,7 @@ MONO_VERSION_BUILD=`echo $VERSION | cut -d . -f 3`
 # This can be reset to 0 when Mono's version number is bumped
 # since it's part of the corlib version (the prefix '1' in the full
 # version number is to ensure the number isn't treated as octal in C)
-MONO_CORLIB_COUNTER=1
+MONO_CORLIB_COUNTER=2
 MONO_CORLIB_VERSION=`printf "1%02d%02d%02d%03d" $MONO_VERSION_MAJOR $MONO_VERSION_MINOR $MONO_VERSION_BUILD $MONO_CORLIB_COUNTER`
 
 AC_DEFINE_UNQUOTED(MONO_CORLIB_VERSION,$MONO_CORLIB_VERSION,[Version of the corlib-runtime interface])
index 2eab28f83eef52ff11772987bf66de571ac9b4f3..d04525bd34fc2a4b5a4425082b6f53cf7258cfc2 100644 (file)
@@ -95,8 +95,7 @@ DISTFILES = \
        mkinstalldirs           \
        MonoIcon.png            \
        README                  \
-       ScalableMonoIcon.svg    \
-       winexe.in
+       ScalableMonoIcon.svg
 
 dist-local: dist-default
 
index f13e64122ace5db53316040604935379b3f4c7c7..1e05c08cfebc4e65d6d910e50613ac59a086b5a0 100644 (file)
@@ -6,7 +6,7 @@ LIBRARY = System.Numerics.dll
 LIB_REFS = System
 LIB_MCS_FLAGS = /unsafe
 TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
-XTEST_LIB_REFS = System Facades/System.Threading.Tasks System.Runtime.InteropServices.RuntimeInformation System.Core System.Numerics.Vectors Microsoft.CSharp
+XTEST_LIB_REFS = System Facades/System.Threading.Tasks Facades/System.Runtime.InteropServices.RuntimeInformation System.Core System.Numerics.Vectors Microsoft.CSharp
 XTEST_LIB_FLAGS = -unsafe
 
 RESX_RESOURCE_STRING = \
index 419035efe15fe3ad31aac61aa2ba427ccc397620..57c549fd2a23ddc44c6fe28c16ed6c84180c9d7e 100644 (file)
@@ -262,7 +262,6 @@ namespace System.Net.Sockets
                        SetResults(SocketError.Success, bytesTransferred, flags);
                        current_socket = connectSocket;
 
-                       Complete ();
                        OnCompleted (this);
                }
 
index 5be627d315adcad7f37fa37397e1d608bca3ade3..7ea0857b3466bb76cd43b6cd25c5806daefb971a 100644 (file)
@@ -5,7 +5,7 @@ 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 System.Runtime.InteropServices.RuntimeInformation Facades/System.Runtime Facades/System.Threading.Tasks
+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 =
index f70ee556ac6adb177de9fa5cc15cc469928fefca..92884a2591d87096214b2498460e1c9499351f3a 100644 (file)
@@ -51,7 +51,7 @@ namespace Mono {
 
                // handle.h HandleStackMark
                struct HandleStackMark {
-                       int size;
+                       int size, interior_size;
                        IntPtr chunk;
                }
 
index 5c812b6f592288d5ac486919837ee6170de6ddde..1c5cdd3ae820dc363687a19efbfe553ca31b6b20 100644 (file)
@@ -574,11 +574,17 @@ namespace System
 #if LIBC
                private static TimeZoneInfo FindSystemTimeZoneByFileName (string id, string filepath)
                {
-                       if (!File.Exists (filepath))
-                               throw new TimeZoneNotFoundException ();
-
-                       using (FileStream stream = File.OpenRead (filepath)) {
+                       FileStream stream = null;
+                       try {
+                               stream = File.OpenRead (filepath);      
+                       } catch (Exception ex) {
+                               throw new TimeZoneNotFoundException ("Couldn't read time zone file " + filepath, ex);
+                       }
+                       try {
                                return BuildFromStream (id, stream);
+                       } finally {
+                               if (stream != null)
+                                       stream.Dispose();
                        }
                }
 #endif
index eda79f7927d24d7faec8bcac20d1d8fff7bc2976..31959c173984ea0d2d5a32ab360e8b6bfccd340b 100644 (file)
@@ -2,8 +2,6 @@ namespace System.Diagnostics.Private
 {
        static partial class Debug
        {
-               static readonly string NewLine = Environment.NewLine;
-
                static void ShowAssertDialog (string stackTrace, string message, string detailMessage)
                {
                        // FIXME should we g_error in this case?
index 145bbb5424b7ffae80cfb0d158a3c230a822a941..c9fca00b3e437277f5fc58b1c8e9a9e2af2710f2 100644 (file)
@@ -783,9 +783,10 @@ namespace System.IO
         internal override DirectoryInfo CreateObject(SearchResult result)
         {
             String name = result.FullPath;
-            String permissionName = name + "\\.";
 
 #if MONO_FEATURE_CAS
+            String permissionName = name + "\\.";
+
 #if FEATURE_CORECLR
             FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, permissionName);
             state.EnsureState();
@@ -821,9 +822,10 @@ namespace System.IO
             if (isDir)
             {
                 String name = result.FullPath;
-                String permissionName = name + "\\.";
 
 #if MONO_FEATURE_CAS
+                String permissionName = name + "\\.";
+
 #if FEATURE_CORECLR
                 FileSecurityState state = new FileSecurityState(FileSecurityStateAccess.Read, String.Empty, permissionName);
                 state.EnsureState();
diff --git a/mcs/errors/cs1031-3.cs b/mcs/errors/cs1031-3.cs
new file mode 100644 (file)
index 0000000..3126dfa
--- /dev/null
@@ -0,0 +1,18 @@
+// CS1031: Type expected
+// Line: 16
+
+public class B<Y>  where Y: B<Y>
+{
+}
+
+public class A<X>: B<A<X>>
+{
+}
+
+public class Repro
+{
+       public static void Main (string[] args)
+       {
+               var h = typeof (B<A<>>);
+       }
+}
\ No newline at end of file
index e6a95fe8163a3590acb9f23602cc10d4cdec63dd..d6314ff005a3222079d9eb1eb746b258780da2f8 100644 (file)
@@ -1267,7 +1267,8 @@ namespace Mono.CSharp
                        else if (the_token == Token.INTERR_NULLABLE || the_token == Token.STAR)
                                goto again;
                        else if (the_token == Token.OP_GENERICS_LT) {
-                               if (!parse_less_than (ref genericDimension))
+                               int unused = 0;
+                               if (!parse_less_than (ref unused))
                                        return false;
                                goto again;
                        } else if (the_token == Token.OPEN_BRACKET) {
index a76e9f88c92a1440897c007e92937f4d16b89311..ab13accc034c54695fba45e8b4deecf3854a0f30 100755 (executable)
@@ -1110,6 +1110,14 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
                }
 
                if (error != null) {
+                       Console.Error.WriteLine ("Failure to load i18n assemblies, the following directories were searched for the assemblies:");
+                       foreach (var path in link_paths){
+                               Console.Error.WriteLine ("   Path: " + path);
+                       }
+                       if (custom_mode){
+                               Console.WriteLine ("In Custom mode, you need to provide the directory to lookup assemblies from using -L");
+                       }
+                       
                        Error ("Couldn't load one or more of the i18n assemblies: " + error);
                        Environment.Exit (1);
                }
@@ -1183,7 +1191,12 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
                Assembly a = null;
                
                try {
+                       if (!quiet)
+                               Console.WriteLine ("Attempting to load assembly: {0}", assembly);
                        a = universe.LoadFile (assembly);
+                       if (!quiet)
+                               Console.WriteLine ("Assembly {0} loaded successfully.", assembly);
+                       
                } catch (FileNotFoundException){
                        Error ($"Cannot find assembly `{assembly}'");
                } catch (IKVM.Reflection.BadImageFormatException f) {
@@ -1206,6 +1219,8 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
                string total_log = "";
                foreach (string dir in link_paths){
                        string full_path = Path.Combine (dir, assembly);
+                       if (!quiet)
+                               Console.WriteLine ("Attempting to load assembly from: " + full_path);
                        if (!assembly.EndsWith (".dll") && !assembly.EndsWith (".exe"))
                                full_path += ".dll";
                        
index a998457113d3b60c6e475a8cb714743e932f34a6..ee0695ceccfbdb32dd39229a366fef7f3f01824d 100644 (file)
@@ -1631,8 +1631,7 @@ mono_class_setup_fields (MonoClass *klass)
                        char *class_name = mono_type_get_full_name (klass);
                        char *type_name = mono_type_full_name (field->type);
 
-                       mono_class_set_type_load_failure (klass, "");
-                       g_warning ("Invalid type %s for instance field %s:%s", type_name, class_name, field->name);
+                       mono_class_set_type_load_failure (klass, "Invalid type %s for instance field %s:%s", type_name, class_name, field->name);
                        g_free (class_name);
                        g_free (type_name);
                        break;
index 00a11e67319e375ff9004906341b53320767fbcb..a0f5c4459f1a90c215ace491307b2ede24d7fb80 100644 (file)
@@ -73,66 +73,12 @@ const MonoObjectHandle mono_null_value_handle = NULL;
 
 #define THIS_IS_AN_OK_NUMBER_OF_HANDLES 100
 
-enum {
-       HANDLE_CHUNK_PTR_OBJ = 0x0, /* chunk element points to beginning of a managed object */
-       HANDLE_CHUNK_PTR_INTERIOR = 0x1, /* chunk element points into the middle of a managed object */
-       HANDLE_CHUNK_PTR_MASK = 0x1
-};
-
-/* number of bits in each word of the interior pointer bitmap */
-#define INTERIOR_HANDLE_BITMAP_BITS_PER_WORD (sizeof(guint32) << 3)
-
-static gboolean
-bitset_bits_test (guint32 *bitmaps, int idx)
-{
-       int w = idx / INTERIOR_HANDLE_BITMAP_BITS_PER_WORD;
-       int b = idx % INTERIOR_HANDLE_BITMAP_BITS_PER_WORD;
-       guint32 bitmap = bitmaps [w];
-       guint32 mask = 1u << b;
-       return ((bitmap & mask) != 0);
-}
-
-static void
-bitset_bits_set (guint32 *bitmaps, int idx)
-{
-       int w = idx / INTERIOR_HANDLE_BITMAP_BITS_PER_WORD;
-       int b = idx % INTERIOR_HANDLE_BITMAP_BITS_PER_WORD;
-       guint32 *bitmap = &bitmaps [w];
-       guint32 mask = 1u << b;
-       *bitmap |= mask;
-}
-static void
-bitset_bits_clear (guint32 *bitmaps, int idx)
-{
-       int w = idx / INTERIOR_HANDLE_BITMAP_BITS_PER_WORD;
-       int b = idx % INTERIOR_HANDLE_BITMAP_BITS_PER_WORD;
-       guint32 *bitmap = &bitmaps [w];
-       guint32 mask = ~(1u << b);
-       *bitmap &= mask;
-}
-
-static gpointer*
-chunk_element_objslot_init (HandleChunk *chunk, int idx, gboolean interior)
-{
-       if (interior)
-               bitset_bits_set (chunk->interior_bitmap, idx);
-       else
-               bitset_bits_clear (chunk->interior_bitmap, idx);
-       return &chunk->elems [idx].o;
-}
-
 static HandleChunkElem*
 chunk_element (HandleChunk *chunk, int idx)
 {
        return &chunk->elems[idx];
 }
 
-static guint
-chunk_element_kind (HandleChunk *chunk, int idx)
-{
-       return bitset_bits_test (chunk->interior_bitmap, idx) ? HANDLE_CHUNK_PTR_INTERIOR : HANDLE_CHUNK_PTR_OBJ;
-}
-
 static HandleChunkElem*
 handle_to_chunk_element (MonoObjectHandle o)
 {
@@ -207,25 +153,12 @@ mono_handle_chunk_leak_check (HandleStack *handles) {
 }
 #endif
 
-MonoRawHandle
-#ifndef MONO_HANDLE_TRACK_OWNER
-mono_handle_new (MonoObject *object)
-#else
-mono_handle_new (MonoObject *object, const char *owner)
-#endif
-{
-#ifndef MONO_HANDLE_TRACK_OWNER
-       return mono_handle_new_full (object, FALSE);
-#else
-       return mono_handle_new_full (object, FALSE, owner);
-#endif
-}
 /* Actual handles implementation */
 MonoRawHandle
 #ifndef MONO_HANDLE_TRACK_OWNER
-mono_handle_new_full (gpointer rawptr, gboolean interior)
+mono_handle_new (MonoObject *obj)
 #else
-mono_handle_new_full (gpointer rawptr, gboolean interior, const char *owner)
+mono_handle_new (MonoObject *obj, const char *owner)
 #endif
 {
        MonoThreadInfo *info = mono_thread_info_current ();
@@ -238,7 +171,7 @@ mono_handle_new_full (gpointer rawptr, gboolean interior, const char *owner)
 retry:
        if (G_LIKELY (top->size < OBJECTS_PER_HANDLES_CHUNK)) {
                int idx = top->size;
-               gpointer* objslot = chunk_element_objslot_init (top, idx, interior);
+               gpointer* objslot = &top->elems [idx].o;
                /* can be interrupted anywhere here, so:
                 * 1. make sure the new slot is null
                 * 2. make the new slot scannable (increment size)
@@ -251,7 +184,7 @@ retry:
                mono_memory_write_barrier ();
                top->size++;
                mono_memory_write_barrier ();
-               *objslot = rawptr;
+               *objslot = obj;
                SET_OWNER (top,idx);
                SET_SP (handles, top, idx);
                return objslot;
@@ -266,7 +199,6 @@ retry:
        }
        HandleChunk *new_chunk = g_new (HandleChunk, 1);
        new_chunk->size = 0;
-       memset (new_chunk->interior_bitmap, 0, INTERIOR_HANDLE_BITMAP_WORDS);
        new_chunk->prev = top;
        new_chunk->next = NULL;
        /* make sure size == 0 before new chunk is visible */
@@ -276,19 +208,50 @@ retry:
        goto retry;
 }
 
+MonoRawHandle
+#ifndef MONO_HANDLE_TRACK_OWNER
+mono_handle_new_interior (gpointer rawptr)
+#else
+mono_handle_new_interior (gpointer rawptr, const char *owner)
+#endif
+{
+       MonoThreadInfo *info = mono_thread_info_current ();
+       HandleStack *handles = (HandleStack *)info->handle_stack;
+       HandleChunk *top = handles->interior;
+#ifdef MONO_HANDLE_TRACK_SP
+       mono_handle_chunk_leak_check (handles);
+#endif
 
+       g_assert (top);
+
+       /*
+        * Don't extend the chunk now, interior handles are
+        * only used for icall arguments, they shouldn't
+        * overflow.
+        */
+       g_assert (top->size < OBJECTS_PER_HANDLES_CHUNK);
+       int idx = top->size;
+       gpointer *objslot = &top->elems [idx].o;
+       *objslot = NULL;
+       mono_memory_write_barrier ();
+       top->size++;
+       mono_memory_write_barrier ();
+       *objslot = rawptr;
+       SET_OWNER (top,idx);
+       SET_SP (handles, top, idx);
+       return objslot;
+}
 
 HandleStack*
 mono_handle_stack_alloc (void)
 {
-       HandleStack *stack = g_new (HandleStack, 1);
-       HandleChunk *chunk = g_new (HandleChunk, 1);
+       HandleStack *stack = g_new0 (HandleStack, 1);
+       HandleChunk *chunk = g_new0 (HandleChunk, 1);
+       HandleChunk *interior = g_new0 (HandleChunk, 1);
 
-       chunk->size = 0;
-       memset (chunk->interior_bitmap, 0, INTERIOR_HANDLE_BITMAP_WORDS);
-       chunk->prev = chunk->next = NULL;
        mono_memory_write_barrier ();
        stack->top = stack->bottom = chunk;
+       stack->interior = interior;
 #ifdef MONO_HANDLE_TRACK_OWNER
        stack->stackmark_sp = NULL;
 #endif
@@ -309,6 +272,7 @@ mono_handle_stack_free (HandleStack *stack)
                c = next;
        }
        g_free (c);
+       g_free (stack->interior);
        g_free (stack);
 }
 
@@ -362,46 +326,32 @@ mono_handle_stack_scan (HandleStack *stack, GcScanFunc func, gpointer gc_data, g
 
          Note that if we're running, we know the world is stopped.
        */
-       HandleChunk *cur = stack->bottom;
-       HandleChunk *last = stack->top;
+       if (precise) {
+               HandleChunk *cur = stack->bottom;
+               HandleChunk *last = stack->top;
 
-       if (!cur)
-               return;
-
-       while (cur) {
-               /* assume that object pointers will be much more common than interior pointers.
-                * scan the object pointers by iterating over the chunk elements.
-                * scan the interior pointers by iterating over the bitmap bits.
-                */
-               if (precise) {
+               while (cur) {
                        for (int i = 0; i < cur->size; ++i) {
                                HandleChunkElem* elem = chunk_element (cur, i);
-                               int kind = chunk_element_kind (cur, i);
                                gpointer* obj_slot = &elem->o;
-                               if (kind == HANDLE_CHUNK_PTR_OBJ && *obj_slot != NULL)
+                               if (*obj_slot != NULL)
                                        func (obj_slot, gc_data);
                        }
-               } else {
-                       int elem_idx = 0;
-                       for (int i = 0; i < INTERIOR_HANDLE_BITMAP_WORDS; ++i) {
-                               elem_idx = i * INTERIOR_HANDLE_BITMAP_BITS_PER_WORD;
-                               if (elem_idx >= cur->size)
-                                       break;
-                               /* no interior pointers in the range */ 
-                               if (cur->interior_bitmap [i] == 0)
-                                       continue;
-                               for (int j = 0; j < INTERIOR_HANDLE_BITMAP_BITS_PER_WORD && elem_idx < cur->size; ++j,++elem_idx) {
-                                       HandleChunkElem *elem = chunk_element (cur, elem_idx);
-                                       int kind = chunk_element_kind (cur, elem_idx);
-                                       gpointer *ptr_slot = &elem->o;
-                                       if (kind == HANDLE_CHUNK_PTR_INTERIOR && *ptr_slot != NULL)
-                                               func (ptr_slot, gc_data);
-                               }
-                       }            
+                       if (cur == last)
+                               break;
+                       cur = cur->next;
+               }
+       } else {
+               HandleChunk *cur = stack->interior;
+
+               if (!cur)
+                       return;
+               for (int i = 0; i < cur->size; ++i) {
+                       HandleChunkElem* elem = chunk_element (cur, i);
+                       gpointer* ptr_slot = &elem->o;
+                       if (*ptr_slot != NULL)
+                               func (ptr_slot, gc_data);
                }
-               if (cur == last)
-                       break;
-               cur = cur->next;
        }
 }
 
@@ -488,7 +438,6 @@ mono_gchandle_from_handle (MonoObjectHandle handle, mono_bool pinned)
        HandleChunk *chunk = chunk_element_to_chunk_idx (stack, elem, &elem_idx);
        /* gchandles cannot deal with interior pointers */
        g_assert (chunk != NULL);
-       g_assert (chunk_element_kind (chunk, elem_idx) != HANDLE_CHUNK_PTR_INTERIOR);
        return mono_gchandle_new (MONO_HANDLE_RAW (handle), pinned);
 }
 
index fd6d0cfffee7cbd002523a8a2b2ee1bc06604140..dba7c26c90bafeafd4871281307ce910249718a3 100644 (file)
@@ -25,7 +25,6 @@
 
 G_BEGIN_DECLS
 
-
 /*
 Handle stack.
 
@@ -73,13 +72,8 @@ typedef struct {
 #endif
 } HandleChunkElem;
 
-/* number of guint32's needed to store the interior pointers bitmap */
-#define INTERIOR_HANDLE_BITMAP_WORDS ((OBJECTS_PER_HANDLES_CHUNK + 31) / 32)
-
 struct _HandleChunk {
        int size; //number of handles
-       /* bits in the range 0..size-1 of interior_bitmap are valid; rest are ignored. */
-       guint32 interior_bitmap [INTERIOR_HANDLE_BITMAP_WORDS];
        HandleChunk *prev, *next;
        HandleChunkElem elems [OBJECTS_PER_HANDLES_CHUNK];
 };
@@ -90,10 +84,13 @@ typedef struct {
 #ifdef MONO_HANDLE_TRACK_SP
        gpointer stackmark_sp; // C stack pointer top when from most recent mono_stack_mark_init
 #endif
+       /* Chunk for storing interior pointers. Not extended right now */
+       HandleChunk *interior;
 } HandleStack;
 
+// Keep this in sync with RuntimeStructs.cs
 typedef struct {
-       int size;
+       int size, interior_size;
        HandleChunk *chunk;
 #ifdef MONO_HANDLE_TRACK_SP
        gpointer prev_sp; // C stack pointer from prior mono_stack_mark_init
@@ -108,12 +105,13 @@ typedef void (*GcScanFunc) (gpointer*, gpointer);
 #ifndef MONO_HANDLE_TRACK_OWNER
 MonoRawHandle mono_handle_new (MonoObject *object);
 MonoRawHandle mono_handle_new_full (gpointer rawptr, gboolean interior);
+MonoRawHandle mono_handle_new_interior (gpointer rawptr);
 #else
 MonoRawHandle mono_handle_new (MonoObject *object, const char* owner);
 MonoRawHandle mono_handle_new_full (gpointer rawptr, gboolean interior, const char *owner);
+MonoRawHandle mono_handle_new_interior (gpointer rawptr, const char *owner);
 #endif
 
-
 void mono_handle_stack_scan (HandleStack *stack, GcScanFunc func, gpointer gc_data, gboolean precise);
 gboolean mono_handle_stack_is_empty (HandleStack *stack);
 HandleStack* mono_handle_stack_alloc (void);
@@ -134,6 +132,7 @@ mono_stack_mark_init (MonoThreadInfo *info, HandleStackMark *stackmark)
        HandleStack *handles = (HandleStack *)info->handle_stack;
        stackmark->size = handles->top->size;
        stackmark->chunk = handles->top;
+       stackmark->interior_size = handles->interior->size;
 #ifdef MONO_HANDLE_TRACK_SP
        stackmark->prev_sp = handles->stackmark_sp;
        handles->stackmark_sp = sptop;
@@ -148,6 +147,7 @@ mono_stack_mark_pop (MonoThreadInfo *info, HandleStackMark *stackmark)
        old_top->size = stackmark->size;
        mono_memory_write_barrier ();
        handles->top = old_top;
+       handles->interior->size = stackmark->interior_size;
 #ifdef MONO_HANDLE_TRACK_SP
        mono_memory_write_barrier (); /* write to top before prev_sp */
        handles->stackmark_sp = stackmark->prev_sp;
@@ -403,20 +403,6 @@ This is why we evaluate index and value before any call to MONO_HANDLE_RAW or ot
                mono_handle_array_getref (MONO_HANDLE_CAST(MonoObject, (DEST)), (HANDLE), (IDX)); \
        } while (0)
 
-/* Handles into the interior of objects.
- *
- * Typically when working with value types, we pass them by reference.  In the case where the value type
- * is a field in a managed class, the reference will be a pointer into the middle of a managed object.
- * We need to identify such pointers in order for SGen to scan them correctly.
- */
-
-#ifndef MONO_HANDLE_TRACK_OWNER
-#define MONO_HANDLE_NEW_GET_VALPTR(HANDLE,TYPE,FIELD) (TYPE_VALUE_HANDLE_NAME(TYPE))(mono_handle_new_full (&(HANDLE)->__raw->FIELD), TRUE))
-#else
-#define MONO_HANDLE_NEW_GET_VALPTR(HANDLE,TYPE,FIELD) (TYPE_VALUE_HANDLE_NAME(TYPE))(mono_handle_new_full (&(HANDLE)->__raw->FIELD), TRUE, HANDLE_OWNER_STRINGIFY(__FILE__, __LINE__))
-#endif
-
-
 #define MONO_HANDLE_ASSIGN(DESTH, SRCH)                                \
        mono_handle_assign (MONO_HANDLE_CAST (MonoObject, (DESTH)), MONO_HANDLE_CAST(MonoObject, (SRCH)))
 
index 4eedbaae3b678ea6db9f67fa75256e977426efe4..f60de81c46bdd63387cdb457671478449335dcdb 100644 (file)
@@ -222,7 +222,10 @@ static void
 mono_icall_end (MonoThreadInfo *info, HandleStackMark *stackmark, MonoError *error);
 
 static MonoObjectHandle
-mono_icall_handle_new_full (gpointer rawobj, MonoBoolean interior);
+mono_icall_handle_new (gpointer rawobj);
+
+static MonoObjectHandle
+mono_icall_handle_new_interior (gpointer rawobj);
 
 /* Lazy class loading functions */
 static GENERATE_GET_CLASS_WITH_CACHE (string_builder, "System.Text", "StringBuilder");
@@ -397,7 +400,8 @@ mono_marshal_init (void)
                register_icall (mono_threads_detach_coop, "mono_threads_detach_coop", "void ptr ptr", TRUE);
                register_icall (mono_icall_start, "mono_icall_start", "ptr ptr ptr", TRUE);
                register_icall (mono_icall_end, "mono_icall_end", "void ptr ptr ptr", TRUE);
-               register_icall (mono_icall_handle_new_full, "mono_icall_handle_new_full", "ptr ptr bool", TRUE);
+               register_icall (mono_icall_handle_new, "mono_icall_handle_new", "ptr ptr", TRUE);
+               register_icall (mono_icall_handle_new_interior, "mono_icall_handle_new_interior", "ptr ptr", TRUE);
 
                mono_cominterop_init ();
                mono_remoting_init ();
@@ -6093,8 +6097,10 @@ emit_marshal_object (EmitMarshalContext *m, int argnum, MonoType *t,
                        mono_mb_emit_ldloc (mb, 0);
                        mono_mb_emit_icall (mb, conv_to_icall (MONO_MARSHAL_CONV_FTN_DEL, NULL));
                        mono_mb_emit_stloc (mb, 3);
-               } else if (klass == mono_defaults.stringbuilder_class){
-                       // FIXME: implement
+               } else if (klass == mono_defaults.stringbuilder_class) {
+                       // FIXME:
+                       char *msg = g_strdup_printf ("Return marshalling of stringbuilders is not implemented.");
+                       mono_mb_emit_exception_marshal_directive (mb, msg);
                } else {
                        /* set src */
                        mono_mb_emit_stloc (mb, 0);
@@ -8155,8 +8161,7 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions,
                                mono_mb_emit_byte (mb, CEE_LDARG_0);
                                /* TODO support adding wrappers to non-static struct methods */
                                g_assert (!mono_class_is_valuetype(mono_method_get_class (method)));
-                               mono_mb_emit_byte (mb, CEE_LDC_I4_0);
-                               mono_mb_emit_icall (mb, mono_icall_handle_new_full);
+                               mono_mb_emit_icall (mb, mono_icall_handle_new);
                        }
                        for (i = 0; i < sig->param_count; i++) {
                                /* load each argument. references into the managed heap get wrapped in handles */
@@ -8166,27 +8171,24 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions,
                                        mono_mb_emit_ldarg (mb, j);
                                        break;
                                case ICALL_HANDLES_WRAP_OBJ:
-                                       /* argI = mono_handle_new_full (argI_raw, FALSE) */
+                                       /* argI = mono_handle_new (argI_raw) */
                                        mono_mb_emit_ldarg (mb, j);
-                                       mono_mb_emit_byte (mb, CEE_LDC_I4_0);
-                                       mono_mb_emit_icall (mb, mono_icall_handle_new_full);
+                                       mono_mb_emit_icall (mb, mono_icall_handle_new);
                                        break;
                                case ICALL_HANDLES_WRAP_OBJ_INOUT:
-                                       /* handleI = argI = mono_handle_new_full (NULL, FALSE) */
+                                       /* handleI = argI = mono_handle_new (NULL) */
                                        mono_mb_emit_byte (mb, CEE_LDNULL);
-                                       mono_mb_emit_byte (mb, CEE_LDC_I4_0);
-                                       mono_mb_emit_icall (mb, mono_icall_handle_new_full);
+                                       mono_mb_emit_icall (mb, mono_icall_handle_new);
                                        /* tmp = argI */
                                        mono_mb_emit_byte (mb, CEE_DUP);
                                        /* handleI = tmp */
                                        mono_mb_emit_stloc (mb, handles_locals[j].handle);
                                        break;
                                case ICALL_HANDLES_WRAP_VALUETYPE_REF:
-                                       /* (void) mono_handle_new_full (argI, TRUE); argI */
+                                       /* (void) mono_handle_new (argI); argI */
                                        mono_mb_emit_ldarg (mb, j);
                                        mono_mb_emit_byte (mb, CEE_DUP);
-                                       mono_mb_emit_byte (mb, CEE_LDC_I4_1);
-                                       mono_mb_emit_icall (mb, mono_icall_handle_new_full);
+                                       mono_mb_emit_icall (mb, mono_icall_handle_new_interior);
                                        mono_mb_emit_byte (mb, CEE_POP);
 #if 0
                                        fprintf (stderr, " Method %s.%s.%s has byref valuetype argument %d\n", method->klass->name_space, method->klass->name, method->name, i);
@@ -12362,11 +12364,21 @@ mono_icall_end (MonoThreadInfo *info, HandleStackMark *stackmark, MonoError *err
 }
 
 static MonoObjectHandle
-mono_icall_handle_new_full (gpointer rawobj, MonoBoolean interior)
+mono_icall_handle_new (gpointer rawobj)
+{
+#ifdef MONO_HANDLE_TRACK_OWNER
+       return mono_handle_new (rawobj, "<marshal args>");
+#else
+       return mono_handle_new (rawobj);
+#endif
+}
+
+static MonoObjectHandle
+mono_icall_handle_new_interior (gpointer rawobj)
 {
 #ifdef MONO_HANDLE_TRACK_OWNER
-       return mono_handle_new_full (rawobj, interior, "<marshal args>");
+       return mono_handle_new_interior (rawobj, "<marshal args>");
 #else
-       return mono_handle_new_full (rawobj, interior);
+       return mono_handle_new_interior (rawobj);
 #endif
 }
index d9722a14c2a5a1d30076ba146c8d224ad4f303d7..58b826ef15af98b6039bd5bc4e6f91d0462f49e3 100755 (executable)
@@ -820,7 +820,9 @@ PROFILE_DISABLED_TESTS += \
        vt-sync-method.exe \
        resolve_method_bug.2.exe \
        resolve_field_bug.2.exe \
-       resolve_type_bug.2.exe
+       resolve_type_bug.2.exe \
+       bug-81691.exe \
+       bug-327438.2.exe
 
 # Tests which rely on remoting
 PROFILE_DISABLED_TESTS += \
@@ -943,7 +945,9 @@ PROFILE_DISABLED_TESTS += \
        sgen-domain-unload-2.exe
 
 PROFILE_DISABLED_TESTS += \
-       appdomain-loader.exe
+       appdomain-loader.exe \
+       assemblyresolve_event3.exe \
+       appdomain-serialize-exception.exe
 endif
 
 if HYBRID_AOT_TESTS
index 1a4e30a68f3ed7cd3d522643eeb9c4ba993ad204..a1fa3fe0325f20a69a57849c8092c1991b1b107c 100644 (file)
@@ -68,15 +68,15 @@ SIGNED_V2_DLL= signed_v2/gactestlib.dll
 GACTESTLIB_SRCS= $(V1_SRC) $(V2_SRC)
 GACTESTLIB_DLLS= $(SIGNED_V1_DLL) $(SIGNED_V2_DLL) $(UNSIGNED_V1_DLL) $(UNSIGNED_V2_DLL)
 
-if FULL_AOT_TESTS
-GACTESTLIB_DLLS_AOT=$(GACTESTLIB_DLLS:.dll=.dll$(PLATFORM_AOT_SUFFIX))
-APP_SIGNED_V1_AOT=$(APP_SIGNED_V1_EXE:.exe=.exe$(PLATFORM_AOT_SUFFIX))
-endif
-
-if HYBRID_AOT_TESTS
-GACTESTLIB_DLLS_AOT=$(GACTESTLIB_DLLS:.dll=.dll$(PLATFORM_AOT_SUFFIX))
-APP_SIGNED_V1_AOT=$(APP_SIGNED_V1_EXE:.exe=.exe$(PLATFORM_AOT_SUFFIX))
-endif
+#if FULL_AOT_TESTS
+#GACTESTLIB_DLLS_AOT=$(GACTESTLIB_DLLS:.dll=.dll$(PLATFORM_AOT_SUFFIX))
+#APP_SIGNED_V1_AOT=$(APP_SIGNED_V1_EXE:.exe=.exe$(PLATFORM_AOT_SUFFIX))
+#endif
+
+#if HYBRID_AOT_TESTS
+#GACTESTLIB_DLLS_AOT=$(GACTESTLIB_DLLS:.dll=.dll$(PLATFORM_AOT_SUFFIX))
+#APP_SIGNED_V1_AOT=$(APP_SIGNED_V1_EXE:.exe=.exe$(PLATFORM_AOT_SUFFIX))
+#endif
 
 
 SIGNING_KEY= $(srcdir)/testkey.snk