[svn:parrot] r47274 - in branches/gc_massacre_no_constant/src: ops pmc

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Wed Jun 2 01:17:14 UTC 2010


Author: whiteknight
Date: Wed Jun  2 01:17:14 2010
New Revision: 47274
URL: https://trac.parrot.org/parrot/changeset/47274

Log:
[gc_massacre_no_constant] add ->library to UnManagedStruct too, since it can be associated to a library through the dlvar opcode

Modified:
   branches/gc_massacre_no_constant/src/ops/core.ops
   branches/gc_massacre_no_constant/src/pmc/unmanagedstruct.pmc

Modified: branches/gc_massacre_no_constant/src/ops/core.ops
==============================================================================
--- branches/gc_massacre_no_constant/src/ops/core.ops	Wed Jun  2 01:08:12 2010	(r47273)
+++ branches/gc_massacre_no_constant/src/ops/core.ops	Wed Jun  2 01:17:14 2010	(r47274)
@@ -1301,6 +1301,7 @@
            a PMC with it so we can get and set the value */
         $1 = Parrot_pmc_new(interp, enum_class_UnManagedStruct);
         VTABLE_set_pointer(interp, $1, p);
+        VTABLE_set_attr_str(INTERP, $1, CONST_STRING(INTERP, "library"), $2);
     }
     Parrot_str_free_cstring(name);
 }

Modified: branches/gc_massacre_no_constant/src/pmc/unmanagedstruct.pmc
==============================================================================
--- branches/gc_massacre_no_constant/src/pmc/unmanagedstruct.pmc	Wed Jun  2 01:08:12 2010	(r47273)
+++ branches/gc_massacre_no_constant/src/pmc/unmanagedstruct.pmc	Wed Jun  2 01:17:14 2010	(r47274)
@@ -795,9 +795,10 @@
 }
 
 pmclass UnManagedStruct auto_attrs no_ro {
-    ATTR void   *ptr;   /* the struct that this UnManagedStruct isn't managing */
-    ATTR PMC    *init;  /* the initializer used with this UnManagedStruct */
-    ATTR INTVAL  size;  /* the size of the struct */
+    ATTR void   *ptr;     /* the struct that this UnManagedStruct isn't managing */
+    ATTR PMC    *init;    /* the initializer used with this UnManagedStruct */
+    ATTR INTVAL  size;    /* the size of the struct */
+    ATTR PMC    *library; /* The owning ParrotLibrary, if any */
 
 /*
 
@@ -884,8 +885,9 @@
 */
 
     VTABLE void mark() {
-        PMC * const init = PARROT_UNMANAGEDSTRUCT(SELF)->init;
-        Parrot_gc_mark_PMC_alive(INTERP, init);
+        Parrot_UnManagedStruct_attributes * const attrs = PARROT_UNMANAGEDSTRUCT(SELF);
+        Parrot_gc_mark_PMC_alive(INTERP, attrs->init);
+        Parrot_gc_mark_PMC_alive(INTERP, attrs->library);
     }
 
 /*
@@ -1199,6 +1201,32 @@
         set_string(INTERP, p, type, value);
     }
 
+/*
+
+=item C<void set_attr_str(STRING *idx, PMC *value)>
+
+Set an attribute
+
+=item C<PMC *get_attr_str(STRING *idx)>
+
+Get an attribute
+
+=cut
+
+*/
+
+    VTABLE void set_attr_str(STRING * idx, PMC *value)
+    {
+        if (Parrot_str_equal(INTERP, idx, CONST_STRING(interp, "library")))
+            PARROT_UNMANAGEDSTRUCT(SELF)->library = value;
+    }
+
+    VTABLE PMC * get_attr_str(STRING * idx)
+    {
+        if (Parrot_str_equal(INTERP, idx, CONST_STRING(interp, "library")))
+            return PARROT_UNMANAGEDSTRUCT(SELF)->library;
+    }
+
 }
 
 /*


More information about the parrot-commits mailing list