--- ChangeLog 2009-08-18 15:29:26.000000000 +0200
+++ ChangeLog 2009-08-20 19:56:36.000000000 +0200
@@ -1,4 +1,4 @@
-#1 $Id: ChangeLog 40184 2009-07-21 08:08:33Z cotto $
+#1 $Id: ChangeLog 40625 2009-08-18 16:10:36Z whiteknight $
2009.8.18 Whiteknight
* Released 1.5.0
@@ -3817,9 +3817,9 @@
2002-01-04 16:09 dan
* classes/: genclass.pl, perlarray.pmc, perlint.pmc, perlnum.pmc,
- perlstring.pmc, perlundef.pmc: - genclass.pl attempts to put $Id: ChangeLog 40184 2009-07-21 08:08:33Z cotto $
+ perlstring.pmc, perlundef.pmc: - genclass.pl attempts to put $Id: ChangeLog 40625 2009-08-18 16:10:36Z whiteknight $
into generated files
- but the $Id: ChangeLog 40184 2009-07-21 08:08:33Z cotto $ string gets mangled when it's committed.
+ but the $Id: ChangeLog 40625 2009-08-18 16:10:36Z whiteknight $ string gets mangled when it's committed.
This patch fixes the existing .pmc files and fixes genclass.pl.
- Makes capitalization in .pmc header match actual filenames
--- compilers/imcc/parser_util.c 2009-08-02 14:36:27.000000000 +0200
+++ compilers/imcc/parser_util.c 2009-08-20 19:56:29.000000000 +0200
@@ -8,7 +8,7 @@
*
* parser support functions
*
- * $Id: parser_util.c 40268 2009-07-25 19:53:04Z whiteknight $
+ * $Id: parser_util.c 40643 2009-08-18 22:57:11Z bacek $
*
*/
@@ -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
--- compilers/imcc/pbc.c 2009-08-07 02:50:19.000000000 +0200
+++ compilers/imcc/pbc.c 2009-08-20 19:56:28.000000000 +0200
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2002-2009, Parrot Foundation.
- * $Id: pbc.c 40414 2009-08-05 11:29:16Z bacek $
+ * $Id: pbc.c 40643 2009-08-18 22:57:11Z bacek $
*/
#include "imc.h"
@@ -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;
--- compilers/pirc/src/bcgen.c 2009-08-02 14:36:27.000000000 +0200
+++ compilers/pirc/src/bcgen.c 2009-08-20 19:56:29.000000000 +0200
@@ -1,5 +1,5 @@
/*
- * $Id: bcgen.c 38095 2009-04-13 14:20:12Z coke $
+ * $Id: bcgen.c 40676 2009-08-20 15:11:44Z fperrad $
* Copyright (C) 2008-2009, Parrot Foundation.
*/
#include <stdio.h>
@@ -910,7 +910,7 @@
{
ASSERT_ARGS(find_outer_sub)
PMC *current;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
STRING *cur_name;
size_t len;
global_label *outersub;
@@ -1131,7 +1131,7 @@
{
ASSERT_ARGS(add_sub_pmc)
PMC *sub_pmc; /* the "Sub" pmc, or a variant, such as "Coroutine" */
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
int subconst_index; /* index in const table for the sub pmc */
int subname_index;
int i; /* for loop iterator */
--- config/gen/core_pmcs.pm 2009-07-08 02:19:09.000000000 +0200
+++ config/gen/core_pmcs.pm 2009-08-20 19:56:31.000000000 +0200
@@ -1,5 +1,5 @@
# Copyright (C) 2001-2009, Parrot Foundation.
-# $Id: core_pmcs.pm 38777 2009-05-14 19:43:11Z petdance $
+# $Id: core_pmcs.pm 40651 2009-08-19 08:55:58Z NotFound $
=head1 NAME
@@ -116,26 +116,20 @@
__attribute__nonnull__(1)
__attribute__nonnull__(2);
-extern void Parrot_initialize_core_pmcs(PARROT_INTERP)
+extern void Parrot_initialize_core_pmcs(PARROT_INTERP, int pass)
__attribute__nonnull__(1);
-void Parrot_initialize_core_pmcs(PARROT_INTERP)
+void Parrot_initialize_core_pmcs(PARROT_INTERP, int pass)
{
- int pass;
- for (pass = 0; pass <= 1; ++pass) {
- /* first the PMC with the highest enum
- * this reduces MMD table resize action */
+ /* first the PMC with the highest enum
+ * this reduces MMD table resize action */
END_C
- print {$OUT} " Parrot_${_}_class_init(interp, enum_class_${_}, pass);\n"
+ print {$OUT} " Parrot_${_}_class_init(interp, enum_class_${_}, pass);\n"
foreach ( @pmcs[ -1 .. -1 ] );
- print {$OUT} " Parrot_${_}_class_init(interp, enum_class_${_}, pass);\n"
+ print {$OUT} " Parrot_${_}_class_init(interp, enum_class_${_}, pass);\n"
foreach ( @pmcs[ 0 .. $#pmcs - 1 ] );
print {$OUT} <<'END_C';
- if (!pass) {
- parrot_global_setup_2(interp);
- }
- }
}
static void register_pmc(PARROT_INTERP, NOTNULL(PMC *registry), int pmc_id)
--- config/gen/platform/generic/platform_limits.h 2009-07-22 02:33:43.000000000 +0200
+++ config/gen/platform/generic/platform_limits.h 2009-08-20 19:56:31.000000000 +0200
@@ -1,6 +1,6 @@
/*
- * $Id: platform_limits.h 40176 2009-07-21 00:33:45Z whiteknight $
- * Copyright (C) 2008, Parrot Foundation.
+ * $Id: platform_limits.h 40634 2009-08-18 21:23:45Z mikehh $
+ * Copyright (C) 2009, Parrot Foundation.
*/
#ifndef PARROT_PLATFORM_GENERIC_PLATFORM_LIMITS_GUARD
@@ -14,6 +14,11 @@
/* LLONG_MAX doesn't appear to be provided for some compilers of Win64, so
try to define them here. */
+#include "parrot/has_header.h"
+#if PARROT_HAS_HEADER_LIMITS
+# include <limits.h>
+#endif
+
#ifdef _MSC_VER
# ifndef LLONG_MAX
# define LLONG_MAX _I64_MAX
--- config/init/defaults.pm 2009-07-28 14:52:00.000000000 +0200
+++ config/init/defaults.pm 2009-08-20 19:56:30.000000000 +0200
@@ -1,5 +1,5 @@
# Copyright (C) 2001-2007, Parrot Foundation.
-# $Id: defaults.pm 40296 2009-07-28 03:24:55Z chromatic $
+# $Id: defaults.pm 40635 2009-08-18 21:34:54Z chromatic $
=head1 NAME
--- CREDITS 2009-08-18 15:29:26.000000000 +0200
+++ CREDITS 2009-08-20 19:56:36.000000000 +0200
@@ -1,6 +1,6 @@
=pod
-# $Id: CREDITS 40495 2009-08-11 22:19:23Z mikehh $
+# $Id: CREDITS 40625 2009-08-18 16:10:36Z whiteknight $
Following in the steps of other open source projects that
eventually take over the world, here is the partial list
--- DEPRECATED.pod 2009-08-15 15:06:27.000000000 +0200
+++ DEPRECATED.pod 2009-08-20 19:56:36.000000000 +0200
@@ -1,4 +1,4 @@
-# $Id: DEPRECATED.pod 40557 2009-08-15 10:41:06Z dukeleto $
+# $Id: DEPRECATED.pod 40621 2009-08-18 14:30:59Z coke $
=head1 Purpose
@@ -210,7 +210,8 @@
=item C<PASM1 compiler> [eligible in 2.1]
-See PDB_compile.
+See PDB_compile. Note that the current version of the C<PASM1> compiler
+issues a warning and is not functional. (However, it used to segfault.)
=back
--- docs/project/release_manager_guide.pod 2009-08-18 15:29:26.000000000 +0200
+++ docs/project/release_manager_guide.pod 2009-08-20 19:56:27.000000000 +0200
@@ -1,5 +1,5 @@
# Copyright (C) 2007-2009, Parrot Foundation.
-# $Id: release_manager_guide.pod 40352 2009-07-31 09:59:25Z whiteknight $
+# $Id: release_manager_guide.pod 40660 2009-08-19 16:38:19Z whiteknight $
=head1 Release Instructions
@@ -365,9 +365,9 @@
F<docs/project/support_policy.pod>.
- Sept 15, 2009 - 1.6 - particle
- - Oct 20, 2009 - 1.7 -
- - Nov 17, 2009 - 1.8 -
- - Dec 15, 2009 - 1.9 -
+ - Oct 20, 2009 - 1.7 - dukeleto
+ - Nov 17, 2009 - 1.8 - bernhard
+ - Dec 15, 2009 - 1.9 - gerd
- Jan 19, 2010 - 2.0* -
=cut
--- include/parrot/gc_api.h 2009-08-02 14:39:21.000000000 +0200
+++ include/parrot/gc_api.h 2009-08-20 19:56:28.000000000 +0200
@@ -1,7 +1,7 @@
/* gc_api.h
* Copyright (C) 2001-2009, Parrot Foundation.
* SVN Info
- * $Id: gc_api.h 40381 2009-08-02 12:39:19Z whiteknight $
+ * $Id: gc_api.h 40641 2009-08-18 22:39:00Z whiteknight $
* Overview:
* Handles dead object destruction of the various headers
* History:
@@ -17,6 +17,10 @@
#include "parrot/parrot.h"
+/* Set to 1 if we want to use the fixed-size allocator. Set to 0 if we want
+ to allocate these things using mem_sys_allocate instead */
+#define GC_USE_FIXED_SIZE_ALLOCATOR 1
+
/*
* we need an alignment that is the same as malloc(3) have for
* allocating Buffer items like FLOATVAL (double)
--- include/parrot/global_setup.h 2009-08-02 14:36:27.000000000 +0200
+++ include/parrot/global_setup.h 2009-08-20 19:56:28.000000000 +0200
@@ -1,7 +1,7 @@
/* global_setup.h
* Copyright (C) 2001-2007, Parrot Foundation.
* SVN Info
- * $Id: global_setup.h 37201 2009-03-08 12:07:48Z fperrad $
+ * $Id: global_setup.h 40651 2009-08-19 08:55:58Z NotFound $
* Overview:
* Contains declarations of global data and the functions
* that initialize that data.
@@ -32,9 +32,6 @@
void init_world_once(PARROT_INTERP)
__attribute__nonnull__(1);
-void parrot_global_setup_2(PARROT_INTERP)
- __attribute__nonnull__(1);
-
#define ASSERT_ARGS_Parrot_set_config_hash_internal \
__attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(parrot_config)
@@ -42,8 +39,6 @@
PARROT_ASSERT_ARG(interp)
#define ASSERT_ARGS_init_world_once __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp)
-#define ASSERT_ARGS_parrot_global_setup_2 __attribute__unused__ int _ASSERT_ARGS_CHECK = \
- PARROT_ASSERT_ARG(interp)
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: src/global_setup.c */
--- include/parrot/sub.h 2009-08-02 14:36:27.000000000 +0200
+++ include/parrot/sub.h 2009-08-20 19:56:28.000000000 +0200
@@ -1,7 +1,7 @@
/* sub.h
* Copyright (C) 2001-2008, Parrot Foundation.
* SVN Info
- * $Id: sub.h 40310 2009-07-28 17:40:11Z NotFound $
+ * $Id: sub.h 40643 2009-08-18 22:57:11Z bacek $
* Overview:
* Data Structure and Algorithms:
* Subroutine, coroutine, closure and continuation structures
@@ -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)
--- include/parrot/vtables.h 2009-08-02 14:36:27.000000000 +0200
+++ include/parrot/vtables.h 2009-08-20 19:56:28.000000000 +0200
@@ -1,7 +1,7 @@
/* vtables.h
* Copyright (C) 2001-2003, Parrot Foundation.
* SVN Info
- * $Id: vtables.h 37201 2009-03-08 12:07:48Z fperrad $
+ * $Id: vtables.h 40673 2009-08-20 11:05:41Z NotFound $
* Overview:
* Vtable manipulation code. Not to be confused with vtable.h
* Data Structure and Algorithms:
@@ -32,6 +32,10 @@
FUNC_MODIFIES(*vtable);
PARROT_EXPORT
+void Parrot_initialize_core_vtables(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
+PARROT_EXPORT
PARROT_MALLOC
PARROT_CANNOT_RETURN_NULL
VTABLE * Parrot_new_vtable(SHIM_INTERP);
@@ -54,6 +58,9 @@
#define ASSERT_ARGS_Parrot_destroy_vtable __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp) \
|| PARROT_ASSERT_ARG(vtable)
+#define ASSERT_ARGS_Parrot_initialize_core_vtables \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+ PARROT_ASSERT_ARG(interp)
#define ASSERT_ARGS_Parrot_new_vtable __attribute__unused__ int _ASSERT_ARGS_CHECK = 0
#define ASSERT_ARGS_mark_vtables __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp)
--- lib/Parrot/Pmc2c/Attribute.pm 2009-07-08 02:19:04.000000000 +0200
+++ lib/Parrot/Pmc2c/Attribute.pm 2009-08-20 19:56:28.000000000 +0200
@@ -1,5 +1,5 @@
# Copyright (C) 2008, Parrot Foundation.
-# $Id: Attribute.pm 39697 2009-06-22 04:12:51Z petdance $
+# $Id: Attribute.pm 40643 2009-08-18 22:57:11Z bacek $
package Parrot::Pmc2c::Attribute;
@@ -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);
--- lib/Parrot/Pmc2c/Parser.pm 2009-07-08 02:19:04.000000000 +0200
+++ lib/Parrot/Pmc2c/Parser.pm 2009-08-20 19:56:28.000000000 +0200
@@ -1,5 +1,5 @@
# Copyright (C) 2004-2008, Parrot Foundation.
-# $Id: Parser.pm 38932 2009-05-19 14:40:19Z Infinoid $
+# $Id: Parser.pm 40643 2009-08-18 22:57:11Z bacek $
package Parrot::Pmc2c::Parser;
@@ -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,
}
));
}
--- lib/Parrot/Pmc2c/PMCEmitter.pm 2009-07-29 23:02:09.000000000 +0200
+++ lib/Parrot/Pmc2c/PMCEmitter.pm 2009-08-20 19:56:28.000000000 +0200
@@ -1,5 +1,5 @@
# Copyright (C) 2007-2009, Parrot Foundation.
-# $Id: PMCEmitter.pm 40308 2009-07-28 16:55:09Z NotFound $
+# $Id: PMCEmitter.pm 40663 2009-08-19 18:08:52Z NotFound $
=head1 NAME
@@ -464,7 +464,8 @@
NULL, /* mro */
NULL, /* attribute_defs */
NULL, /* ro_variant_vtable */
- $methlist
+ $methlist,
+ 0 /* attr size */
};
ENDOFCODE
return $cout;
@@ -581,14 +582,6 @@
$cout .= "\";\n";
my $const = ( $self->{flags}{dynpmc} ) ? " " : " const ";
- if ( @$multi_funcs ) {
- $cout .= $multi_strings . <<"EOC";
-
- $const multi_func_list _temp_multi_func_list[] = {
- $multi_list
- };
-EOC
- }
my $flags = $self->vtable_flags;
$cout .= <<"EOC";
@@ -640,6 +633,7 @@
vt_${k} = Parrot_${classname}_${k}_get_vtable(interp);
vt_${k}->base_type = $enum_name;
vt_${k}->flags = $k_flags;
+
vt_${k}->attribute_defs = attr_defs;
vt_${k}->base_type = entry;
@@ -728,7 +722,11 @@
if ( @$multi_funcs ) {
- $cout .= <<"EOC";
+ $cout .= $multi_strings . <<"EOC";
+
+ $const multi_func_list _temp_multi_func_list[] = {
+ $multi_list
+ };
#define N_MULTI_LIST (sizeof(_temp_multi_func_list)/sizeof(_temp_multi_func_list[0]))
Parrot_mmd_add_multi_list_from_c_args(interp,
_temp_multi_func_list, N_MULTI_LIST);
@@ -761,6 +759,22 @@
my $classname = $self->name;
my $export = $self->is_dynamic ? 'PARROT_DYNEXT_EXPORT ' : 'PARROT_EXPORT';
+ # Sets the attr_size field:
+ # If the auto_attrs flag is set, use the current data,
+ # else check if this PMC has init or init_pmc vtable functions,
+ # setting it to 0 in that case, and keeping the value from the
+ # parent otherwise.
+ my $set_attr_size = '';
+ if ( @{$self->attributes} && $self->{flags}{auto_attrs} ) {
+ $set_attr_size .= "sizeof(Parrot_${classname}_attributes)";
+ }
+ else {
+ $set_attr_size .= "0" if exists($self->{has_method}{init}) ||
+ exists($self->{has_method}{init_pmc});
+ }
+ $set_attr_size = " vt->attr_size = " . $set_attr_size . ";\n"
+ if $set_attr_size ne '';
+
my $vtable_updates = '';
for my $name ( @{ $self->vtable->names } ) {
if (exists $self->{has_method}{$name}) {
@@ -768,6 +782,8 @@
}
}
+ $vtable_updates .= $set_attr_size;
+
$cout .= <<"EOC";
$export
@@ -793,6 +809,8 @@
}
}
+ $vtable_updates .= $set_attr_size;
+
$cout .= <<"EOC";
$export
--- lib/Parrot/Test.pm 2009-08-16 13:54:58.000000000 +0200
+++ lib/Parrot/Test.pm 2009-08-20 19:56:28.000000000 +0200
@@ -1,5 +1,5 @@
# Copyright (C) 2004-2009, Parrot Foundation.
-# $Id: Test.pm 40582 2009-08-16 06:30:09Z dukeleto $
+# $Id: Test.pm 40658 2009-08-19 16:03:57Z dukeleto $
=head1 NAME
@@ -100,6 +100,11 @@
the output with the unexpected result is false I<and> if Parrot exits with a
non-zero exit code.
+=item C<pasm_exit_code_is($code, $exit_code, $description)>
+
+Runs the PASM code and passes the test if the exit code equals $exit_code,
+fails the test otherwise.
+
=item C<pir_output_is($code, $expected, $description)>
Runs the PIR code and passes the test if a string comparison of output with the
@@ -130,6 +135,11 @@
the unexpected result is false I<and> if Parrot exits with a non-zero exit
code.
+=item C<pir_exit_code_is($code, $exit_code, $description)>
+
+Runs the PIR code and passes the test if the exit code equals $exit_code,
+fails the test otherwise.
+
=item C<pbc_output_is($code, $expected, $description)>
Runs the Parrot Bytecode and passes the test if a string comparison of output
@@ -161,6 +171,11 @@
with the unexpected result is false I<and> if Parrot exits with a non-zero exit
code.
+=item C<pbc_exit_code_is($code, $exit_code, $description)>
+
+Runs the Parrot Bytecode and passes the test if the exit code equals $exit_code,
+fails the test otherwise.
+
=item C<pir_2_pasm_is($code, $expected, $description)>
Compile the Parrot Intermediate Representation and generate Parrot Assembler Code.
@@ -579,13 +594,13 @@
# Name of the file with test code.
# This depends on which kind of code we are testing.
my $code_f;
- if ( $func =~ m/^pir_.*?output/ ) {
+ if ( $func =~ m/^pir_(exit_code|.*?output)/ ) {
$code_f = per_test( '.pir', $test_no );
}
- elsif ( $func =~ m/^pasm_.*?output_/ ) {
+ elsif ( $func =~ m/^pasm_(exit_code|.*?output_)/ ) {
$code_f = per_test( '.pasm', $test_no );
}
- elsif ( $func =~ m/^pbc_.*?output_/ ) {
+ elsif ( $func =~ m/^pbc_(exit_code|.*?output_)/ ) {
$code_f = per_test( '.pbc', $test_no );
}
else {
@@ -684,6 +699,7 @@
my %parrot_test_map = map {
$_ . '_output_is' => 'is_eq',
$_ . '_error_output_is' => 'is_eq',
+ $_ . '_exit_code_is' => 'is_eq',
$_ . '_output_isnt' => 'isnt_eq',
$_ . '_error_output_isnt' => 'isnt_eq',
$_ . '_output_like' => 'like',
@@ -723,6 +739,18 @@
\$extra{todo}
if defined $extra{todo};
+ if ( $func =~ /_exit_code_is$/ ) {
+ $expected = int($expected);
+ if ($exit_code == $expected) {
+ my $pass = $builder->$meth( $exit_code, $expected, $desc );
+ return $pass;
+ }
+ else {
+ $builder->ok(0);
+ return 0;
+ }
+ }
+
if ( $func =~ /_error_/ ) {
return _handle_error_output( $builder, $real_output, $expected, $desc )
unless $exit_code;
--- lib/Parrot/Vtable.pm 2009-07-31 11:53:02.000000000 +0200
+++ lib/Parrot/Vtable.pm 2009-08-20 19:56:28.000000000 +0200
@@ -1,5 +1,5 @@
# Copyright (C) 2001-2008, Parrot Foundation.
-# $Id: Vtable.pm 40350 2009-07-31 00:12:14Z NotFound $
+# $Id: Vtable.pm 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -186,6 +186,10 @@
$struct .= " $entry->[1]_method_t $entry->[1];\n";
}
+ $struct .= <<'EOF';
+ UINTVAL attr_size; /* Size of the attributes struct */
+EOF
+
$struct .= "} _vtable;\n";
return $struct;
--- MANIFEST 2009-08-18 17:03:56.000000000 +0200
+++ MANIFEST 2009-08-20 20:26:05.000000000 +0200
@@ -1,5 +1,5 @@
# ex: set ro:
-# $Id: MANIFEST 40582 2009-08-16 06:30:09Z dukeleto $
+# $Id: MANIFEST 40658 2009-08-19 16:03:57Z dukeleto $
#
# generated by tools/dev/mk_manifest_and_skip.pl Sat Aug 15 07:51:12 2009 UT
#
@@ -1790,6 +1790,7 @@
t/op/copy.t [test]
t/op/debuginfo.t [test]
t/op/exceptions.t [test]
+t/op/exit.t [test]
t/op/gc.t [test]
t/op/globals.t [test]
t/op/hacks.t [test]
--- MANIFEST.generated 2009-08-18 15:29:26.000000000 +0200
+++ MANIFEST.generated 2009-08-20 19:56:36.000000000 +0200
@@ -1,4 +1,4 @@
-# $Id: MANIFEST.generated 40599 2009-08-16 21:11:18Z dukeleto $
+# $Id: MANIFEST.generated 40625 2009-08-18 16:10:36Z whiteknight $
# See tools/dev/install_files.pl for documentation on the
# format of this file.
# Please re-sort this file after *EVERY* modification
--- META.yml 2009-08-18 15:29:26.000000000 +0200
+++ META.yml 2009-08-20 19:56:36.000000000 +0200
@@ -1,4 +1,4 @@
-# $Id: META.yml 40184 2009-07-21 08:08:33Z cotto $
+# $Id: META.yml 40625 2009-08-18 16:10:36Z whiteknight $
#
# This file describes the CPAN distribution for Parrot.
# See http://module-build.sourceforge.net/META-spec-current.html for details.
--- NEWS 2009-08-18 15:50:34.000000000 +0200
+++ NEWS 2009-08-20 19:56:36.000000000 +0200
@@ -1,4 +1,4 @@
-# $Id: NEWS 40617 2009-08-18 12:57:33Z NotFound $
+# $Id: NEWS 40621 2009-08-18 14:30:59Z coke $
New in 1.5.0
- Core
@@ -12,7 +12,6 @@
+ Improvements to the Parrot Debugger
+ Added experimental fixed-size structure allocator to the GC
+ Added experimental lazy arena allocation to the GC
- + Removed the defunct PASM1 compiler object
+ Refactored hashes, keys, and iterators
+ Added "corevm" make target to build Parrot without all the supporting libraries
+ Removed Random PMC type and added in a "rand" dynop
@@ -28,6 +27,7 @@
+ Improved documentation about Parrot Debugger
+ Update PGE Documentation
- Miscellaneous
+ + Deprecate 'PASM1' compiler object, update to warn instead of segfault
+ Added tests
+ Fixes to code, documentation, and standards
--- PLATFORMS 2009-07-22 02:33:46.000000000 +0200
+++ PLATFORMS 2009-08-20 19:56:36.000000000 +0200
@@ -1,4 +1,4 @@
-# $Id: PLATFORMS 40177 2009-07-21 00:38:34Z whiteknight $
+# $Id: PLATFORMS 40664 2009-08-19 20:29:16Z fperrad $
Parrot was reported to compile and run tests successfully on the following
platforms.
@@ -20,12 +20,12 @@
linux-x86-gcc4.2.3 Y Y ? Y Y Y Y ? 20080715
linux-x86-gcc4.2.4 Y Y ? Y Y Y Y ? 20081023
linux-x86-gcc4.3.2 Y Y ? Y Y Y Y ? 20081030
-linux-x86-llvm-gcc-4.2 Y Y ? ? ? Y Y ? 20090514
+linux-x86-llvm-gcc-4.2 Y Y ? ? ? Y Y ? 20090819
sol10-sparc-cc_5.9 B4 Y - - Y Y Y Y ? 20090720
sol10-sparc-cc_5.9 B8 Y - - Y Y Y Y ? 20090720
sol10-sparc-gcc_4.0.2 B4 Y - - Y Y Y Y/1 ? 20080510
sol10-sparc-gcc_4.0.2 B8 Y - - Y Y Y Y/2 ? 20080518
-win32-x86-mingw_gcc3.4.5 Y Y - - - Y Y Y 20090421
+win32-x86-mingw_gcc3.4.5 Y Y - - - Y Y/1 Y 20090818
win32-x86-msvc_9.0 - Y - Y - Y Y ? 20090317
--- README 2009-08-18 15:29:26.000000000 +0200
+++ README 2009-08-20 19:56:36.000000000 +0200
@@ -3,7 +3,7 @@
Parrot is Copyright (C) 2001-2009, Parrot Foundation.
-$Id: README 40184 2009-07-21 08:08:33Z cotto $
+$Id: README 40670 2009-08-20 08:14:34Z moritz $
LICENSE INFORMATION
-------------------
@@ -85,6 +85,13 @@
But please note that dynamic libs will not be found for non-standard
locations unless you set LD_LIBRARY_PATH or similar.
+If you want to build high level languages on top of Parrot, you should
+also run
+
+ make install-dev
+
+to install development files which compilers need in their build process.
+
Look at docs/parrot.pod and docs/intro.pod for where to go from here. If you
have any problems, see the section "How To Submit A Bug Report" in
docs/submissions.pod. These documents are in POD format. You can view these
--- runtime/parrot/library/PGE/Text.pir 2009-07-08 02:19:00.000000000 +0200
+++ runtime/parrot/library/PGE/Text.pir 2009-08-20 19:56:24.000000000 +0200
@@ -1,5 +1,5 @@
# Copyright (C) 2005-2009, Parrot Foundation.
-# $Id: Text.pir 38369 2009-04-26 12:57:09Z fperrad $
+# $Id: Text.pir 40667 2009-08-19 23:36:58Z coke $
=head1 TITLE
@@ -50,7 +50,6 @@
.local int balanced # in balanced match
.local pmc stack # lookket backtracking
- stack = new 'ResizableStringArray'
$P0 = get_hll_global ['PGE'], 'Match'
(mob, pos, target) = $P0.'new'(tgt)
from = pos
@@ -88,6 +87,7 @@
if $I0 < 0 goto end # no leading delim fails
lookket = ''
balanced = 1
+ stack = new 'ResizableStringArray'
next:
$S0 = substr target, pos, 1 # check current pos
if $S0 == '' goto fail # end of string -> fail
--- src/dynpmc/dynlexpad.pmc 2009-08-02 14:06:53.000000000 +0200
+++ src/dynpmc/dynlexpad.pmc 2009-08-20 19:56:27.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2005-2008, Parrot Foundation.
-$Id: dynlexpad.pmc 40367 2009-08-01 23:05:54Z NotFound $
+$Id: dynlexpad.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -19,7 +19,7 @@
*/
-pmclass DynLexPad dynpmc provides lexpad need_ext {
+pmclass DynLexPad dynpmc provides lexpad need_ext auto_attrs {
ATTR Hash *hash;
ATTR PMC *init; /* the PMC used to initialize this DynLexPad */
@@ -42,8 +42,7 @@
Hash *hash;
Parrot_DynLexPad_attributes *attrs =
- mem_allocate_zeroed_typed(Parrot_DynLexPad_attributes);
- PMC_data(SELF) = attrs;
+ (Parrot_DynLexPad_attributes *) PMC_data(SELF);
if (VTABLE_elements(interp, lexinfo)) {
attrs->init = pmc_new_init(interp, enum_class_LexPad, lexinfo);
@@ -188,8 +187,6 @@
parrot_hash_destroy(interp, PARROT_DYNLEXPAD(SELF)->hash);
PARROT_DYNLEXPAD(SELF)->hash = NULL;
}
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
}
/*
--- src/dynpmc/foo2.pmc 2009-07-29 23:02:08.000000000 +0200
+++ src/dynpmc/foo2.pmc 2009-08-20 19:56:27.000000000 +0200
@@ -1,5 +1,5 @@
/*
- * $Id: foo2.pmc 40313 2009-07-28 20:39:11Z cotto $
+ * $Id: foo2.pmc 40628 2009-08-18 17:24:24Z NotFound $
* Copyright (C) 2009, Parrot Foundation.
*/
@@ -8,7 +8,7 @@
* proper inheritance - for testing only
*/
-pmclass Foo2 dynpmc group foo_group provides scalar extends Foo {
+pmclass Foo2 dynpmc group foo_group provides scalar extends Foo auto_attrs {
VTABLE INTVAL get_integer() {
INTVAL i = SUPER();
--- src/dynpmc/foo.pmc 2009-07-29 23:02:08.000000000 +0200
+++ src/dynpmc/foo.pmc 2009-08-20 19:56:27.000000000 +0200
@@ -1,5 +1,5 @@
/*
- * $Id: foo.pmc 40313 2009-07-28 20:39:11Z cotto $
+ * $Id: foo.pmc 40628 2009-08-18 17:24:24Z NotFound $
* Copyright (C) 2003-2008, Parrot Foundation.
*/
@@ -8,7 +8,7 @@
* proper inheritance - for testing only
*/
-pmclass Foo dynpmc group foo_group provides scalar extends Integer {
+pmclass Foo dynpmc group foo_group provides scalar extends Integer auto_attrs {
VTABLE INTVAL get_integer() {
return 42;
--- src/dynpmc/rotest.pmc 2009-07-08 02:19:03.000000000 +0200
+++ src/dynpmc/rotest.pmc 2009-08-20 19:56:27.000000000 +0200
@@ -1,5 +1,5 @@
/*
- * $Id: rotest.pmc 38336 2009-04-25 04:53:29Z bacek $
+ * $Id: rotest.pmc 40628 2009-08-18 17:24:24Z NotFound $
* Copyright (C) 2006-2008, Parrot Foundation.
*/
@@ -8,7 +8,7 @@
* generation. For testing only.
*/
-pmclass ROTest dynpmc provides scalar extends Integer {
+pmclass ROTest dynpmc provides scalar extends Integer auto_attrs {
VTABLE void set_integer_native(INTVAL value) :read {
}
VTABLE INTVAL get_integer() :write {
--- src/dynpmc/subproxy.pmc 2009-07-08 02:19:03.000000000 +0200
+++ src/dynpmc/subproxy.pmc 2009-08-20 19:56:27.000000000 +0200
@@ -1,5 +1,5 @@
/*
- * $Id: subproxy.pmc 38336 2009-04-25 04:53:29Z bacek $
+ * $Id: subproxy.pmc 40659 2009-08-19 16:16:54Z NotFound $
* Copyright (C) 2003-2008, Parrot Foundation.
*/
@@ -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");
--- src/embed.c 2009-08-02 14:36:27.000000000 +0200
+++ src/embed.c 2009-08-20 19:56:27.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: embed.c 40348 2009-07-30 20:33:19Z NotFound $
+$Id: embed.c 40643 2009-08-18 22:57:11Z bacek $
=head1 NAME
@@ -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) {
--- src/extend.c 2009-08-02 14:36:26.000000000 +0200
+++ src/extend.c 2009-08-20 19:56:27.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2007, Parrot Foundation.
-$Id: extend.c 38756 2009-05-13 21:50:19Z petdance $
+$Id: extend.c 40643 2009-08-18 22:57:11Z bacek $
=head1 NAME
@@ -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);
--- src/gc/alloc_register.c 2009-08-02 14:36:27.000000000 +0200
+++ src/gc/alloc_register.c 2009-08-20 19:56:25.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: alloc_register.c 40299 2009-07-28 07:49:48Z chromatic $
+$Id: alloc_register.c 40643 2009-08-18 22:57:11Z bacek $
=head1 NAME
@@ -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);
}
--- src/gc/api.c 2009-08-17 23:43:56.000000000 +0200
+++ src/gc/api.c 2009-08-20 19:56:25.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: api.c 40596 2009-08-16 17:34:39Z dukeleto $
+$Id: api.c 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -374,6 +374,16 @@
if (PObj_active_destroy_TEST(pmc))
VTABLE_destroy(interp, pmc);
+ if (PMC_data(pmc) && pmc->vtable->attr_size) {
+#if 0
+ mem_sys_free(PMC_data(pmc));
+ PMC_data(pmc) = NULL;
+#else
+ Parrot_gc_free_pmc_attributes(interp, pmc, pmc->vtable->attr_size);
+#endif
+ }
+ PARROT_ASSERT(NULL == PMC_data(pmc));
+
if (PObj_is_PMC_EXT_TEST(pmc))
Parrot_gc_free_pmc_ext(interp, pmc);
--- src/gc/gc_ms.c 2009-08-15 15:06:27.000000000 +0200
+++ src/gc/gc_ms.c 2009-08-20 19:56:25.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: gc_ms.c 40559 2009-08-15 10:51:21Z mikehh $
+$Id: gc_ms.c 40638 2009-08-18 22:20:56Z chromatic $
=head1 NAME
@@ -424,18 +424,21 @@
(*pool->more_objects)(interp, pool);
free_list = (PObj *)pool->free_list;
}
+
if (!free_list) {
Small_Object_Arena * const arena = pool->last_Arena;
- ptr = (PObj *)pool->newfree;
+ ptr = (PObj *)pool->newfree;
pool->newfree = (void *)((char *)pool->newfree + pool->object_size);
arena->used++;
+
if (pool->newfree >= pool->newlast)
pool->newfree = NULL;
- PARROT_ASSERT(ptr < pool->newlast);
+
+ PARROT_ASSERT(ptr < (PObj *)pool->newlast);
}
else {
- ptr = free_list;
- pool->free_list = ((GC_MS_PObj_Wrapper*)ptr)->next_ptr;
+ ptr = free_list;
+ pool->free_list = ((GC_MS_PObj_Wrapper *)ptr)->next_ptr;
}
#else
/* if we don't have any objects */
@@ -455,6 +458,7 @@
return ptr;
}
+
/*
=item C<static void gc_ms_alloc_objects(PARROT_INTERP, Small_Object_Pool *pool)>
@@ -581,20 +585,23 @@
#if GC_USE_LAZY_ALLOCATOR
if (!free_list && !pool->newfree) {
(*pool->more_objects)(interp, pool);
- free_list = (PObj *)pool->free_list;
+ free_list = (PMC_EXT *)pool->free_list;
}
+
if (!free_list) {
Small_Object_Arena * const arena = pool->last_Arena;
- ptr = (PMC_EXT *)pool->newfree;
+
+ ptr = (PMC_EXT *)pool->newfree;
pool->newfree = (void *)((char *)pool->newfree + pool->object_size);
+
if (pool->newfree >= pool->newlast)
pool->newfree = NULL;
arena->used++;
- PARROT_ASSERT(ptr < pool->newlast);
+ PARROT_ASSERT(ptr < (PMC_EXT *)pool->newlast);
}
else {
- ptr = free_list;
- pool->free_list = ptr->_next_for_GC;
+ ptr = free_list;
+ pool->free_list = ptr->_next_for_GC;
ptr->_next_for_GC = NULL;
}
#else
@@ -603,6 +610,7 @@
(*pool->more_objects)(interp, pool);
free_list = (PMC_EXT *)pool->free_list;
}
+
ptr = free_list;
pool->free_list = ptr->_next_for_GC;
ptr->_next_for_GC = NULL;
@@ -613,6 +621,7 @@
return ptr;
}
+
/*
=back
--- src/global.c 2009-08-02 14:36:27.000000000 +0200
+++ src/global.c 2009-08-20 19:56:27.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2004-2009, Parrot Foundation.
-$Id: global.c 40226 2009-07-23 06:51:50Z petdance $
+$Id: global.c 40643 2009-08-18 22:57:11Z bacek $
=head1 NAME
@@ -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);
--- src/global_setup.c 2009-08-02 14:36:27.000000000 +0200
+++ src/global_setup.c 2009-08-20 19:56:27.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2008, Parrot Foundation.
-$Id: global_setup.c 37848 2009-04-01 18:29:18Z Infinoid $
+$Id: global_setup.c 40673 2009-08-20 11:05:41Z NotFound $
=head1 NAME
@@ -27,7 +27,7 @@
/* These functions are defined in the auto-generated file core_pmcs.c */
/* XXX Get it into some public place */
-extern void Parrot_initialize_core_pmcs(PARROT_INTERP);
+extern void Parrot_initialize_core_pmcs(PARROT_INTERP, int pass);
void Parrot_register_core_pmcs(PARROT_INTERP, PMC* registry);
static const unsigned char* parrot_config_stored = NULL;
@@ -38,9 +38,14 @@
/* HEADERIZER BEGIN: static */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+static void parrot_global_setup_2(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
static void parrot_set_config_hash_interpreter(PARROT_INTERP)
__attribute__nonnull__(1);
+#define ASSERT_ARGS_parrot_global_setup_2 __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+ PARROT_ASSERT_ARG(interp)
#define ASSERT_ARGS_parrot_set_config_hash_interpreter \
__attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp)
@@ -159,10 +164,9 @@
Parrot_platform_init_code();
#endif
- parrot_alloc_vtables(interp);
-
/* Call base vtable class constructor methods */
- Parrot_initialize_core_pmcs(interp);
+ parrot_global_setup_2(interp);
+ Parrot_initialize_core_pmcs(interp, 1);
iglobals = interp->iglobals;
VTABLE_set_pmc_keyed_int(interp, iglobals,
@@ -190,7 +194,7 @@
/*
-=item C<void parrot_global_setup_2(PARROT_INTERP)>
+=item C<static void parrot_global_setup_2(PARROT_INTERP)>
called from inmidst of PMC bootstrapping between pass 0 and 1
@@ -198,7 +202,7 @@
*/
-void
+static void
parrot_global_setup_2(PARROT_INTERP)
{
ASSERT_ARGS(parrot_global_setup_2)
--- src/interp/inter_create.c 2009-08-02 19:22:04.000000000 +0200
+++ src/interp/inter_create.c 2009-08-20 19:56:25.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: inter_create.c 40385 2009-08-02 14:27:22Z NotFound $
+$Id: inter_create.c 40673 2009-08-20 11:05:41Z NotFound $
=head1 NAME
@@ -178,6 +178,8 @@
*/
Parrot_str_init(interp);
+ Parrot_initialize_core_vtables(interp);
+
/* Set up the MMD struct */
interp->binop_mmd_funcs = NULL;
--- src/jit.c 2009-07-08 02:19:03.000000000 +0200
+++ src/jit.c 2009-08-20 19:56:27.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: jit.c 38999 2009-05-20 22:56:06Z chromatic $
+$Id: jit.c 40643 2009-08-18 22:57:11Z bacek $
=head1 NAME
@@ -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;
--- src/multidispatch.c 2009-08-02 14:36:27.000000000 +0200
+++ src/multidispatch.c 2009-08-20 19:56:27.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2003-2009, Parrot Foundation.
-$Id: multidispatch.c 39986 2009-07-11 02:16:56Z petdance $
+$Id: multidispatch.c 40643 2009-08-18 22:57:11Z bacek $
=head1 NAME
@@ -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);
--- src/packdump.c 2009-08-07 02:50:19.000000000 +0200
+++ src/packdump.c 2009-08-20 19:56:27.000000000 +0200
@@ -2,7 +2,7 @@
Copyright (C) 2001-2009, Parrot Foundation.
This program is free software. It is subject to the same license as
Parrot itself.
-$Id: packdump.c 40414 2009-08-05 11:29:16Z bacek $
+$Id: packdump.c 40643 2009-08-18 22:57:11Z bacek $
=head1 NAME
@@ -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;
--- src/packfile.c 2009-08-07 02:50:19.000000000 +0200
+++ src/packfile.c 2009-08-20 19:56:27.000000000 +0200
@@ -2,7 +2,7 @@
Copyright (C) 2001-2009, Parrot Foundation.
This program is free software. It is subject to the same license as
Parrot itself.
-$Id: packfile.c 40414 2009-08-05 11:29:16Z bacek $
+$Id: packfile.c 40650 2009-08-19 07:45:38Z NotFound $
=head1 NAME
@@ -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)
@@ -1005,8 +1005,9 @@
/* Ensure the bytecode version is one we can read. Currently, we only
* support bytecode versions matching the current one.
*
- * tools/dev/pbc_header.pl --upd t/native_pbc/ *.pbc
- * stamps version and fingerprint in the native tests. */
+ * tools/dev/pbc_header.pl --upd t/native_pbc/(ASTERISK).pbc
+ * stamps version and fingerprint in the native tests.
+ * NOTE: (ASTERISK) is *, we don't want to fool the C preprocessor. */
if (header->bc_major != PARROT_PBC_MAJOR
|| header->bc_minor != PARROT_PBC_MINOR) {
Parrot_io_eprintf(NULL, "PackFile_unpack: This Parrot cannot read "
@@ -3119,7 +3120,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;
--- src/pbc_merge.c 2009-08-02 14:36:27.000000000 +0200
+++ src/pbc_merge.c 2009-08-20 19:56:27.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2005-2009, Parrot Foundation.
-$Id: pbc_merge.c 39775 2009-06-25 19:55:05Z NotFound $
+$Id: pbc_merge.c 40643 2009-08-18 22:57:11Z bacek $
=head1 NAME
@@ -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;
--- src/pic_jit.c 2009-08-02 14:36:27.000000000 +0200
+++ src/pic_jit.c 2009-08-20 19:56:27.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2006-2009, Parrot Foundation.
-$Id: pic_jit.c 37854 2009-04-01 20:00:45Z coke $
+$Id: pic_jit.c 40643 2009-08-18 22:57:11Z bacek $
=head1 NAME
@@ -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;
--- src/pmc/arrayiterator.pmc 2009-08-02 14:06:53.000000000 +0200
+++ src/pmc/arrayiterator.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: arrayiterator.pmc 40366 2009-08-01 22:49:23Z NotFound $
+$Id: arrayiterator.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -51,7 +51,7 @@
*/
-pmclass ArrayIterator extends Iterator no_ro {
+pmclass ArrayIterator extends Iterator no_ro auto_attrs {
ATTR PMC *array; /* the array which this Iterator iterates */
ATTR INTVAL pos; /* Current position of iterator for forward iterator */
/* Previous position of iterator for reverse iterator */
@@ -86,12 +86,11 @@
VTABLE void init_pmc(PMC *array) {
Parrot_ArrayIterator_attributes * const attrs =
- mem_allocate_zeroed_typed(Parrot_ArrayIterator_attributes);
+ (Parrot_ArrayIterator_attributes *) PMC_data(SELF);
attrs->array = array;
- PMC_data(SELF) = attrs;
- PObj_custom_mark_destroy_SETALL(SELF);
+ PObj_custom_mark_SET(SELF);
/* by default, iterate from start */
SELF.set_integer_native(ITERATE_FROM_START);
@@ -99,21 +98,6 @@
/*
-=item C<void destroy()>
-
-destroys this PMC
-
-=cut
-
-*/
-
- VTABLE void destroy() {
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
- }
-
-/*
-
=item C<void mark()>
Marks the current idx/key and the aggregate as live.
--- src/pmc/boolean.pmc 2009-07-08 02:19:02.000000000 +0200
+++ src/pmc/boolean.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2007, Parrot Foundation.
-$Id: boolean.pmc 38794 2009-05-15 16:12:33Z coke $
+$Id: boolean.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -21,7 +21,7 @@
*/
-pmclass Boolean extends Integer provides boolean provides scalar {
+pmclass Boolean extends Integer provides boolean provides scalar auto_attrs {
/*
--- src/pmc/callsignature.pmc 2009-07-08 02:19:02.000000000 +0200
+++ src/pmc/callsignature.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2008-2009, Parrot Foundation.
-$Id: callsignature.pmc 38963 2009-05-20 04:48:44Z petdance $
+$Id: callsignature.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -27,7 +27,7 @@
if (!PARROT_CAPTURE(obj)->hash) \
PARROT_CAPTURE(obj)->hash = pmc_new((i), enum_class_Hash);
-pmclass CallSignature extends Capture need_ext provides array provides hash {
+pmclass CallSignature extends Capture need_ext auto_attrs provides array provides hash {
ATTR PMC *returns; /* Result PMCs, if they were passed with the call */
ATTR PMC *type_tuple; /* Cached argument types for multiple dispatch */
ATTR STRING *short_sig; /* Simple string signature args & returns */
@@ -44,16 +44,10 @@
VTABLE void init() {
Parrot_CallSignature_attributes * const sig_struct =
- mem_allocate_typed(Parrot_CallSignature_attributes);
- PMC_data(SELF) = sig_struct;
- sig_struct->short_sig = NULL;
+ (Parrot_CallSignature_attributes *) PMC_data(SELF);
+ SUPER();
sig_struct->type_tuple = PMCNULL;
sig_struct->returns = PMCNULL;
- sig_struct->array = NULL;
- sig_struct->hash = NULL;
- sig_struct->data_size = CAPTURE_DATA_SIZE;
- PObj_active_destroy_SET(SELF);
- PObj_custom_mark_SET(SELF);
}
/*
@@ -182,15 +176,9 @@
*/
VTABLE void mark() {
- PMC ** const data = PMC_data_typed(SELF, PMC **);
Parrot_CallSignature_attributes * const attrs = PARROT_CALLSIGNATURE(SELF);
if (attrs) {
-
- if (attrs->array)
- Parrot_gc_mark_PObj_alive(interp, (PObj*)attrs->array);
- if (attrs->hash)
- Parrot_gc_mark_PObj_alive(interp, (PObj*)attrs->hash);
if (attrs->returns)
Parrot_gc_mark_PObj_alive(interp, (PObj*)attrs->returns);
if (attrs->type_tuple)
@@ -198,13 +186,7 @@
if (attrs->short_sig)
Parrot_gc_mark_PObj_alive(interp, (PObj*)attrs->short_sig);
}
-
- if (data) {
- INTVAL i;
- for (i = attrs->data_size - 1; i >= 0; --i)
- if (data[i])
- Parrot_gc_mark_PObj_alive(interp, (PObj *)data[i]);
- }
+ SUPER();
}
--- src/pmc/capture.pmc 2009-07-08 02:19:02.000000000 +0200
+++ src/pmc/capture.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
-Copyright (C) 2001-2008, Parrot Foundation.
-$Id: capture.pmc 38794 2009-05-15 16:12:33Z coke $
+Copyright (C) 2001-2009, Parrot Foundation.
+$Id: capture.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -26,7 +26,7 @@
if (!PARROT_CAPTURE(obj)->hash) \
PARROT_CAPTURE(obj)->hash = pmc_new((i), enum_class_Hash);
-pmclass Capture need_ext {
+pmclass Capture need_ext auto_attrs {
ATTR PMC *array;
ATTR PMC *hash;
ATTR INTVAL data_size;
@@ -37,31 +37,17 @@
Initializes the Capture instance.
-=item C<void destroy()>
-
-Free structures.
-
=cut
*/
VTABLE void init() {
- Parrot_Capture_attributes *capture = mem_allocate_typed(Parrot_Capture_attributes);
- PMC_data(SELF) = capture;
- capture->array = NULL;
- capture->hash = NULL;
+ Parrot_Capture_attributes *capture =
+ (Parrot_Capture_attributes *) PMC_data(SELF);
capture->data_size = CAPTURE_DATA_SIZE;
- PObj_active_destroy_SET(SELF);
PObj_custom_mark_SET(SELF);
}
- VTABLE void destroy() {
- if (PARROT_CAPTURE(SELF)) {
- mem_sys_free(PARROT_CAPTURE(SELF));
- PMC_data(SELF) = NULL;
- }
- }
-
/*
=item C<PMC *clone()>
--- src/pmc/class.pmc 2009-08-02 14:06:53.000000000 +0200
+++ src/pmc/class.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: class.pmc 40366 2009-08-01 22:49:23Z NotFound $
+$Id: class.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -443,7 +443,7 @@
*/
pmclass Class
- need_ext {
+ need_ext auto_attrs {
ATTR INTVAL id; /* The type number of the PMC. [deprecated: See RT #48024] */
ATTR STRING *name; /* The name of the class. */
@@ -479,14 +479,13 @@
*/
VTABLE void init() {
- Parrot_Class_attributes * const _class = mem_allocate_zeroed_typed(Parrot_Class_attributes);
+ Parrot_Class_attributes * const _class =
+ (Parrot_Class_attributes *) PMC_data(SELF);
- /* Set flags for custom GC mark and destroy. */
+ /* Set flag for custom GC mark. */
PObj_custom_mark_SET(SELF);
- PObj_active_destroy_SET(SELF);
/* Set up the object. */
- PMC_data(SELF) = _class;
_class->name = CONST_STRING(interp, "");
_class->_namespace = PMCNULL;
_class->parents = pmc_new(interp, enum_class_ResizablePMCArray);
@@ -559,21 +558,6 @@
/*
-=item C<void destroy()>
-
-Frees the memory associated with the class's underlying struct.
-
-=cut
-
-*/
-
- VTABLE void destroy() {
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
- }
-
-/*
-
=item C<STRING *get_string()>
Returns the name of the class (without the HLL namespace).
--- src/pmc/codestring.pmc 2009-07-08 02:19:02.000000000 +0200
+++ src/pmc/codestring.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2007-2009, Parrot Foundation.
-$Id: codestring.pmc 39449 2009-06-08 09:10:08Z chromatic $
+$Id: codestring.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -34,18 +34,10 @@
# include <unicode/uchar.h>
#endif
-pmclass CodeString extends String provides string {
+pmclass CodeString extends String provides string auto_attrs {
ATTR INTVAL last_line_number; /* most recent line number seen */
ATTR INTVAL last_pos; /* most recent byte position seen */
- VTABLE void init() {
- Parrot_CodeString_attributes *attrs =
- mem_allocate_zeroed_typed(Parrot_CodeString_attributes);
- attrs->str_val = Parrot_str_new_noinit(INTERP, enum_stringrep_one, 0);
- PMC_data(SELF) = attrs;
- PObj_custom_mark_destroy_SETALL(SELF);
- }
-
/*
=item C<emit(string fmt [, pmc args ] [, pmc hash ])>
--- src/pmc/complex.pmc 2009-07-08 02:19:02.000000000 +0200
+++ src/pmc/complex.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2004-2009, Parrot Foundation.
-$Id: complex.pmc 38964 2009-05-20 04:49:37Z petdance $
+$Id: complex.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -217,7 +217,7 @@
}
-pmclass Complex need_ext {
+pmclass Complex need_ext auto_attrs {
ATTR FLOATVAL re; /* real part */
ATTR FLOATVAL im; /* imaginary part */
@@ -327,10 +327,6 @@
Initializes the complex number with the specified initializer.
The initializer can be a string PMC or a numeric array with (real, imag)
-=item C<void destroy()>
-
-Cleans up.
-
=item C<PMC *clone()>
Creates an identical copy of the complex number.
@@ -340,12 +336,8 @@
*/
VTABLE void init() {
- /* XXX should check if mem_sys_allocate failed */
- PMC_data(SELF) = mem_allocate_typed(Parrot_Complex_attributes);
SET_ATTR_re(INTERP, SELF, 0.0);
SET_ATTR_im(INTERP, SELF, 0.0);
-
- PObj_active_destroy_SET(SELF);
}
VTABLE void init_pmc(PMC *initializer) {
@@ -380,11 +372,6 @@
}
}
- VTABLE void destroy() {
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
- }
-
VTABLE PMC *clone() {
PMC * const dest = pmc_new(INTERP, VTABLE_type(INTERP, SELF));
FLOATVAL re, im;
--- src/pmc/continuation.pmc 2009-07-28 14:51:59.000000000 +0200
+++ src/pmc/continuation.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2008, Parrot Foundation.
-$Id: continuation.pmc 40298 2009-07-28 07:44:59Z chromatic $
+$Id: continuation.pmc 40643 2009-08-18 22:57:11Z bacek $
=head1 NAME
@@ -45,7 +45,7 @@
* need the next_for_GC pointer in the pmc_ext area.
*/
-pmclass Continuation need_ext {
+pmclass Continuation need_ext auto_attrs {
ATTR struct Parrot_cont *cont; /* the continuation struct */
/*
@@ -60,8 +60,7 @@
VTABLE void init() {
Parrot_Continuation_attributes *attrs =
- mem_allocate_zeroed_typed(Parrot_Continuation_attributes);
- PMC_data(SELF) = attrs;
+ (Parrot_Continuation_attributes *) PMC_data(SELF);
PMC_cont(SELF) = new_continuation(INTERP, NULL);
PObj_custom_mark_destroy_SETALL(SELF);
@@ -120,8 +119,6 @@
mem_sys_free(cc);
}
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
}
/*
@@ -302,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;
--- src/pmc/coroutine.pmc 2009-07-27 00:03:45.000000000 +0200
+++ src/pmc/coroutine.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2008, Parrot Foundation.
-$Id: coroutine.pmc 40288 2009-07-26 22:03:33Z whiteknight $
+$Id: coroutine.pmc 40659 2009-08-19 16:16:54Z NotFound $
=head1 NAME
@@ -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) {
--- src/pmc/cpointer.pmc 2009-07-08 02:19:02.000000000 +0200
+++ src/pmc/cpointer.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2008-2009, Parrot Foundation.
-$Id: cpointer.pmc 38913 2009-05-18 21:47:33Z NotFound $
+$Id: cpointer.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -46,7 +46,7 @@
*/
-pmclass CPointer need_ext {
+pmclass CPointer need_ext auto_attrs {
ATTR void *pointer; /* The stored pointer. */
ATTR STRING *sig; /* A string signature for the pointer. */
@@ -61,12 +61,8 @@
*/
VTABLE void init() {
- Parrot_CPointer_attributes * const pdata_struct =
- mem_allocate_typed(Parrot_CPointer_attributes);
-
- PMC_data(SELF) = pdata_struct;
- pdata_struct->pointer = NULL;
- pdata_struct->sig = NULL;
+ SET_ATTR_pointer(INTERP, SELF, NULL);
+ SET_ATTR_sig(INTERP, SELF, NULL);
PObj_custom_mark_destroy_SETALL(SELF);
}
@@ -83,19 +79,21 @@
*/
VTABLE void mark() {
- Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
-
- if (data->sig) {
- Parrot_gc_mark_PObj_alive(interp, (PObj *)data->sig);
-
- if (data->pointer) {
- if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "P"))) {
- PMC ** const pmc_pointer = (PMC **) data->pointer;
+ STRING *sig;
+ GET_ATTR_sig(INTERP, SELF, sig);
+ if (sig) {
+ void *pointer;
+ GET_ATTR_pointer(INTERP, SELF, pointer);
+ Parrot_gc_mark_PObj_alive(interp, (PObj *)sig);
+
+ if (pointer) {
+ if (Parrot_str_equal(interp, sig, CONST_STRING(interp, "P"))) {
+ PMC ** const pmc_pointer = (PMC **) pointer;
PARROT_ASSERT(*pmc_pointer);
Parrot_gc_mark_PObj_alive(interp, (PObj *) *pmc_pointer);
}
- else if (Parrot_str_equal(interp, data->sig, CONST_STRING(interp, "S"))) {
- STRING ** const str_pointer = (STRING **) data->pointer;
+ else if (Parrot_str_equal(interp, sig, CONST_STRING(interp, "S"))) {
+ STRING ** const str_pointer = (STRING **) pointer;
PARROT_ASSERT(*str_pointer);
Parrot_gc_mark_PObj_alive(interp, (PObj *) *str_pointer);
}
@@ -114,12 +112,6 @@
*/
VTABLE void destroy() {
- Parrot_CPointer_attributes * const data = PARROT_CPOINTER(SELF);
-
- if (data) {
- mem_sys_free(data);
- PMC_data(SELF) = NULL;
- }
}
/*
--- src/pmc/default.pmc 2009-07-31 11:53:02.000000000 +0200
+++ src/pmc/default.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2008, Parrot Foundation.
-$Id: default.pmc 40350 2009-07-31 00:12:14Z NotFound $
+$Id: default.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -327,6 +327,19 @@
/*
+=item C<void destroy()>
+
+Does nothing.
+
+=cut
+
+*/
+
+ VTABLE void destroy() {
+ }
+
+/*
+
=item C<PMC *instantiate(PMC *init)>
Default fallback. Creates a new PMC of the type of the class SELF and
--- src/pmc/eval.pmc 2009-07-08 02:19:02.000000000 +0200
+++ src/pmc/eval.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2008, Parrot Foundation.
-$Id: eval.pmc 38794 2009-05-15 16:12:33Z coke $
+$Id: eval.pmc 40659 2009-08-19 16:16:54Z NotFound $
=head1 NAME
@@ -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;
--- src/pmc/eventhandler.pmc 2009-07-08 02:19:02.000000000 +0200
+++ src/pmc/eventhandler.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2007-2009, Parrot Foundation.
-$Id: eventhandler.pmc 39411 2009-06-05 23:07:35Z chromatic $
+$Id: eventhandler.pmc 40659 2009-08-19 16:16:54Z NotFound $
=head1 NAME
--- src/pmc/exceptionhandler.pmc 2009-07-11 01:06:11.000000000 +0200
+++ src/pmc/exceptionhandler.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2008, Parrot Foundation.
-$Id: exceptionhandler.pmc 39973 2009-07-10 05:15:20Z pmichaud $
+$Id: exceptionhandler.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -22,7 +22,7 @@
#include "parrot/oplib/ops.h"
-pmclass ExceptionHandler extends Continuation need_ext {
+pmclass ExceptionHandler extends Continuation need_ext auto_attrs {
ATTR PMC *handled_types;
ATTR PMC *handled_types_except;
@@ -41,11 +41,10 @@
VTABLE void init() {
Parrot_ExceptionHandler_attributes * const core_struct =
- mem_allocate_zeroed_typed(Parrot_ExceptionHandler_attributes);
+ (Parrot_ExceptionHandler_attributes *)PMC_data(SELF);
Parrot_cont * const cc = new_continuation(INTERP, NULL);
cc->invoked = 0;
- PMC_data(SELF) = core_struct;
PMC_cont(SELF) = cc;
core_struct->min_severity = 0;
core_struct->max_severity = 0;
--- src/pmc/exception.pmc 2009-08-04 23:05:29.000000000 +0200
+++ src/pmc/exception.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: exception.pmc 40397 2009-08-04 13:08:47Z NotFound $
+$Id: exception.pmc 40643 2009-08-18 22:57:11Z bacek $
=head1 NAME
@@ -52,7 +52,7 @@
#include "parrot/exceptions.h"
#include "pmc_sub.h"
-pmclass Exception {
+pmclass Exception auto_attrs {
ATTR INTVAL id; /* The task ID in the scheduler. */
ATTR FLOATVAL birthtime; /* The creation time stamp of the exception. */
@@ -83,15 +83,9 @@
*/
VTABLE void init() {
- Parrot_Exception_attributes * const core_struct =
- mem_allocate_zeroed_typed(Parrot_Exception_attributes);
-
- /* Set up the core struct and default values for the exception object. */
- PMC_data(SELF) = core_struct;
-
/* Set flags for custom GC mark and destroy. */
- PObj_custom_mark_SET(SELF);
PObj_active_destroy_SET(SELF);
+ PObj_custom_mark_SET(SELF);
SET_ATTR_severity(INTERP, SELF, EXCEPT_error);
SET_ATTR_handled(INTERP, SELF, 0);
@@ -116,9 +110,6 @@
INTVAL severity_val;
STRING *message_val;
- Parrot_Exception_attributes * const core_struct =
- mem_allocate_zeroed_typed(Parrot_Exception_attributes);
-
INTVAL ishash = VTABLE_isa(interp, values, CONST_STRING(interp, 'Hash'));
if (ishash) {
@@ -132,10 +123,9 @@
message_val = VTABLE_get_string(interp, values);
}
- PMC_data(SELF) = core_struct;
- /* Set flags for custom GC mark and destroy. */
- PObj_custom_mark_SET(SELF);
+ /* Set flags for custom GC mark. */
PObj_active_destroy_SET(SELF);
+ PObj_custom_mark_SET(SELF);
/* Set up the core struct and default values for the exception object. */
@@ -185,11 +175,8 @@
VTABLE void destroy() {
Parrot_Exception_attributes * const core_struct = PARROT_EXCEPTION(SELF);
- if (core_struct) {
- if (core_struct->thrower)
- Parrot_free_context(interp, core_struct->thrower, 1);
- mem_sys_free(core_struct);
- }
+ if (core_struct && core_struct->thrower)
+ Parrot_free_context(interp, core_struct->thrower, 1);
}
/*
@@ -794,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;
--- src/pmc/exporter.pmc 2009-08-07 02:50:19.000000000 +0200
+++ src/pmc/exporter.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2007-2009, Parrot Foundation.
-$Id: exporter.pmc 40436 2009-08-06 23:22:04Z NotFound $
+$Id: exporter.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -90,7 +90,7 @@
*/
-pmclass Exporter need_ext {
+pmclass Exporter need_ext auto_attrs {
ATTR PMC *ns_src;
ATTR PMC *ns_dest;
@@ -107,10 +107,6 @@
*/
VTABLE void init() {
- Parrot_Exporter_attributes * const exp =
- mem_allocate_zeroed_typed(Parrot_Exporter_attributes);
- PMC_data(SELF) = exp;
-
/* Set up the object. */
SET_ATTR_ns_src(INTERP, SELF, PMCNULL);
SET_ATTR_ns_dest(INTERP, SELF, CONTEXT(interp)->current_namespace);
@@ -118,26 +114,8 @@
/* Set flags for custom GC mark and destroy. */
PObj_custom_mark_SET(SELF);
- PObj_active_destroy_SET(SELF);
}
-
-/*
-
-=item C<void destroy()>
-
-Free the memory associated with the object's underlying struct.
-
-=cut
-
-*/
-
- VTABLE void destroy() {
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
- }
-
-
/*
=item C<void mark()>
--- src/pmc/filehandle.pmc 2009-07-19 03:19:23.000000000 +0200
+++ src/pmc/filehandle.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2008-2009, Parrot Foundation.
-$Id: filehandle.pmc 40139 2009-07-18 04:54:10Z petdance $
+$Id: filehandle.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -31,7 +31,7 @@
#endif
#endif
-pmclass FileHandle extends Handle {
+pmclass FileHandle extends Handle auto_attrs {
ATTR INTVAL flags; /* Filehandle flags */
ATTR STRING *filename; /* The opened path and filename */
ATTR STRING *mode; /* The mode string used in open */
@@ -64,9 +64,8 @@
VTABLE void init() {
Parrot_FileHandle_attributes * const data_struct =
- mem_allocate_typed(Parrot_FileHandle_attributes);
+ (Parrot_FileHandle_attributes *) PMC_data(SELF);
- PMC_data(SELF) = data_struct;
data_struct->flags = 0;
data_struct->filename = NULL;
data_struct->mode = NULL;
@@ -150,9 +149,6 @@
if (data_struct->buffer_start)
mem_sys_free(data_struct->buffer_start);
-
- mem_sys_free(PARROT_FILEHANDLE(SELF));
- PMC_data(SELF) = NULL;
}
}
--- src/pmc/fixedbooleanarray.pmc 2009-08-02 14:06:53.000000000 +0200
+++ src/pmc/fixedbooleanarray.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: fixedbooleanarray.pmc 40366 2009-08-01 22:49:23Z NotFound $
+$Id: fixedbooleanarray.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -23,7 +23,7 @@
#define BITS_PER_CHAR 8
-pmclass FixedBooleanArray need_ext provides array {
+pmclass FixedBooleanArray need_ext auto_attrs provides array {
ATTR UINTVAL size; /* # of bits this fba holds */
ATTR UINTVAL resize_threshold; /* max capacity before resizing */
ATTR unsigned char * bit_array; /* where the bits go */
@@ -45,10 +45,6 @@
*/
VTABLE void init() {
- Parrot_FixedBooleanArray_attributes* attrs =
- mem_allocate_zeroed_typed(Parrot_FixedBooleanArray_attributes);
-
- PMC_data(SELF) = attrs;
PObj_active_destroy_SET(SELF);
}
@@ -67,8 +63,6 @@
GET_ATTR_bit_array(INTERP, SELF, bit_array);
if (bit_array)
mem_sys_free(bit_array);
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
}
/*
--- src/pmc/fixedfloatarray.pmc 2009-08-02 14:06:53.000000000 +0200
+++ src/pmc/fixedfloatarray.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: fixedfloatarray.pmc 40366 2009-08-01 22:49:23Z NotFound $
+$Id: fixedfloatarray.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -19,7 +19,7 @@
*/
-pmclass FixedFloatArray need_ext provides array {
+pmclass FixedFloatArray need_ext auto_attrs provides array {
ATTR INTVAL size;
ATTR FLOATVAL *float_array;
@@ -40,9 +40,6 @@
*/
VTABLE void init() {
- Parrot_FixedFloatArray_attributes* attrs =
- mem_allocate_zeroed_typed(Parrot_FixedFloatArray_attributes);
- PMC_data(SELF) = attrs;
}
/*
@@ -60,9 +57,6 @@
GET_ATTR_float_array(INTERP, SELF, float_array);
if (float_array)
mem_sys_free(float_array);
-
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
}
/*
--- src/pmc/fixedintegerarray.pmc 2009-08-02 14:06:53.000000000 +0200
+++ src/pmc/fixedintegerarray.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: fixedintegerarray.pmc 40365 2009-08-01 22:10:42Z NotFound $
+$Id: fixedintegerarray.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -19,7 +19,7 @@
*/
-pmclass FixedIntegerArray need_ext provides array {
+pmclass FixedIntegerArray need_ext auto_attrs provides array {
ATTR INTVAL size; /* number of INTVALs stored in this array */
ATTR INTVAL * int_array; /* INTVALs are stored here */
@@ -40,9 +40,6 @@
*/
VTABLE void init() {
- Parrot_FixedIntegerArray_attributes* attrs =
- mem_allocate_zeroed_typed(Parrot_FixedIntegerArray_attributes);
- PMC_data(SELF) = attrs;
PObj_active_destroy_SET(SELF);
}
@@ -154,8 +151,6 @@
GET_ATTR_int_array(INTERP, SELF, int_array);
if (int_array)
mem_sys_free(int_array);
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
}
/*
--- src/pmc/fixedpmcarray.pmc 2009-08-02 14:06:53.000000000 +0200
+++ src/pmc/fixedpmcarray.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: fixedpmcarray.pmc 40365 2009-08-01 22:10:42Z NotFound $
+$Id: fixedpmcarray.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -27,7 +27,7 @@
#define PMC_size(x) ((Parrot_FixedPMCArray_attributes *)PMC_data(x))->size
#define PMC_array(x) ((Parrot_FixedPMCArray_attributes *)PMC_data(x))->pmc_array
-pmclass FixedPMCArray need_ext provides array {
+pmclass FixedPMCArray need_ext auto_attrs provides array {
ATTR INTVAL size; /* number of elements in the array */
ATTR PMC **pmc_array; /* pointer to PMC array */
@@ -66,9 +66,7 @@
VTABLE void init() {
Parrot_FixedPMCArray_attributes *attrs =
- mem_allocate_zeroed_typed(Parrot_FixedPMCArray_attributes);
-
- PMC_data(SELF) = attrs;
+ (Parrot_FixedPMCArray_attributes *) PMC_data(SELF);
PObj_custom_mark_destroy_SETALL(SELF);
}
@@ -86,8 +84,6 @@
if (PMC_array(SELF)) {
mem_sys_free(PMC_array(SELF));
}
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
}
/*
--- src/pmc/fixedstringarray.pmc 2009-08-02 14:06:53.000000000 +0200
+++ src/pmc/fixedstringarray.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: fixedstringarray.pmc 40365 2009-08-01 22:10:42Z NotFound $
+$Id: fixedstringarray.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -19,7 +19,7 @@
*/
-pmclass FixedStringArray need_ext provides array {
+pmclass FixedStringArray need_ext auto_attrs provides array {
ATTR STRING **str_array; /* where the STRINGs are stored */
ATTR UINTVAL size; /* element count */
@@ -40,12 +40,6 @@
*/
VTABLE void init() {
-
- Parrot_FixedStringArray_attributes *attrs =
- mem_allocate_zeroed_typed(Parrot_FixedStringArray_attributes);
-
- PMC_data(SELF) = attrs;
-
PObj_custom_mark_destroy_SETALL(SELF);
}
@@ -67,9 +61,6 @@
if (str_array)
mem_sys_free(str_array);
-
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
}
/*
--- src/pmc/float.pmc 2009-08-02 14:06:53.000000000 +0200
+++ src/pmc/float.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2003-2009, Parrot Foundation.
-$Id: float.pmc 40365 2009-08-01 22:10:42Z NotFound $
+$Id: float.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -18,7 +18,7 @@
*/
-pmclass Float extends scalar provides float provides scalar {
+pmclass Float extends scalar provides float provides scalar auto_attrs {
ATTR FLOATVAL fv;
/*
@@ -32,27 +32,9 @@
*/
VTABLE void init() {
- Parrot_Float_attributes * const fattr = mem_allocate_zeroed_typed(Parrot_Float_attributes);
-
- PMC_data(SELF) = fattr;
SET_ATTR_fv(INTERP, SELF, 0.0);
-
- PObj_active_destroy_SET(SELF);
}
-/*
-
-=item C<void destroy()>
-
-Destroy this PMC.
-=cut
-
-*/
-
- VTABLE void destroy() {
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
- }
/*
=item C<PMC *clone()>
--- src/pmc/hashiteratorkey.pmc 2009-08-02 14:06:53.000000000 +0200
+++ src/pmc/hashiteratorkey.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: hashiteratorkey.pmc 40366 2009-08-01 22:49:23Z NotFound $
+$Id: hashiteratorkey.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -19,48 +19,12 @@
*/
-pmclass HashIteratorKey no_ro {
+pmclass HashIteratorKey no_ro auto_attrs {
ATTR Hash *parrot_hash; /* Underlying parrot's hash */
ATTR HashBucket *bucket; /* Current bucket from HashItertor */
/*
-=item C<void init()>
-
-Initializes the PMC.
-
-Not really part of public API.
-
-=cut
-
-*/
-
- VTABLE void init() {
- Parrot_HashIteratorKey_attributes *attrs =
- mem_allocate_zeroed_typed(Parrot_HashIteratorKey_attributes);
-
- PMC_data(SELF) = attrs;
-
- PObj_active_destroy_SET(SELF);
- }
-
-/*
-
-=item C<void destroy()>
-
-Destroys this PMC
-
-=cut
-
-*/
-
- VTABLE void destroy() {
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
- }
-
-/*
-
=item C<get_pmc()>
Get "key".
--- src/pmc/hashiterator.pmc 2009-08-02 14:06:53.000000000 +0200
+++ src/pmc/hashiterator.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: hashiterator.pmc 40366 2009-08-01 22:49:23Z NotFound $
+$Id: hashiterator.pmc 40672 2009-08-20 09:28:47Z chromatic $
=head1 NAME
@@ -75,7 +75,7 @@
return bucket;
}
-pmclass HashIterator extends Iterator no_ro {
+pmclass HashIterator extends Iterator no_ro auto_attrs {
ATTR PMC *pmc_hash; /* the Hash which this Iterator iterates */
ATTR Hash *parrot_hash; /* Underlying implementation of hash */
ATTR HashBucket *bucket; /* Current bucket */
@@ -96,7 +96,7 @@
VTABLE void init_pmc(PMC *hash) {
Parrot_HashIterator_attributes * const attrs =
- mem_allocate_zeroed_typed(Parrot_HashIterator_attributes);
+ (Parrot_HashIterator_attributes *) PMC_data(SELF);
attrs->pmc_hash = hash;
attrs->parrot_hash = (Hash*)VTABLE_get_pointer(INTERP, hash);
@@ -106,9 +106,8 @@
/* Will be decreased on initial advance_to_next */
/* XXX Do we really need to support this use-case ? */
attrs->elements = attrs->parrot_hash->entries + 1;
- PMC_data(SELF) = attrs;
- PObj_custom_mark_destroy_SETALL(SELF);
+ PObj_custom_mark_SET(SELF);
/* Initial state of iterator is "before start" */
/* So, advance to first element */
@@ -117,21 +116,6 @@
/*
-=item C<void destroy()>
-
-destroys this PMC
-
-=cut
-
-*/
-
- VTABLE void destroy() {
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
- }
-
-/*
-
=item C<void mark()>
Marks the hash as live.
@@ -262,8 +246,10 @@
*/
VTABLE STRING* shift_string() {
- PMC * const key = SELF.shift_pmc();
- return VTABLE_get_string(INTERP, key);
+ PMC * const key = SELF.shift_pmc();
+ STRING * const ret = VTABLE_get_string(INTERP, key);
+ temporary_pmc_free(INTERP, key);
+ return ret;
}
}
--- src/pmc/integer.pmc 2009-08-11 01:20:59.000000000 +0200
+++ src/pmc/integer.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2003-2008, Parrot Foundation.
-$Id: integer.pmc 39346 2009-06-02 23:42:17Z bacek $
+$Id: integer.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -43,7 +43,7 @@
return self;
}
-pmclass Integer extends scalar provides integer provides scalar {
+pmclass Integer extends scalar provides integer provides scalar auto_attrs {
ATTR INTVAL iv; /* the value of this Integer */
/*
@@ -91,16 +91,13 @@
VTABLE void init() {
Parrot_Integer_attributes * const attrs =
- mem_allocate_typed(Parrot_Integer_attributes);
+ (Parrot_Integer_attributes *)PMC_data(SELF);
attrs->iv = 0;
- PMC_data(SELF) = attrs;
PObj_active_destroy_SET(SELF);
}
VTABLE void destroy() {
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
}
/*
--- src/pmc/key.pmc 2009-08-02 14:06:53.000000000 +0200
+++ src/pmc/key.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: key.pmc 40366 2009-08-01 22:49:23Z NotFound $
+$Id: key.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -18,7 +18,7 @@
*/
-pmclass Key need_ext {
+pmclass Key need_ext auto_attrs {
ATTR PMC *next_key; /* Sometimes it's the next key, sometimes it's
not. The Key code is like that. */
ATTR INTVAL int_key; /* int value of this key, or something magical if
@@ -40,26 +40,7 @@
*/
VTABLE void init() {
-
- Parrot_Key_attributes * const attrs =
- mem_allocate_zeroed_typed(Parrot_Key_attributes);
-
- PMC_data(SELF) = attrs;
- PObj_custom_mark_destroy_SETALL(SELF);
- }
-
-/*
-
-=item C<void destroy()>
-
-Destroy this Key, but not in the way anyone reading its code would want.
-
-=cut
-
-*/
- VTABLE void destroy() {
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
+ PObj_custom_mark_SET(SELF);
}
/*
@@ -77,8 +58,6 @@
PMC *dkey = dest;
PMC *key = SELF;
- PObj_custom_mark_destroy_SETALL(dest);
-
for (; key ;) {
switch (PObj_get_FLAGS(key) & KEY_type_FLAGS) {
case KEY_integer_FLAG:
--- src/pmc/lexpad.pmc 2009-08-02 14:06:53.000000000 +0200
+++ src/pmc/lexpad.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2007-2009, Parrot Foundation.
-$Id: lexpad.pmc 40366 2009-08-01 22:49:23Z NotFound $
+$Id: lexpad.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -26,7 +26,7 @@
* pmc_val ... LexInfo
*/
-pmclass LexPad provides hash no_ro {
+pmclass LexPad provides hash no_ro auto_attrs {
ATTR PMC *lexinfo;
ATTR struct Parrot_Context *ctx;
@@ -78,18 +78,7 @@
*/
VTABLE void init_pmc(PMC *lexinfo) {
- Parrot_LexPad_attributes * const attrs =
- mem_allocate_zeroed_typed(Parrot_LexPad_attributes);
-
- PObj_active_destroy_SET(SELF);
-
- attrs->lexinfo = lexinfo;
- PMC_data(SELF) = attrs;
- }
-
- VTABLE void destroy() {
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
+ SET_ATTR_lexinfo(INTERP, SELF, lexinfo);
}
VTABLE void set_pointer(void *ctx) {
--- src/pmc/managedstruct.pmc 2009-08-02 14:06:53.000000000 +0200
+++ src/pmc/managedstruct.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: managedstruct.pmc 40366 2009-08-01 22:49:23Z NotFound $
+$Id: managedstruct.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 DESCRIPTION
@@ -22,7 +22,7 @@
typedef void (*custom_free_func_t)(PARROT_INTERP, void *ptr, void *priv);
typedef PMC * (*custom_clone_func_t)(PARROT_INTERP, PMC *ptr, void *priv);
-pmclass ManagedStruct extends UnManagedStruct need_ext {
+pmclass ManagedStruct extends UnManagedStruct need_ext auto_attrs {
/* if custom_free_func and ptr (inherited from UnManagedStruct) are both set,
* custom_free_func is called before the normal destroy() function does any
* work.
@@ -46,11 +46,7 @@
*/
VTABLE void init() {
- Parrot_ManagedStruct_attributes *attrs =
- mem_allocate_zeroed_typed(Parrot_ManagedStruct_attributes);
PObj_active_destroy_SET(SELF);
- PMC_data(SELF) = attrs;
-
}
/*
@@ -91,8 +87,6 @@
} else
mem_sys_free(ptr);
}
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
}
/*
--- src/pmc/multisub.pmc 2009-07-08 02:19:02.000000000 +0200
+++ src/pmc/multisub.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: multisub.pmc 39694 2009-06-22 02:49:35Z cotto $
+$Id: multisub.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -19,7 +19,7 @@
*/
-pmclass MultiSub extends ResizablePMCArray need_ext provides array {
+pmclass MultiSub extends ResizablePMCArray need_ext auto_attrs provides array {
VTABLE void push_pmc(PMC *value) {
STRING * const _sub = CONST_STRING(interp, "Sub");
--- src/pmc/namespace.pmc 2009-07-16 00:37:18.000000000 +0200
+++ src/pmc/namespace.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2005-2009, Parrot Foundation.
-$Id: namespace.pmc 40100 2009-07-15 13:15:25Z bacek $
+$Id: namespace.pmc 40643 2009-08-18 22:57:11Z bacek $
=head1 NAME
@@ -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) {
--- src/pmc/nci.pmc 2009-08-16 13:54:58.000000000 +0200
+++ src/pmc/nci.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2008, Parrot Foundation.
-$Id: nci.pmc 40589 2009-08-16 10:36:30Z mikehh $
+$Id: nci.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -101,7 +101,7 @@
}
-pmclass NCI need_ext {
+pmclass NCI need_ext auto_attrs {
ATTR STRING *signature; /* The signature. */
ATTR void *func; /* Function pointer to call. */
ATTR void *orig_func; /* Function pointer
@@ -155,12 +155,9 @@
*/
VTABLE void init() {
- PMC_data(SELF) = mem_allocate_zeroed_typed(Parrot_NCI_attributes);
-
/* Mark that we're not a raw NCI. */
PObj_flag_CLEAR(private2, SELF);
PObj_custom_mark_SET(SELF);
- PObj_active_destroy_SET(SELF);
}
/*
@@ -232,25 +229,6 @@
/*
-=item C<void destroy()>
-
-Destroys the NCI, freeing any allocated memory.
-
-=cut
-
-*/
-
- VTABLE void destroy() {
- if (PMC_data(SELF)) {
- Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
-
- mem_sys_free(nci_info);
- PMC_data(SELF) = NULL;
- }
- }
-
-/*
-
=item C<PMC *clone()>
Creates and returns a clone of the NCI.
--- src/pmc/orderedhashiterator.pmc 2009-08-02 14:06:53.000000000 +0200
+++ src/pmc/orderedhashiterator.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: orderedhashiterator.pmc 40366 2009-08-01 22:49:23Z NotFound $
+$Id: orderedhashiterator.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -21,7 +21,7 @@
#include "pmc_hash.h"
#include "pmc_hashiteratorkey.h"
-pmclass OrderedHashIterator extends Iterator no_ro {
+pmclass OrderedHashIterator extends Iterator no_ro auto_attrs {
ATTR PMC *pmc_hash; /* the Hash which this Iterator iterates */
ATTR Hash *parrot_hash; /* Underlying implementation of hash */
ATTR INTVAL pos; /* */
@@ -41,7 +41,7 @@
VTABLE void init_pmc(PMC *hash) {
Parrot_OrderedHashIterator_attributes * const attrs =
- mem_allocate_zeroed_typed(Parrot_OrderedHashIterator_attributes);
+ (Parrot_OrderedHashIterator_attributes *) PMC_data(SELF);
attrs->pmc_hash = hash;
attrs->parrot_hash = (Hash*)VTABLE_get_pointer(INTERP, hash);
@@ -49,24 +49,8 @@
/* Will be decreased on initial advance_to_next */
/* XXX Do we really need to support this use-case ? */
attrs->elements = attrs->parrot_hash->entries;
- PMC_data(SELF) = attrs;
- PObj_custom_mark_destroy_SETALL(SELF);
- }
-
-/*
-
-=item C<void destroy()>
-
-destroys this PMC
-
-=cut
-
-*/
-
- VTABLE void destroy() {
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
+ PObj_custom_mark_SET(SELF);
}
/*
--- src/pmc/parrotinterpreter.pmc 2009-08-14 23:52:40.000000000 +0200
+++ src/pmc/parrotinterpreter.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: parrotinterpreter.pmc 40546 2009-08-14 17:13:00Z NotFound $
+$Id: parrotinterpreter.pmc 40643 2009-08-18 22:57:11Z bacek $
=head1 NAME
@@ -238,8 +238,9 @@
Parrot_ParrotInterpreter_attributes *attrs =
mem_allocate_zeroed_typed(Parrot_ParrotInterpreter_attributes);
PMC_data(SELF) = attrs;
+ }
+ if (!PMC_interp(SELF)) {
create_interp(SELF, INTERP);
- PARROT_ASSERT(attrs->interp);
}
PObj_active_destroy_SET(SELF);
}
@@ -259,8 +260,15 @@
VTABLE void init_pmc(PMC *parent) {
Parrot_Interp p = PMC_interp(parent);
- if (!PMC_interp(SELF))
+ if (!PMC_data(SELF)) {
+ Parrot_ParrotInterpreter_attributes *attrs =
+ mem_allocate_zeroed_typed(Parrot_ParrotInterpreter_attributes);
+ PMC_data(SELF) = attrs;
+ }
+ if (!PMC_interp(SELF)) {
create_interp(SELF, p);
+ }
+ PObj_active_destroy_SET(SELF);
}
@@ -532,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;
--- src/pmc/parrotlibrary.pmc 2009-08-02 14:06:53.000000000 +0200
+++ src/pmc/parrotlibrary.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: parrotlibrary.pmc 40366 2009-08-01 22:49:23Z NotFound $
+$Id: parrotlibrary.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -31,7 +31,7 @@
#define PMC_dlhandle(x) ((Parrot_ParrotLibrary_attributes*)PMC_data(x))->dl_handle
#define PMC_oplib_init(x) ((Parrot_ParrotLibrary_attributes*)PMC_data(x))->oplib_init
-pmclass ParrotLibrary need_ext provides library {
+pmclass ParrotLibrary need_ext auto_attrs provides library {
ATTR void * dl_handle; /* DLL handle */
ATTR void * oplib_init; /* oplib init function */
@@ -46,9 +46,6 @@
*/
VTABLE void init() {
- Parrot_ParrotLibrary_attributes * const attrs =
- mem_allocate_zeroed_typed(Parrot_ParrotLibrary_attributes);
- PMC_data(SELF) = attrs;
PObj_active_destroy_SET(SELF);
}
@@ -66,8 +63,6 @@
void *dl_handle = PMC_dlhandle(SELF);
if (dl_handle)
Parrot_dlclose(dl_handle);
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
}
--- src/pmc/pmcproxy.pmc 2009-07-14 23:29:37.000000000 +0200
+++ src/pmc/pmcproxy.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2008, Parrot Foundation.
-$Id: pmcproxy.pmc 40078 2009-07-14 14:19:53Z bacek $
+$Id: pmcproxy.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -64,7 +64,7 @@
*/
-pmclass PMCProxy extends Class need_ext {
+pmclass PMCProxy extends Class need_ext auto_attrs {
/*
@@ -77,14 +77,13 @@
*/
VTABLE void init() {
- Parrot_Class_attributes * const _pmc = mem_allocate_zeroed_typed(Parrot_Class_attributes);
+ Parrot_Class_attributes * const _pmc =
+ (Parrot_Class_attributes *) PMC_data(SELF);
PMC * const new_attribute = pmc_new(interp, enum_class_Hash);
STRING * const name = CONST_STRING(interp, "proxy");
- PMC_data(SELF) = _pmc;
- /* Set flags for custom GC mark and destroy. */
+ /* Set flag for custom GC mark. */
PObj_custom_mark_SET(SELF);
- PObj_active_destroy_SET(SELF);
/* Set up the object. */
_pmc->id = 0;
--- src/pmc/pointer.pmc 2009-08-02 14:06:53.000000000 +0200
+++ src/pmc/pointer.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2007, Parrot Foundation.
-$Id: pointer.pmc 40366 2009-08-01 22:49:23Z NotFound $
+$Id: pointer.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -20,7 +20,7 @@
*/
-pmclass Pointer need_ext {
+pmclass Pointer need_ext auto_attrs {
ATTR void * mark_function;
ATTR void * pointer;
@@ -35,28 +35,11 @@
*/
VTABLE void init() {
- PObj_custom_mark_destroy_SETALL(SELF);
- PMC_data(SELF) = mem_allocate_zeroed_typed(Parrot_Pointer_attributes);
+ PObj_custom_mark_SET(SELF);
}
/*
-=item C<void destroy()>
-
-Destroy the Pointer and free associated memory
-
-=cut
-
-*/
-
- VTABLE void destroy() {
- mem_sys_free(PARROT_POINTER(SELF));
- PMC_data(SELF) = NULL;
- }
-
-
-/*
-
=item C<void mark()>
Marks the pointer as live.
--- src/pmc/resizablebooleanarray.pmc 2009-07-08 02:19:02.000000000 +0200
+++ src/pmc/resizablebooleanarray.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: resizablebooleanarray.pmc 38794 2009-05-15 16:12:33Z coke $
+$Id: resizablebooleanarray.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -30,7 +30,7 @@
/* Convert a size in bits to a size in bytes */
#define BITS_TO_BYTES(size) ((size) / BITS_PER_CHAR)
-pmclass ResizableBooleanArray extends FixedBooleanArray need_ext provides array {
+pmclass ResizableBooleanArray extends FixedBooleanArray need_ext auto_attrs provides array {
/* RBA uses the same attributes as FBA, but in RBA they're used as follows:
size: position of the last element (a.k.a tail_pos)
resize_threshold: position of the first element (a.k.a. head_pos) */
--- src/pmc/resizablefloatarray.pmc 2009-07-08 02:19:02.000000000 +0200
+++ src/pmc/resizablefloatarray.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2008, Parrot Foundation.
-$Id: resizablefloatarray.pmc 38794 2009-05-15 16:12:33Z coke $
+$Id: resizablefloatarray.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -20,26 +20,9 @@
*/
-pmclass ResizableFloatArray extends FixedFloatArray need_ext provides array {
+pmclass ResizableFloatArray extends FixedFloatArray need_ext auto_attrs provides array {
ATTR INTVAL resize_threshold; /* max size before array needs resizing */
-
-
-/*
-
-=item C<void init()>
-
-Initializes this array.
-
-=cut
-
-*/
- VTABLE void init() {
- Parrot_ResizableFloatArray_attributes* attrs =
- mem_allocate_zeroed_typed(Parrot_ResizableFloatArray_attributes);
- PMC_data(SELF) = attrs;
- }
-
/*
=item C<FLOATVAL get_number_keyed_int(INTVAL key)>
--- src/pmc/resizableintegerarray.pmc 2009-07-08 02:19:02.000000000 +0200
+++ src/pmc/resizableintegerarray.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2008, Parrot Foundation.
-$Id: resizableintegerarray.pmc 38794 2009-05-15 16:12:33Z coke $
+$Id: resizableintegerarray.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -20,27 +20,11 @@
*/
-pmclass ResizableIntegerArray extends FixedIntegerArray need_ext provides array {
+pmclass ResizableIntegerArray extends FixedIntegerArray need_ext auto_attrs provides array {
ATTR INTVAL resize_threshold; /* max size before array needs to be resized */
/*
-=item C<void init()>
-
-Initializes the array.
-
-=cut
-
-*/
- VTABLE void init() {
- Parrot_ResizableIntegerArray_attributes* attrs =
- mem_allocate_zeroed_typed(Parrot_ResizableIntegerArray_attributes);
- PMC_data(SELF) = attrs;
- PObj_active_destroy_SET(SELF);
- }
-
-/*
-
=item C<INTVAL get_integer_keyed_int(INTVAL key)>
Returns the integer value of the element at index C<key>.
--- src/pmc/resizablepmcarray.pmc 2009-07-08 02:19:02.000000000 +0200
+++ src/pmc/resizablepmcarray.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: resizablepmcarray.pmc 38994 2009-05-20 22:27:54Z chromatic $
+$Id: resizablepmcarray.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -23,7 +23,7 @@
#define PMC_array(x) ((Parrot_ResizablePMCArray_attributes *)PMC_data(x))->pmc_array
#define PMC_threshold(x) ((Parrot_ResizablePMCArray_attributes *)PMC_data(x))->resize_threshold
-pmclass ResizablePMCArray extends FixedPMCArray need_ext provides array {
+pmclass ResizablePMCArray extends FixedPMCArray need_ext auto_attrs provides array {
ATTR INTVAL resize_threshold; /* max size before array needs resizing */
@@ -37,10 +37,6 @@
*/
VTABLE void init() {
- Parrot_ResizablePMCArray_attributes *attrs =
- mem_allocate_zeroed_typed(Parrot_ResizablePMCArray_attributes);
-
- PMC_data(SELF) = attrs;
PObj_custom_mark_destroy_SETALL(SELF);
}
--- src/pmc/resizablestringarray.pmc 2009-07-08 02:19:02.000000000 +0200
+++ src/pmc/resizablestringarray.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: resizablestringarray.pmc 39412 2009-06-05 23:08:10Z chromatic $
+$Id: resizablestringarray.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -18,7 +18,7 @@
*/
-pmclass ResizableStringArray extends FixedStringArray need_ext provides array {
+pmclass ResizableStringArray extends FixedStringArray need_ext auto_attrs provides array {
ATTR UINTVAL resize_threshold; /*max capacity before resizing */
/*
@@ -27,25 +27,6 @@
=over 4
-=item C<void init()>
-
-Initializes the array.
-
-=cut
-
-*/
-
- VTABLE void init() {
- Parrot_ResizableStringArray_attributes *attrs =
- mem_allocate_zeroed_typed(Parrot_ResizableStringArray_attributes);
-
- PMC_data(SELF) = attrs;
-
- PObj_custom_mark_destroy_SETALL(SELF);
- }
-
-/*
-
=item C<STRING *get_string_keyed_int(INTVAL key)>
Returns the Parrot string value of the element at index C<key>.
--- src/pmc/retcontinuation.pmc 2009-08-02 14:06:53.000000000 +0200
+++ src/pmc/retcontinuation.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2008, Parrot Foundation.
-$Id: retcontinuation.pmc 40366 2009-08-01 22:49:23Z NotFound $
+$Id: retcontinuation.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -23,7 +23,7 @@
#include "parrot/oplib/ops.h"
-pmclass RetContinuation extends Continuation need_ext {
+pmclass RetContinuation extends Continuation need_ext auto_attrs {
/*
@@ -37,9 +37,7 @@
VTABLE void init() {
Parrot_RetContinuation_attributes * const attrs =
- mem_allocate_typed(Parrot_RetContinuation_attributes);
-
- PMC_data(SELF) = attrs;
+ (Parrot_RetContinuation_attributes *) PMC_data(SELF);
PMC_cont(SELF) = new_ret_continuation(INTERP);
PObj_custom_mark_destroy_SETALL(SELF);
@@ -55,9 +53,6 @@
if (cc)
mem_sys_free(cc);
-
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
}
/*
--- src/pmc/role.pmc 2009-08-02 14:06:53.000000000 +0200
+++ src/pmc/role.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2008, Parrot Foundation.
-$Id: role.pmc 40366 2009-08-01 22:49:23Z NotFound $
+$Id: role.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -198,7 +198,7 @@
*/
-pmclass Role need_ext {
+pmclass Role need_ext auto_attrs {
ATTR STRING *name; /* The name of the role. */
ATTR PMC *_namespace; /* The namespace it's linked to, if any. */
ATTR PMC *roles; /* Roles from which this role is composed. */
@@ -221,12 +221,11 @@
*/
VTABLE void init() {
- Parrot_Role_attributes * const role = mem_allocate_zeroed_typed(Parrot_Role_attributes);
- PMC_data(SELF) = role;
+ Parrot_Role_attributes * const role =
+ (Parrot_Role_attributes *) PMC_data(SELF);
- /* Set flags for custom GC mark and destroy. */
+ /* Set flags for custom GC mark. */
PObj_custom_mark_SET(SELF);
- PObj_active_destroy_SET(SELF);
/* Set up the object. */
role->name = CONST_STRING(interp, "");
@@ -246,21 +245,6 @@
/*
-=item C<void destroy()>
-
-Free the memory associated with the object's underlying struct.
-
-=cut
-
-*/
-
- VTABLE void destroy() {
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
- }
-
-/*
-
=item C<void mark()>
Mark referenced strings and PMCs in the structure as live.
--- src/pmc/schedulermessage.pmc 2009-08-02 14:06:53.000000000 +0200
+++ src/pmc/schedulermessage.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
-Copyright (C) 2001-2008, Parrot Foundation.
-$Id: schedulermessage.pmc 40366 2009-08-01 22:49:23Z NotFound $
+Copyright (C) 2001-2009, Parrot Foundation.
+$Id: schedulermessage.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -20,7 +20,7 @@
#include "parrot/scheduler_private.h"
-pmclass SchedulerMessage need_ext {
+pmclass SchedulerMessage need_ext auto_attrs {
ATTR INTVAL id; /* The message's ID. */
ATTR STRING *type; /* The message's type. */
ATTR PMC *data; /* Additional data for the message. */
@@ -37,14 +37,12 @@
VTABLE void init() {
Parrot_SchedulerMessage_attributes * const core_struct
- = mem_allocate_zeroed_typed(Parrot_SchedulerMessage_attributes);
+ = (Parrot_SchedulerMessage_attributes *) PMC_data(SELF);
- /* Set flags for custom GC mark and destroy. */
+ /* Set flags for custom GC mark. */
PObj_custom_mark_SET(SELF);
- PObj_active_destroy_SET(SELF);
/* Set up the core struct. */
- PMC_data(SELF) = core_struct;
core_struct->id = 0;
core_struct->type = CONST_STRING(INTERP, "");
core_struct->data = PMCNULL;
@@ -189,20 +187,6 @@
/*
-=item C<void destroy()>
-
-Free the scheduler's underlying struct.
-
-=cut
-
-*/
- VTABLE void destroy() {
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
- }
-
-/*
-
=item C<void mark()>
Mark any referenced strings and PMCs.
--- src/pmc/scheduler.pmc 2009-08-02 14:06:53.000000000 +0200
+++ src/pmc/scheduler.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2008, Parrot Foundation.
-$Id: scheduler.pmc 40366 2009-08-01 22:49:23Z NotFound $
+$Id: scheduler.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -20,7 +20,7 @@
#include "parrot/scheduler_private.h"
-pmclass Scheduler need_ext {
+pmclass Scheduler need_ext auto_attrs {
ATTR INTVAL id; /* The scheduler's ID. */
ATTR INTVAL max_tid; /* The highest assigned task ID. */
@@ -48,14 +48,13 @@
VTABLE void init() {
Parrot_Scheduler_attributes * const core_struct =
- mem_allocate_zeroed_typed(Parrot_Scheduler_attributes);
+ (Parrot_Scheduler_attributes *) PMC_data(SELF);
/* Set flags for custom GC mark and destroy. */
PObj_custom_mark_SET(SELF);
PObj_active_destroy_SET(SELF);
/* Set up the core struct. */
- PMC_data(SELF) = core_struct;
core_struct->id = 0;
core_struct->max_tid = 0;
core_struct->task_list = pmc_new(interp, enum_class_Hash);
@@ -248,8 +247,6 @@
VTABLE void destroy() {
Parrot_Scheduler_attributes * const core_struct = PARROT_SCHEDULER(SELF);
MUTEX_DESTROY(core_struct->msg_lock);
- mem_sys_free(core_struct);
- PMC_data(SELF) = NULL;
}
--- src/pmc/sockaddr.pmc 2009-07-08 02:19:02.000000000 +0200
+++ src/pmc/sockaddr.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2008-2009, Parrot Foundation.
-$Id: sockaddr.pmc 38794 2009-05-15 16:12:33Z coke $
+$Id: sockaddr.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -29,7 +29,7 @@
}
#endif
-pmclass Sockaddr need_ext {
+pmclass Sockaddr need_ext auto_attrs {
ATTR void *pointer; /* The stored pointer. */
/*
@@ -44,10 +44,10 @@
VTABLE void init() {
Parrot_Sockaddr_attributes * const pdata_struct =
- mem_allocate_typed(Parrot_Sockaddr_attributes);
+ (Parrot_Sockaddr_attributes *) PMC_data(SELF);
- PMC_data(SELF) = pdata_struct;
pdata_struct->pointer = mem_allocate_zeroed_typed(struct sockaddr_in);
+ PObj_active_destroy_SET(SELF);
}
/*
@@ -65,8 +65,7 @@
if (data) {
mem_sys_free(data->pointer);
- mem_sys_free(data);
- PMC_data(SELF) = NULL;
+ data->pointer = NULL;
}
}
--- src/pmc/socket.pmc 2009-08-03 23:01:42.000000000 +0200
+++ src/pmc/socket.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2008, Parrot Foundation.
-$Id: socket.pmc 40393 2009-08-03 15:20:49Z tene $
+$Id: socket.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -20,7 +20,7 @@
#include "../src/io/io_private.h"
-pmclass Socket extends Handle {
+pmclass Socket extends Handle auto_attrs {
ATTR PMC *local; /* Local addr */
ATTR PMC *remote; /* Remote addr */
@@ -36,9 +36,8 @@
VTABLE void init() {
Parrot_Socket_attributes *data_struct =
- mem_allocate_zeroed_typed(Parrot_Socket_attributes);
+ (Parrot_Socket_attributes *) PMC_data(SELF);
- PMC_data(SELF) = data_struct;
data_struct->local = PMCNULL;
data_struct->remote = PMCNULL;
@@ -119,7 +118,6 @@
Parrot_io_close_piohandle(interp, data_struct->os_handle);
data_struct->os_handle = PIO_INVALID_HANDLE;
}
- PMC_data(SELF) = NULL;
}
/*
--- src/pmc/stringhandle.pmc 2009-07-08 02:19:02.000000000 +0200
+++ src/pmc/stringhandle.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2008, Parrot Foundation.
-$Id: stringhandle.pmc 39782 2009-06-25 22:29:08Z chromatic $
+$Id: stringhandle.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -46,7 +46,7 @@
return Parrot_str_equal(interp, s, CONST_STRING(interp, "utf8"));
}
-pmclass StringHandle extends Handle need_ext {
+pmclass StringHandle extends Handle need_ext auto_attrs {
ATTR INTVAL flags; /* Filehandle flags */
ATTR STRING *stringhandle; /* The string data */
ATTR STRING *mode; /* The mode string used in open */
@@ -70,9 +70,8 @@
VTABLE void init() {
Parrot_StringHandle_attributes *data_struct =
- mem_allocate_typed(Parrot_StringHandle_attributes);
+ (Parrot_StringHandle_attributes *) PMC_data(SELF);
- PMC_data(SELF) = data_struct;
data_struct->flags = 0;
data_struct->stringhandle = NULL;
data_struct->mode = NULL;
@@ -81,7 +80,6 @@
data_struct->read_offset = 0;
PObj_custom_mark_SET(SELF);
- PObj_active_destroy_SET(SELF);
}
/*
@@ -134,22 +132,6 @@
/*
-=item C<void destroy()>
-
-Free structures.
-
-=cut
-
-*/
- VTABLE void destroy() {
- if (PARROT_STRINGHANDLE(SELF)) {
- mem_sys_free(PARROT_STRINGHANDLE(SELF));
- PMC_data(SELF) = NULL;
- }
- }
-
-/*
-
=item C<INTVAL get_bool()>
Returns whether the StringHandle has reached the end of the file.
--- src/pmc/stringiterator.pmc 2009-08-02 14:06:53.000000000 +0200
+++ src/pmc/stringiterator.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: stringiterator.pmc 40366 2009-08-01 22:49:23Z NotFound $
+$Id: stringiterator.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -22,7 +22,7 @@
*/
-pmclass StringIterator extends Iterator {
+pmclass StringIterator auto_attrs extends Iterator {
ATTR PMC *string; /* String to iterate over */
ATTR INTVAL pos; /* Current position of iterator for forward iterator */
/* Previous position of iterator for reverse iterator */
@@ -39,31 +39,11 @@
*/
VTABLE void init_pmc(PMC *string) {
- Parrot_StringIterator_attributes * const attrs =
- mem_allocate_zeroed_typed(Parrot_StringIterator_attributes);
-
- attrs->string = string;
- PMC_data(SELF) = attrs;
-
- PObj_custom_mark_destroy_SETALL(SELF);
+ SET_ATTR_string(INTERP, SELF, string);
/* by default, iterate from start */
SELF.set_integer_native(ITERATE_FROM_START);
- }
-
-/*
-
-=item C<void destroy()>
-
-destroys this PMC
-
-=cut
-
-*/
-
- VTABLE void destroy() {
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
+ PObj_custom_mark_SET(SELF);
}
/*
--- src/pmc/string.pmc 2009-08-02 14:06:53.000000000 +0200
+++ src/pmc/string.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2003-2009, Parrot Foundation.
-$Id: string.pmc 40364 2009-08-01 21:49:43Z NotFound $
+$Id: string.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -20,7 +20,7 @@
*/
-pmclass String extends scalar provides string provides scalar {
+pmclass String extends scalar provides string provides scalar auto_attrs {
ATTR STRING * str_val;
/*
@@ -34,33 +34,14 @@
*/
VTABLE void init() {
- Parrot_String_attributes *attrs =
- mem_allocate_typed(Parrot_String_attributes);
STRING *str_val = Parrot_str_new_noinit(INTERP, enum_stringrep_one, 0);
- PMC_data(SELF) = attrs;
SET_ATTR_str_val(INTERP, SELF, str_val);
- PObj_custom_mark_destroy_SETALL(SELF);
+ PObj_custom_mark_SET(SELF);
}
/*
-=item C<void destroy()>
-
-Destroys this String PMC.
-
-=cut
-
-*/
-
- VTABLE void destroy() {
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
- }
-
-
-/*
-
=item C<PMC instantiate_str(STRING *rep)>
Class method to construct a String from the string representation C<rep>.
@@ -111,7 +92,6 @@
VTABLE PMC *clone() {
PMC * const dest = pmc_new(INTERP, SELF->vtable->base_type);
- PObj_custom_mark_destroy_SETALL(dest);
VTABLE_set_string_native(INTERP, dest, Parrot_str_copy(INTERP, SELF.get_string()));
return dest;
}
--- src/pmc/sub.pmc 2009-07-08 02:19:02.000000000 +0200
+++ src/pmc/sub.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: sub.pmc 39887 2009-07-05 05:02:03Z petdance $
+$Id: sub.pmc 40675 2009-08-20 13:13:11Z bacek $
=head1 NAME
@@ -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,17 +144,17 @@
*/
VTABLE STRING *get_string() {
- Parrot_sub *sub;
- PMC_get_sub(INTERP, SELF, sub);
+ STRING *name;
+ GET_ATTR_name(INTERP, SELF, name);
- if (sub->name)
- return Parrot_str_copy(INTERP, sub->name);
+ if (name)
+ return Parrot_str_copy(INTERP, name);
return NULL;
}
VTABLE void set_string_native(STRING *subname) {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PMC_get_sub(INTERP, SELF, sub);
sub->name = Parrot_str_copy(INTERP, subname);
}
@@ -163,7 +188,7 @@
*/
VTABLE void *get_pointer() {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PMC_get_sub(INTERP, SELF, sub);
return sub->seg->base.data + sub->start_offs;
}
@@ -181,10 +206,10 @@
*/
VTABLE INTVAL get_integer_keyed(PMC *key) {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
UNUSED(key)
-
PMC_get_sub(INTERP, SELF, sub);
+
return (INTVAL) (sub->seg->base.data);
}
@@ -219,7 +244,7 @@
*/
VTABLE opcode_t *invoke(void *next) {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
Parrot_Context *caller_ctx;
Parrot_Context *context;
PMC *ccont;
@@ -321,7 +346,7 @@
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);
outer_pmc = current_sub->outer_sub;
@@ -388,12 +413,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_attributes *sub;
+ /* XXX Why? */
/* we have to mark it ourselves */
PObj_custom_mark_destroy_SETALL(ret);
+ PMC_get_sub(INTERP, SELF, dest_sub);
PMC_get_sub(INTERP, ret, sub);
/* release any previously held contexts */
@@ -402,8 +429,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,8 +464,9 @@
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;
+ Parrot_Sub_attributes *my_sub;
+ Parrot_Sub_attributes *other_sub;
+
PMC_get_sub(INTERP, SELF, my_sub);
PMC_get_sub(INTERP, other, other_sub);
@@ -454,7 +480,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 +503,7 @@
*/
VTABLE void mark() {
- Parrot_sub *sub;
- PMC_get_sub(INTERP, SELF, sub);
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
if (!sub)
return;
@@ -520,7 +545,8 @@
*/
MULTI INTVAL is_equal(PMC *value) {
- Parrot_sub *my_sub, *value_sub;
+ Parrot_Sub_attributes *my_sub;
+ Parrot_Sub_attributes *value_sub;
PMC_get_sub(INTERP, SELF, my_sub);
PMC_get_sub(INTERP, value, value_sub);
@@ -545,7 +571,7 @@
*/
VTABLE void visit(visit_info *info) {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PMC_get_sub(INTERP, SELF, sub);
@@ -572,14 +598,13 @@
}
VTABLE void freeze(visit_info *info) {
- IMAGE_IO * const io = info->image_io;
- Parrot_sub *sub;
- STRING *hll_name;
+ IMAGE_IO * const io = info->image_io;
+ Parrot_Sub_attributes *sub;
+ STRING *hll_name;
int i;
- PMC_get_sub(INTERP, SELF, sub);
-
SUPER(info);
+ PMC_get_sub(INTERP, SELF, sub);
/*
* we currently need to write these items:
* - start offset in byte-code segment
@@ -644,7 +669,7 @@
SUPER(info);
if (info->extra_flags == EXTRA_IS_NULL) {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
INTVAL flags;
int i;
@@ -756,9 +781,9 @@
VTABLE PMC *inspect_str(STRING *what)
{
- Parrot_sub *sub;
- PMC *retval;
- INTVAL count_found = -1;
+ Parrot_Sub_attributes *sub;
+ PMC *retval;
+ INTVAL count_found = -1;
PMC_get_sub(INTERP, SELF, sub);
@@ -882,10 +907,14 @@
*/
METHOD get_namespace() {
- Parrot_sub *sub;
PMC *_namespace;
-
+ Parrot_Sub_attributes *sub;
PMC_get_sub(INTERP, SELF, sub);
+ /*
+ XXX Rakudo's failing with with this code on ASSERT. Why???
+ GET_ATTR_namespace_stash(INTERP, SELF, _namespace);
+ PARROT_ASSERT(_namespace == sub->namespace_stash || !"consistency!!!");
+ */
_namespace = sub->namespace_stash;
RETURN(PMC *_namespace);
}
@@ -896,12 +925,11 @@
* 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;
+ Parrot_Sub_attributes *sub;
+ char * const kind = Parrot_str_to_cstring(interp, reg);
+ INTVAL regs_used;
PMC_get_sub(INTERP, SELF, sub);
-
PARROT_ASSERT(sub->n_regs_used);
if (!*kind || kind[1]) {
@@ -922,37 +950,40 @@
}
METHOD get_lexinfo() {
- Parrot_sub *sub;
PMC *lexinfo;
+ GET_ATTR_lex_info(INTERP, SELF, lexinfo);
+
+ if (!lexinfo)
+ lexinfo = PMCNULL;
- PMC_get_sub(INTERP, SELF, sub);
- lexinfo = sub->lex_info ? sub->lex_info : PMCNULL;
RETURN(PMC *lexinfo);
}
METHOD get_subid() {
- Parrot_sub *sub;
STRING *subid;
+ GET_ATTR_subid(INTERP, SELF, subid);
+
+ if (!subid)
+ subid = CONST_STRING(interp, "");
- PMC_get_sub(INTERP, SELF, sub);
- subid = sub->subid ? sub->subid : CONST_STRING(interp, "");
RETURN(STRING *subid);
}
METHOD get_outer() {
- Parrot_sub *sub;
PMC *outersub;
+ GET_ATTR_outer_sub(INTERP, SELF, outersub);
+
+ if (!outersub)
+ outersub = PMCNULL;
- 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;
PMC_get_sub(INTERP, SELF, sub);
+
sub->outer_sub = outer;
/* Make sure outer flag of that sub is set. */
@@ -974,11 +1005,12 @@
}
METHOD get_multisig() {
- Parrot_sub *sub;
- PMC *multisig;
+ PMC *multisig;
+ GET_ATTR_multi_signature(INTERP, SELF, multisig);
+
+ if (!multisig)
+ multisig = PMCNULL;
- PMC_get_sub(INTERP, SELF, sub);
- multisig = sub->multi_signature ? sub->multi_signature : PMCNULL;
RETURN(PMC *multisig);
}
--- src/pmc/task.pmc 2009-08-02 14:06:53.000000000 +0200
+++ src/pmc/task.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2008, Parrot Foundation.
-$Id: task.pmc 40366 2009-08-01 22:49:23Z NotFound $
+$Id: task.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -20,7 +20,7 @@
#include "parrot/scheduler_private.h"
-pmclass Task need_ext {
+pmclass Task need_ext auto_attrs {
ATTR INTVAL id; /* The task ID. */
ATTR INTVAL priority; /* The priority of the task. */
ATTR FLOATVAL birthtime; /* The creation time stamp of the task. */
@@ -44,14 +44,12 @@
VTABLE void init() {
Parrot_Task_attributes * const core_struct =
- mem_allocate_zeroed_typed(Parrot_Task_attributes);
+ (Parrot_Task_attributes *) PMC_data(SELF);
- /* Set flags for custom GC mark and destroy. */
+ /* Set flags for custom GC mark. */
PObj_custom_mark_SET(SELF);
- PObj_active_destroy_SET(SELF);
/* Set up the core struct. */
- PMC_data(SELF) = core_struct;
core_struct->id = 0;
core_struct->type = CONST_STRING(interp, "");
core_struct->subtype = CONST_STRING(interp, "");
@@ -123,14 +121,12 @@
Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
"Task initializer must be a Hash");
- core_struct = mem_allocate_zeroed_typed(Parrot_Task_attributes);
+ core_struct = (Parrot_Task_attributes *) PMC_data(SELF);
- /* Set flags for custom GC mark and destroy. */
+ /* Set flags for custom GC mark. */
PObj_custom_mark_SET(SELF);
- PObj_active_destroy_SET(SELF);
/* Set up the core struct. */
- PMC_data(SELF) = core_struct;
elem = VTABLE_get_pmc_keyed_str(INTERP, data, CONST_STRING(INTERP, "id"));
if (! PMC_IS_NULL(elem))
@@ -369,20 +365,6 @@
/*
-=item C<void destroy()>
-
-Free the task's underlying struct.
-
-=cut
-
-*/
- VTABLE void destroy() {
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
- }
-
-/*
-
=item C<void mark()>
Mark any referenced strings and PMCs.
--- src/pmc/timer.pmc 2009-08-02 14:06:53.000000000 +0200
+++ src/pmc/timer.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2008, Parrot Foundation.
-$Id: timer.pmc 40366 2009-08-01 22:49:23Z NotFound $
+$Id: timer.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -57,7 +57,7 @@
#include "parrot/scheduler_private.h"
-pmclass Timer extends Task provides event need_ext {
+pmclass Timer extends Task provides event need_ext auto_attrs {
ATTR FLOATVAL duration; /* The duration of the timer pause */
ATTR FLOATVAL interval; /* How often to repeat */
ATTR INTVAL repeat; /* Whether to repeat:
@@ -75,14 +75,13 @@
VTABLE void init() {
Parrot_Timer_attributes * const core_struct =
- mem_allocate_zeroed_typed(Parrot_Timer_attributes);
+ (Parrot_Timer_attributes *) PMC_data(SELF);
/* Set flags for custom GC mark and destroy. */
PObj_custom_mark_SET(SELF);
PObj_active_destroy_SET(SELF);
/* Set up the core struct. */
- PMC_data(SELF) = core_struct;
core_struct->id = 0;
core_struct->type = CONST_STRING(interp, "timer");
core_struct->subtype = CONST_STRING(interp, "");
@@ -179,8 +178,6 @@
VTABLE void destroy() {
Parrot_cx_delete_task(INTERP, SELF);
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
}
/*
--- src/pmc/undef.pmc 2009-07-08 02:19:02.000000000 +0200
+++ src/pmc/undef.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2004-2009, Parrot Foundation.
-$Id: undef.pmc 39479 2009-06-09 21:00:23Z chromatic $
+$Id: undef.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -57,7 +57,6 @@
VTABLE_destroy(interp, clone);
PObj_is_object_SET(SELF);
- PObj_active_destroy_SET(SELF);
}
}
--- src/pmc/unmanagedstruct.pmc 2009-08-02 14:06:53.000000000 +0200
+++ src/pmc/unmanagedstruct.pmc 2009-08-20 19:56:26.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: unmanagedstruct.pmc 40365 2009-08-01 22:10:42Z NotFound $
+$Id: unmanagedstruct.pmc 40628 2009-08-18 17:24:24Z NotFound $
=head1 NAME
@@ -651,7 +651,7 @@
return toff;
}
-pmclass UnManagedStruct need_ext no_ro {
+pmclass UnManagedStruct need_ext auto_attrs no_ro {
ATTR void *ptr; /* the struct that this UnManagedStruct isn't managing */
ATTR PMC *init; /* the initializer used with this UnManagedStruct */
ATTR INTVAL size; /* the size of the struct */
@@ -664,39 +664,6 @@
=over 4
-=item C<void init()>
-
-Initializes the C<struct> with a default value of C<NULL>.
-
-=cut
-
-*/
-
- VTABLE void init() {
- Parrot_UnManagedStruct_attributes *attrs =
- mem_allocate_zeroed_typed(Parrot_UnManagedStruct_attributes);
- PMC_data(SELF) = attrs;
- PObj_active_destroy_SET(SELF);
- }
-
-/*
-
-=item C<void destroy()>
-
-Destroys the subroutine.
-
-=cut
-
-*/
-
- VTABLE void destroy() {
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
- }
-
-
-/*
-
=item C<void init_pmc(PMC *value)>
Initialize the struct with some data.
@@ -724,9 +691,6 @@
*/
VTABLE void init_pmc(PMC *value) {
- Parrot_UnManagedStruct_attributes *attrs =
- mem_allocate_zeroed_typed(Parrot_UnManagedStruct_attributes);
- PMC_data(SELF) = attrs;
SELF.set_pmc(value);
}
--- src/pmc.c 2009-08-15 03:57:47.000000000 +0200
+++ src/pmc.c 2009-08-20 19:56:27.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: pmc.c 40100 2009-07-15 13:15:25Z bacek $
+$Id: pmc.c 40641 2009-08-18 22:39:00Z whiteknight $
=head1 NAME
@@ -241,6 +241,24 @@
/* Set the right vtable */
pmc->vtable = new_vtable;
+ if (PMC_data(pmc) && pmc->vtable->attr_size) {
+#if GC_USE_FIXED_SIZE_ALLOCATOR
+ Parrot_gc_free_pmc_attributes(interp, pmc, pmc->vtable->attr_size);
+#else
+ mem_sys_free(PMC_data(pmc));
+#endif
+ }
+
+ if (new_vtable->attr_size) {
+#if GC_USE_FIXED_SIZE_ALLOCATOR
+ Parrot_gc_allocate_pmc_attributes(interp, pmc, pmc->vtable->attr_size);
+#else
+ PMC_data(pmc) = mem_sys_allocate_zeroed(new_vtable->attr_size);
+#endif
+}
+ else
+ PMC_data(pmc) = NULL;
+
return pmc;
}
@@ -361,6 +379,14 @@
/* Do we have an extension area? */
INTVAL const has_ext = (PObj_is_PMC_EXT_TEST(pmc) && pmc->pmc_ext);
+ if (PMC_data(pmc) && pmc->vtable->attr_size) {
+#if GC_USE_FIXED_SIZE_ALLOCATOR
+ Parrot_gc_free_pmc_attributes(interp, pmc, pmc->vtable->attr_size);
+#else
+ mem_sys_free(PMC_data(pmc));
+#endif
+ }
+
/* Do we need one? */
if (flags & VTABLE_PMC_NEEDS_EXT) {
/* If we need an ext area, go allocate one */
@@ -465,6 +491,14 @@
pmc = Parrot_gc_new_pmc_header(interp, flags);
pmc->vtable = vtable;
+ if (vtable->attr_size) {
+#if GC_USE_FIXED_SIZE_ALLOCATOR
+ Parrot_gc_allocate_pmc_attributes(interp, pmc, pmc->vtable->attr_size);
+#else
+ PMC_data(pmc) = mem_sys_allocate_zeroed(vtable->attr_size);
+#endif
+ }
+
#if GC_VERBOSE
if (Interp_flags_TEST(interp, PARROT_TRACE_FLAG)) {
/* XXX make a more verbose trace flag */
--- src/runcore/trace.c 2009-08-02 14:36:27.000000000 +0200
+++ src/runcore/trace.c 2009-08-20 19:56:25.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: trace.c 40288 2009-07-26 22:03:33Z whiteknight $
+$Id: trace.c 40643 2009-08-18 22:57:11Z bacek $
=head1 NAME
@@ -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)");
--- src/sub.c 2009-08-02 14:36:26.000000000 +0200
+++ src/sub.c 2009-08-20 19:56:27.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: sub.c 40310 2009-07-28 17:40:11Z NotFound $
+$Id: sub.c 40643 2009-08-18 22:57:11Z bacek $
=head1 NAME
@@ -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,
--- src/thread.c 2009-08-02 14:36:27.000000000 +0200
+++ src/thread.c 2009-08-20 19:56:27.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: thread.c 40021 2009-07-12 19:32:44Z NotFound $
+$Id: thread.c 40643 2009-08-18 22:57:11Z bacek $
=head1 NAME
@@ -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);
--- src/vtables.c 2009-08-02 14:36:26.000000000 +0200
+++ src/vtables.c 2009-08-20 19:56:27.000000000 +0200
@@ -1,6 +1,6 @@
/*
Copyright (C) 2001-2009, Parrot Foundation.
-$Id: vtables.c 39076 2009-05-23 10:38:31Z chromatic $
+$Id: vtables.c 40673 2009-08-20 11:05:41Z NotFound $
=head1 NAME
@@ -19,6 +19,10 @@
#include "parrot/parrot.h"
#include "parrot/vtables.h"
+/* This function is defined in the auto-generated file core_pmcs.c */
+/* XXX Get it into some public place */
+extern void Parrot_initialize_core_pmcs(PARROT_INTERP, int pass);
+
/* HEADERIZER HFILE: include/parrot/vtables.h */
/*
@@ -222,6 +226,28 @@
}
/*
+
+=item C<void Parrot_initialize_core_vtables(PARROT_INTERP)>
+
+Initialize vtables for the core PMCs.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+void
+Parrot_initialize_core_vtables(PARROT_INTERP)
+{
+ ASSERT_ARGS(Parrot_initialize_core_vtables)
+
+ if (! interp->vtables) {
+ parrot_alloc_vtables(interp);
+ Parrot_initialize_core_pmcs(interp, 0);
+ }
+}
+
+/*
* Local variables:
* c-file-style: "parrot"
* End:
Binärdateien t/native_pbc/annotations.pbc and t/native_pbc/annotations.pbc sind verschieden.
Binärdateien t/native_pbc/integer_1.pbc and t/native_pbc/integer_1.pbc sind verschieden.
Binärdateien t/native_pbc/number_1.pbc and t/native_pbc/number_1.pbc sind verschieden.
Binärdateien t/native_pbc/string_1.pbc and t/native_pbc/string_1.pbc sind verschieden.
--- t/op/arithmetics.t 2009-08-16 13:54:58.000000000 +0200
+++ t/op/arithmetics.t 2009-08-20 19:56:30.000000000 +0200
@@ -1,13 +1,13 @@
#!perl
# Copyright (C) 2001-2009, Parrot Foundation.
-# $Id: arithmetics.t 40588 2009-08-16 09:00:17Z dukeleto $
+# $Id: arithmetics.t 40671 2009-08-20 09:17:12Z dukeleto $
use strict;
use warnings;
use lib qw( . lib ../lib ../../lib );
use Test::More;
-use Parrot::Test tests => 26;
+use Parrot::Test tests => 27;
# test for GMP
use Parrot::Config;
@@ -697,6 +697,33 @@
-Inf
OUTPUT
+TODO: {
+
+local $TODO = 'rounding nan/inf gives something like -2147483648';
+pir_output_is(<<CODE,<<OUTPUT, "TT #370 Rounding inf/nan");
+.sub 'main'
+ \$N0 = 'Inf'
+ \$I0 = floor \$N0
+ say \$I0
+ \$N0 = 'NaN'
+ \$I0 = floor \$N0
+ say \$I0
+ \$N0 = 'Inf'
+ \$I0 = ceil \$N0
+ say \$I0
+ \$N0 = 'NaN'
+ \$I0 = ceil \$N0
+ say \$I0
+ .end
+CODE
+Inf
+NaN
+Inf
+NaN
+OUTPUT
+
+}
+
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
Nur in t/op: exit.t.
--- tools/dev/nm.pl 2009-07-08 02:19:04.000000000 +0200
+++ tools/dev/nm.pl 2009-06-28 22:26:06.000000000 +0200
@@ -143,7 +143,7 @@
$VERSION = sprintf "%d.%d", q$Revision: 37201 $ =~ /(\d+)/g; # jhi@iki.fi;
my $ME = basename($0);
-my $RCS_DATE = q$Date: 2009-03-08 08:07:48 -0400 (Sun, 08 Mar 2009) $;
+my $RCS_DATE = q$Date: 2009-03-08 13:07:48 +0100 (So, 08. Mär 2009) $;
my $nm_cmd = 'nm';
my $nm_opt = '';
--- tools/dev/install_files.pl 2009-07-13 10:26:40.000000000 +0200
+++ tools/dev/install_files.pl 2009-07-13 13:37:49.000000000 +0200
@@ -163,7 +163,7 @@
# libdir as it is typically done with automake installed packages.
# If there is a use case to make this configurable we'll add a
# seperate --pkgconfigdir option.
- $filehash->{DestDirs} = ['pkgconfig', $parrotdir];
+ $filehash->{DestDirs} = ['pkgconfig'];
return($filehash);
},
},
--- config/gen/makefiles/parrot_pc.in 2009-06-06 16:33:32.000000000 +0200
+++ config/gen/makefiles/parrot_pc.in.new 2009-07-13 23:09:45.000000000 +0200
@@ -7,4 +7,4 @@
Description: virtual machine to execute bytecode for interpreted languages
Version: @VERSION@
Libs: -L${libdir} -lparrot @icu_shared@ @libs@
-Cflags: -I${includedir}
+Cflags: -I${includedir}@versiondir@
--- lib/Parrot/Install.pm 2009-06-01 09:29:57.000000000 +0200
+++ lib/Parrot/Install.pm 2009-06-03 08:41:22.000000000 +0200
@@ -220,6 +220,16 @@
else {
next unless -e $src;
next if $^O eq 'cygwin' and -e "$src.exe"; # stat works, copy not
+ if (-l $src) {
+ # check if the system supports symbolic linking
+ use Config;
+ if ($Config{d_symlink} && $Config{d_readlink}) {
+ # copy as symbolic link
+ symlink(readlink($src), $dest);
+ print "$dest\n";
+ next;
+ }
+ }
copy( $src, $dest ) or die "Error: couldn't copy $src to $dest: $!\n";
print "$dest\n";
}
--- /dev/null 2009-07-29 14:58:11.425144471 +0200
+++ t/op/exit.t 2009-08-20 19:56:30.000000000 +0200
@@ -0,0 +1,72 @@
+#!perl
+# Copyright (C) 2009, Parrot Foundation.
+# $Id: exit.t 40662 2009-08-19 18:02:12Z mikehh $
+
+use strict;
+use warnings;
+use lib qw( . lib ../lib ../../lib );
+
+use Test::More;
+use Parrot::Test tests => 7;
+
+=head1 NAME
+
+t/op/exit.t - Testing the exit pseudo-opcode
+
+=head1 SYNOPSIS
+
+ % prove t/op/exit.t
+
+=head1 DESCRIPTION
+
+Test both success and failure exit status.
+
+=cut
+
+pir_exit_code_is( <<'CODE', 0, 'pir exit with success' );
+.sub main
+ exit 0
+.end
+CODE
+
+pir_exit_code_is( <<'CODE', 1, 'pir exit with failure' );
+.sub main
+ exit 1
+.end
+CODE
+
+pasm_exit_code_is( <<'CODE', 1, 'pasm exit with failure' );
+ exit 1
+CODE
+
+pasm_exit_code_is( <<'CODE', 0, 'pasm exit without failure' );
+ exit 0
+CODE
+
+# If you know of a better place to put these tests, please put them there
+
+pir_exit_code_is( <<'CODE', 0, 'pir exits with success by default' );
+.sub main
+ $S0 = "cheese"
+.end
+CODE
+
+TODO: {
+ local $TODO = 'pasm exits with 1 by default';
+ pasm_exit_code_is( <<'CODE', 0, 'exit with success by default' );
+ set I0, 0
+CODE
+
+}
+TODO: {
+ local $TODO = 'pbc exits with 1 by default';
+ # Should we be using this file?
+ my $pbc = File::Spec->catfile(qw/ t native_pbc integer_1.pbc /);
+ pbc_exit_code_is($pbc, 0, 'pbc exits with 0 by default');
+}
+
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4: