[svn:parrot] r40643 - in trunk: compilers/imcc include/parrot lib/Parrot/Pmc2c src src/dynpmc src/gc src/pmc src/runcore t/native_pbc
bacek at svn.parrot.org
bacek at svn.parrot.org
Tue Aug 18 22:57:13 UTC 2009
Author: bacek
Date: Tue Aug 18 22:57:11 2009
New Revision: 40643
URL: https://trac.parrot.org/parrot/changeset/40643
Log:
Merge tt795_kill_parrot_sub_structure back to trunk.
Modified:
trunk/compilers/imcc/parser_util.c
trunk/compilers/imcc/pbc.c
trunk/include/parrot/sub.h
trunk/lib/Parrot/Pmc2c/Attribute.pm
trunk/lib/Parrot/Pmc2c/Parser.pm
trunk/src/dynpmc/subproxy.pmc
trunk/src/embed.c
trunk/src/extend.c
trunk/src/gc/alloc_register.c
trunk/src/global.c
trunk/src/jit.c
trunk/src/multidispatch.c
trunk/src/packdump.c
trunk/src/packfile.c
trunk/src/pbc_merge.c
trunk/src/pic_jit.c
trunk/src/pmc/continuation.pmc
trunk/src/pmc/coroutine.pmc
trunk/src/pmc/eval.pmc
trunk/src/pmc/exception.pmc
trunk/src/pmc/namespace.pmc
trunk/src/pmc/parrotinterpreter.pmc
trunk/src/pmc/sub.pmc
trunk/src/runcore/trace.c
trunk/src/sub.c
trunk/src/thread.c
trunk/t/native_pbc/annotations.pbc
trunk/t/native_pbc/integer_1.pbc
trunk/t/native_pbc/number_1.pbc
trunk/t/native_pbc/string_1.pbc
Modified: trunk/compilers/imcc/parser_util.c
==============================================================================
--- trunk/compilers/imcc/parser_util.c Tue Aug 18 22:40:26 2009 (r40642)
+++ trunk/compilers/imcc/parser_util.c Tue Aug 18 22:57:11 2009 (r40643)
@@ -693,7 +693,7 @@
IMCC_pop_parser_state(interp, yyscanner);
if (!IMCC_INFO(interp)->error_code) {
- Parrot_sub *sub_data;
+ Parrot_Sub_attributes *sub_data;
/*
* create sub PMC
Modified: trunk/compilers/imcc/pbc.c
==============================================================================
--- trunk/compilers/imcc/pbc.c Tue Aug 18 22:40:26 2009 (r40642)
+++ trunk/compilers/imcc/pbc.c Tue Aug 18 22:57:11 2009 (r40643)
@@ -1205,7 +1205,7 @@
while (n) {
STRING *lex_name;
const int k = n->color;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PARROT_ASSERT(k >= 0);
lex_name = constants[k]->u.string;
@@ -1255,7 +1255,7 @@
subs_t *s;
PMC *current;
STRING *cur_name;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
size_t len;
if (!unit->outer)
@@ -1320,9 +1320,9 @@
add_const_pmc_sub(PARROT_INTERP, ARGMOD(SymReg *r), size_t offs, size_t end)
{
ASSERT_ARGS(add_const_pmc_sub)
- PMC *ns_pmc;
- PMC *sub_pmc;
- Parrot_sub *sub, *outer_sub;
+ PMC *ns_pmc;
+ PMC *sub_pmc;
+ Parrot_Sub_attributes *sub, *outer_sub;
const int k = add_const_table(interp);
PackFile_ConstTable * const ct = interp->code->const_table;
Modified: trunk/include/parrot/sub.h
==============================================================================
--- trunk/include/parrot/sub.h Tue Aug 18 22:40:26 2009 (r40642)
+++ trunk/include/parrot/sub.h Tue Aug 18 22:57:11 2009 (r40643)
@@ -136,37 +136,6 @@
Parrot_UInt1 named_slurpy;
} Parrot_sub_arginfo;
-
-typedef struct Parrot_sub {
- PackFile_ByteCode *seg; /* bytecode segment */
- size_t start_offs; /* sub entry in ops from seg->base.data */
- size_t end_offs;
-
- INTVAL HLL_id; /* see src/hll.c XXX or per segment? */
- PMC *namespace_name; /* where this Sub is in - this is either
- * a String or a [Key] and describes
- * the relative path in the NameSpace
- */
- PMC *namespace_stash; /* the actual hash, HLL::namespace */
- STRING *name; /* name of the sub */
- STRING *method_name; /* method name of the sub */
- STRING *ns_entry_name; /* ns entry name of the sub */
- STRING *subid; /* The ID of the sub. */
- INTVAL vtable_index; /* index in Parrot_vtable_slot_names */
- PMC *multi_signature; /* list of types for MMD */
- INTVAL n_regs_used[4]; /* INSP in PBC */
-
- PMC *lex_info; /* LexInfo PMC */
- PMC *outer_sub; /* :outer for closures */
- PMC *eval_pmc; /* eval container / NULL */
- Parrot_Context *ctx; /* the context this sub is in */
- UINTVAL comp_flags; /* compile time and additional flags */
- Parrot_sub_arginfo *arg_info;/* Argument counts and flags. */
-
- /* - end common */
- struct Parrot_Context *outer_ctx; /* outer context, if a closure */
-} Parrot_sub;
-
#define PMC_get_sub(interp, pmc, sub) \
do { \
const INTVAL type = (pmc)->vtable->base_type; \
@@ -174,47 +143,13 @@
type == enum_class_Coroutine || \
type == enum_class_Eval) \
{\
- GETATTR_Sub_sub((interp), (pmc), (sub)); \
+ (sub) = PARROT_SUB((pmc)); \
} \
else { \
- (sub) = Parrot_get_sub_pmc_from_subclass((interp), (pmc)); \
+ (sub) = (Parrot_Sub_attributes*)Parrot_get_sub_pmc_from_subclass((interp), (pmc)); \
} \
} while (0)
-/* the first entries must match Parrot_sub, so we can cast
- * these two to the other type
- */
-typedef struct Parrot_coro {
- PackFile_ByteCode *seg; /* bytecode segment */
- size_t start_offs; /* sub entry in ops from seg->base.data */
- size_t end_offs;
-
- INTVAL HLL_id; /* see src/hll.c XXX or per segment? */
- PMC *_namespace; /* where this Sub is in - this is either
- * a String or a [Key] and describes
- * the relative path in the NameSpace
- */
- PMC *namespace_stash; /* the actual hash, HLL::namespace */
- STRING *name; /* name of the sub */
- STRING *method_name; /* method name of the sub */
- STRING *ns_entry_name; /* ns entry name of the sub */
- STRING *subid; /* The ID of the sub. */
- INTVAL vtable_index; /* index in Parrot_vtable_slot_names */
- PMC *multi_signature; /* list of types for MMD */
- INTVAL n_regs_used[4]; /* INSP in PBC */
-
- PMC *lex_info; /* LexInfo PMC */
- PMC *outer_sub; /* :outer for closures */
- PMC *eval_pmc; /* eval container / NULL */
- struct Parrot_Context *ctx; /* coroutine context */
- UINTVAL comp_flags; /* compile time and additional flags */
- Parrot_sub_arginfo arg_info; /* Argument counts and flags. */
-
- /* - end common */
-
- PackFile_ByteCode *caller_seg; /* bytecode segment */
- opcode_t *address; /* next address to run - toggled each time */
-} Parrot_coro;
typedef struct Parrot_cont {
/* continuation destination */
@@ -276,8 +211,7 @@
PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
-Parrot_sub * Parrot_get_sub_pmc_from_subclass(PARROT_INTERP,
- ARGIN(PMC *subclass))
+void * Parrot_get_sub_pmc_from_subclass(PARROT_INTERP, ARGIN(PMC *subclass))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
@@ -307,19 +241,9 @@
PARROT_MALLOC
PARROT_CANNOT_RETURN_NULL
-Parrot_coro * new_coroutine(PARROT_INTERP)
- __attribute__nonnull__(1);
-
-PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
Parrot_cont * new_ret_continuation(PARROT_INTERP)
__attribute__nonnull__(1);
-PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
-Parrot_sub * new_sub(PARROT_INTERP)
- __attribute__nonnull__(1);
-
void Parrot_capture_lex(PARROT_INTERP, ARGMOD(PMC *sub_pmc))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
@@ -374,12 +298,8 @@
#define ASSERT_ARGS_mark_context_start __attribute__unused__ int _ASSERT_ARGS_CHECK = 0
#define ASSERT_ARGS_new_continuation __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp)
-#define ASSERT_ARGS_new_coroutine __attribute__unused__ int _ASSERT_ARGS_CHECK = \
- PARROT_ASSERT_ARG(interp)
#define ASSERT_ARGS_new_ret_continuation __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp)
-#define ASSERT_ARGS_new_sub __attribute__unused__ int _ASSERT_ARGS_CHECK = \
- PARROT_ASSERT_ARG(interp)
#define ASSERT_ARGS_Parrot_capture_lex __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp) \
|| PARROT_ASSERT_ARG(sub_pmc)
Modified: trunk/lib/Parrot/Pmc2c/Attribute.pm
==============================================================================
--- trunk/lib/Parrot/Pmc2c/Attribute.pm Tue Aug 18 22:40:26 2009 (r40642)
+++ trunk/lib/Parrot/Pmc2c/Attribute.pm Tue Aug 18 22:57:11 2009 (r40643)
@@ -10,9 +10,10 @@
my ( $class, $self_hash ) = @_;
my $self = {
(
- name => "",
- type => "",
- modifiers => [],
+ name => "",
+ type => "",
+ array_size => "",
+ modifiers => [],
%{ $self_hash || {} }
)
};
@@ -36,7 +37,7 @@
sub generate_declaration {
my ( $self, $pmc ) = @_;
my $h = $pmc->{emitter};
- my $decl = ' ' . $self->{type} . ' ' . $self->{name} . ";\n";
+ my $decl = ' ' . $self->{type} . ' ' . $self->{name} . $self->{array_size} . ";\n";
$h->emit($decl);
Modified: trunk/lib/Parrot/Pmc2c/Parser.pm
==============================================================================
--- trunk/lib/Parrot/Pmc2c/Parser.pm Tue Aug 18 22:40:26 2009 (r40642)
+++ trunk/lib/Parrot/Pmc2c/Parser.pm Tue Aug 18 22:57:11 2009 (r40643)
@@ -146,6 +146,9 @@
| \(\*\w*\)\(.*?\)
)
+ # Array size
+ (\[\d+\])?
+
# modifiers
\s*
((?::\w+\s*)*)
@@ -159,19 +162,21 @@
}sx;
while ($pmcbody =~ s/($attr_re)//o) {
- my ($type, $name, @modifiers, $comment);
+ my ($type, $name, $array_size, @modifiers, $comment);
$type = $2;
$name = $3;
- @modifiers = split /\s/, $4;
- $comment = $5;
+ $array_size = $4 || '';
+ @modifiers = split /\s/, $5;
+ $comment = $6;
$lineno += count_newlines($1);
$pmc->add_attribute(Parrot::Pmc2c::Attribute->new(
{
- name => $name,
- type => $type,
- modifiers => \@modifiers,
+ name => $name,
+ type => $type,
+ array_size => $array_size,
+ modifiers => \@modifiers,
}
));
}
Modified: trunk/src/dynpmc/subproxy.pmc
==============================================================================
--- trunk/src/dynpmc/subproxy.pmc Tue Aug 18 22:40:26 2009 (r40642)
+++ trunk/src/dynpmc/subproxy.pmc Tue Aug 18 22:57:11 2009 (r40643)
@@ -31,7 +31,7 @@
PMC *key = PMC_data_typed(SELF, PMC *);
STRING *file;
PMC *rsub_pmc, *sub_pmc;
- Parrot_sub *rsub, *my_sub;
+ Parrot_Sub_attributes *rsub, *my_sub;
if (!key)
Parrot_ex_throw_from_c_args(interp, NULL, 1, "SubProxy: no key");
Modified: trunk/src/embed.c
==============================================================================
--- trunk/src/embed.c Tue Aug 18 22:40:26 2009 (r40642)
+++ trunk/src/embed.c Tue Aug 18 22:57:11 2009 (r40643)
@@ -885,7 +885,7 @@
set_current_sub(PARROT_INTERP)
{
ASSERT_ARGS(set_current_sub)
- Parrot_sub *sub_pmc_sub;
+ Parrot_Sub_attributes *sub_pmc_sub;
PMC *sub_pmc;
PackFile_ByteCode * const cur_cs = interp->code;
@@ -903,7 +903,7 @@
if (ft->fixups[i]->type == enum_fixup_sub) {
const opcode_t ci = ft->fixups[i]->offset;
PMC *sub_pmc = ct->constants[ci]->u.key;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PMC_get_sub(interp, sub_pmc, sub);
if (sub->seg == cur_cs) {
Modified: trunk/src/extend.c
==============================================================================
--- trunk/src/extend.c Tue Aug 18 22:40:26 2009 (r40642)
+++ trunk/src/extend.c Tue Aug 18 22:57:11 2009 (r40643)
@@ -1040,7 +1040,7 @@
ASSERT_ARGS(Parrot_call_sub)
va_list ap;
void *result;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PARROT_CALLIN_START(interp);
@@ -1073,7 +1073,7 @@
ASSERT_ARGS(Parrot_call_sub_ret_int)
va_list ap;
Parrot_Int result;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PARROT_CALLIN_START(interp);
@@ -1106,7 +1106,7 @@
ASSERT_ARGS(Parrot_call_sub_ret_float)
va_list ap;
Parrot_Float result;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PARROT_CALLIN_START(interp);
Modified: trunk/src/gc/alloc_register.c
==============================================================================
--- trunk/src/gc/alloc_register.c Tue Aug 18 22:40:26 2009 (r40642)
+++ trunk/src/gc/alloc_register.c Tue Aug 18 22:57:11 2009 (r40643)
@@ -585,7 +585,7 @@
if (Interp_debug_TEST(interp, PARROT_CTX_DESTROY_DEBUG_FLAG)
&& ctx->current_sub) {
/* can't probably Parrot_io_eprintf here */
- Parrot_sub *doomed;
+ Parrot_Sub_attributes *doomed;
PMC_get_sub(interp, ctx->current_sub, doomed);
if (doomed) {
@@ -670,7 +670,7 @@
const char *name = "unknown";
if (ctx->current_sub) {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PMC_get_sub(interp, ctx->current_sub, sub);
name = (char *)(sub->name->strstart);
}
Modified: trunk/src/global.c
==============================================================================
--- trunk/src/global.c Tue Aug 18 22:40:26 2009 (r40642)
+++ trunk/src/global.c Tue Aug 18 22:57:11 2009 (r40643)
@@ -718,7 +718,7 @@
get_namespace_pmc(PARROT_INTERP, ARGIN(PMC *sub_pmc))
{
ASSERT_ARGS(get_namespace_pmc)
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PMC *nsname, *nsroot;
PMC_get_sub(interp, sub_pmc, sub);
@@ -752,7 +752,7 @@
store_sub_in_multi(PARROT_INTERP, ARGIN(PMC *sub_pmc), ARGIN(PMC *ns))
{
ASSERT_ARGS(store_sub_in_multi)
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
STRING *ns_entry_name;
PMC *multisub;
@@ -791,7 +791,7 @@
const INTVAL cur_id = CONTEXT(interp)->current_HLL;
PMC *ns;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
/* PF structures aren't fully constructed yet */
Parrot_block_GC_mark(interp);
Modified: trunk/src/jit.c
==============================================================================
--- trunk/src/jit.c Tue Aug 18 22:40:26 2009 (r40642)
+++ trunk/src/jit.c Tue Aug 18 22:57:11 2009 (r40643)
@@ -1294,10 +1294,10 @@
for (i = 0; i < ft->fixup_count; i++) {
if (ft->fixups[i]->type == enum_fixup_sub) {
const int ci = ft->fixups[i]->offset;
- PMC * const sub_pmc = ct->constants[ci]->u.key;
- Parrot_sub *sub;
- size_t offs;
- int i;
+ PMC * const sub_pmc = ct->constants[ci]->u.key;
+ Parrot_Sub_attributes *sub;
+ size_t offs;
+ int i;
PMC_get_sub(interp, sub_pmc, sub);
offs = pc - sub->seg->base.data;
Modified: trunk/src/multidispatch.c
==============================================================================
--- trunk/src/multidispatch.c Tue Aug 18 22:40:26 2009 (r40642)
+++ trunk/src/multidispatch.c Tue Aug 18 22:57:11 2009 (r40643)
@@ -816,8 +816,8 @@
{
ASSERT_ARGS(Parrot_mmd_get_cached_multi_sig)
if (VTABLE_isa(interp, sub_pmc, CONST_STRING(interp, "Sub"))) {
- Parrot_sub *sub;
- PMC *multi_sig;
+ Parrot_Sub_attributes *sub;
+ PMC *multi_sig;
PMC_get_sub(interp, sub_pmc, sub);
multi_sig = sub->multi_signature;
@@ -856,7 +856,7 @@
{
ASSERT_ARGS(mmd_distance)
PMC *multi_sig, *mro;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
INTVAL args, dist, i, j, n, m;
/* has to be a builtin multi method */
@@ -1261,7 +1261,7 @@
ARGIN(STRING *sub_name), ARGIN(STRING *long_sig), ARGIN(PMC *sub_obj))
{
ASSERT_ARGS(Parrot_mmd_add_multi_from_long_sig)
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
STRING *sub_str = CONST_STRING(interp, "Sub");
STRING *closure_str = CONST_STRING(interp, "Closure");
PMC *type_list = Parrot_str_split(interp, CONST_STRING(interp, ","), long_sig);
Modified: trunk/src/packdump.c
==============================================================================
--- trunk/src/packdump.c Tue Aug 18 22:40:26 2009 (r40642)
+++ trunk/src/packdump.c Tue Aug 18 22:57:11 2009 (r40643)
@@ -269,7 +269,7 @@
Parrot_io_printf(interp, " [ 'PFC_PMC', {\n");
{
PMC * const pmc = self->u.key;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
STRING * const null = Parrot_str_new_constant(interp, "(null)");
STRING *namespace_description;
Modified: trunk/src/packfile.c
==============================================================================
--- trunk/src/packfile.c Tue Aug 18 22:40:26 2009 (r40642)
+++ trunk/src/packfile.c Tue Aug 18 22:57:11 2009 (r40643)
@@ -618,7 +618,7 @@
* These casts are a quick fix to allow parrot build with c++,
* a refactor of the macros will be a cleaner solution. */
DECL_CONST_CAST;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
int todo = 0;
const int pragmas = PObj_get_FLAGS(sub_pmc) & SUB_FLAG_PF_MASK
& ~SUB_FLAG_IS_OUTER;
@@ -707,7 +707,7 @@
do_1_sub_pragma(PARROT_INTERP, ARGMOD(PMC *sub_pmc), pbc_action_enum_t action)
{
ASSERT_ARGS(do_1_sub_pragma)
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PMC_get_sub(interp, sub_pmc, sub);
switch (action) {
@@ -922,7 +922,7 @@
{
/* offset is an index into const_table holding the Sub PMC */
PMC *sub_pmc;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
const opcode_t ci = ft->fixups[i]->offset;
if (ci < 0 || ci >= ct->const_count)
@@ -3119,7 +3119,7 @@
if (old_const->type == PFC_PMC
&& VTABLE_isa(interp, old_const->u.key, _sub)) {
PMC *old_sub_pmc, *new_sub_pmc;
- Parrot_sub *old_sub, *new_sub;
+ Parrot_Sub_attributes *old_sub, *new_sub;
PackFile_Constant * const ret = mem_allocate_typed(PackFile_Constant);
ret->type = old_const->type;
Modified: trunk/src/pbc_merge.c
==============================================================================
--- trunk/src/pbc_merge.c Tue Aug 18 22:40:26 2009 (r40642)
+++ trunk/src/pbc_merge.c Tue Aug 18 22:57:11 2009 (r40643)
@@ -457,7 +457,7 @@
case enum_class_Sub:
case enum_class_Coroutine:
{
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PMC_get_sub(interp, copy->u.key, sub);
sub->start_offs += inputs[i]->code_start;
sub->end_offs += inputs[i]->code_start;
Modified: trunk/src/pic_jit.c
==============================================================================
--- trunk/src/pic_jit.c Tue Aug 18 22:40:26 2009 (r40642)
+++ trunk/src/pic_jit.c Tue Aug 18 22:57:11 2009 (r40643)
@@ -212,7 +212,7 @@
const jit_arch_info * const info = Parrot_jit_init(interp);
const jit_arch_regs * const regs = info->regs + JIT_CODE_SUB_REGS_ONLY;
INTVAL *n_regs_used;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PMC_get_sub(interp, sub_pmc, sub);
n_regs_used = sub->n_regs_used;
@@ -349,7 +349,7 @@
{
ASSERT_ARGS(call_is_safe)
PMC *called, *sig_results;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PMC *sig_args;
opcode_t *pc = *set_args;
@@ -480,7 +480,7 @@
ASSERT_ARGS(parrot_pic_is_safe_to_jit)
#ifdef HAS_JIT
opcode_t *base, *start, *end;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
*flags = 0;
@@ -549,11 +549,11 @@
/*
* create JIT code - just a test
*/
- Parrot_sub *sub;
- opcode_t *base;
- opcode_t *start;
- opcode_t *end;
- Parrot_jit_info_t *jit_info;
+ Parrot_Sub_attributes *sub;
+ opcode_t *base;
+ opcode_t *start;
+ opcode_t *end;
+ Parrot_jit_info_t *jit_info;
PMC_get_sub(interp, sub_pmc, sub);
base = sub->seg->base.data;
Modified: trunk/src/pmc/continuation.pmc
==============================================================================
--- trunk/src/pmc/continuation.pmc Tue Aug 18 22:40:26 2009 (r40642)
+++ trunk/src/pmc/continuation.pmc Tue Aug 18 22:57:11 2009 (r40643)
@@ -299,7 +299,7 @@
METHOD caller() {
Parrot_cont *cc = PMC_cont(SELF);
PMC *caller = cc->to_ctx->current_sub;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
if (!caller)
caller = PMCNULL;
Modified: trunk/src/pmc/coroutine.pmc
==============================================================================
--- trunk/src/pmc/coroutine.pmc Tue Aug 18 22:40:26 2009 (r40642)
+++ trunk/src/pmc/coroutine.pmc Tue Aug 18 22:57:11 2009 (r40643)
@@ -36,13 +36,11 @@
print_sub_name(PARROT_INTERP, PMC *sub_pmc)
{
/* It's actually a Parrot_coro, but this avoids casting warnings. */
- Parrot_sub *co;
+ Parrot_Sub_attributes *co = PARROT_SUB(sub_pmc);
Interp * const tracer = (interp->pdb && interp->pdb->debugger) ?
interp->pdb->debugger :
interp;
- GETATTR_Coroutine_sub(interp, sub_pmc, co);
-
Parrot_io_eprintf(tracer, "# %s coro '%Ss'",
!(PObj_get_FLAGS(sub_pmc) & SUB_FLAG_CORO_FF) ?
"Calling" : "yielding from",
@@ -59,6 +57,8 @@
}
pmclass Coroutine extends Sub need_ext {
+ ATTR PackFile_ByteCode *caller_seg; /* bytecode segment */
+ ATTR opcode_t *address; /* next address to run - toggled each time */
/*
@@ -76,9 +76,10 @@
VTABLE void init() {
Parrot_Coroutine_attributes *attrs =
- mem_allocate_typed(Parrot_Coroutine_attributes);
+ mem_allocate_zeroed_typed(Parrot_Coroutine_attributes);
- attrs->sub = (Parrot_sub *)new_coroutine(INTERP);
+ attrs->seg = INTERP->code;
+ attrs->ctx = NULL;
PMC_data(SELF) = attrs;
PObj_custom_mark_destroy_SETALL(SELF);
@@ -97,14 +98,12 @@
VTABLE PMC *clone() {
PMC * const ret = pmc_new(INTERP, SELF->vtable->base_type);
- Parrot_sub *sub;
- Parrot_sub *coro_sub;
+ Parrot_Coroutine_attributes *sub = PARROT_COROUTINE(SELF);
+ Parrot_Coroutine_attributes *coro_sub = PARROT_COROUTINE(ret);
PObj_custom_mark_destroy_SETALL(ret);
- PMC_get_sub(INTERP, ret, coro_sub);
- PMC_get_sub(INTERP, SELF, sub);
- memcpy(coro_sub, sub, sizeof (Parrot_coro));
+ memcpy(coro_sub, sub, sizeof (Parrot_Coroutine_attributes));
coro_sub->name = Parrot_str_copy(INTERP, coro_sub->name);
@@ -123,8 +122,7 @@
VTABLE opcode_t *invoke(void *next) {
PackFile_ByteCode *wanted_seg;
- Parrot_Coroutine_attributes *attrs = PARROT_COROUTINE(SELF);
- Parrot_coro * const co = (Parrot_coro *)attrs->sub;
+ Parrot_Coroutine_attributes *co = PARROT_COROUTINE(SELF);
opcode_t * dest = co->address;
if (Interp_trace_TEST(INTERP, PARROT_TRACE_SUB_CALL_FLAG))
@@ -244,8 +242,7 @@
*/
VTABLE void mark() {
- Parrot_Coroutine_attributes *attrs = PARROT_COROUTINE(SELF);
- Parrot_coro * const co = (Parrot_coro *)attrs->sub;
+ Parrot_Coroutine_attributes *co = PARROT_COROUTINE(SELF);
/* co->ctx marked in SUPER(), so do not mark here */
if (co) {
Modified: trunk/src/pmc/eval.pmc
==============================================================================
--- trunk/src/pmc/eval.pmc Tue Aug 18 22:40:26 2009 (r40642)
+++ trunk/src/pmc/eval.pmc Tue Aug 18 22:57:11 2009 (r40643)
@@ -22,7 +22,7 @@
#include "pmc_sub.h"
static void
-clear_fixups(PARROT_INTERP, Parrot_sub *sub_data)
+clear_fixups(PARROT_INTERP, Parrot_Sub_attributes *sub_data)
{
INTVAL i;
PackFile_ByteCode *seg = sub_data->seg;
@@ -55,11 +55,11 @@
static PMC*
get_sub(PARROT_INTERP, PMC *self, int idx)
{
- INTVAL i, n;
- Parrot_sub *sub;
- PackFile_ByteCode *seg;
- PackFile_FixupTable *ft;
- PackFile_ConstTable *ct;
+ INTVAL i, n;
+ Parrot_Sub_attributes *sub;
+ PackFile_ByteCode *seg;
+ PackFile_FixupTable *ft;
+ PackFile_ConstTable *ct;
PMC_get_sub(interp, self, sub);
seg = sub->seg;
@@ -92,7 +92,7 @@
static void
mark_subs(PARROT_INTERP, PMC *self)
{
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PackFile_ByteCode *seg;
PackFile_FixupTable *ft;
PackFile_ConstTable *ct;
@@ -128,7 +128,7 @@
pmclass Eval extends Sub need_ext {
VTABLE void init() {
- Parrot_sub *sub_data;
+ Parrot_Sub_attributes *sub_data;
SUPER();
PMC_get_sub(INTERP, SELF, sub_data);
@@ -168,7 +168,7 @@
*/
PackFile_Segment *seg;
PackFile_ByteCode *cur_cs;
- Parrot_sub *sub_data;
+ Parrot_Sub_attributes *sub_data;
PMC_get_sub(INTERP, SELF, sub_data);
@@ -229,7 +229,7 @@
*/
VTABLE STRING *get_string() {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PackFile *pf = PackFile_new(INTERP, 0);
PackFile_ByteCode *seg;
STRING *res;
@@ -336,7 +336,7 @@
STRING *packed = VTABLE_shift_string(INTERP, io);
PackFile *pf;
PackFile_Segment *seg;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
size_t i;
SUPER(info);
@@ -371,7 +371,7 @@
VTABLE INTVAL elements() {
INTVAL i, n;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PackFile_ByteCode *seg;
PackFile_FixupTable *ft;
Modified: trunk/src/pmc/exception.pmc
==============================================================================
--- trunk/src/pmc/exception.pmc Tue Aug 18 22:40:26 2009 (r40642)
+++ trunk/src/pmc/exception.pmc Tue Aug 18 22:57:11 2009 (r40643)
@@ -781,7 +781,7 @@
while (cur_ctx) {
PMC *frame = pmc_new(interp, enum_class_Hash);
PMC *annotations = NULL;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
/* Get sub and put it in the hash. */
PMC *sub_pmc = cur_ctx->current_sub;
Modified: trunk/src/pmc/namespace.pmc
==============================================================================
--- trunk/src/pmc/namespace.pmc Tue Aug 18 22:40:26 2009 (r40642)
+++ trunk/src/pmc/namespace.pmc Tue Aug 18 22:57:11 2009 (r40643)
@@ -50,7 +50,7 @@
PMC * vtable = nsinfo->vtable;
PMC * const classobj = VTABLE_get_class(interp, self);
STRING * vtable_key = NULL;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PMC_get_sub(interp, value, sub);
@@ -276,7 +276,7 @@
/* Extract the first alternate and check if it is a method */
PMC *pmc_sub = VTABLE_get_pmc_keyed_int(interp, value, 0);
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PMC_get_sub(INTERP, pmc_sub, sub);
if (sub->comp_flags & SUB_COMP_FLAG_METHOD) {
Modified: trunk/src/pmc/parrotinterpreter.pmc
==============================================================================
--- trunk/src/pmc/parrotinterpreter.pmc Tue Aug 18 22:40:26 2009 (r40642)
+++ trunk/src/pmc/parrotinterpreter.pmc Tue Aug 18 22:57:11 2009 (r40643)
@@ -540,9 +540,9 @@
}
if (!PMC_IS_NULL(sub_pmc)
&& sub_pmc->vtable->base_type == enum_class_Sub) {
- Parrot_sub *sub;
- PackFile_ByteCode *seg;
- opcode_t *pc = ctx->current_pc;
+ Parrot_Sub_attributes *sub;
+ PackFile_ByteCode *seg;
+ opcode_t *pc = ctx->current_pc;
PMC_get_sub(interp, sub_pmc, sub);
seg = sub->seg;
Modified: trunk/src/pmc/sub.pmc
==============================================================================
--- trunk/src/pmc/sub.pmc Tue Aug 18 22:40:26 2009 (r40642)
+++ trunk/src/pmc/sub.pmc Tue Aug 18 22:57:11 2009 (r40643)
@@ -40,7 +40,33 @@
* effectively a container. Therefore need_ext has to be set
*/
pmclass Sub need_ext {
- ATTR struct Parrot_sub * sub; /* the Parrot sub structure */
+ ATTR PackFile_ByteCode *seg; /* bytecode segment */
+ ATTR size_t start_offs; /* sub entry in ops from seg->base.data */
+ ATTR size_t end_offs;
+
+ ATTR INTVAL HLL_id; /* see src/hll.c XXX or per segment? */
+ ATTR PMC *namespace_name; /* where this Sub is in - this is either
+ * a String or a [Key] and describes
+ * the relative path in the NameSpace
+ */
+ ATTR PMC *namespace_stash; /* the actual hash, HLL::namespace */
+ ATTR STRING *name; /* name of the sub */
+ ATTR STRING *method_name; /* method name of the sub */
+ ATTR STRING *ns_entry_name; /* ns entry name of the sub */
+ ATTR STRING *subid; /* The ID of the sub. */
+ ATTR INTVAL vtable_index; /* index in Parrot_vtable_slot_names */
+ ATTR PMC *multi_signature; /* list of types for MMD */
+ ATTR INTVAL n_regs_used[4]; /* INSP in PBC */
+
+ ATTR PMC *lex_info; /* LexInfo PMC */
+ ATTR PMC *outer_sub; /* :outer for closures */
+ ATTR PMC *eval_pmc; /* eval container / NULL */
+ ATTR Parrot_Context *ctx; /* the context this sub is in */
+ ATTR UINTVAL comp_flags; /* compile time and additional flags */
+ ATTR Parrot_sub_arginfo *arg_info;/* Argument counts and flags. */
+
+ /* - end common */
+ ATTR Parrot_Context *outer_ctx; /* outer context, if a closure */
/*
@@ -68,9 +94,10 @@
*/
VTABLE void init() {
Parrot_Sub_attributes * const attrs =
- mem_allocate_typed(Parrot_Sub_attributes);
+ mem_allocate_zeroed_typed(Parrot_Sub_attributes);
+
+ attrs->seg = INTERP->code;
- attrs->sub = new_sub(INTERP);
PMC_data(SELF) = attrs;
PObj_custom_mark_destroy_SETALL(SELF);
}
@@ -86,8 +113,7 @@
*/
VTABLE void destroy() {
- Parrot_sub *sub;
- GET_ATTR_sub(INTERP, SELF, sub);
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
if (sub) {
if (sub->arg_info)
@@ -100,7 +126,6 @@
mem_sys_free(sub);
}
- mem_sys_free(PMC_data(SELF));
PMC_data(SELF) = NULL;
}
@@ -119,8 +144,7 @@
*/
VTABLE STRING *get_string() {
- Parrot_sub *sub;
- PMC_get_sub(INTERP, SELF, sub);
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
if (sub->name)
return Parrot_str_copy(INTERP, sub->name);
@@ -129,8 +153,7 @@
}
VTABLE void set_string_native(STRING *subname) {
- Parrot_sub *sub;
- PMC_get_sub(INTERP, SELF, sub);
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
sub->name = Parrot_str_copy(INTERP, subname);
}
@@ -163,8 +186,7 @@
*/
VTABLE void *get_pointer() {
- Parrot_sub *sub;
- PMC_get_sub(INTERP, SELF, sub);
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
return sub->seg->base.data + sub->start_offs;
}
@@ -181,10 +203,9 @@
*/
VTABLE INTVAL get_integer_keyed(PMC *key) {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
UNUSED(key)
- PMC_get_sub(INTERP, SELF, sub);
return (INTVAL) (sub->seg->base.data);
}
@@ -219,7 +240,7 @@
*/
VTABLE opcode_t *invoke(void *next) {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
Parrot_Context *caller_ctx;
Parrot_Context *context;
PMC *ccont;
@@ -321,15 +342,15 @@
for (c = context; !c->outer_ctx; c = c->outer_ctx) {
PMC *outer_pmc;
- Parrot_sub *current_sub, *outer_sub;
+ Parrot_Sub_attributes *current_sub, *outer_sub;
- PMC_get_sub(INTERP, c->current_sub, current_sub);
+ current_sub = PARROT_SUB(c->current_sub);
outer_pmc = current_sub->outer_sub;
if (PMC_IS_NULL(outer_pmc))
break;
- PMC_get_sub(INTERP, outer_pmc, outer_sub);
+ outer_sub = PARROT_SUB(outer_pmc);
if (!outer_sub->ctx) {
Parrot_Context * const dummy = Parrot_alloc_context(INTERP,
@@ -388,13 +409,14 @@
VTABLE PMC *clone() {
PMC * const ret = pmc_new(INTERP, SELF->vtable->base_type);
- Parrot_sub *dest_sub;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *dest_sub = PARROT_SUB(SELF);
+ Parrot_Sub_attributes *sub;
+ /* XXX Why? */
/* we have to mark it ourselves */
PObj_custom_mark_destroy_SETALL(ret);
- PMC_get_sub(INTERP, ret, sub);
+ sub = PARROT_SUB(ret);
/* release any previously held contexts */
if (sub->ctx)
@@ -402,8 +424,6 @@
if (sub->outer_ctx)
Parrot_free_context(INTERP, sub->outer_ctx, 1);
- PMC_get_sub(INTERP, SELF, dest_sub);
-
/* first set the sub struct, Parrot_str_copy may cause GC */
*sub = *dest_sub;
@@ -439,10 +459,8 @@
VTABLE void assign_pmc(PMC *other) {
/* only handle the case where the other PMC is the same type */
if (other->vtable->base_type == SELF->vtable->base_type) {
- Parrot_sub *my_sub;
- Parrot_sub *other_sub;
- PMC_get_sub(INTERP, SELF, my_sub);
- PMC_get_sub(INTERP, other, other_sub);
+ Parrot_Sub_attributes *my_sub = PARROT_SUB(SELF);
+ Parrot_Sub_attributes *other_sub = PARROT_SUB(other);
/* Increase reference count of destination before
* freeing the one in self, to avoid problems in
@@ -454,7 +472,7 @@
Parrot_free_context(INTERP, my_sub->ctx, 1);
/* copy the sub struct */
- memmove(my_sub, other_sub, sizeof (Parrot_sub));
+ memmove(my_sub, other_sub, sizeof (Parrot_Sub_attributes));
/* copy the name so it's a different string in memory */
if (my_sub->name)
@@ -477,8 +495,7 @@
*/
VTABLE void mark() {
- Parrot_sub *sub;
- PMC_get_sub(INTERP, SELF, sub);
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
if (!sub)
return;
@@ -520,10 +537,8 @@
*/
MULTI INTVAL is_equal(PMC *value) {
- Parrot_sub *my_sub, *value_sub;
-
- PMC_get_sub(INTERP, SELF, my_sub);
- PMC_get_sub(INTERP, value, value_sub);
+ Parrot_Sub_attributes *my_sub = PARROT_SUB(SELF);
+ Parrot_Sub_attributes *value_sub = PARROT_SUB(value);
return SELF->vtable == value->vtable
&& (my_sub)->start_offs == (value_sub)->start_offs
@@ -545,7 +560,7 @@
*/
VTABLE void visit(visit_info *info) {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PMC_get_sub(INTERP, SELF, sub);
@@ -573,12 +588,10 @@
VTABLE void freeze(visit_info *info) {
IMAGE_IO * const io = info->image_io;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
STRING *hll_name;
int i;
- PMC_get_sub(INTERP, SELF, sub);
-
SUPER(info);
/*
* we currently need to write these items:
@@ -644,7 +657,7 @@
SUPER(info);
if (info->extra_flags == EXTRA_IS_NULL) {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
INTVAL flags;
int i;
@@ -756,11 +769,9 @@
VTABLE PMC *inspect_str(STRING *what)
{
- Parrot_sub *sub;
- PMC *retval;
- INTVAL count_found = -1;
-
- PMC_get_sub(INTERP, SELF, sub);
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
+ PMC *retval;
+ INTVAL count_found = -1;
/* If the argument info hasn't been generated yet, generate it. */
if (!sub->arg_info) {
@@ -882,11 +893,8 @@
*/
METHOD get_namespace() {
- Parrot_sub *sub;
- PMC *_namespace;
-
- PMC_get_sub(INTERP, SELF, sub);
- _namespace = sub->namespace_stash;
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
+ PMC *_namespace = sub->namespace_stash;
RETURN(PMC *_namespace);
}
@@ -896,11 +904,9 @@
* see also imcc/reg_alloc.c */
static const char types[] = "INSP";
char *p;
- Parrot_sub *sub;
- char * const kind = Parrot_str_to_cstring(interp, reg);
- INTVAL regs_used;
-
- PMC_get_sub(INTERP, SELF, sub);
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
+ char * const kind = Parrot_str_to_cstring(interp, reg);
+ INTVAL regs_used;
PARROT_ASSERT(sub->n_regs_used);
@@ -922,37 +928,33 @@
}
METHOD get_lexinfo() {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
PMC *lexinfo;
- PMC_get_sub(INTERP, SELF, sub);
lexinfo = sub->lex_info ? sub->lex_info : PMCNULL;
RETURN(PMC *lexinfo);
}
METHOD get_subid() {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
STRING *subid;
- PMC_get_sub(INTERP, SELF, sub);
subid = sub->subid ? sub->subid : CONST_STRING(interp, "");
RETURN(STRING *subid);
}
METHOD get_outer() {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
PMC *outersub;
- PMC_get_sub(INTERP, SELF, sub);
outersub = sub->outer_sub ? sub->outer_sub : PMCNULL;
RETURN(PMC *outersub);
}
METHOD set_outer(PMC *outer) {
/* Set outer sub. */
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
- PMC_get_sub(INTERP, SELF, sub);
sub->outer_sub = outer;
/* Make sure outer flag of that sub is set. */
@@ -974,10 +976,9 @@
}
METHOD get_multisig() {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
PMC *multisig;
- PMC_get_sub(INTERP, SELF, sub);
multisig = sub->multi_signature ? sub->multi_signature : PMCNULL;
RETURN(PMC *multisig);
}
Modified: trunk/src/runcore/trace.c
==============================================================================
--- trunk/src/runcore/trace.c Tue Aug 18 22:40:26 2009 (r40642)
+++ trunk/src/runcore/trace.c Tue Aug 18 22:57:11 2009 (r40643)
@@ -105,7 +105,7 @@
{
ASSERT_ARGS(trace_pmc_dump)
Interp * const debugger = debugger_or_interp(interp);
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
if (!pmc) {
Parrot_io_eprintf(debugger, "(null)");
Modified: trunk/src/sub.c
==============================================================================
--- trunk/src/sub.c Tue Aug 18 22:40:26 2009 (r40642)
+++ trunk/src/sub.c Tue Aug 18 22:57:11 2009 (r40643)
@@ -127,28 +127,6 @@
/*
-=item C<Parrot_sub * new_sub(PARROT_INTERP)>
-
-Returns a new C<Parrot_sub>.
-
-=cut
-
-*/
-
-PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
-Parrot_sub *
-new_sub(PARROT_INTERP)
-{
- ASSERT_ARGS(new_sub)
- /* Using system memory until I figure out GC issues */
- Parrot_sub * const newsub = mem_allocate_zeroed_typed(Parrot_sub);
- newsub->seg = interp->code;
- return newsub;
-}
-
-/*
-
=item C<Parrot_cont * new_continuation(PARROT_INTERP, const Parrot_cont *to)>
Returns a new C<Parrot_cont> to the context of C<to> with its own copy of the
@@ -213,32 +191,6 @@
/*
-=item C<Parrot_coro * new_coroutine(PARROT_INTERP)>
-
-Returns a new C<Parrot_coro>.
-
-XXX: Need to document semantics in detail.
-
-=cut
-
-*/
-
-PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
-Parrot_coro *
-new_coroutine(PARROT_INTERP)
-{
- ASSERT_ARGS(new_coroutine)
- Parrot_coro * const co = mem_allocate_zeroed_typed(Parrot_coro);
-
- co->seg = interp->code;
- co->ctx = NULL;
-
- return co;
-}
-
-/*
-
=item C<PMC * new_ret_continuation_pmc(PARROT_INTERP, opcode_t *address)>
Returns a new C<RetContinuation> PMC. Uses one from the cache,
@@ -312,7 +264,7 @@
{
ASSERT_ARGS(Parrot_full_sub_name)
if (sub_pmc && VTABLE_defined(interp, sub_pmc)) {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PMC_get_sub(interp, sub_pmc, sub);
@@ -381,7 +333,7 @@
ARGOUT(Parrot_Context_info *info))
{
ASSERT_ARGS(Parrot_Context_get_info)
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
/* set file/line/pc defaults */
info->file = CONST_STRING(interp, "(unknown file)");
@@ -550,8 +502,8 @@
{
ASSERT_ARGS(Parrot_capture_lex)
Parrot_Context * const ctx = CONTEXT(interp);
- Parrot_sub *current_sub;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *current_sub;
+ Parrot_Sub_attributes *sub;
Parrot_Context *old;
PMC_get_sub(interp, ctx->current_sub, current_sub);
@@ -564,7 +516,7 @@
while (VTABLE_get_bool(interp, iter)) {
PMC * const child_pmc = VTABLE_shift_pmc(interp, iter);
- Parrot_sub *child_sub, *child_outer_sub;
+ Parrot_Sub_attributes *child_sub, *child_outer_sub;
PMC_get_sub(interp, child_pmc, child_sub);
@@ -702,8 +654,7 @@
/*
-=item C<Parrot_sub * Parrot_get_sub_pmc_from_subclass(PARROT_INTERP, PMC
-*subclass)>
+=item C<void * Parrot_get_sub_pmc_from_subclass(PARROT_INTERP, PMC *subclass)>
Gets a Parrot_sub structure from something that isn't a Sub PMC, but rather a
subclass.
@@ -714,19 +665,18 @@
PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
-Parrot_sub *
+void *
Parrot_get_sub_pmc_from_subclass(PARROT_INTERP, ARGIN(PMC *subclass)) {
ASSERT_ARGS(Parrot_get_sub_pmc_from_subclass)
PMC *key, *sub_pmc;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
/* Ensure we really do have a subclass of sub. */
if (VTABLE_isa(interp, subclass, CONST_STRING(interp, "Sub"))) {
/* If it's actually a PMC still, probably does the same structure
* underneath. */
if (!PObj_is_object_TEST(subclass)) {
- GETATTR_Sub_sub(interp, subclass, sub);
- return sub;
+ return PARROT_SUB(subclass);
}
/* Get the Sub PMC itself. */
@@ -734,8 +684,7 @@
VTABLE_set_string_native(interp, key, CONST_STRING(interp, "Sub"));
sub_pmc = VTABLE_get_attr_keyed(interp, subclass, key, CONST_STRING(interp, "proxy"));
if (sub_pmc->vtable->base_type == enum_class_Sub) {
- GETATTR_Sub_sub(interp, sub_pmc, sub);
- return sub;
+ return PARROT_SUB(sub_pmc);
}
}
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
Modified: trunk/src/thread.c
==============================================================================
--- trunk/src/thread.c Tue Aug 18 22:40:26 2009 (r40642)
+++ trunk/src/thread.c Tue Aug 18 22:57:11 2009 (r40643)
@@ -201,7 +201,7 @@
* working as one might expect mainly because the segment is
* not correctly copied
*/
- Parrot_sub *ret_val_sub, *arg_sub;
+ Parrot_Sub_attributes *ret_val_sub, *arg_sub;
ret_val = Parrot_clone(interp, arg);
PMC_get_sub(interp, ret_val, ret_val_sub);
@@ -632,7 +632,7 @@
if (PMC_IS_NULL(dval)) {
PMC * const copy = make_local_copy(d, s, val);
- Parrot_sub *val_sub;
+ Parrot_Sub_attributes *val_sub;
if (val->vtable->base_type == enum_class_Sub)
PMC_get_sub(interp, val, val_sub);
Modified: trunk/t/native_pbc/annotations.pbc
==============================================================================
Binary file (source and/or target). No diff available.
Modified: trunk/t/native_pbc/integer_1.pbc
==============================================================================
Binary file (source and/or target). No diff available.
Modified: trunk/t/native_pbc/number_1.pbc
==============================================================================
Binary file (source and/or target). No diff available.
Modified: trunk/t/native_pbc/string_1.pbc
==============================================================================
Binary file (source and/or target). No diff available.
More information about the parrot-commits
mailing list