[svn:parrot] r36256 - in trunk: . config/gen/makefiles src src/gc

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Sun Feb 1 20:34:44 UTC 2009


Author: whiteknight
Date: Sun Feb  1 20:34:43 2009
New Revision: 36256
URL: https://trac.parrot.org/parrot/changeset/36256

Log:
[GC] Move src/cpu_dep.c to src/gc/system.c, since this is a gc-related file

Added:
   trunk/src/gc/system.c   (props changed)
      - copied unchanged from r36254, trunk/src/cpu_dep.c
Deleted:
   trunk/src/cpu_dep.c
Modified:
   trunk/MANIFEST
   trunk/config/gen/makefiles/root.in
   trunk/src/gc/api.c

Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST	Sun Feb  1 20:26:10 2009	(r36255)
+++ trunk/MANIFEST	Sun Feb  1 20:34:43 2009	(r36256)
@@ -2686,7 +2686,6 @@
 src/bignum.c                                                []
 src/bignum.h                                                []
 src/byteorder.c                                             []
-src/cpu_dep.c                                               []
 src/datatypes.c                                             []
 src/debug.c                                                 []
 src/dynext.c                                                []
@@ -2721,6 +2720,7 @@
 src/gc/register.c                                           []
 src/gc/res_lea.c                                            []
 src/gc/resources.c                                          []
+src/gc/system.c                                             []
 src/global.c                                                []
 src/global_setup.c                                          []
 src/hash.c                                                  []

Modified: trunk/config/gen/makefiles/root.in
==============================================================================
--- trunk/config/gen/makefiles/root.in	Sun Feb  1 20:26:10 2009	(r36255)
+++ trunk/config/gen/makefiles/root.in	Sun Feb  1 20:34:43 2009	(r36256)
@@ -371,7 +371,6 @@
     $(SRC_DIR)/byteorder$(O) \
     $(SRC_DIR)/string/charset$(O) \
     $(SRC_DIR)/core_pmcs$(O) \
-    $(SRC_DIR)/cpu_dep$(O) \
     $(SRC_DIR)/datatypes$(O) \
     $(SRC_DIR)/debug$(O) \
     $(SRC_DIR)/dynext$(O) \
@@ -389,6 +388,7 @@
     $(SRC_DIR)/gc/pools$(O) \
     $(SRC_DIR)/gc/register$(O) \
     $(SRC_DIR)/gc/mark_sweep$(O) \
+    $(SRC_DIR)/gc/system$(O) \
     $(SRC_DIR)/global$(O) \
     $(SRC_DIR)/global_setup$(O) \
     $(SRC_DIR)/hash$(O) \
@@ -1170,7 +1170,7 @@
 
 $(SRC_DIR)/vtables$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/vtables.c
 
-$(SRC_DIR)/cpu_dep$(O) : $(GENERAL_H_FILES)
+$(SRC_DIR)/gc/system$(O) : $(GENERAL_H_FILES)
 
 $(SRC_DIR)/nci.c : $(SRC_DIR)/call_list.txt $(BUILD_TOOLS_DIR)/nativecall.pl
 	$(PERL) $(BUILD_TOOLS_DIR)/nativecall.pl $(SRC_DIR)/call_list.txt

