[svn:parrot] r48346 - branches/gsoc_instrument/src/dynpmc

khairul at svn.parrot.org khairul at svn.parrot.org
Sun Aug 8 16:34:32 UTC 2010


Author: khairul
Date: Sun Aug  8 16:34:32 2010
New Revision: 48346
URL: https://trac.parrot.org/parrot/changeset/48346

Log:
Please codetest (mostly)

Modified:
   branches/gsoc_instrument/src/dynpmc/instrument.pmc
   branches/gsoc_instrument/src/dynpmc/instrumentinvokable.pmc   (contents, props changed)
   branches/gsoc_instrument/src/dynpmc/instrumentobject.pmc
   branches/gsoc_instrument/src/dynpmc/instrumentop.pmc
   branches/gsoc_instrument/src/dynpmc/instrumentruncore.pmc   (contents, props changed)
   branches/gsoc_instrument/src/dynpmc/instrumentstubbase.pmc   (contents, props changed)

Modified: branches/gsoc_instrument/src/dynpmc/instrument.pmc
==============================================================================
--- branches/gsoc_instrument/src/dynpmc/instrument.pmc	Sun Aug  8 16:30:29 2010	(r48345)
+++ branches/gsoc_instrument/src/dynpmc/instrument.pmc	Sun Aug  8 16:34:32 2010	(r48346)
@@ -47,7 +47,7 @@
     ATTR PMC           *probes;             /* A list of probes registered. */
     ATTR PMC           *instrument_rc;      /* Reference to the InstrumentRuncore object. */
     ATTR PMC           *instrument_gc;      /* Reference to the InstrumentGC object. */
-    ATTR PMC           *instrument_classes; /* Registry to hold instances of InstrumentClass. */
+    ATTR Hash          *instrument_classes; /* Registry to hold instances of InstrumentClass. */
     ATTR Hash          *instrument_objects; /* Registry of current instrumented objects. */
     ATTR Hash          *event_handlers;     /* Reference to registered instrument event handlers. */
 
@@ -73,7 +73,7 @@
         attr->supervised         = Parrot_new(INTERP);
         attr->probes             = Parrot_pmc_new(INTERP, enum_class_Hash);
         attr->event_handlers     = parrot_new_hash(INTERP);
-        attr->instrument_classes = Parrot_pmc_new(INTERP, enum_class_Hash);
+        attr->instrument_classes = parrot_new_hash(INTERP);
         attr->instrument_rc      = Parrot_pmc_new_init(INTERP, rc_class_type, SELF);
         attr->instrument_gc      = Parrot_pmc_new_init(INTERP, gc_class_type, SELF);
         attr->instrument_objects = parrot_new_pointer_hash(INTERP);
@@ -119,7 +119,8 @@
         Parrot_gc_mark_PMC_alive_fun(INTERP, attr->probes);
         Parrot_gc_mark_PMC_alive_fun(INTERP, attr->instrument_gc);
         Parrot_gc_mark_PMC_alive_fun(INTERP, attr->instrument_rc);
