[svn:parrot] r43900 - in trunk: include/parrot src src/gc src/interp

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Thu Feb 11 13:20:58 UTC 2010


Author: whiteknight
Date: Thu Feb 11 13:20:57 2010
New Revision: 43900
URL: https://trac.parrot.org/parrot/changeset/43900

Log:
add a GC_SYS_NAME option to interpinfo_s_i. Returns the name of the current GC system

Modified:
   trunk/include/parrot/gc_api.h
   trunk/src/gc/api.c
   trunk/src/interp/inter_misc.c
   trunk/src/pbc_dump.c

Modified: trunk/include/parrot/gc_api.h
==============================================================================
--- trunk/include/parrot/gc_api.h	Thu Feb 11 13:20:20 2010	(r43899)
+++ trunk/include/parrot/gc_api.h	Thu Feb 11 13:20:57 2010	(r43900)
@@ -85,7 +85,8 @@
     /* interpinfo_s constants */
     EXECUTABLE_FULLNAME,
     EXECUTABLE_BASENAME,
-    RUNTIME_PREFIX
+    RUNTIME_PREFIX,
+    GC_SYS_NAME
 } Interpinfo_enum;
 
 /* &end_gen */

Modified: trunk/src/gc/api.c
==============================================================================
--- trunk/src/gc/api.c	Thu Feb 11 13:20:20 2010	(r43899)
+++ trunk/src/gc/api.c	Thu Feb 11 13:20:57 2010	(r43900)
@@ -987,6 +987,28 @@
 
 /*
 
+=item C<STRING * Parrot_gc_sys_name(PARROT_INTERP)>
+
+Retrieve the name of the currently active GC system.
+
+=cut
+
+*/
+
+STRING *
+Parrot_gc_sys_name(PARROT_INTERP) {
+    switch (interp->gc_sys->sys_type) {
+        case MS:
+            return Parrot_str_new(interp, "ms", 2);
+        case INF:
+            return Parrot_str_new(interp, "inf", 3);
+        default:
+            return Parrot_str_new(interp, "unknown", 7);
+    }
+}
+
+/*
+
 =back
 
 =head1 SEE ALSO

Modified: trunk/src/interp/inter_misc.c
==============================================================================
--- trunk/src/interp/inter_misc.c	Thu Feb 11 13:20:20 2010	(r43899)
+++ trunk/src/interp/inter_misc.c	Thu Feb 11 13:20:57 2010	(r43900)
@@ -322,16 +322,14 @@
 {
     ASSERT_ARGS(interpinfo_s)
     switch (what) {
-      case EXECUTABLE_FULLNAME:
-        {
+        case EXECUTABLE_FULLNAME: {
             PMC *exe_name = VTABLE_get_pmc_keyed_int(interp, interp->iglobals,
                     IGLOBALS_EXECUTABLE);
             if (PMC_IS_NULL(exe_name))
                 return string_from_literal(interp, "");
             return VTABLE_get_string(interp, exe_name);
         }
-      case EXECUTABLE_BASENAME:
-        {
+        case EXECUTABLE_BASENAME: {
             STRING *basename;
             PMC    *exe_name = VTABLE_get_pmc_keyed_int(interp,
                                 interp->iglobals, IGLOBALS_EXECUTABLE);
@@ -359,8 +357,13 @@
                 return basename;
             }
         }
-      case RUNTIME_PREFIX:
-        return Parrot_get_runtime_path(interp);
+        case RUNTIME_PREFIX:
+            return Parrot_get_runtime_path(interp);
+        case GC_SYS_NAME: {
+            const char * const name = Parrot_gc_sys_name(interp);
+            STRING *const newstr = Parrot_str_new(interp, name, strlen(name));
+            return name;
+        }
       default:
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
                 "illegal argument in interpinfo");

Modified: trunk/src/pbc_dump.c
==============================================================================
--- trunk/src/pbc_dump.c	Thu Feb 11 13:20:20 2010	(r43899)
+++ trunk/src/pbc_dump.c	Thu Feb 11 13:20:57 2010	(r43900)
@@ -62,8 +62,7 @@
 
 /*
 
-=item C<static void
-const_dump(PARROT_INTERP, const PackFile_Segment *segp)>
+=item C<static void const_dump(PARROT_INTERP, const PackFile_Segment *segp)>
 
 Dump the constant table.
 
@@ -81,8 +80,7 @@
 
 /*
 
-=item C<static void
-fixup_dump(PARROT_INTERP, const PackFile_Segment *segp)>
+=item C<static void fixup_dump(PARROT_INTERP, const PackFile_Segment *segp)>
 
 Dump the fixup table.
 
@@ -100,8 +98,7 @@
 
 /*
 
-=item C<static void
-disas_dump(PARROT_INTERP, const PackFile_Segment *self)>
+=item C<static void disas_dump(PARROT_INTERP, const PackFile_Segment *self)>
 
 Disassemble and dump.
 
@@ -136,8 +133,7 @@
 
 /*
 
-=item C<static void
-PackFile_header_dump(PARROT_INTERP, PackFile *pf)>
+=item C<static void PackFile_header_dump(PARROT_INTERP, PackFile *pf)>
 
 Dump the header.
 


More information about the parrot-commits mailing list