Deleted: trunk/src/cpu_dep.c
==============================================================================
--- trunk/src/cpu_dep.c	Sun Feb  1 20:34:43 2009	(r36255)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,184 +0,0 @@
-/*
-Copyright (C) 2001-2008, The Perl Foundation.
-$Id$
-
-=head1 NAME
-
-src/cpu_dep.c - CPU-dependent functions
-
-=head1 DESCRIPTION
-
-These functions setup a trace of the current processor context and the
-system stack. The trace is set up here in C<trace_system_areas>. This
-function gets the current processor context and either traces it
-directly or stores it on the system stack. C<trace_system_stack>
-sets up a trace of the system stack using two marker addresses as
-boundaries. The code to actually perform the trace of a memory block
-between two boundaries is located in C<src/gc/api.c:trace_mem_block>.
-
-=head2 Functions
-
-=over 4
-
-=cut
-
-*/
-
-#include "parrot/parrot.h"
-
-/* HEADERIZER HFILE: include/parrot/gc_api.h */
-
-/* HEADERIZER BEGIN: static */
-/* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
-
-static void trace_system_stack(PARROT_INTERP)
-        __attribute__nonnull__(1);
-
-#define ASSERT_ARGS_trace_system_stack __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(interp)
-/* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
-/* HEADERIZER END: static */
-
-#ifdef __ia64__
-
-#  include <ucontext.h>
-extern void *flush_reg_store(void);
-#  define BACKING_STORE_BASE 0x80000fff80000000
-
-#endif
-
-/*
-
-=item C<void trace_system_areas>
-
-Initiates a trace of the system stack, looking for pointers which are being
-used by functions in the call chain, but which might not be marked as alive
-in any other way. Setting the trace up, which involves storing the processor
-context onto the stack, is highly system dependent. However, once stored,
-tracing the stack is very straightforward.
-
-=cut
-
-*/
-
-void
-trace_system_areas(PARROT_INTERP)
-{
-    ASSERT_ARGS(trace_system_areas)
-    {
-#if defined(__sparc)
-        /* Flush the register windows. For sparc systems, we use hand-coded
-           assembly language to create a small function that flushes the
-           register windows. Store the code in a union with a double to
-           ensure proper memory alignment. */
-        static union {
-            unsigned int insns[4];
-            double align_hack[2];
-        } u = { {
-#  ifdef __sparcv9
-                            0x81580000, /* flushw */
-#  else
-                            0x91d02003, /* ta ST_FLUSH_WINDOWS */
-#  endif
-                            0x81c3e008, /* retl */
-                            0x01000000  /* nop */
-        } };
-
-        /* Turn the array of machine code values above into a function pointer.
-           Call the new function pointer to flush the register windows. */
-        static void (*fn_ptr)(void) = (void (*)(void))&u.align_hack[0];
-        fn_ptr();
-
-#elif defined(__ia64__)
-
-        /* On IA64 systems, we use the function getcontext() to get the current
-           processor context. This function is located in <ucontext.h>, included
-           above. */
-        struct ucontext ucp;
-        void *current_regstore_top;
-
-        getcontext(&ucp);
-
-        /* flush_reg_store() is defined in config/gen/platforms/ia64/asm.s.
-           it calls the flushrs opcode to perform the register flush, and
-           returns the address of the register backing stack. */
-        current_regstore_top = flush_reg_store();
-
-        /* Trace the memory block for the register backing stack, which
-           is separate from the normal system stack. The register backing
-           stack starts at memory address 0x80000FFF80000000 and ends at
-           current_regstore_top. */
-        trace_mem_block(interp, 0x80000fff80000000,
-                (size_t)current_regstore_top);
-#else
-
-#  ifdef PARROT_HAS_HEADER_SETJMP
-        /* A jump buffer that is used to store the current processor context.
-           local variables like this are created on the stack. */
-        Parrot_jump_buff env;
-
-        /* Zero the Parrot_jump_buff, otherwise you will trace stale objects.
-           Plus, optimizing compilers won't be so quick to optimize the data
-           away if we're passing pointers around. */
-        memset(&env, 0, sizeof (env));
-
-        /* this should put registers in env, which then get marked in
-         * trace_system_stack below
-         */
-        setjmp(env);
-#  endif
-
-#endif
-    }
-
-    /* With the processor context accounted for above, we can trace the
-       system stack here. */
-    trace_system_stack(interp);
-}
-
-/*
-
-=item C<static void trace_system_stack>
-
-Traces the memory block starting at C<< interp->lo_var_ptr >>. This should be
-the address of a local variable which has been created on the stack early in
-the interpreter's lifecycle. We trace until the address of another local stack
-variable in this function, which should be at the "top" of the stack.
-
-=cut
-
-*/
-
-static void
-trace_system_stack(PARROT_INTERP)
-{
-    ASSERT_ARGS(trace_system_stack)
-    /* Create a local variable on the system stack. This represents the
-       "top" of the stack. A value stored in interp->lo_var_ptr represents
-       the "bottom" of the stack. We must trace the entire area between the
-       top and bottom. */
-    const size_t lo_var_ptr = (size_t)interp->lo_var_ptr;
-
-    trace_mem_block(interp, (size_t)lo_var_ptr,
-            (size_t)&lo_var_ptr);
-}
-
-/*
-
-=back
-
-=head1 SEE ALSO
-
-F<src/gc/api.c> and F<include/parrot/gc_api.h>.
-
-=cut
-
-*/
-
-
-/*
- * Local variables:
- *   c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */

Modified: trunk/src/gc/api.c
==============================================================================
--- trunk/src/gc/api.c	Sun Feb  1 20:26:10 2009	(r36255)
+++ trunk/src/gc/api.c	Sun Feb  1 20:34:43 2009	(r36256)
@@ -8,9 +8,12 @@
 
 =head1 DESCRIPTION
 
-This file implements I<dead object destruction>. This is documented in
-PDD 9 with supplementary notes in F<docs/dev/dod.pod> and
-F<docs/memory_internals.pod>.
+This file implements the external-facing API for Parrot's garbage collector.
+The collector itself is composed of various interchangable cores that each
+may operate very differently internally. The functions in this file can be used
+throughtout Parrot without having to be concerned about the internal operations
+of the GC. This is documented in PDD 9 with supplementary notes in
+F<docs/dev/dod.pod> and F<docs/memory_internals.pod>.
 
 It's possible to turn on/off the checking of the system stack and
 processor registers. The actual checking is set up in F<src/cpu_dep.c>