-        Parrot_gc_mark_PMC_alive_fun(INTERP, attr->instrument_classes);
+        parrot_mark_hash(INTERP, attr->instrument_classes);
+        parrot_mark_hash(INTERP, attr->instrument_objects);
     }
 
 /*
@@ -294,29 +295,33 @@
 
     METHOD instrument_class(STRING *classname) {
         Parrot_Instrument_attributes * const attr = PARROT_INSTRUMENT(SELF);
-        INTVAL  class_type;
-        PMC    *class_instr;
+        PMC *obj_instr;
+        INTVAL  class_type, obj_type;
+        PMC    *class_instr, *key;
 
-        /* Lookup the classname in the InstrumentClass registry.
-           If the entry doesn't exist, create an entry for it. */
-        if (VTABLE_exists_keyed_str(INTERP, attr->instrument_classes, classname)) {
-            class_instr = VTABLE_get_pmc_keyed_str(INTERP, attr->instrument_classes, classname);
-        }
-        else if (Parrot_pmc_get_type_str(attr->supervised, classname) == 0) {
-            Parrot_ex_throw_from_c_args(INTERP, NULL, 1,
-                                        "%Ss : Class not found, '%Ss'",
-                                        VTABLE_name(INTERP, SELF), classname);
-        }
-        else {
+        /* Create the Instrument::Event::Object instance. */
+        key = key_new_cstring(INTERP, "Instrument");
+        key_append(INTERP, key, key_new_cstring(INTERP, "Event"));
+        key_append(INTERP, key, key_new_cstring(INTERP, "Class"));
+
+        obj_type  = Parrot_pmc_get_type(INTERP, key);
+        obj_instr = Parrot_pmc_new(INTERP, obj_type);
+        Parrot_pcc_invoke_method_from_c_args(INTERP, obj_instr,
+                                             CONST_STRING(INTERP, "new"), "->P", &obj_instr);
+
+        /* Attach to the InstrumentObject instance. */
+        class_instr = (PMC *) parrot_hash_get(INTERP, attr->instrument_classes, classname);
+        if (PMC_IS_NULL(class_instr)) {
             class_type  = Parrot_pmc_get_type_str(INTERP, CONST_STRING(INTERP, "InstrumentClass"));
             class_instr = Parrot_pmc_new_init(INTERP, class_type, SELF);
 
             () = PCCINVOKE(INTERP, class_instr, "attach_to_class", STRING *classname);
 
-            VTABLE_set_pmc_keyed_str(INTERP, attr->instrument_classes, classname, class_instr);
+            parrot_hash_put(INTERP, attr->instrument_classes, classname, class_instr);
         }
+        VTABLE_set_attr_str(INTERP, obj_instr, CONST_STRING(INTERP, "$!hook_obj"), class_instr);
 
-        RETURN(PMC *class_instr);
+        RETURN(PMC *obj_instr);
     }
 
 /*
@@ -331,30 +336,51 @@
     METHOD instrument_object(PMC *object) {
         Parrot_Instrument_attributes * const attr = PARROT_INSTRUMENT(SELF);
         PMC *obj_instr;
+        INTVAL  class_type, obj_type;
+        PMC    *class_instr, *key;
+        STRING *new_str, *hook_str;
+
+        new_str  = CONST_STRING(INTERP, "new");
+        hook_str = CONST_STRING(INTERP, "$!hook_obj");
+
+        /* Create the Instrument::Event::Object instance. */
+        key = key_new_cstring(INTERP, "Instrument");
+        key_append(INTERP, key, key_new_cstring(INTERP, "Event"));
+        key_append(INTERP, key, key_new_cstring(INTERP, "Object"));
 
