[sgen] DTrace probe for when a GC is requested.
[mono.git] / mono / metadata / sgen-minor-scan-object.h
index ce1f3207bdc5157b94543230608d54af83ee0031..9efe2ff1868a4ff0a94c9bf90bf655d238c067d1 100644 (file)
@@ -1,26 +1,24 @@
 /*
+ * sgen-minor-scan-object.h: Object scanning in the nursery collectors.
+ *
  * Copyright 2001-2003 Ximian, Inc
  * Copyright 2003-2010 Novell, 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.
+ * Copyright (C) 2012 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
+
 extern long long stat_scan_object_called_nursery;
 
 #if defined(SGEN_SIMPLE_NURSERY)
@@ -48,7 +46,7 @@ extern long long stat_scan_object_called_nursery;
                        __copy = *(ptr);        \
                        SGEN_COND_LOG (9, __old != __copy, "Overwrote field at %p with %p (was: %p)", (ptr), *(ptr), __old);    \
                        if (G_UNLIKELY (sgen_ptr_in_nursery (__copy) && !sgen_ptr_in_nursery ((ptr)))) \
-                               sgen_add_to_global_remset ((ptr));      \
+                               sgen_add_to_global_remset ((ptr), __copy); \
                }       \
        } while (0)
 
@@ -82,22 +80,12 @@ PARALLEL_SCAN_VTYPE (char *start, mword desc, SgenGrayQueue *queue)
 #include "sgen-scan-object.h"
 }
 
-#ifdef SGEN_SIMPLE_NURSERY
-#define NEEDS_REMSET_COND(ptr) (__copy == __old && !sgen_ptr_in_nursery ((ptr)))
-#else
-#define NEEDS_REMSET_COND(ptr) (sgen_ptr_in_nursery (__copy) && !sgen_ptr_in_nursery ((ptr)))
-#endif
-
 #undef HANDLE_PTR
 /* Global remsets are handled in SERIAL_COPY_OBJECT_FROM_OBJ */
 #define HANDLE_PTR(ptr,obj)    do {    \
                void *__old = *(ptr);   \
-               void *__copy;           \
                if (__old) {    \
-                       SERIAL_COPY_OBJECT ((ptr), queue);      \
-                       __copy = *(ptr);        \
-                       if (G_UNLIKELY (NEEDS_REMSET_COND(ptr)))        \
-                               sgen_add_to_global_remset ((ptr));      \
+                       SERIAL_COPY_OBJECT_FROM_OBJ ((ptr), queue);     \
                        SGEN_COND_LOG (9, __old != *(ptr), "Overwrote field at %p with %p (was: %p)", (ptr), *(ptr), __old); \
                }       \
        } while (0)