[svn:parrot] r47937 - in branches/gsoc_instrument: runtime/parrot/library/Instrument src/dynpmc t/library

khairul at svn.parrot.org khairul at svn.parrot.org
Wed Jun 30 15:47:23 UTC 2010


Author: khairul
Date: Wed Jun 30 15:47:22 2010
New Revision: 47937
URL: https://trac.parrot.org/parrot/changeset/47937

Log:
Refactored EventDispatcher + added GC events.

Modified:
   branches/gsoc_instrument/runtime/parrot/library/Instrument/EventDispatcher.nqp
   branches/gsoc_instrument/runtime/parrot/library/Instrument/EventLibrary.nqp
   branches/gsoc_instrument/src/dynpmc/instrument.pmc
   branches/gsoc_instrument/src/dynpmc/instrumentgc.pmc
   branches/gsoc_instrument/t/library/instrument_eventlibrary.t

Modified: branches/gsoc_instrument/runtime/parrot/library/Instrument/EventDispatcher.nqp
==============================================================================
--- branches/gsoc_instrument/runtime/parrot/library/Instrument/EventDispatcher.nqp	Wed Jun 30 07:04:42 2010	(r47936)
+++ branches/gsoc_instrument/runtime/parrot/library/Instrument/EventDispatcher.nqp	Wed Jun 30 15:47:22 2010	(r47937)
@@ -21,7 +21,9 @@
 =end
 
 class Instrument::EventDispatcher is EventHandler {
-    has $!events;
+    has $!evt_category;
+    has $!evt_subtype;
+    has $!evt_fulltype;
 
 =begin
 
@@ -34,8 +36,10 @@
 =end
 
     method _self_init () {
-        $!events := Q:PIR { %r = new ['Hash'] };
-        
+        $!evt_category := Q:PIR { %r = new ['Hash'] };
+        $!evt_subtype  := Q:PIR { %r = new ['Hash'] };
+        $!evt_fulltype := Q:PIR { %r = new ['Hash'] };
+
         Q:PIR {
             $P0 = get_global 'handler'
             setattribute self, 'code', $P0
@@ -48,8 +52,7 @@
 =item can_handle ($task)
 
 Overrides the can_handle method of parent EventHandler
-and checks if there is a handler(s) registered with it
-to handle that task.
+and handle only tasks with subtype 'Instrument'.
 
 =cut
 
@@ -57,9 +60,7 @@
 
     method can_handle ($task) {
         my $subtype    := pir::getattribute__PPS($task, "subtype");
-        my $list       := pir::set_p_p_kc__PPS($!events, $subtype);
-
-        return pir::defined__IP($list);
+        return $subtype eq 'Instrument';
     };
 
 =begin
@@ -73,15 +74,26 @@
 =end
 
     method register ($event, $callback) {
-        my $list := Q:PIR {
-            find_lex $P0, '$event'
-            $P1 = getattribute self, '$!events'
-            %r  = $P1[$P0]
-        };
+        my $tokens   := pir::split__PSS('::', $event);
+        my $count    := pir::set__IP($tokens);
+        if $count > 3 || $count < 1 {
+            die('Invalid Instrument event: ' ~ $event ~ "\n"
+              ~ 'Expected between 1 to 3 tokens when split with \'::\'.');
+        }
 
-        if !pir::defined__IP($list) {
-            $list := Q:PIR { %r = new ['ResizablePMCArray'] };
-            pir::set_p_k_p($!events, $event, $list);
+        my $list;
+
+        if    $count == 3 {
+            # Assume callback is for an exact event.
+            $list  := get_list($!evt_fulltype, $event);
+        }
+        elsif $count == 2 {
+            # Assume callback is for a subtype event.
+            $list  := get_list($!evt_subtype, $event);
+        }
+        elsif $count == 1 {
+            # Assume callback is for a category event.
+            $list  := get_list($!evt_category, $event);
         }
 
         $list.push($callback);
@@ -89,6 +101,50 @@
 
 =begin
 
+=item deregister ($event, $callback)
+
+Removes the handler for the given event.
+
+=cut
+
+=end
+
+    method deregister ($event, $callback) {
+        my $tokens   := pir::split__PSS('::', $event);
+        my $count    := pir::set__IP($tokens);
+        if $count > 3 || $count < 1 {
+            die('Invalid Instrument event: ' ~ $event ~ "\n"
+              ~ 'Expected between 1 to 3 tokens when split with \'::\'.');
+        }
+
+        my $list;
+
+        if    $count == 3 {
+            # Assume callback is for an exact event.
+            $list  := get_list($!evt_fulltype, $event);
+        }
+        elsif $count == 2 {
+            # Assume callback is for a subtype event.
+            $list  := get_list($!evt_subtype, $event);
+        }
+        elsif $count == 1 {
+            # Assume callback is for a category event.
+            $list  := get_list($!evt_category, $event);
+        }
+
+        # Look for $callback in $list.
+        my $index := 0;
+        for $list {
+            if $_ eq $callback {
+                pir::delete_p_k($list, $index);
+                break;
+            }
+            $index++;
+        }
+    };
+
+=begin
+
 =item handler ($event, $callback)
 
 Helper sub that acts as the callback for the EventDispatcher
@@ -100,15 +156,57 @@
 =end
 
     sub handler ($handler, $task) {
-        my $subtype := pir::getattribute__PPS($task, "subtype");
-        my $events  := pir::getattribute__PPS($handler, '$!events');
-        my $list    := pir::set_p_p_kc__PPS($events, $subtype);
+        my $evt_category := pir::getattribute__PPS($handler, '$!evt_category');
+        my $evt_subtype  := pir::getattribute__PPS($handler, '$!evt_subtype');
+        my $evt_fulltype := pir::getattribute__PPS($handler, '$!evt_fulltype');
+
+        # Get the required subkeys.
         my $data    := pir::getattribute__PPS($task, "data");
+        my $category := pir::set_p_p_kc__PPS($data, 'event_category');
+        my $subtype  := pir::set_p_p_kc__PPS($data, 'event_subtype');
+        my $fulltype := pir::set_p_p_kc__PPS($data, 'event_fulltype');
+
+        # Get the lists and join them into 1 big list.
+        my $key  := [$category];
+        my $list := Q:PIR { %r = new ['ResizablePMCArray'] };
+        $list.append(get_list($evt_category, $category));
+        $key.push($subtype);
+        $list.append(get_list($evt_subtype, pir::join__SSP('::', $key)));
+        $key.push($fulltype);
+        $list.append(get_list($evt_fulltype, pir::join__SSP('::', $key)));
 
+        # Call the callbacks.
         for $list {
             $_($data);
         }
     };
+
+=begin
+
+=item get_list ($hash, $key)
+
+Returns a ResizablePMCArray object for the given key in
+the given hash. If the key does not exists, create an entry
+for it.
+
+=cut
+
+=end
+
+    sub get_list ($hash, $key) {
+        my $list  := Q:PIR {
+            find_lex $P0, '$hash'
+            find_lex $P1, '$key'
+            %r  = $P0[$P1]
+        };
+
+        if !pir::defined__IP($list) {
+            $list := Q:PIR { %r = new ['ResizablePMCArray'] };
+            pir::set_p_k_p($hash, $key, $list);
+        }
+
+        return $list;
+    };
 };
 
 # vim: ft=perl6 expandtab shiftwidth=4:

Modified: branches/gsoc_instrument/runtime/parrot/library/Instrument/EventLibrary.nqp
==============================================================================
--- branches/gsoc_instrument/runtime/parrot/library/Instrument/EventLibrary.nqp	Wed Jun 30 07:04:42 2010	(r47936)
+++ branches/gsoc_instrument/runtime/parrot/library/Instrument/EventLibrary.nqp	Wed Jun 30 15:47:22 2010	(r47937)
@@ -41,7 +41,7 @@
 class Instrument::Event::Internal::loadlib is Instrument::Event {
 
     method _self_init() {
-        $!event_type := 'Instrument::Event::Internal::loadlib';
+        $!event_type := 'Internal::loadlib';
     };
 };
 
@@ -125,27 +125,72 @@
     };
 };
 
-class Instrument::Event::GC::allocate is Instrument::Event {
+=begin
+=item Instrument::Event::GC
+
+Interface to register callbacks for any given GC event.
+
+Usage (in PIR):
+    # Inspect a group (allocate) and two separate free events.
+    $P0 = get_hll_global ['Instrument';'Event'], 'GC'
+    $P1 = $P0.'new'()
+    $P1.'callback'('gc_cb2')
+    $P1.'inspect'('allocate')
+    $P1.'inspect'('free_pmc_header')
+    $P1.'inspect'('free_pmc_attributes')
+
+    $P2 = new ['Instrument']
+    $P2.'attach'($P1)
+
+=cut
+=end
+
+class Instrument::Event::GC is Instrument::Event {
+    has $!probe_list;
+
     method _self_init() {
-        $!event_type := 'Instrument::Event::GC::allocate';
+        $!probe_list := Q:PIR { %r = new ['ResizablePMCArray'] };
     };
-};
 
-class Instrument::Event::GC::reallocate is Instrument::Event {
-    method _self_init() {
-        $!event_type := 'Instrument::Event::GC::reallocate';
+    method inspect($item) {
+        $!probe_list.push($item);
     };
-};
 
-class Instrument::Event::GC::free is Instrument::Event {
-    method _self_init() {
-        $!event_type := 'Instrument::Event::GC::free';
+    method _on_attach() {
+        self.enable();
     };
-};
 
-class Instrument::Event::GC::administration is Instrument::Event {
-    method _self_init() {
-        $!event_type := 'Instrument::Event::GC::administration';
+    method enable() {
+        # Grab the InstrumentGC and EventDispatcher object.
+        my $gc := Q:PIR {
+            $P0 = getattribute self, '$!instr_obj'
+            %r  = $P0['gc']
+        };
+        my $dispatcher := Q:PIR {
+            $P0 = getattribute self, '$!instr_obj'
+            %r  = $P0['eventdispatcher']
+        };
+
+        # For each item in $!probe_list, insert the gc hook
+        #  and register the event handler.
+        for $!probe_list {
+            my $hooks := $gc.get_hook_list($_);
+
+            for $hooks {
+                $gc.insert_gc_hook($_);
+
+                my $tokens := pir::split__PSS('_', $_);
+                my $group  := $tokens[0];
+                if $group ne 'allocate' && $group ne  'reallocate' && $group ne 'free' {
+                    $group := 'administration';
+                }
+
+                my $event := 'GC::' ~ $group ~ '::' ~ $_;
+
+                # Register the callback.
+                $dispatcher.register($event, $!callback);
+            }
+        }
     };
 };
 

Modified: branches/gsoc_instrument/src/dynpmc/instrument.pmc
==============================================================================
--- branches/gsoc_instrument/src/dynpmc/instrument.pmc	Wed Jun 30 07:04:42 2010	(r47936)
+++ branches/gsoc_instrument/src/dynpmc/instrument.pmc	Wed Jun 30 15:47:22 2010	(r47937)
@@ -70,6 +70,7 @@
 
 /* Helper prototype */
 static opcode_t *Instrument_fire_hooks(opcode_t *pc, PARROT_INTERP);
+static void raise_dynlib_event(PARROT_INTERP, PMC *lib);
 
 /* dynlib detection */
 static void normalise_vtables(Parrot_Interp src, Parrot_Interp dest);
@@ -790,24 +791,7 @@
 
                 lib = VTABLE_get_pmc_keyed(interp, dynlibs, key);
 
-                task_data = Parrot_pmc_new(supervisor, enum_class_ResizablePMCArray);
-                VTABLE_push_string(supervisor, task_data, VTABLE_get_string(interp, lib));
-                VTABLE_push_pmc(supervisor, task_data, core->supervisor_pmc);
-
-                task_hash = Parrot_pmc_new(supervisor, enum_class_Hash);
-                VTABLE_set_string_keyed_str(supervisor, task_hash,
-                                            CONST_STRING(supervisor, "type"),
-                                            CONST_STRING(supervisor, "event"));
-                VTABLE_set_string_keyed_str(supervisor, task_hash,
-                                            CONST_STRING(supervisor, "subtype"),
-                                            CONST_STRING(supervisor,
-                                                         "Instrument::Event::Internal::loadlib"));
-                VTABLE_set_pmc_keyed_str(supervisor, task_hash,
-                                         CONST_STRING(supervisor, "data"),
-                                         task_data);
-
-                task = Parrot_pmc_new_init(supervisor, enum_class_Task, task_hash);
-                Parrot_cx_schedule_task(supervisor, task);
+                raise_dynlib_event(supervisor, lib);
 
                 /* Add lib to the old dynlib hash */
                 VTABLE_set_pmc_keyed(supervisor, old_dynlibs, key, lib);
@@ -871,6 +855,43 @@
 }
 
 /*
+ * Raises an Internal::loadlib event.
+ */
+static void raise_dynlib_event(PARROT_INTERP, PMC *lib) {
+    PMC *data, *task_hash, *task;
+
+    data = Parrot_pmc_new(interp, enum_class_Hash);
+    VTABLE_set_string_keyed_str(interp, data,
+                                CONST_STRING(interp, "library"),
+                                VTABLE_get_string(interp, lib));
+    VTABLE_set_string_keyed_str(interp, data,
+                                CONST_STRING(interp, "event_category"),
+                                CONST_STRING(interp, "Internal"));
+    VTABLE_set_string_keyed_str(interp, data,
+                                CONST_STRING(interp, "event_subtype"),
+                                CONST_STRING(interp, "loadlib"));
+    VTABLE_set_string_keyed_str(interp, data,
+                                CONST_STRING(interp, "event_fulltype"),
+                                VTABLE_get_string(interp, lib));
+
+    task_hash = Parrot_pmc_new(interp, enum_class_Hash);
+    VTABLE_set_string_keyed_str(interp, task_hash,
+                                CONST_STRING(interp, "type"),
+                                CONST_STRING(interp, "event"));
+    VTABLE_set_string_keyed_str(interp, task_hash,
+                                CONST_STRING(interp, "subtype"),
+                                CONST_STRING(interp,
+                                             "Instrument"));
+    VTABLE_set_pmc_keyed_str(interp, task_hash,
+                             CONST_STRING(interp, "data"),
+                             data);
+
+    task = Parrot_pmc_new_init(interp, enum_class_Task, task_hash);
+    Parrot_cx_schedule_task(interp, task);
+}
+
+
+/*
  * Functions implementing the linked list for the probes.
  */
 

Modified: branches/gsoc_instrument/src/dynpmc/instrumentgc.pmc
==============================================================================
--- branches/gsoc_instrument/src/dynpmc/instrumentgc.pmc	Wed Jun 30 07:04:42 2010	(r47936)
+++ branches/gsoc_instrument/src/dynpmc/instrumentgc.pmc	Wed Jun 30 15:47:22 2010	(r47937)
@@ -15,8 +15,7 @@
 
 =head1 TODO
 
-1. Update Instrument::Events::GC
-2. Tests.
+1. Tests.
 
 =over 4
 
@@ -211,8 +210,9 @@
 
     METHOD insert_gc_hook(STRING *name) {
         Parrot_InstrumentGC_attributes * const attr = PARROT_INSTRUMENTGC(SELF);
-        PMC *list = get_gc_funcs(INTERP, name);
+        PMC *list;
         PMC *iter;
+        (PMC *list) = PCCINVOKE(INTERP, SELF, "get_hook_list", STRING *name);
 
         iter = VTABLE_get_iter(INTERP, list);
         while (VTABLE_get_bool(INTERP, iter)) {
@@ -245,10 +245,11 @@
 
     METHOD remove_gc_hook(STRING *name) {
         Parrot_InstrumentGC_attributes * const attr = PARROT_INSTRUMENTGC(SELF);
-        PMC *list = get_gc_funcs(INTERP, name);
+        PMC *list;
         PMC *iter;
         GC_Subsystem           *orig  = attr->gc_original;
         InstrumentGC_Subsystem *instr = attr->gc_instrumented;
+        (PMC *list) = PCCINVOKE(INTERP, SELF, "get_hook_list", STRING *name);
 
         iter = VTABLE_get_iter(INTERP, list);
         while (VTABLE_get_bool(INTERP, iter)) {
@@ -266,6 +267,75 @@
             *entry = func;
         }
     }
+
+/*
+
+=item C<PMC* get_hook_list(STRING *name)>
+
+Returns a ResizableStringArray PMC filled with
+the names of the gc entries to instrument.
+
+=cut
+
+*/
+
+    METHOD get_hook_list(STRING *name) {
+        PMC *list;
+
+        list = Parrot_pmc_new(INTERP, enum_class_ResizableStringArray);
+
+        if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "allocate"))) {
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "allocate_pmc_header"));
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "allocate_string_header"));
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "allocate_bufferlike_header"));
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "allocate_pmc_attributes"));
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "allocate_string_storage"));
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "allocate_buffer_storage"));
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "allocate_fixed_size_storage"));
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "allocate_memory_chunk"));
+            VTABLE_push_string(INTERP, list,
+                               CONST_STRING(INTERP, "allocate_memory_chunk_with_interior_pointers"));
+        }
+        else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "reallocate"))) {
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "reallocate_string_storage"));
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "reallocate_buffer_storage"));
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "reallocate_memory_chunk"));
+            VTABLE_push_string(INTERP, list,
+                               CONST_STRING(INTERP, "reallocate_memory_chunk_with_interior_pointers"));
+        }
+        else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "free"))) {
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "free_pmc_header"));
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "free_string_header"));
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "free_bufferlike_header"));
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "free_pmc_attributes"));
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "free_fixed_size_storage"));
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "free_memory_chunk"));
+        }
+        else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "administration"))) {
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "finalize_gc_system"));
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "destroy_child_interp"));
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "do_gc_mark"));
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "compact_string_pool"));
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "mark_special"));
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "pmc_needs_early_collection"));
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "init_pool"));
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "block_mark"));
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "unblock_mark"));
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "block_sweep"));
+            VTABLE_push_string(INTERP, list, CONST_STRING(INTERP, "unblock_sweep"));
+        }
+        else {
+            /* Convert name to a constant string since we use the address of the
+               constant string as the key to the various hashes. */
+            char *c_str     = Parrot_str_to_cstring(INTERP, name);
+            STRING *con_str = CONST_STRING(INTERP, c_str);
+            VTABLE_push_string(INTERP, list, con_str);
+            Parrot_free_cstring(c_str);
+        }
+
+        RETURN(PMC *list);
+    }
+
 }
 
 /*
@@ -1021,20 +1091,27 @@
     PMC *task, *task_hash;
     STRING *event_str;
     Parrot_Context_info info;
+    event_str = VTABLE_get_string_keyed_str(interp, data, CONST_STRING(interp, "type"));
 
     Parrot_Context_get_info(interp, CURRENT_CONTEXT(supervised), &info);
     VTABLE_set_string_keyed_str(interp,  data, CONST_STRING(interp, "file"),      info.file);
     VTABLE_set_string_keyed_str(interp,  data, CONST_STRING(interp, "sub"),       info.subname);
     VTABLE_set_string_keyed_str(interp,  data, CONST_STRING(interp, "namespace"), info.nsname);
     VTABLE_set_integer_keyed_str(interp, data, CONST_STRING(interp, "line"),      info.line);
-
-    event_str = Parrot_str_concat(interp, CONST_STRING(interp, "Instrument::Event::GC::"), event);
+    VTABLE_set_string_keyed_str(interp, data,  CONST_STRING(interp, "event_category"),
+                                CONST_STRING(interp, "GC"));
+    VTABLE_set_string_keyed_str(interp, data,  CONST_STRING(interp, "event_subtype"),
+                                event);
+    VTABLE_set_string_keyed_str(interp, data,  CONST_STRING(interp, "event_fulltype"),
+                                event_str);
 
     task_hash = Parrot_pmc_new(interp, enum_class_Hash);
     VTABLE_set_string_keyed_str(interp, task_hash,
                                 CONST_STRING(interp, "type"),
                                 CONST_STRING(interp, "event"));
-    VTABLE_set_string_keyed_str(interp, task_hash, CONST_STRING(interp, "subtype"), event_str);
+    VTABLE_set_string_keyed_str(interp, task_hash,
+                                CONST_STRING(interp, "subtype"),
+                                CONST_STRING(interp, "Instrument"));
     VTABLE_set_pmc_keyed_str(interp, task_hash, CONST_STRING(interp, "data"), data);
 
     task = Parrot_pmc_new_init(interp, enum_class_Task, task_hash);
@@ -1042,68 +1119,6 @@
 }
 
 /*
- * get_gc_funcs: Returns a ResizableStringArray PMC filled with
- *               the names of the gc entries to instrument.
- */
-
-PMC *get_gc_funcs(PARROT_INTERP, STRING *name) {
-    PMC *list;
-
-    list = Parrot_pmc_new(interp, enum_class_ResizableStringArray);
-
-    if (Parrot_str_equal(interp, name, CONST_STRING(interp, "allocate"))) {
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "allocate_pmc_header"));
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "allocate_string_header"));
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "allocate_bufferlike_header"));
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "allocate_pmc_attributes"));
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "allocate_string_storage"));
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "allocate_buffer_storage"));
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "allocate_fixed_size_storage"));
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "allocate_memory_chunk"));
-        VTABLE_push_string(interp, list,
-                           CONST_STRING(interp, "allocate_memory_chunk_with_interior_pointers"));
-    }
-    else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "reallocate"))) {
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "reallocate_string_storage"));
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "reallocate_buffer_storage"));
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "reallocate_memory_chunk"));
-        VTABLE_push_string(interp, list,
-                           CONST_STRING(interp, "reallocate_memory_chunk_with_interior_pointers"));
-    }
-    else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "free"))) {
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "free_pmc_header"));
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "free_string_header"));
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "free_bufferlike_header"));
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "free_pmc_attributes"));
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "free_fixed_size_storage"));
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "free_memory_chunk"));
-    }
-    else if (Parrot_str_equal(interp, name, CONST_STRING(interp, "administration"))) {
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "finalize_gc_system"));
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "destroy_child_interp"));
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "do_gc_mark"));
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "compact_string_pool"));
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "mark_special"));
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "pmc_needs_early_collection"));
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "init_pool"));
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "block_mark"));
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "unblock_mark"));
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "block_sweep"));
-        VTABLE_push_string(interp, list, CONST_STRING(interp, "unblock_sweep"));
-    }
-    else {
-        /* Convert name to a constant string since we use the address of the
-           constant string as the key to the various hashes. */
-        char *c_str     = Parrot_str_to_cstring(interp, name);
-        STRING *con_str = CONST_STRING(interp, c_str);
-        VTABLE_push_string(interp, list, con_str);
-        Parrot_free_cstring(c_str);
-    }
-
-    return list;
-}
-
-/*
  * build_gc_func_hash: Insert the appropriate values into the given 3 hashes.
  *                     1. instr_hash: name => stub function.
  *                     2. orig_hash : name => original gc function.

Modified: branches/gsoc_instrument/t/library/instrument_eventlibrary.t
==============================================================================
--- branches/gsoc_instrument/t/library/instrument_eventlibrary.t	Wed Jun 30 07:04:42 2010	(r47936)
+++ branches/gsoc_instrument/t/library/instrument_eventlibrary.t	Wed Jun 30 15:47:22 2010	(r47937)
@@ -112,9 +112,9 @@
 .sub test_loadlib_callback
     .param pmc data
 
-    # data[0] is the library name.
+    # data['library'] is the library name.
     $P0 = get_global '%test_loadlib_res'
-    $S0 = data[0]
+    $S0 = data['library']
     $P0[$S0] = 1
 .end
 


More information about the parrot-commits mailing list