-        obj_instr = (PMC *) parrot_hash_get(INTERP, attr->instrument_objects, object);
-        if(PMC_IS_NULL(obj_instr)) {
-            INTVAL  class_type, obj_type;
-            PMC    *class_instr, *key;
-
-            key = key_new_cstring(INTERP, "Instrument");
-            key_append(INTERP, key, key_new_cstring(INTERP, "Event"));
-            key_append(INTERP, key, key_new_cstring(INTERP, "Object"));
-
-            obj_type  = Parrot_pmc_get_type(INTERP, key);
-            obj_instr = Parrot_pmc_new(INTERP, obj_type);
-            Parrot_pcc_invoke_method_from_c_args(INTERP, obj_instr,
-                                                 CONST_STRING(INTERP, "new"), "->P", &obj_instr);
+        obj_type  = Parrot_pmc_get_type(INTERP, key);
+        obj_instr = Parrot_pmc_new(INTERP, obj_type);
+        Parrot_pcc_invoke_method_from_c_args(INTERP, obj_instr, new_str, "->P", &obj_instr);
+
+        /* Attach to the InstrumentObject instance. */
+        class_instr = (PMC *) parrot_hash_get(INTERP, attr->instrument_objects, object);
+        if (PMC_IS_NULL(class_instr)) {
+            PMC *dest_key, *dest_obj;
+            INTVAL dest_type;
 
             class_type  = Parrot_pmc_get_type_str(INTERP, CONST_STRING(INTERP, "InstrumentObject"));
             class_instr = Parrot_pmc_new_init(INTERP, class_type, SELF);
 
             () = PCCINVOKE(INTERP, class_instr, "attach_to_object", PMC *object);
 
-            VTABLE_set_attr_str(INTERP, obj_instr, CONST_STRING(INTERP, "$!object"), class_instr);
+            parrot_hash_put(INTERP, attr->instrument_objects, object, class_instr);
 
-            parrot_hash_put(INTERP, attr->instrument_objects, object, obj_instr);
+            /* Create an instance of Instrument::Event::ObjectDestroy so that we can
+               be notified when the object is dead. */
+            dest_key = key_new_cstring(INTERP, "Instrument");
+            key_append(INTERP, dest_key, key_new_cstring(INTERP, "Event"));
+            key_append(INTERP, dest_key, key_new_cstring(INTERP, "ObjectDestroy"));
+
+            dest_type = Parrot_pmc_get_type(INTERP,dest_key);
+            dest_obj  = Parrot_pmc_new(INTERP, dest_type);
+            Parrot_pcc_invoke_method_from_c_args(INTERP, dest_obj, new_str, "->P", &dest_obj);
+
+            VTABLE_set_attr_str(INTERP, dest_obj, hook_str, class_instr);
+            VTABLE_set_attr_str(INTERP, dest_obj, CONST_STRING(INTERP, "$!instr_obj"), SELF);
+            Parrot_pcc_invoke_method_from_c_args(INTERP, dest_obj,
+                                                 CONST_STRING(INTERP, "_self_attach"), "->");
         }
+        VTABLE_set_attr_str(INTERP, obj_instr, hook_str, class_instr);
 
         RETURN(PMC *obj_instr);
     }
@@ -381,7 +407,35 @@
         (PMC *obj) = PCCINVOKE(INTERP, obj, "new");
 
         VTABLE_set_attr_str(INTERP, obj, CONST_STRING(INTERP, "$!instr_obj"), SELF);
-        VTABLE_set_attr_str(INTERP, obj, CONST_STRING(INTERP, "$!rc_obj"), attr->instrument_rc);
+        VTABLE_set_attr_str(INTERP, obj, CONST_STRING(INTERP, "$!hook_obj"), attr->instrument_rc);
+
+        RETURN(PMC *obj);
+    }
+
+/*
+=item C<PMC* instrument_gc()>
+
+Creates and returns an instance of Instrument::Event::GC that can be used
+to inspect any calls to gc functions.
+
+=cut
+*/
+
+    METHOD instrument_gc() {
+        Parrot_Instrument_attributes * const attr = PARROT_INSTRUMENT(SELF);
+        PMC *key, *obj;
+        INTVAL type;
+
+        key = key_new_cstring(INTERP, "Instrument");
+        key_append(INTERP, key, key_new_cstring(INTERP, "Event"));
+        key_append(INTERP, key, key_new_cstring(INTERP, "GC"));
+
+        type = Parrot_pmc_get_type(INTERP, key);
+        obj  = Parrot_pmc_new(INTERP, type);
+        (PMC *obj) = PCCINVOKE(INTERP, obj, "new");
+
+        VTABLE_set_attr_str(INTERP, obj, CONST_STRING(INTERP, "$!instr_obj"), SELF);
+        VTABLE_set_attr_str(INTERP, obj, CONST_STRING(INTERP, "$!hook_obj"), attr->instrument_gc);
 
         RETURN(PMC *obj);
     }
@@ -400,7 +454,7 @@
         probe_list_t *list;
 
         list = (probe_list_t *) parrot_hash_get(INTERP, attr->event_handlers, event);