Copied: trunk/src/gc/system.c (from r36254, trunk/src/cpu_dep.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/src/gc/system.c	Sun Feb  1 20:34:43 2009	(r36256, copy of r36254, trunk/src/cpu_dep.c)
@@ -0,0 +1,184 @@
+/*
+Copyright (C) 2001-2008, The Perl Foundation.
+$Id$
+
+=head1 NAME
+
+src/cpu_dep.c - CPU-dependent functions
+
+=head1 DESCRIPTION
+
+These functions setup a trace of the current processor context and the
+system stack. The trace is set up here in C<trace_system_areas>. This
+function gets the current processor context and either traces it
+directly or stores it on the system stack. C<trace_system_stack>
+sets up a trace of the system stack using two marker addresses as
+boundaries. The code to actually perform the trace of a memory block
+between two boundaries is located in C<src/gc/api.c:trace_mem_block>.
+
+=head2 Functions
+
+=over 4
+
+=cut
+
+*/
+
+#include "parrot/parrot.h"
+
+/* HEADERIZER HFILE: include/parrot/gc_api.h */
+
+/* HEADERIZER BEGIN: static */
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
+
+static void trace_system_stack(PARROT_INTERP)
+        __attribute__nonnull__(1);
+
+#define ASSERT_ARGS_trace_system_stack __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+       PARROT_ASSERT_ARG(interp)
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
+/* HEADERIZER END: static */
+
+#ifdef __ia64__
+
+#  include <ucontext.h>
+extern void *flush_reg_store(void);
+#  define BACKING_STORE_BASE 0x80000fff80000000
+
+#endif
+
+/*
+
+=item C<void trace_system_areas>
+
+Initiates a trace of the system stack, looking for pointers which are being
+used by functions in the call chain, but which might not be marked as alive
+in any other way. Setting the trace up, which involves storing the processor
+context onto the stack, is highly system dependent. However, once stored,
+tracing the stack is very straightforward.
+
+=cut
+
+*/
+
+void
+trace_system_areas(PARROT_INTERP)
+{
+    ASSERT_ARGS(trace_system_areas)
+    {
+#if defined(__sparc)
+        /* Flush the register windows. For sparc systems, we use hand-coded
+           assembly language to create a small function that flushes the
+           register windows. Store the code in a union with a double to
+           ensure proper memory alignment. */
+        static union {
+            unsigned int insns[4];
+            double align_hack[2];
+        } u = { {
+#  ifdef __sparcv9
+                            0x81580000, /* flushw */
+#  else
+                            0x91d02003, /* ta ST_FLUSH_WINDOWS */
+#  endif
+                            0x81c3e008, /* retl */
+                            0x01000000  /* nop */
+        } };
+
+        /* Turn the array of machine code values above into a function pointer.
+           Call the new function pointer to flush the register windows. */
+        static void (*fn_ptr)(void) = (void (*)(void))&u.align_hack[0];
+        fn_ptr();
+
+#elif defined(__ia64__)
+
+        /* On IA64 systems, we use the function getcontext() to get the current
+           processor context. This function is located in <ucontext.h>, included
+           above. */
+        struct ucontext ucp;
+        void *current_regstore_top;
+
+        getcontext(&ucp);
+
+        /* flush_reg_store() is defined in config/gen/platforms/ia64/asm.s.
+           it calls the flushrs opcode to perform the register flush, and
+           returns the address of the register backing stack. */
+        current_regstore_top = flush_reg_store();
+
+        /* Trace the memory block for the register backing stack, which
+           is separate from the normal system stack. The register backing
+           stack starts at memory address 0x80000FFF80000000 and ends at
+           current_regstore_top. */
+        trace_mem_block(interp, 0x80000fff80000000,
+                (size_t)current_regstore_top);
+#else
+
+#  ifdef PARROT_HAS_HEADER_SETJMP
+        /* A jump buffer that is used to store the current processor context.
+           local variables like this are created on the stack. */
+        Parrot_jump_buff env;
+
+        /* Zero the Parrot_jump_buff, otherwise you will trace stale objects.
+           Plus, optimizing compilers won't be so quick to optimize the data
+           away if we're passing pointers around. */
+        memset(&env, 0, sizeof (env));
+
+        /* this should put registers in env, which then get marked in
+         * trace_system_stack below
+         */
+        setjmp(env);
+#  endif
+
+#endif
+    }
+
+    /* With the processor context accounted for above, we can trace the
+       system stack here. */
+    trace_system_stack(interp);
+}
+
+/*
+
+=item C<static void trace_system_stack>
+
+Traces the memory block starting at C<< interp->lo_var_ptr >>. This should be
+the address of a local variable which has been created on the stack early in
+the interpreter's lifecycle. We trace until the address of another local stack
+variable in this function, which should be at the "top" of the stack.
+
+=cut
+
+*/
+
+static void
+trace_system_stack(PARROT_INTERP)
+{
+    ASSERT_ARGS(trace_system_stack)
+    /* Create a local variable on the system stack. This represents the
+       "top" of the stack. A value stored in interp->lo_var_ptr represents
+       the "bottom" of the stack. We must trace the entire area between the
+       top and bottom. */
+    const size_t lo_var_ptr = (size_t)interp->lo_var_ptr;
+
+    trace_mem_block(interp, (size_t)lo_var_ptr,
+            (size_t)&lo_var_ptr);
+}
+
+/*
+
+=back
+
+=head1 SEE ALSO
+
+F<src/gc/api.c> and F<include/parrot/gc_api.h>.
+
+=cut
+
+*/
+
+
+/*
+ * Local variables:
+ *   c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */


More information about the parrot-commits mailing list