[svn:parrot] r38040 - in trunk: src/pmc tools/build

cotto at svn.parrot.org cotto at svn.parrot.org
Fri Apr 10 22:39:36 UTC 2009


Author: cotto
Date: Fri Apr 10 22:39:35 2009
New Revision: 38040
URL: https://trac.parrot.org/parrot/changeset/38040

Log:
[NCI] use VTABLE functions instead of twiddling with PMC internals directly

Modified:
   trunk/src/pmc/pointer.pmc
   trunk/tools/build/nativecall.pl

Modified: trunk/src/pmc/pointer.pmc
==============================================================================
--- trunk/src/pmc/pointer.pmc	Fri Apr 10 22:15:40 2009	(r38039)
+++ trunk/src/pmc/pointer.pmc	Fri Apr 10 22:39:35 2009	(r38040)
@@ -93,6 +93,20 @@
 
 /*
 
+=item C<void set_pointer(void *)>
+
+Sets the pointer value.
+
+=cut
+
+*/
+
+    VTABLE void set_pointer(void *ptr) {
+        PARROT_POINTER(SELF)->pointer = ptr;
+    }
+
+/*
+
 =item C<void *get_pointer()>
 
 Returns the pointer value.

Modified: trunk/tools/build/nativecall.pl
==============================================================================
--- trunk/tools/build/nativecall.pl	Fri Apr 10 22:15:40 2009	(r38039)
+++ trunk/tools/build/nativecall.pl	Fri Apr 10 22:39:35 2009	(r38040)
@@ -353,8 +353,11 @@
     };
     /V/ && do {
         push @{$temps_ref},          "PMC *t_$temp_num;";
+        push @{$temps_ref},          "void *v_$temp_num;";
         push @{$extra_preamble_ref}, "t_$temp_num = GET_NCI_P($reg_num);";
-        return "(void**)&PARROT_POINTER(t_$temp_num)->pointer";
+        push @{$extra_preamble_ref}, "v_$temp_num = VTABLE_get_pointer(interp, t_$temp_num);";
+        push @{$extra_postamble_ref}, "VTABLE_set_pointer(interp, t_$temp_num, v_$temp_num);";
+        return "&v_$temp_num";
     };
     /[ilIscfdNS]/ && do {
         my $ret_type = $sig_table{$_}{return_type};


More information about the parrot-commits mailing list