-        if(list == NULL) {
+        if (list == NULL) {
             list = probe_list_create_list(INTERP);
             parrot_hash_put(INTERP, attr->event_handlers, event, list);
         }
@@ -420,23 +474,13 @@
     METHOD remove_eventhandler(STRING *event, PMC *handler) {
         Parrot_Instrument_attributes * const attr = PARROT_INSTRUMENT(SELF);
         probe_list_t *list;
-        probe_node_t *entry;
 
-        entry = NULL;
         list  = (probe_list_t *) parrot_hash_get(INTERP, attr->event_handlers, event);
-        if(list != NULL) {
+        if (list != NULL) {
+            probe_node_t *entry;
             entry = probe_list_find(INTERP, list, handler);
+            probe_list_remove(INTERP, list, entry);
         }
-
-        if(entry == NULL) {
-            /* Not found */
-            Parrot_ex_throw_from_c_args(INTERP, NULL, 1,
-                "%Ss : Tried to remove a non-existing event handler, '%Ss'",
-                VTABLE_name(INTERP, SELF),
-                VTABLE_get_attr_str(INTERP, handler, CONST_STRING(INTERP, "$!identifier")));
-        }
-
-        probe_list_remove(INTERP, list, entry);
     }
 
 /*
@@ -460,7 +504,7 @@
         PMC *ret;
 
         /* Build up the handlers to call. */
-        if(!has_recall || PMC_IS_NULL(recall)) {
+        if (!has_recall || PMC_IS_NULL(recall)) {
             Parrot_Context_info info;
             PMC *event_tokens, *cur_event, *iter;
 
@@ -476,7 +520,7 @@
             cur_list     = probe_list_create_list(INTERP);
 
             iter = VTABLE_get_iter(INTERP, event_tokens);
-            while(VTABLE_get_bool(INTERP, iter)) {
+            while (VTABLE_get_bool(INTERP, iter)) {
                 STRING *key;
                 probe_list_t *to_add;
 
@@ -520,11 +564,9 @@
 
     METHOD refresh_probes() {
         PMC *iter, *probes;
-        STRING *enable, *disable, *attr_enabled;
+        STRING *refresh;
 
-        enable  = CONST_STRING(INTERP, "enable");
-        disable = CONST_STRING(INTERP, "disable");
-        attr_enabled = CONST_STRING(INTERP, "$!is_enabled");
+        refresh = CONST_STRING(INTERP, "refresh");
 
         GETATTR_Instrument_probes(INTERP, SELF, probes);
         iter = VTABLE_get_iter(INTERP, probes);
@@ -534,14 +576,7 @@
             key = VTABLE_shift_pmc(INTERP, iter);
             obj = VTABLE_get_pmc_keyed(INTERP, probes, key);
 
-            /* If this probe is disabled, ignore. */
-            enabled = VTABLE_get_attr_str(INTERP, obj, attr_enabled);
-            if (!VTABLE_get_integer(INTERP, enabled)) {
-                continue;
-            }
-
-            Parrot_pcc_invoke_method_from_c_args(INTERP, obj, disable, "->");
-            Parrot_pcc_invoke_method_from_c_args(INTERP, obj, enable,  "->");
+            Parrot_pcc_invoke_method_from_c_args(INTERP, obj, refresh, "->");
         }
     }
 
@@ -642,7 +677,7 @@
            F : floatval
            S : string
            V : pointer */
-        switch(*cur) {
+        switch (*cur) {
           case 'P':
             VTABLE_push_pmc(interp, ret, (PMC *) va_arg(args, PMC *));
             break;
@@ -712,7 +747,7 @@
  */
 void probe_list_delete_list(PARROT_INTERP, probe_list_t *list) {
     probe_node_t *node, *next;
-    if(list == NULL) { return; }
+    if (list == NULL) { return; }
 
     node = list->head;
     while (node != NULL) {
@@ -728,7 +763,7 @@
  * Deletes the node.
  */
 void probe_list_delete_node(PARROT_INTERP, probe_node_t *node) {
-    if(node == NULL) { return; }
+    if (node == NULL) { return; }
     mem_gc_free(interp, node);
 }
 
@@ -783,7 +818,7 @@
  */
 PMC * probe_list_remove(PARROT_INTERP, probe_list_t *list, probe_node_t *node) {
     PMC *item;
-    if(node == NULL) { return PMCNULL; }
+    if (node == NULL) { return PMCNULL; }
 
     if (node == list->head) { list->head = node->next; }
     if (node == list->tail) { list->tail = node->prev; }
@@ -820,7 +855,7 @@
  */
 void probe_list_append(PARROT_INTERP, probe_list_t *dest, probe_list_t *src) {
     probe_node_t *cur, *dup;
-    if(src == NULL || dest == NULL) { return; }
+    if (src == NULL || dest == NULL) { return; }
 
     for(cur = src->head; cur != NULL; cur = cur->next) {
         probe_list_push(interp, dest, cur->list_obj);

Modified: branches/gsoc_instrument/src/dynpmc/instrumentinvokable.pmc
==============================================================================
--- branches/gsoc_instrument/src/dynpmc/instrumentinvokable.pmc	Sun Aug  8 16:30:29 2010	(r48345)
+++ branches/gsoc_instrument/src/dynpmc/instrumentinvokable.pmc	Sun Aug  8 16:34:32 2010	(r48346)
@@ -63,7 +63,7 @@
 
 */
 
-    VTABLE opcode_t* invoke (void *next) {
+    VTABLE opcode_t* invoke(void *next) {
         Parrot_InstrumentInvokable_attributes * const attr = PARROT_INSTRUMENTINVOKABLE(SELF);
         Parrot_Interp supervised;
         PMC *task_hash, *task, *data, *recall, *signature;
@@ -246,7 +246,7 @@
 
 */
 
-    METHOD set_event (PMC *event) {
+    METHOD set_event(PMC *event) {
         Parrot_InstrumentInvokable_attributes * const attr = PARROT_INSTRUMENTINVOKABLE(SELF);
         attr->event = Parrot_str_join(INTERP, CONST_STRING(INTERP, "::"), event);
     }

Modified: branches/gsoc_instrument/src/dynpmc/instrumentobject.pmc
==============================================================================
--- branches/gsoc_instrument/src/dynpmc/instrumentobject.pmc	Sun Aug  8 16:30:29 2010	(r48345)
+++ branches/gsoc_instrument/src/dynpmc/instrumentobject.pmc	Sun Aug  8 16:34:32 2010	(r48346)
@@ -29,6 +29,7 @@
 
 pmclass InstrumentObject auto_attrs dynpmc group instrument_group extends InstrumentClass {
     ATTR PMC *object;
+
 /*
 
 =item C<void attach_to_class(STRING *classname)>
@@ -60,7 +61,6 @@
     METHOD attach_to_object(PMC *object) {
         Parrot_InstrumentObject_attributes * const attr = PARROT_INSTRUMENTOBJECT(SELF);
         Parrot_Interp supervised;
-        PMC *_class;
         STRING *addr;
 
         GETATTR_Instrument_supervised(INTERP, attr->instrument, supervised);
@@ -84,11 +84,63 @@
         VTABLE_push_string(INTERP, attr->event_prefix, addr);
 
         /* Create a copy of the class. */
-        _class = VTABLE_clone(supervised, VTABLE_get_class(supervised, object));
         {
             Parrot_Object_attributes * const obj = PARROT_OBJECT(object);
+            PMC *_class, *orig_class, *orig_ns;
+            STRING *orig_name;
+
+            orig_class = VTABLE_get_class(supervised, object);
+            GETATTR_Class__namespace(supervised, orig_class, orig_ns);
+            GETATTR_Class_name(supervised, orig_class, orig_name);
+
+            _class = VTABLE_clone(supervised, orig_class);
+            SETATTR_Class__namespace(supervised, _class, orig_ns);
+            SETATTR_Class_name(supervised, _class, orig_name);
+
             obj->_class = _class;
         }
+
+        /* Make sure the object has the custom destroy flag set. */
+        PObj_custom_destroy_SET(object);
+    }
+
+/*
+
+=item C<void detach_from_object()>
+
+Each InstrumentObject instance has an associated
+Instrument::Event::ObjectDestroy instance attached to it.
+When the instrumented object is destroyed, the associated event
+instance will then call this method, allowing cleanup of the
+destroyed object in the internal data structures of Instrument.
+
+For internal use only.
+
+=cut
+
+*/
+
+    METHOD detach_from_object() {
+        Parrot_InstrumentObject_attributes * const attr = PARROT_INSTRUMENTOBJECT(SELF);
+        Hash *instrument_objects;
+
+        GETATTR_Instrument_instrument_objects(INTERP, attr->instrument, instrument_objects);
+        parrot_hash_delete(INTERP, instrument_objects, attr->object);
+        attr->object = NULL;
+    }
+
+/*
+
+=item C<void _instrument_vtable()>
+
+Overrides parent's method, doing nothing in this instance.
+
+=cut
+
+*/
+
+    METHOD _instrument_vtable() {
+        /* Do nothing. */
     }
 
 /*
@@ -222,6 +274,7 @@
     }
 }
 
+
 /*
 
 =back

Modified: branches/gsoc_instrument/src/dynpmc/instrumentop.pmc
==============================================================================
--- branches/gsoc_instrument/src/dynpmc/instrumentop.pmc	Sun Aug  8 16:30:29 2010	(r48345)
+++ branches/gsoc_instrument/src/dynpmc/instrumentop.pmc	Sun Aug  8 16:34:32 2010	(r48346)
@@ -207,6 +207,23 @@
 
 /*
 
+=item C<STRING pc_address()>
+
+Returns the pc address as a string.
+
+=cut
+
+*/
+
+    METHOD pc_address() {
+        Parrot_InstrumentOp_attributes * const attr = PARROT_INSTRUMENTOP(SELF);
+        STRING* pc_rel = Parrot_sprintf_c(INTERP, "%p", attr->pc);
+
+        RETURN(STRING* pc_rel);
+    }
+
+/*
+
 =item C<PMC* get_arg(INTVAL arg_index, INTVAL raw :optional)>
 
 Returns the argument as interpreted according to its type at the given index.

Modified: branches/gsoc_instrument/src/dynpmc/instrumentruncore.pmc
==============================================================================
--- branches/gsoc_instrument/src/dynpmc/instrumentruncore.pmc	Sun Aug  8 16:30:29 2010	(r48345)
+++ branches/gsoc_instrument/src/dynpmc/instrumentruncore.pmc	Sun Aug  8 16:34:32 2010	(r48346)
@@ -23,6 +23,8 @@
 #include "parrot/runcore_api.h"
 #include "parrot/opsenum.h"
 
+#include "pmc/pmc_class.h"
+
 #include "pmc_instrument.h"
 
 #include "instrument_private.h"
@@ -68,6 +70,7 @@
 pmclass InstrumentRuncore auto_attrs dynpmc group instrument_group {
     ATTR PMC                  *instrument;
     ATTR PMC                  *dynlibs;
+    ATTR PMC                  *op;
     ATTR struct probe_list_t **op_hooks;
     ATTR INTVAL                op_hooks_size;
     ATTR struct probe_list_t  *op_catchall;
@@ -96,9 +99,11 @@
 
     VTABLE void init_pmc(PMC *instrument) {
         Parrot_InstrumentRuncore_attributes * const attr = PARROT_INSTRUMENTRUNCORE(SELF);
+        INTVAL op_type = Parrot_pmc_get_type_str(INTERP, CONST_STRING(INTERP, "InstrumentOp"));
 
         attr->instrument    = instrument;
         attr->dynlibs       = Parrot_pmc_new(INTERP, enum_class_Hash);
+        attr->op            = Parrot_pmc_new_init(INTERP, op_type, attr->instrument);
         attr->op_hooks      = NULL;
         attr->op_hooks_size = 0;
         attr->op_catchall   = NULL;
@@ -109,6 +114,9 @@
         /* Set up the op probe tables. */
         runcore_probes_setup(INTERP, SELF);
 
+        /* Fixup the vtables. */
+        runcore_vtable_fixup(INTERP, SELF);
+
         PObj_custom_mark_destroy_SETALL(SELF);
     }
 
@@ -125,6 +133,7 @@
     VTABLE void mark() {
         Parrot_InstrumentRuncore_attributes * const attr = PARROT_INSTRUMENTRUNCORE(SELF);
         Parrot_gc_mark_PMC_alive_fun(INTERP, attr->dynlibs);
+        Parrot_gc_mark_PMC_alive_fun(INTERP, attr->op);
     }
 
 /*
@@ -396,14 +405,9 @@
 probe_list_t*
 runcore_probes_fire_probes(PARROT_INTERP, PMC *runcore, opcode_t *pc, probe_list_t *callbacks) {
     PMC   *op, *instrument, *interp_pmc;
-    INTVAL op_type;
-
 
     GETATTR_InstrumentRuncore_instrument(interp, runcore, instrument);
-
-    op_type    = Parrot_pmc_get_type_str(interp, CONST_STRING(interp, "InstrumentOp"));
-    op         = Parrot_pmc_new_init(interp, op_type, instrument);
-
+    GETATTR_InstrumentRuncore_op(interp, runcore, op);
     VTABLE_set_pointer(interp, op, pc);
 
     return fire_callbacks(interp, callbacks, op, instrument);
@@ -474,9 +478,9 @@
     runcore_library_update(supervisor, runcore);
 
     /* Setup exception handler to handle exits and unhandled exceptions. */
-    if(setjmp(exc_handler.resume)) {
+    if (setjmp(exc_handler.resume)) {
         /* Return if the exit op is called. */
-        if(*pc == enum_ops_exit_i
+        if (*pc == enum_ops_exit_i
         || *pc == enum_ops_exit_ic) {
             core->has_ended = 1;
             return pc;
@@ -569,7 +573,7 @@
 
                 VTABLE_set_pmc_keyed_str(interp, task_data, CONST_STRING(interp, "library"), lib);
                 event = Parrot_sprintf_c(interp, "Internal::loadlib::%Ss",
-                                         VTABLE_name(supervised, lib));
+                                         VTABLE_get_string(supervised, lib));
 
                 /* Fire the event and discard the list returned. */
                 Parrot_pcc_invoke_method_from_c_args(interp, instrument,
@@ -604,35 +608,8 @@
     PMC           *instrument;
     Parrot_Interp  supervised, dest, src;
 
-    GETATTR_InstrumentRuncore_instrument(interp, runcore, instrument);
-    GETATTR_Instrument_supervised(interp, instrument, supervised);
-
-    /* Dest is the one with the smaller vtable. */
-    if (interp->n_vtable_max > supervised->n_vtable_max) {
-        dest = supervised;
-        src  = interp;
-    }
-    else {
-        dest = interp;
-        src  = supervised;
-    }
-
-    /* Extend dest's vtable if needed. */
-    if (dest->n_vtable_alloced < src->n_vtable_max) {
-        INTVAL new_size;
-        new_size = src->n_vtable_max + 16;
-        dest->vtables = mem_gc_realloc_n_typed_zeroed(dest, dest->vtables,
-                                                      new_size, dest->n_vtable_alloced,
-                                                      VTABLE *);
-        dest->n_vtable_alloced = new_size;
-    }
-
-    /* Copy over the new vtable entries. */
-    for (i = dest->n_vtable_max; i < src->n_vtable_max; i++) {
-        dest->vtables[i] = src->vtables[i];
-    }
-
-    dest->n_vtable_max = src->n_vtable_max;
+    /* Do nothing. */
+    return;
 }
 
 /*

Modified: branches/gsoc_instrument/src/dynpmc/instrumentstubbase.pmc
==============================================================================
--- branches/gsoc_instrument/src/dynpmc/instrumentstubbase.pmc	Sun Aug  8 16:30:29 2010	(r48345)
+++ branches/gsoc_instrument/src/dynpmc/instrumentstubbase.pmc	Sun Aug  8 16:34:32 2010	(r48346)
@@ -97,7 +97,6 @@
         Parrot_gc_mark_PMC_alive_fun(INTERP, attr->event_prefix);
 
         parrot_mark_hash(INTERP, attr->group_items);
-        parrot_mark_hash(INTERP, attr->item_groups);
     }
 
 /*
@@ -275,7 +274,7 @@
         STRING *group;
 
         group = (STRING *) parrot_hash_get(INTERP, attr->item_groups, name);
-        if(STRING_IS_NULL(group)) {
+        if (STRING_IS_NULL(group)) {
             /* Should not happen. All items should have a group mapping. */
             Parrot_ex_throw_from_c_args(INTERP, NULL, 1,
                                         "%Ss : a Unknown function, '%Ss'",


More information about the parrot-commits mailing list