Author: bernhard
Date: Tue Mar 21 14:23:53 2006
New Revision: 11975
Modified:
trunk/compilers/imcc/pbc.c
trunk/docs/vtables.pod
trunk/include/parrot/perltypes.h
trunk/include/parrot/pmc.h
trunk/languages/python/pmc/pybuiltin.pmc
trunk/src/dod.c
trunk/src/extend.c
trunk/src/gc_ims.c
trunk/src/inter_misc.c
trunk/src/jit/i386/jit_emit.h
trunk/src/jit/sun4/jit_emit.h
trunk/src/jit_debug.c
trunk/src/jit_debug_xcoff.c
trunk/src/mmd.c
trunk/src/objects.c
trunk/src/ops/experimental.ops
trunk/src/ops/pmc.ops
trunk/src/pmc.c
trunk/src/pmc/closure.pmc
trunk/src/pmc/default.pmc
trunk/src/pmc/parrotio.pmc
trunk/src/pmc/sub.pmc
trunk/src/pmc_freeze.c
trunk/src/sub.c
trunk/tools/build/pmc2c.pl
Log:
#38756: [TODO] remove enum_class_max ...
Replace the macros 'enum_class_max' and 'Parrot_base_vtables'
with the respective replacement.
Modified: trunk/compilers/imcc/pbc.c
==============================================================================
--- trunk/compilers/imcc/pbc.c (original)
+++ trunk/compilers/imcc/pbc.c Tue Mar 21 14:23:53 2006
@@ -532,7 +532,7 @@
/* TODO use CONST_STRING */
decl_lex = const_string(interpreter, "declare_lex_preg");
lex_info_id = Parrot_get_ctx_HLL_type(interpreter, enum_class_LexInfo);
- lex_info_class = Parrot_base_vtables[lex_info_id]->class;
+ lex_info_class = interpreter->vtables[lex_info_id]->class;
decl_lex_meth = VTABLE_find_method(interpreter,
lex_info_class, decl_lex);
if (!decl_lex_meth) {
@@ -923,7 +923,7 @@
s = string_unescape_cstring(interpreter, r->name + 1, '\'', NULL);
else
s = string_unescape_cstring(interpreter, r->name, 0, NULL);
- class = Parrot_base_vtables[r->pmc_type]->class;
+ class = interpreter->vtables[r->pmc_type]->class;
p = VTABLE_new_from_string(interpreter, class, s, PObj_constant_FLAG);
/* append PMC constant */
k = PDB_extend_const_table(interpreter);
Modified: trunk/docs/vtables.pod
==============================================================================
--- trunk/docs/vtables.pod (original)
+++ trunk/docs/vtables.pod Tue Mar 21 14:23:53 2006
@@ -92,7 +92,7 @@
indicate this by using the 'extension' keyword after the 'pmclass YOURCLASS'
declaration in F<src/pmc/YOURCLASS.pmc>. Then, change the type of the C<init>
function to return C<struct _vtable>, and then return C<temp_base_vtable>
-instead of assigning to the C<Parrot_base_vtables> array.
+instead of assigning to the interpreter specific C<vtables> array.
To finish up adding a built-in class:
Modified: trunk/include/parrot/perltypes.h
==============================================================================
--- trunk/include/parrot/perltypes.h (original)
+++ trunk/include/parrot/perltypes.h Tue Mar 21 14:23:53 2006
@@ -19,10 +19,10 @@
*/
#define DONT_USE_CHANGE_TYPE(thing, type) { \
- if ((thing)->vtable == &Parrot_base_vtables[enum_class_PerlString]) { \
+ if ((thing)->vtable == &interpreter->vtables[enum_class_PerlString]) { \
PObj_is_buffer_ptr_CLEAR(thing); \
} \
- (thing)->vtable = &Parrot_base_vtables[enum_class_ ## type]; \
+ (thing)->vtable = &interpreter->vtables[enum_class_ ## type]; \
if (enum_class_ ## type == enum_class_PerlString) { \
PObj_is_buffer_ptr_SET(thing); \
} \
Modified: trunk/include/parrot/pmc.h
==============================================================================
--- trunk/include/parrot/pmc.h (original)
+++ trunk/include/parrot/pmc.h Tue Mar 21 14:23:53 2006
@@ -1,5 +1,5 @@
/* pmc.h
- * Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
+ * Copyright: 2001-2006 The Perl Foundation. All Rights Reserved.
* SVN Info
* $Id$
* Overview:
@@ -19,14 +19,6 @@
#define PARROT_MAX_CLASSES 100
-/*
- * macros used during vtables conversion
- * TODO go through files and use the real thing
- */
-
-#define enum_class_max interpreter->n_vtable_max
-#define Parrot_base_vtables interpreter->vtables
-
/* Internal use */
PMC *pmc_init_null(Interp * interpreter);
Modified: trunk/languages/python/pmc/pybuiltin.pmc
==============================================================================
--- trunk/languages/python/pmc/pybuiltin.pmc (original)
+++ trunk/languages/python/pmc/pybuiltin.pmc Tue Mar 21 14:23:53 2006
@@ -81,7 +81,7 @@
make_type(Interp* interpreter, INTVAL class, STRING* name,
PMC *parent, PMC *pad)
{
- STRING *pmcname = Parrot_base_vtables[class]->whoami;
+ STRING *pmcname = interpreter->vtables[class]->whoami;
PMC *type = pmc_new(interpreter, PyBuiltin_PyProxyType);
PMC *stash, *iter, *item, *nameprop;
STRING *key;
@@ -108,7 +108,7 @@
nameprop = pmc_new(interpreter, PyBuiltin_PyString);
VTABLE_set_string_native(interpreter, nameprop, key);
VTABLE_setprop(interpreter, item, PyString_name, nameprop);
- item->vtable = Parrot_base_vtables[PyBuiltin_PyNCI];
+ item->vtable = interpreter->vtables[PyBuiltin_PyNCI];
}
VTABLE_add_method(interpreter, type, key, item);
@@ -242,7 +242,7 @@
PMC *nameprop = pmc_new(INTERP, PyBuiltin_PyString);
VTABLE_set_string_native(INTERP, nameprop, key);
VTABLE_setprop(INTERP, item, PyString_name, nameprop);
- item->vtable = Parrot_base_vtables[PyBuiltin_PyNCI];
+ item->vtable = interpreter->vtables[PyBuiltin_PyNCI];
}
scratchpad_store_by_name(INTERP, pad, 0, key, item);
@@ -287,11 +287,11 @@
/* Class objects */
key = const_string(INTERP, "object");
item = make_type(INTERP, PyBuiltin_PyClass, key, NULL, pad);
- item->vtable = Parrot_base_vtables[PyBuiltin_PyType];
- Parrot_base_vtables[PyBuiltin_PyType]->class = item;
+ item->vtable = interpreter->vtables[PyBuiltin_PyType];
+ interpreter->vtables[PyBuiltin_PyType]->class = item;
parent = make_type(INTERP, PyBuiltin_PyObject, key, NULL, NULL);
- parent->vtable = Parrot_base_vtables[PyBuiltin_PyProxyType];
+ parent->vtable = interpreter->vtables[PyBuiltin_PyProxyType];
PyBuiltin_PyProxyClass_class = parent;
key = const_string(INTERP, "bool");
@@ -341,7 +341,7 @@
key = const_string(INTERP, "type");
item = make_type(INTERP, PyBuiltin_PyType, key, parent, pad);
PyBuiltin_PyType_class = item;
- item->vtable = Parrot_base_vtables[PyBuiltin_PyType];
+ item->vtable = interpreter->vtables[PyBuiltin_PyType];
key = const_string(INTERP, "staticmethod");
item = make_type(INTERP, PyBuiltin_PyStaticMeth, key, parent, pad);
@@ -391,8 +391,8 @@
METHOD PMC* callable(PMC *object) {
PMC * ret = pmc_new(INTERP, PyBuiltin_PyBoolean);
- STRING *sub = Parrot_base_vtables[enum_class_Sub]->whoami;
- STRING *nci = Parrot_base_vtables[enum_class_NCI]->whoami;
+ STRING *sub = interpreter->vtables[enum_class_Sub]->whoami;
+ STRING *nci = interpreter->vtables[enum_class_NCI]->whoami;
INTVAL isa = VTABLE_isa(INTERP, object, sub) ||
VTABLE_isa(INTERP, object, nci);
VTABLE_set_integer_native(INTERP, ret, isa);
Modified: trunk/src/dod.c
==============================================================================
--- trunk/src/dod.c (original)
+++ trunk/src/dod.c Tue Mar 21 14:23:53 2006
@@ -304,12 +304,12 @@
* It seems that the Class PMC gets DODed - these should
* get created as constant PMCs.
*/
- for (i = 1; i < (unsigned int)enum_class_max; i++) {
+ for (i = 1; i < (unsigned int)interpreter->n_vtable_max; i++) {
VTABLE *vtable;
/*
* XXX dynpmc groups have empty slots for abstract objects
*/
- if ( (vtable = Parrot_base_vtables[i])) {
+ if ( (vtable = interpreter->vtables[i])) {
#if 0
if (vtable->class)
pobject_lives(interpreter, (PObj *)vtable->class);
Modified: trunk/src/extend.c
==============================================================================
--- trunk/src/extend.c (original)
+++ trunk/src/extend.c Tue Mar 21 14:23:53 2006
@@ -1101,7 +1101,7 @@
Parrot_VTABLE
Parrot_get_vtable(Parrot_INTERP interpreter, Parrot_Int id)
{
- return Parrot_base_vtables[id];
+ return interpreter->vtables[id];
}
/*
Modified: trunk/src/gc_ims.c
==============================================================================
--- trunk/src/gc_ims.c (original)
+++ trunk/src/gc_ims.c Tue Mar 21 14:23:53 2006
@@ -438,7 +438,7 @@
if (GC_DEBUG(interpreter)) {
if (pool == interpreter->arena_base->pmc_pool) {
PMC *p = to_add;
- p->vtable = Parrot_base_vtables[enum_class_Null];
+ p->vtable = interpreter->vtables[enum_class_Null];
}
}
#endif
Modified: trunk/src/inter_misc.c
==============================================================================
--- trunk/src/inter_misc.c (original)
+++ trunk/src/inter_misc.c Tue Mar 21 14:23:53 2006
@@ -49,7 +49,7 @@
func);
/* insert it into namespace */
VTABLE_set_pmc_keyed_str(interpreter,
- Parrot_base_vtables[type]->_namespace,
+ interpreter->vtables[type]->_namespace,
string_make(interpreter, name,
strlen(name), NULL,
PObj_constant_FLAG|PObj_external_FLAG),
Modified: trunk/src/jit/i386/jit_emit.h
==============================================================================
--- trunk/src/jit/i386/jit_emit.h (original)
+++ trunk/src/jit/i386/jit_emit.h Tue Mar 21 14:23:53 2006
@@ -2776,7 +2776,7 @@
assert(op_info->types[0] == PARROT_ARG_P);
p1 = *(jit_info->cur_op + 1);
i2 = *(jit_info->cur_op + 2);
- if (i2 <= 0 || i2 >= enum_class_max)
+ if (i2 <= 0 || i2 >= interpreter->n_vtable_max)
internal_exception(1, "Illegal PMC enum (%d) in new", i2);
/* get interpreter */
Parrot_jit_emit_get_INTERP(jit_info->native_ptr, emit_ECX);
Modified: trunk/src/jit/sun4/jit_emit.h
==============================================================================
--- trunk/src/jit/sun4/jit_emit.h (original)
+++ trunk/src/jit/sun4/jit_emit.h Tue Mar 21 14:23:53 2006
@@ -1110,7 +1110,7 @@
int p1 = *(jit_info->cur_op + 1);
int i2 = *(jit_info->cur_op + 2);
- if (i2 <= 0 || i2 >= enum_class_max)
+ if (i2 <= 0 || i2 >= interpreter->n_vtable_max)
internal_exception(1, "Illegal PMC enum (%d) in new", i2);
/* get "a" pmc first - calling function: pmc_new_noinit(...) */
Modified: trunk/src/jit_debug.c
==============================================================================
--- trunk/src/jit_debug.c (original)
+++ trunk/src/jit_debug.c Tue Mar 21 14:23:53 2006
@@ -163,9 +163,9 @@
);
fprintf(stabs, ".stabs \"PMCType:T(0,%d)=e", i++);
- for (j = 0; j < enum_class_max; ++j) {
- if (Parrot_base_vtables[j] && Parrot_base_vtables[j]->whoami) {
- STRING* name = Parrot_base_vtables[j]->whoami;
+ for (j = 0; j < interpreter->n_vtable_max; ++j) {
+ if (interpreter->vtables[j] && interpreter->vtables[j]->whoami) {
+ STRING* name = interpreter->vtables[j]->whoami;
fwrite(name->strstart, name->strlen, 1, stabs);
fprintf(stabs, ":%d,", j);
}
Modified: trunk/src/jit_debug_xcoff.c
==============================================================================
--- trunk/src/jit_debug_xcoff.c (original)
+++ trunk/src/jit_debug_xcoff.c Tue Mar 21 14:23:53 2006
@@ -130,9 +130,9 @@
);
fprintf(stabs, ".stabx \"PMCType:T%d=e", i++);
- for (j = 0; j < enum_class_max; ++j) {
- if (Parrot_base_vtables[j] && Parrot_base_vtables[j]->whoami) {
- STRING* name = Parrot_base_vtables[j]->whoami;
+ for (j = 0; j < interpreter->n_vtable_max; ++j) {
+ if (interpreter->vtables[j] && interpreter->vtables[j]->whoami) {
+ STRING* name = interpreter->vtables[j]->whoami;
fwrite(name->strstart, name->strlen, 1, stabs);
fprintf(stabs, ":%d,", j);
}
Modified: trunk/src/mmd.c
==============================================================================
--- trunk/src/mmd.c (original)
+++ trunk/src/mmd.c Tue Mar 21 14:23:53 2006
@@ -146,9 +146,9 @@
* install the mmd_wrapper as real function
*/
if (isa_deleg_pmc(interpreter,
- Parrot_base_vtables[left_type]->class)
+ interpreter->vtables[left_type]->class)
|| (r > 0 && isa_deleg_pmc(interpreter,
- Parrot_base_vtables[r]->class))) {
+ interpreter->vtables[r]->class))) {
/* TODO check dest too */
nci = pmc_new(interpreter, enum_class_Bound_NCI);
dod_register_pmc(interpreter, nci); /* XXX */
@@ -1580,7 +1580,7 @@
/* TODO create some class namespace */
}
else {
- mro = Parrot_base_vtables[type1]->mro;
+ mro = interpreter->vtables[type1]->mro;
n = VTABLE_elements(interpreter, mro);
for (i = start_at_parent; i < n; ++i) {
class = VTABLE_get_pmc_keyed_int(interpreter, mro, i);
@@ -1706,7 +1706,7 @@
* now consider MRO of types the signature type has to be somewhere
* in the MRO of the type_call
*/
- mro = Parrot_base_vtables[type_call]->mro;
+ mro = interpreter->vtables[type_call]->mro;
m = VTABLE_elements(interpreter, mro);
for (j = 0; j < m; ++j) {
PMC *cl = VTABLE_get_pmc_keyed_int(interpreter, mro, j);
@@ -1729,12 +1729,12 @@
if (type_sig < 0)
s1 = Parrot_get_datatype_name(interpreter, type_sig);
else {
- s1 = Parrot_base_vtables[type_sig]->whoami;
+ s1 = interpreter->vtables[type_sig]->whoami;
}
if (type_call < 0)
s2 = Parrot_get_datatype_name(interpreter, type_call);
else {
- s2 = Parrot_base_vtables[type_call]->whoami;
+ s2 = interpreter->vtables[type_call]->whoami;
}
PIO_eprintf(interpreter, "arg %d: dist %d sig %Ss arg %Ss\n",
i, dist, s1, s2);
@@ -2086,7 +2086,7 @@
if (memcmp(short_name, "__i_", 4) == 0)
signature[0] = 'v';
meth_name = const_string(interpreter, short_name);
- class = Parrot_base_vtables[type]->class;
+ class = interpreter->vtables[type]->class;
method = Parrot_find_method_direct(interpreter, class, meth_name);
if (!method) {
/* first method */
Modified: trunk/src/objects.c
==============================================================================
--- trunk/src/objects.c (original)
+++ trunk/src/objects.c Tue Mar 21 14:23:53 2006
@@ -165,9 +165,9 @@
vtable_pmc = get_attrib_num((SLOTTYPE*)PMC_data(class),
PCD_OBJECT_VTABLE);
vtable = PMC_struct_val(vtable_pmc);
- deleg_pmc_vtable = Parrot_base_vtables[enum_class_deleg_pmc];
- object_vtable = Parrot_base_vtables[enum_class_ParrotObject];
- delegate_vtable = Parrot_base_vtables[enum_class_delegate];
+ deleg_pmc_vtable = interpreter->vtables[enum_class_deleg_pmc];
+ object_vtable = interpreter->vtables[enum_class_ParrotObject];
+ delegate_vtable = interpreter->vtables[enum_class_delegate];
memset(&meth_str, 0, sizeof(meth_str));
meth_str.encoding = Parrot_fixed_8_encoding_ptr;
@@ -272,7 +272,7 @@
/*
* ParrotClass is the baseclass anyway, so build just a new class
*/
- if (base_class == Parrot_base_vtables[enum_class_ParrotClass]->class) {
+ if (base_class == interpreter->vtables[enum_class_ParrotClass]->class) {
return pmc_new_init(interpreter, enum_class_ParrotClass,
(PMC*)child_class_name);
}
@@ -411,11 +411,11 @@
(Hash*) PMC_struct_val(interpreter->class_hash), class_name);
if (b) {
INTVAL type = PMC_int_val((PMC*)b->value);
- PMC *pmc = Parrot_base_vtables[type]->class;
+ PMC *pmc = interpreter->vtables[type]->class;
assert(pmc);
#if 0
if (!pmc) {
- pmc = Parrot_base_vtables[type]->class =
+ pmc = interpreter->vtables[type]->class =
pmc_new_noinit(interpreter, type);
}
#endif
@@ -482,7 +482,7 @@
new_class->vtable = new_vtable;
/* Put our new vtable in the global table */
- Parrot_base_vtables[new_type] = new_vtable;
+ interpreter->vtables[new_type] = new_vtable;
/* check if we already have a NameSpace */
top = CONTEXT(interpreter->ctx)->current_namespace;
@@ -514,7 +514,7 @@
parent_vtable = PMC_struct_val(vtable_pmc);
}
else
- parent_vtable = Parrot_base_vtables[enum_class_ParrotObject];
+ parent_vtable = interpreter->vtables[enum_class_ParrotObject];
new_vtable = Parrot_clone_vtable(interpreter, parent_vtable);
new_vtable->base_type = new_type;
@@ -1003,7 +1003,7 @@
invalidate_all_caches(Interp *interpreter)
{
UINTVAL i;
- for (i = 1; i < (UINTVAL)enum_class_max; ++i)
+ for (i = 1; i < (UINTVAL)interpreter->n_vtable_max; ++i)
invalidate_type_caches(interpreter, i);
}
Modified: trunk/src/ops/experimental.ops
==============================================================================
--- trunk/src/ops/experimental.ops (original)
+++ trunk/src/ops/experimental.ops Tue Mar 21 14:23:53 2006
@@ -140,7 +140,7 @@
=cut
op new(out PMC, in INT, in KEY) {
- if ($2 <= 0 || $2 >= enum_class_max) {
+ if ($2 <= 0 || $2 >= interpreter->n_vtable_max) {
internal_exception(1, "Illegal PMC enum (%d) in new", (int)$2);
}
$1 = pmc_new_init(interpreter, $2, $3);
Modified: trunk/src/ops/pmc.ops
==============================================================================
--- trunk/src/ops/pmc.ops (original)
+++ trunk/src/ops/pmc.ops Tue Mar 21 14:23:53 2006
@@ -53,7 +53,7 @@
=cut
op new(out PMC, in INT) {
- if ($2 <= 0 || $2 >= enum_class_max) {
+ if ($2 <= 0 || $2 >= interpreter->n_vtable_max) {
internal_exception(1, "Illegal PMC enum (%d) in new", (int)$2);
abort(); /* Deserve to lose */
}
@@ -82,7 +82,7 @@
}
op new(out PMC, in INT, in PMC) {
- if ($2 <= 0 || $2 >= enum_class_max) {
+ if ($2 <= 0 || $2 >= interpreter->n_vtable_max) {
internal_exception(1, "Illegal PMC enum (%d) in new", (int)$2);
}
$1 = pmc_new_init(interpreter, $2, $3);
@@ -90,7 +90,7 @@
}
op new(out PMC, in INT, in PMC, in PMC) {
- if ($2 <= 0 || $2 >= enum_class_max) {
+ if ($2 <= 0 || $2 >= interpreter->n_vtable_max) {
internal_exception(1, "Illegal PMC enum (%d) in new", (int)$2);
}
$1 = pmc_new_noinit(interpreter, $2);
@@ -107,10 +107,10 @@
op new(out PMC, in INT, in STR) {
PMC *class;
- if ($2 <= 0 || $2 >= enum_class_max) {
+ if ($2 <= 0 || $2 >= interpreter->n_vtable_max) {
internal_exception(1, "Illegal PMC enum (%d) in new", (int)$2);
}
- class = Parrot_base_vtables[$2]->class;
+ class = interpreter->vtables[$2]->class;
$1 = VTABLE_new_from_string(interpreter, class, $3, 0);
goto NEXT();
}
@@ -175,8 +175,8 @@
=cut
inline op typeof(out STR, in INT) {
- if ($2 > 0 && $2 < enum_class_max)
- $1 = Parrot_base_vtables[$2]->whoami;
+ if ($2 > 0 && $2 < interpreter->n_vtable_max)
+ $1 = interpreter->vtables[$2]->whoami;
else
$1 = Parrot_get_datatype_name(interpreter, $2);
goto NEXT();
@@ -204,7 +204,7 @@
=cut
op valid_type(out INT, in INT) {
- if ($2 > 0 && $2 < enum_class_max)
+ if ($2 > 0 && $2 < interpreter->n_vtable_max)
$1 = 1;
else if ($2 >= enum_first_type && $2 < enum_last_type)
$1 = 1;
Modified: trunk/src/pmc.c
==============================================================================
--- trunk/src/pmc.c (original)
+++ trunk/src/pmc.c Tue Mar 21 14:23:53 2006
@@ -31,7 +31,7 @@
pmc_new(Interp *interpreter, INTVAL base_type)>
Creates a new PMC of type C<base_type> (which is an index into the list
-of PMC types declared in C<Parrot_base_vtables> in
+of PMC types declared in C<vtables> in
F<include/parrot/pmc.h>). Once the PMC has been successfully created and
its vtable pointer initialized, we call its C<init> method to perform
any other necessary initialization.
@@ -75,7 +75,7 @@
if (pmc->vtable->base_type == new_type)
return pmc;
- new_vtable = Parrot_base_vtables[new_type];
+ new_vtable = interpreter->vtables[new_type];
/* Singleton/const PMCs/types are not eligible */
@@ -167,7 +167,7 @@
UINTVAL flags)
{
PMC *pmc;
- VTABLE *vtable = Parrot_base_vtables[base_type];
+ VTABLE *vtable = interpreter->vtables[base_type];
if (!vtable) {
/* This is usually because you either didn't call init_world early
@@ -215,7 +215,7 @@
flags = PObj_constant_FLAG;
#endif
--base_type;
- vtable = Parrot_base_vtables[base_type];
+ vtable = interpreter->vtables[base_type];
}
if (vtable->flags & VTABLE_PMC_NEEDS_EXT) {
flags |= PObj_is_PMC_EXT_FLAG;
@@ -248,7 +248,7 @@
pmc_new_noinit(Interp *interpreter, INTVAL base_type)>
Creates a new PMC of type C<base_type> (which is an index into the list
-of PMC types declared in C<Parrot_base_vtables> in
+of PMC types declared in C<vtables> in
F<include/parrot/pmc.h>). Unlike C<pmc_new()>, C<pmc_new_noinit()> does
not call its C<init> method. This allows separate allocation and
initialization for continuations.
@@ -374,7 +374,7 @@
}
classname_hash = interpreter->class_hash;
- type = enum_class_max++;
+ type = interpreter->n_vtable_max++;
/* Have we overflowed the table? */
if (type >= interpreter->n_vtable_alloced) {
parrot_realloc_vtables(interpreter);
@@ -434,7 +434,7 @@
PMC_pmc_val(class) = (void*)0xdeadbeef;
PMC_struct_val(class)= (void*)0xdeadbeef;
- Parrot_base_vtables[type]->class = class;
+ interpreter->vtables[type]->class = class;
return class;
}
@@ -458,7 +458,7 @@
PMC *class, *mro;
PMC *ns;
- vtable = Parrot_base_vtables[type];
+ vtable = interpreter->vtables[type];
/* multithreaded: has already mro */
if (vtable->mro)
return;
@@ -473,7 +473,7 @@
parent_type = pmc_type(interpreter, class_name);
if (!parent_type) /* abstract classes don't have a vtable */
break;
- vtable = Parrot_base_vtables[parent_type];
+ vtable = interpreter->vtables[parent_type];
if (!vtable->_namespace) {
/* need a namespace Hash, anchor at parent, name it */
ns = pmc_new(interpreter,
Modified: trunk/src/pmc/closure.pmc
==============================================================================
--- trunk/src/pmc/closure.pmc (original)
+++ trunk/src/pmc/closure.pmc Tue Mar 21 14:23:53 2006
@@ -109,7 +109,7 @@
while (caller) {
if (caller->current_sub == outer_sub) {
cont = caller->current_cont;
- cont->vtable =
Parrot_base_vtables[enum_class_Continuation];
+ cont->vtable =
interpreter->vtables[enum_class_Continuation];
sub->outer_ctx = sub->ctx->outer_ctx = caller;
caller->ref_count++;
return next;
@@ -126,7 +126,7 @@
(void)VTABLE_invoke(INTERP, sub->outer_sub, next);
caller = CONTEXT(INTERP->ctx);
cont = caller->current_cont;
- cont->vtable = Parrot_base_vtables[enum_class_Continuation];
+ cont->vtable = interpreter->vtables[enum_class_Continuation];
sub->outer_ctx = sub->ctx->outer_ctx = caller;
caller->ref_count++;
(void)VTABLE_invoke(INTERP, cont, next);
Modified: trunk/src/pmc/default.pmc
==============================================================================
--- trunk/src/pmc/default.pmc (original)
+++ trunk/src/pmc/default.pmc Tue Mar 21 14:23:53 2006
@@ -97,7 +97,7 @@
INTVAL on = VTABLE_get_bool(interpreter, value);
/* morph to Const/normal class */
if (on && (pmc->vtable->flags & VTABLE_HAS_CONST_TOO))
- pmc->vtable = Parrot_base_vtables[pmc->vtable->base_type + 1];
+ pmc->vtable = interpreter->vtables[pmc->vtable->base_type + 1];
else if (!on && (pmc->vtable->flags & VTABLE_IS_CONST_FLAG))
VTABLE_morph(interpreter, pmc, pmc->vtable->base_type - 1);
}
@@ -837,7 +837,7 @@
}
else if (VTABLE_isa(INTERP, p, CONST_STRING(INTERP, "NCI"))) {
PMC *bound_meth = VTABLE_clone(INTERP, p);
- bound_meth->vtable = Parrot_base_vtables[enum_class_Bound_NCI];
+ bound_meth->vtable = interpreter->vtables[enum_class_Bound_NCI];
VTABLE_set_pmc(INTERP, bound_meth, SELF);
return bound_meth;
}
Modified: trunk/src/pmc/parrotio.pmc
==============================================================================
--- trunk/src/pmc/parrotio.pmc (original)
+++ trunk/src/pmc/parrotio.pmc Tue Mar 21 14:23:53 2006
@@ -42,7 +42,7 @@
*/
METHOD INTVAL say(STRING *s) {
- PMC *out = SELF == Parrot_base_vtables[enum_class_ParrotIO]->class ?
+ PMC *out = SELF == interpreter->vtables[enum_class_ParrotIO]->class ?
PIO_STDOUT(INTERP) : SELF;
INTVAL r = PIO_putps(INTERP, out, s);
r += PIO_puts(INTERP, out, "\n");
Modified: trunk/src/pmc/sub.pmc
==============================================================================
--- trunk/src/pmc/sub.pmc (original)
+++ trunk/src/pmc/sub.pmc Tue Mar 21 14:23:53 2006
@@ -283,7 +283,7 @@
sub->ctx = context;
if (PObj_get_FLAGS(SELF) & SUB_FLAG_IS_OUTER) {
/* don't destroy context */
- ccont->vtable = Parrot_base_vtables[enum_class_Continuation];
+ ccont->vtable = interpreter->vtables[enum_class_Continuation];
context->ref_count++;
}
Modified: trunk/src/pmc_freeze.c
==============================================================================
--- trunk/src/pmc_freeze.c (original)
+++ trunk/src/pmc_freeze.c Tue Mar 21 14:23:53 2006
@@ -846,7 +846,7 @@
info->last_type = *type = io->vtable->shift_integer(interpreter, io);
if (*type <= 0)
internal_exception(1, "Unknown PMC type to thaw %d", (int) *type);
- if (*type >= enum_class_max) {
+ if (*type >= interpreter->n_vtable_max) {
/* that ought to be a class */
*type = enum_class_ParrotClass;
}
Modified: trunk/src/sub.c
==============================================================================
--- trunk/src/sub.c (original)
+++ trunk/src/sub.c Tue Mar 21 14:23:53 2006
@@ -244,9 +244,9 @@
* if one were created, everything up the chain would have been
* invalidated earlier.
*/
- if (cont->vtable != Parrot_base_vtables[enum_class_RetContinuation])
+ if (cont->vtable != interpreter->vtables[enum_class_RetContinuation])
break;
- cont->vtable = Parrot_base_vtables[enum_class_Continuation];
+ cont->vtable = interpreter->vtables[enum_class_Continuation];
ctx->ref_count++;
cont = ctx->current_cont;
ctx = PMC_cont(cont)->from_ctx;
@@ -444,7 +444,7 @@
parrot_context_t *ctx;
clos_pmc = VTABLE_clone(interpreter, sub_pmc);
- clos_pmc->vtable = Parrot_base_vtables[enum_class_Closure];
+ clos_pmc->vtable = interpreter->vtables[enum_class_Closure];
sub = PMC_sub(sub_pmc);
clos = PMC_sub(clos_pmc);
/*
@@ -469,7 +469,7 @@
}
cont = ctx->current_cont;
/* preserve this frame by converting the continuation */
- cont->vtable = Parrot_base_vtables[enum_class_Continuation];
+ cont->vtable = interpreter->vtables[enum_class_Continuation];
/* remember this (the :outer) ctx in the closure */
clos->outer_ctx = ctx;
/* the closure refs now this context too */
Modified: trunk/tools/build/pmc2c.pl
==============================================================================
--- trunk/tools/build/pmc2c.pl (original)
+++ trunk/tools/build/pmc2c.pl Tue Mar 21 14:23:53 2006
@@ -96,7 +96,7 @@
If the C<noinit> flag was used, then no init function is generated.
Otherwise, one is generated which sets up the vtable and enters it into
-the C<Parrot_base_vtables> array.
+the C<vtables> array.
The .c file is generated by appending the functions after the various
directives have been replaced.