[svn:parrot] r38037 - in trunk: src/pmc tools/build
whiteknight at svn.parrot.org
whiteknight at svn.parrot.org
Fri Apr 10 22:05:53 UTC 2009
Author: whiteknight
Date: Fri Apr 10 22:05:53 2009
New Revision: 38037
URL: https://trac.parrot.org/parrot/changeset/38037
Log:
update src/pmc/pointer.pmc to use ATTRs instead of PMC_struct_val. Requires a change to the nci thunk generator.
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 21:58:57 2009 (r38036)
+++ trunk/src/pmc/pointer.pmc Fri Apr 10 22:05:53 2009 (r38037)
@@ -23,6 +23,8 @@
#include "parrot/parrot.h"
pmclass Pointer need_ext {
+ ATTR void * mark_function;
+ ATTR void * pointer;
/*
@@ -36,6 +38,7 @@
VTABLE void init() {
PObj_custom_mark_SET(SELF);
+ PMC_data(SELF) = mem_allocate_zeroed_typed(Parrot_Pointer_attributes);
}
/*
@@ -50,10 +53,10 @@
VTABLE void mark() {
void (*mark_function)(Interp *, void *) =
- (void (*)(Interp *, void *))D2FPTR(PMC_struct_val(SELF));
-
- if (PMC_data(SELF) && PMC_struct_val(SELF))
- (*mark_function)(INTERP, PMC_data(SELF));
+ (void (*)(Interp *, void *))D2FPTR(PARROT_POINTER(SELF)->mark_function);
+ void * data = PARROT_POINTER(SELF)->pointer;
+ if (data && mark_function)
+ (*mark_function)(INTERP,data);
}
/*
@@ -84,7 +87,7 @@
*/
VTABLE void *get_pointer() {
- return PMC_data(SELF);
+ return PARROT_POINTER(SELF)->pointer;
}
/*
@@ -98,7 +101,7 @@
*/
VTABLE INTVAL get_integer() {
- return (INTVAL)PMC_data(SELF);
+ return (INTVAL)(PARROT_POINTER(SELF)->pointer);
}
/*
@@ -112,7 +115,7 @@
*/
VTABLE FLOATVAL get_number() {
- return (FLOATVAL)(INTVAL)PMC_data(SELF);
+ return (FLOATVAL)(INTVAL)(PARROT_POINTER(SELF)->pointer);
}
/*
@@ -126,7 +129,7 @@
*/
VTABLE STRING *get_repr() {
- return Parrot_sprintf_c(INTERP, "Pointer = 0x%p", PMC_data(SELF));
+ return Parrot_sprintf_c(INTERP, "Pointer = 0x%p", PARROT_POINTER(SELF)->pointer);
}
@@ -141,7 +144,7 @@
*/
VTABLE STRING *get_string() {
- return Parrot_sprintf_c(INTERP, "%s", PMC_data(SELF));
+ return Parrot_sprintf_c(INTERP, "%s", PARROT_POINTER(SELF)->pointer);
}
/*
@@ -170,7 +173,7 @@
VTABLE INTVAL is_same(PMC *pmc2) {
return (INTVAL)(SELF->vtable == pmc2->vtable &&
- PMC_data(SELF) == PMC_data(pmc2));
+ PARROT_POINTER(SELF)->pointer == PARROT_POINTER(pmc2)->pointer);
}
}
Modified: trunk/tools/build/nativecall.pl
==============================================================================
--- trunk/tools/build/nativecall.pl Fri Apr 10 21:58:57 2009 (r38036)
+++ trunk/tools/build/nativecall.pl Fri Apr 10 22:05:53 2009 (r38037)
@@ -197,6 +197,7 @@
#include "parrot/oplib/ops.h"
#include "pmc/pmc_managedstruct.h"
#include "pmc/pmc_nci.h"
+#include "pmc/pmc_pointer.h"
#include "nci.str"
#include "jit.h"
@@ -353,7 +354,7 @@
/V/ && do {
push @{$temps_ref}, "PMC *t_$temp_num;";
push @{$extra_preamble_ref}, "t_$temp_num = GET_NCI_P($reg_num);";
- return "(void**)&PMC_data(t_$temp_num)";
+ return "(void**)&PARROT_POINTER(t_$temp_num)->pointer";
};
/[ilIscfdNS]/ && do {
my $ret_type = $sig_table{$_}{return_type};
More information about the parrot-commits
mailing list