Author: heimdall
Date: Sat Aug  6 15:38:09 2005
New Revision: 8849

Modified:
   branches/gmc/config/gen/makefiles/root.in
   branches/gmc/include/parrot/dod.h
   branches/gmc/include/parrot/pobj.h
   branches/gmc/src/memory.c
Log:
New data structures in pobj.h for PMC. It should compile, although there is a 
dirty hack.
Data structures are not yet definitive (especially pmc_body) but should be 
enough to start the things.

Also added gc_gmc.c to the list of files needing to the Makefile and a call to 
gc_gmc_init.


Modified: branches/gmc/config/gen/makefiles/root.in
==============================================================================
--- branches/gmc/config/gen/makefiles/root.in   (original)
+++ branches/gmc/config/gen/makefiles/root.in   Sat Aug  6 15:38:09 2005
@@ -406,6 +406,7 @@ INTERP_O_FILES = \
     $(SRC_DIR)/dod$(O) \
     $(SRC_DIR)/gc_ims$(O) \
     $(SRC_DIR)/gc_gms$(O) \
+    $(SRC_DIR)/gc_gmc$(O) \
     $(SRC_DIR)/method_util$(O) \
     $(SRC_DIR)/exit$(O) \
     $(SRC_DIR)/misc$(O) \

Modified: branches/gmc/include/parrot/dod.h
==============================================================================
--- branches/gmc/include/parrot/dod.h   (original)
+++ branches/gmc/include/parrot/dod.h   Sat Aug  6 15:38:09 2005
@@ -94,6 +94,7 @@ void Parrot_dod_profile_end(Parrot_Inter
 void Parrot_gc_ms_init(Interp* interpreter);
 void Parrot_gc_ims_init(Interp* interpreter);
 void Parrot_gc_gms_init(Interp* interpreter);
+void Parrot_gc_gmc_init(Interp* interpreter);
 /* do_dod_run function for MS */
 void Parrot_dod_ms_run(Interp *interpreter, int flags);
 

Modified: branches/gmc/include/parrot/pobj.h
==============================================================================
--- branches/gmc/include/parrot/pobj.h  (original)
+++ branches/gmc/include/parrot/pobj.h  Sat Aug  6 15:38:09 2005
@@ -93,6 +93,19 @@ typedef struct Buffer {
 
 typedef Buffer PObj;
 
+#if PARROT_GC_GMC
+
+#define PObj_bufstart(pmc)    (pmc)->obj.u._b._bufstart
+#define PObj_buflen(pmc)      (pmc)->obj.u._b._buflen
+#define PMC_struct_val(pmc)   (pmc)->body->_ptrs._struct_val
+#define PMC_pmc_val(pmc)      (pmc)->body->_ptrs._pmc_val
+#define PMC_int_val(pmc)      (pmc)->body->_i._int_val
+#define PMC_int_val2(pmc)     (pmc)->body->_i._int_val2
+#define PMC_num_val(pmc)      (pmc)->body->_num_val
+#define PMC_str_val(pmc)      (pmc)->body->_string_val
+
+#else
+
 #define PObj_bufstart(pmc)    (pmc)->obj.u._b._bufstart
 #define PObj_buflen(pmc)      (pmc)->obj.u._b._buflen
 #define PMC_struct_val(pmc)   (pmc)->obj.u._ptrs._struct_val
@@ -102,6 +115,8 @@ typedef Buffer PObj;
 #define PMC_num_val(pmc)      (pmc)->obj.u._num_val
 #define PMC_str_val(pmc)      (pmc)->obj.u._string_val
 
+#endif
+
 /* BEGIN DEPRECATED BUFFER ACCESSORS */
 /* macros for accessing old buffer members
  * #define bufstart obj.u._b._bufstart
@@ -144,8 +159,24 @@ struct parrot_string_t {
 /* put data into the PMC_EXT structure */
 #define PMC_DATA_IN_EXT 1
 
+
+/* TODO: Change to a real pmc_body type. */
+#if PARROT_GC_GMC
+typedef UnionVal pmc_body;
+
+/* Hack for the get_FLAGS macro to be happy. */
+typedef struct flags_holder {
+    Parrot_UInt flags;
+} flags_holder;
+#endif
+
 struct PMC {
+#if PARROT_GC_GMC
+    pmc_body *body;
+    flags_holder obj;
+#else
     pobj_t obj;
+#endif
     VTABLE *vtable;
 #if ! PMC_DATA_IN_EXT
     DPOINTER *data;
@@ -203,7 +234,11 @@ typedef struct PMC_EXT PMC_EXT;
 #define PMC_metadata(pmc)     PMC_ext_checked(pmc)->_metadata
 #define PMC_next_for_GC(pmc)  PMC_ext_checked(pmc)->_next_for_GC
 #define PMC_sync(pmc)         PMC_ext_checked(pmc)->_synchronize
-#define PMC_union(pmc)        (pmc)->obj.u
+#if PARROT_GC_GMC
+#define PMC_union(pmc)        (pmc)->body
+#else
+#define PMC_union(pmc)       (pmc)->obj.u
+#endif
 
 /* macro for accessing union data */
 #define next_for_GC pmc_ext->_next_for_GC
@@ -405,6 +440,7 @@ typedef enum PObj_enum {
 
 #define PObj_get_FLAGS(o) ((o)->obj.flags)
 
+
 #define PObj_flag_TEST(flag, o) (PObj_get_FLAGS(o) & PObj_ ## flag ## _FLAG)
 #define PObj_flag_SET(flag, o) (PObj_get_FLAGS(o) |= PObj_ ## flag ## _FLAG)
 #define PObj_flag_CLEAR(flag, o) \

Modified: branches/gmc/src/memory.c
==============================================================================
--- branches/gmc/src/memory.c   (original)
+++ branches/gmc/src/memory.c   Sat Aug  6 15:38:09 2005
@@ -192,6 +192,9 @@ mem_setup_allocator(Interp *interpreter)
 #if PARROT_GC_GMS
     Parrot_gc_gms_init(interpreter);
 #endif
+#if PARROT_GC_GMC
+    Parrot_gc_gmc_init(interpreter);
+#endif
 
     Parrot_initialize_memory_pools(interpreter);
     Parrot_initialize_header_pools(interpreter);

Reply via email to