[svn:parrot] r40639 - in branches/tt795_kill_parrot_sub_structure: . config/gen/platform/generic docs docs/project examples/benchmarks examples/opengl lib/Parrot lib/Parrot/Pmc2c src src/dynpmc src/gc src/pmc src/runcore t/benchmark t/op t/tools tools/util
bacek at svn.parrot.org
bacek at svn.parrot.org
Tue Aug 18 22:38:06 UTC 2009
Author: bacek
Date: Tue Aug 18 22:38:01 2009
New Revision: 40639
URL: https://trac.parrot.org/parrot/changeset/40639
Log:
Bring branch up-to-date with trunk
Added:
branches/tt795_kill_parrot_sub_structure/t/tools/pbc_disassemble.t
branches/tt795_kill_parrot_sub_structure/t/tools/pbc_dump.t
Modified:
branches/tt795_kill_parrot_sub_structure/CREDITS
branches/tt795_kill_parrot_sub_structure/ChangeLog
branches/tt795_kill_parrot_sub_structure/DEPRECATED.pod
branches/tt795_kill_parrot_sub_structure/MANIFEST
branches/tt795_kill_parrot_sub_structure/MANIFEST.generated
branches/tt795_kill_parrot_sub_structure/META.yml
branches/tt795_kill_parrot_sub_structure/NEWS
branches/tt795_kill_parrot_sub_structure/README
branches/tt795_kill_parrot_sub_structure/VERSION
branches/tt795_kill_parrot_sub_structure/config/gen/platform/generic/platform_limits.h
branches/tt795_kill_parrot_sub_structure/docs/embed.pod
branches/tt795_kill_parrot_sub_structure/docs/parrothist.pod
branches/tt795_kill_parrot_sub_structure/docs/project/release_manager_guide.pod
branches/tt795_kill_parrot_sub_structure/examples/benchmarks/primes.pasm
branches/tt795_kill_parrot_sub_structure/examples/opengl/shapes.pir
branches/tt795_kill_parrot_sub_structure/lib/Parrot/Pmc2c/PMCEmitter.pm
branches/tt795_kill_parrot_sub_structure/lib/Parrot/Test.pm
branches/tt795_kill_parrot_sub_structure/lib/Parrot/Vtable.pm
branches/tt795_kill_parrot_sub_structure/src/dynpmc/dynlexpad.pmc
branches/tt795_kill_parrot_sub_structure/src/dynpmc/foo.pmc
branches/tt795_kill_parrot_sub_structure/src/dynpmc/foo2.pmc
branches/tt795_kill_parrot_sub_structure/src/dynpmc/rotest.pmc
branches/tt795_kill_parrot_sub_structure/src/gc/api.c
branches/tt795_kill_parrot_sub_structure/src/packfile.c
branches/tt795_kill_parrot_sub_structure/src/pmc.c
branches/tt795_kill_parrot_sub_structure/src/pmc/arrayiterator.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/boolean.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/callsignature.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/capture.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/class.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/codestring.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/complex.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/continuation.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/cpointer.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/default.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/exception.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/exceptionhandler.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/exporter.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/filehandle.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/fixedbooleanarray.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/fixedfloatarray.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/fixedintegerarray.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/fixedpmcarray.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/fixedstringarray.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/float.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/hashiterator.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/hashiteratorkey.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/integer.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/key.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/lexpad.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/managedstruct.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/multisub.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/nci.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/orderedhashiterator.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/parrotinterpreter.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/parrotlibrary.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/pmcproxy.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/pointer.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/resizablebooleanarray.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/resizablefloatarray.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/resizableintegerarray.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/resizablepmcarray.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/resizablestringarray.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/retcontinuation.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/role.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/scheduler.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/schedulermessage.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/sockaddr.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/socket.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/string.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/stringhandle.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/stringiterator.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/task.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/timer.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/undef.pmc
branches/tt795_kill_parrot_sub_structure/src/pmc/unmanagedstruct.pmc
branches/tt795_kill_parrot_sub_structure/src/runcore/main.c
branches/tt795_kill_parrot_sub_structure/t/benchmark/benchmarks.t
branches/tt795_kill_parrot_sub_structure/t/op/arithmetics.t
branches/tt795_kill_parrot_sub_structure/t/op/gc.t
branches/tt795_kill_parrot_sub_structure/tools/util/release.json
Modified: branches/tt795_kill_parrot_sub_structure/CREDITS
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/CREDITS Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/CREDITS Tue Aug 18 22:38:01 2009 (r40639)
@@ -92,7 +92,7 @@
N: Andrew Whitworth
D: Internals development
D: Documentation
-D: Release manager for 0.8.2 and 1.3.0
+D: Release manager for 0.8.2, 1.3.0 and 1.5.0
E: wknight8111 at gmail.com
U: Whiteknight
Modified: branches/tt795_kill_parrot_sub_structure/ChangeLog
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/ChangeLog Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/ChangeLog Tue Aug 18 22:38:01 2009 (r40639)
@@ -1,5 +1,9 @@
#1 $Id$
+2009.8.18 Whiteknight
+ * Released 1.5.0
+ See NEWS for more.
+
2009.7.21 cotto
* Released 1.4.0
See NEWS for more.
Modified: branches/tt795_kill_parrot_sub_structure/DEPRECATED.pod
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/DEPRECATED.pod Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/DEPRECATED.pod Tue Aug 18 22:38:01 2009 (r40639)
@@ -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
Modified: branches/tt795_kill_parrot_sub_structure/MANIFEST
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/MANIFEST Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/MANIFEST Tue Aug 18 22:38:01 2009 (r40639)
@@ -2087,6 +2087,8 @@
t/tools/ops2pm/samples/ops_num.original [test]
t/tools/ops2pm/samples/pic_ops.original [test]
t/tools/parrot_debugger.t [test]
+t/tools/pbc_disassemble.t [test]
+t/tools/pbc_dump.t [test]
t/tools/pbc_merge.t [test]
t/tools/pgegrep.t [test]
t/tools/pmc2c.t [test]
Modified: branches/tt795_kill_parrot_sub_structure/MANIFEST.generated
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/MANIFEST.generated Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/MANIFEST.generated Tue Aug 18 22:38:01 2009 (r40639)
@@ -2,10 +2,10 @@
# See tools/dev/install_files.pl for documentation on the
# format of this file.
# Please re-sort this file after *EVERY* modification
-blib/lib/libparrot.1.4.0.dylib [main]lib
+blib/lib/libparrot.1.5.0.dylib [main]lib
blib/lib/libparrot.a [main]lib
blib/lib/libparrot.dylib [main]lib
-blib/lib/libparrot.so.1.4.0 [main]lib
+blib/lib/libparrot.so.1.5.0 [main]lib
blib/lib/libparrot.so [main]lib
compilers/json/JSON/grammar.pbc [json]
compilers/json/JSON.pbc [json]
@@ -94,6 +94,14 @@
runtime/parrot/dynext/match_group.dll [library]
runtime/parrot/dynext/match_group.dylib [library]
runtime/parrot/dynext/match_group.so [library]
+runtime/parrot/dynext/math_ops.so [library]
+runtime/parrot/dynext/math_ops.bundle [library]
+runtime/parrot/dynext/math_ops.dll [library]
+runtime/parrot/dynext/math_ops.dylib [library]
+runtime/parrot/dynext/obscure_ops.bundle [library]
+runtime/parrot/dynext/obscure_ops.dll [library]
+runtime/parrot/dynext/obscure_ops.dylib [library]
+runtime/parrot/dynext/obscure_ops.so [library]
runtime/parrot/dynext/rational.bundle [library]
runtime/parrot/dynext/rational.dll [library]
runtime/parrot/dynext/rational.dylib [library]
Modified: branches/tt795_kill_parrot_sub_structure/META.yml
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/META.yml Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/META.yml Tue Aug 18 22:38:01 2009 (r40639)
@@ -4,7 +4,7 @@
# See http://module-build.sourceforge.net/META-spec-current.html for details.
---
name: parrot
-version: 1.4.0
+version: 1.5.0
author: parrot-dev at lists.parrot.org
abstract: a virtual machine designed for dynamic languages
license: artistic2
Modified: branches/tt795_kill_parrot_sub_structure/NEWS
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/NEWS Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/NEWS Tue Aug 18 22:38:01 2009 (r40639)
@@ -1,5 +1,36 @@
# $Id$
+New in 1.5.0
+- Core
+ + Removed several deprecated functions and features
+ + Removed bsr, jsr, branch_cs, and ret opcodes
+ + Removed global stacks system
+ + Changed OPS file format to include explicit preamble
+ + Changed all "new 'Iterator'" instructions into 'iter' instructions
+ + Removed Configure.pl options for specifying non-working GC cores
+ + Removed unexecuting code as found by Coverity
+ + Improvements to the Parrot Debugger
+ + Added experimental fixed-size structure allocator to the GC
+ + Added experimental lazy arena allocation to the GC
+ + 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
+ + Optimization and Improvements to the NCI thunk generator
+ + New include file libpaths.pasm
+- Compilers
+ + Multiple .local with same name and different type is now an error on IMCC.
+- Platforms
+ + Improved support for detecting Fink and Macports
+ + Updated search directories for libraries
+- Documentation
+ + "Parrot Developers Guide: PIR" released to publisher and available to purchase
+ + 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
+
New in 1.4.0
- Core
+ Key and Iterator refactor
Modified: branches/tt795_kill_parrot_sub_structure/README
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/README Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/README Tue Aug 18 22:38:01 2009 (r40639)
@@ -1,4 +1,4 @@
-This is Parrot, version 1.4.0
+This is Parrot, version 1.5.0
------------------------------
Parrot is Copyright (C) 2001-2009, Parrot Foundation.
Modified: branches/tt795_kill_parrot_sub_structure/VERSION
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/VERSION Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/VERSION Tue Aug 18 22:38:01 2009 (r40639)
@@ -1 +1 @@
-1.4.0
+1.5.0
Modified: branches/tt795_kill_parrot_sub_structure/config/gen/platform/generic/platform_limits.h
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/config/gen/platform/generic/platform_limits.h Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/config/gen/platform/generic/platform_limits.h Tue Aug 18 22:38:01 2009 (r40639)
@@ -1,6 +1,6 @@
/*
* $Id$
- * Copyright (C) 2008, Parrot Foundation.
+ * 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
Modified: branches/tt795_kill_parrot_sub_structure/docs/embed.pod
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/docs/embed.pod Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/docs/embed.pod Tue Aug 18 22:38:01 2009 (r40639)
@@ -344,11 +344,6 @@
Sets the value of a global called C<name> in the namespace C<namespace>. Does
nothing if the global is not found.
-=item C<Parrot_PMC Parrot_find_global_k(PARROT_INTERP, Parrot_PMC namespace_key, Parrot_String name)>
-
-Find and return a global called C<name> in the keyed namespace C<namespace>.
-Returns C<PMCNULL> if not found.
-
=back
=head3 Lexicals
Modified: branches/tt795_kill_parrot_sub_structure/docs/parrothist.pod
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/docs/parrothist.pod Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/docs/parrothist.pod Tue Aug 18 22:38:01 2009 (r40639)
@@ -94,5 +94,7 @@
Whiteknight 1.3.0 2009-Jun-16 "Andean Swift"
cotto 1.4.0 2009-Jul-21 "Mundo Cani"
+ Whiteknight 1.5.0 2009-Aug-18 "TEH PARROTZ!"
+
=cut
Modified: branches/tt795_kill_parrot_sub_structure/docs/project/release_manager_guide.pod
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/docs/project/release_manager_guide.pod Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/docs/project/release_manager_guide.pod Tue Aug 18 22:38:01 2009 (r40639)
@@ -364,9 +364,8 @@
The starred releases are Parrot's twice-yearly supported releases, see
F<docs/project/support_policy.pod>.
- - August 18, 2009 - 1.5 - Whiteknight
- Sept 15, 2009 - 1.6 - particle
- - Oct 20, 2009 - 1.7 -
+ - Oct 20, 2009 - 1.7 - dukeleto
- Nov 17, 2009 - 1.8 -
- Dec 15, 2009 - 1.9 -
- Jan 19, 2010 - 2.0* -
Modified: branches/tt795_kill_parrot_sub_structure/examples/benchmarks/primes.pasm
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/examples/benchmarks/primes.pasm Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/examples/benchmarks/primes.pasm Tue Aug 18 22:38:01 2009 (r40639)
@@ -1,9 +1,9 @@
-# Copyright (C) 2001-2006, Parrot Foundation.
+# Copyright (C) 2001-2009, Parrot Foundation.
# $Id$
=head1 NAME
-examples/benchmarks/primes.pasm - Calculate prime numbers < 50000
+examples/benchmarks/primes.pasm - Calculate prime numbers < 5000
=head1 SYNOPSIS
@@ -11,57 +11,62 @@
=head1 DESCRIPTION
-Calculates all the prime numbers up to 50000 and prints out the number
+Calculates all the prime numbers up to 5000 and prints out the number
of primes, the last one found, and the time taken.
=cut
-# I1 holds the number we're currently checking for primality
- new P1, 'Integer'
- set P1, 1
- # I2 holds the highest number we want to check for primality
- new P2, 'Integer'
- set P2, 1000
- new P6, 'Integer'
- set P6, 0
- print "N primes up to "
- print P2
- print " is: "
- time N10
- # I1 counts up to I2
-REDO: # I3 counts from 2 up to I4 (I1/2)
- new P3, 'Integer'
- set P3, 2
- new P4, 'Integer'
- div P4, P1, 2
-LOOP: # Check if I3 is a factor of I1
- new P5, 'Integer'
- cmod P5, P1, P3
- if P5, OK
- # We've found a factor, so it can't be a prime and
- # we can skip right out of this loop and to the next
- # number
- branch NEXT
-OK: inc P3
- le P3, P4, LOOP
- # We haven't found a factor so it must be a prime
- inc P6
- set P7, P1
- # print I1
- # print "\n" # to get them all
-NEXT: # Move on to the next number
- inc P1
- le P1, P2, REDO
- time N11
- print P6
- print "\nlast is: "
- print P7
- print "\n"
- sub N11, N10
- print "Elapsed time: "
- print N11
- print "\n"
- end
+ # P1 holds the number we're currently checking for primality
+ new P1, 'Integer'
+ set P1, 1
+
+ # P2 holds the highest number we want to check for primality
+ new P2, 'Integer'
+ set P2, 5000
+
+ new P6, 'Integer'
+ set P6, 0
+ print "N primes up to "
+ print P2
+ print " is: "
+ time N10
+
+ # P1 counts up to P2
+ # P3 counts from 2 up to P4 (P1/2)
+ new P3, 'Integer'
+
+REDO:
+ set P3, 2
+ div P4, P1, 2
+ # Check if P3 is a factor of P1
+LOOP:
+ cmod P5, P1, P3
+ if P5, OK
+
+ # We've found a factor, so it can't be a prime and
+ # we can skip right out of this loop and to the next number
+ branch NEXT
+OK:
+ inc P3
+ le P3, P4, LOOP
+ # We haven't found a factor so it must be a prime
+ inc P6
+ set P7, P1
+ # print I1
+ # print "\n" # to get them all
+
+ # Move on to the next number
+NEXT:
+ inc P1
+ le P1, P2, REDO
+ time N11
+ say P6
+ print "last is: "
+ say P7
+ sub N11, N10
+ print "Elapsed time: "
+ say N11
+ end
=head1 SEE ALSO
Modified: branches/tt795_kill_parrot_sub_structure/examples/opengl/shapes.pir
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/examples/opengl/shapes.pir Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/examples/opengl/shapes.pir Tue Aug 18 22:38:01 2009 (r40639)
@@ -405,15 +405,15 @@
random = rand 0, 0.1
z += random
- rand random
+ random = rand
random -= .5
random *= .01
vx += random
- random = random
+ random = rand
random -= .5
random *= .01
vy += random
- random = random
+ random = rand
random -= .5
random *= .01
vz += random
Modified: branches/tt795_kill_parrot_sub_structure/lib/Parrot/Pmc2c/PMCEmitter.pm
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/lib/Parrot/Pmc2c/PMCEmitter.pm Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/lib/Parrot/Pmc2c/PMCEmitter.pm Tue Aug 18 22:38:01 2009 (r40639)
@@ -464,7 +464,8 @@
NULL, /* mro */
NULL, /* attribute_defs */
NULL, /* ro_variant_vtable */
- $methlist
+ $methlist,
+ 0 /* attr size */
};
ENDOFCODE
return $cout;
@@ -640,6 +641,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;
@@ -761,6 +763,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 +786,8 @@
}
}
+ $vtable_updates .= $set_attr_size;
+
$cout .= <<"EOC";
$export
@@ -793,6 +813,8 @@
}
}
+ $vtable_updates .= $set_attr_size;
+
$cout .= <<"EOC";
$export
Modified: branches/tt795_kill_parrot_sub_structure/lib/Parrot/Test.pm
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/lib/Parrot/Test.pm Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/lib/Parrot/Test.pm Tue Aug 18 22:38:01 2009 (r40639)
@@ -275,7 +275,7 @@
require Test::Builder;
require Test::More;
-our @EXPORT = qw( plan run_command skip slurp_file);
+our @EXPORT = qw( plan run_command skip slurp_file pbc_postprocess_output_like );
use base qw( Exporter );
@@ -492,6 +492,59 @@
}
}
+=over
+
+=item "pbc_postprocess_output_like"
+
+Takes a path to binary which will post process PBC, a file to run, the extension
+of the file, one regex or an array reference of regexes, and an optional
+diagnostic message. This function generates PBC for the input file, then post
+processes this with the binary and captures the output. The output is then
+verified to match the single or multiple regular expressions given.
+
+ my $postprocess = File::Spec->catfile( ".", "pbc_dump" );
+ my $file = 'foo.pir';
+ my $ext = 'pir';
+ my $check = [ qr/has a foo/, qr/and a bar/ ];
+ pbc_postprocess_output_like ( $postprocess,
+ $file, $ext, $check,
+ "checking pbc_dump"
+ );
+
+=back
+
+=cut
+
+sub pbc_postprocess_output_like {
+ my ( $postprocess, $file, $ext, $check, $diag ) = @_;
+ my $testno = $builder->current_test() + 1;
+ my $codefn = "$0.$testno.$ext";
+ my $pbcfn = "$0.$testno.pbc";
+ my $stdoutfn = "$0.$testno.stdout";
+ my $f = IO::File->new(">$codefn");
+ my $parrot = File::Spec->catfile( ".", $PConfig{test_prog} );
+ $f->print($file);
+ $f->close();
+ system("$parrot -o $pbcfn $codefn 2>&1");
+ system("$postprocess $pbcfn >$stdoutfn 2>&1");
+ $f = IO::File->new($stdoutfn);
+
+ my $output = join( '', <$f> );
+
+ local $Test::Builder::Level = $Test::Builder::Level + 1;
+ unlink ($codefn, $pbcfn, $stdoutfn);
+ if (ref $check eq 'ARRAY') {
+ for my $regex (@$check) {
+ Test::More::like( $output, $regex, $diag );
+ $testno++;
+ }
+ }
+ else {
+ Test::More::like( $output, $check, $diag );
+ }
+
+}
+
# The following methods are private. They should not be used by modules
# inheriting from Parrot::Test.
Modified: branches/tt795_kill_parrot_sub_structure/lib/Parrot/Vtable.pm
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/lib/Parrot/Vtable.pm Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/lib/Parrot/Vtable.pm Tue Aug 18 22:38:01 2009 (r40639)
@@ -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;
Modified: branches/tt795_kill_parrot_sub_structure/src/dynpmc/dynlexpad.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/dynpmc/dynlexpad.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/dynpmc/dynlexpad.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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;
}
/*
Modified: branches/tt795_kill_parrot_sub_structure/src/dynpmc/foo.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/dynpmc/foo.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/dynpmc/foo.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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;
Modified: branches/tt795_kill_parrot_sub_structure/src/dynpmc/foo2.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/dynpmc/foo2.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/dynpmc/foo2.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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();
Modified: branches/tt795_kill_parrot_sub_structure/src/dynpmc/rotest.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/dynpmc/rotest.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/dynpmc/rotest.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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 {
Modified: branches/tt795_kill_parrot_sub_structure/src/gc/api.c
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/gc/api.c Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/gc/api.c Tue Aug 18 22:38:01 2009 (r40639)
@@ -48,16 +48,17 @@
buffers. String storage is managed by special Memory_Pool structures, and use
a separate compacting garbage collector to keep track of them.
-=item F<src/gc/gc_ims.c>
+=item F<src/gc/incremental_ms.c>
-=item F<src/gc/gc_gms.c>
+=item F<src/gc/generational_ms.c>
=item F<src/gc/gc_ms.c>
These files are the individual GC cores which implement the primary tracing
-and sweeping logic. gc_ms.c is the mark&sweep collector core which is used in
-Parrot by default. gc_gms.c is an experimental and incomplete generational core.
-gc_ims.c is an experimental and incomplete incremental collector core.
+and sweeping logic. gc_ms.c is the mark & sweep collector core which is used in
+Parrot by default. generational_ms.c is an experimental and incomplete
+generational core. incremental_ms.c is an experimental and incomplete
+incremental collector core.
=item F<src/gc/mark_sweep.c>
@@ -373,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);
Modified: branches/tt795_kill_parrot_sub_structure/src/packfile.c
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/packfile.c Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/packfile.c Tue Aug 18 22:38:01 2009 (r40639)
@@ -1005,7 +1005,7 @@
/* 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
+ * tools/dev/pbc_header.pl --upd t/native_pbc/*.pbc
* stamps version and fingerprint in the native tests. */
if (header->bc_major != PARROT_PBC_MAJOR
|| header->bc_minor != PARROT_PBC_MINOR) {
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc.c
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc.c Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc.c Tue Aug 18 22:38:01 2009 (r40639)
@@ -241,6 +241,24 @@
/* Set the right vtable */
pmc->vtable = new_vtable;
+ if (PMC_data(pmc) && pmc->vtable->attr_size) {
+#if 0
+ mem_sys_free(PMC_data(pmc));
+#else
+ Parrot_gc_free_pmc_attributes(interp, pmc, pmc->vtable->attr_size);
+#endif
+ }
+
+ if (new_vtable->attr_size) {
+#if 0
+ PMC_data(pmc) = mem_sys_allocate_zeroed(new_vtable->attr_size);
+#else
+ Parrot_gc_allocate_pmc_attributes(interp, pmc, pmc->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 0
+ mem_sys_free(PMC_data(pmc));
+#else
+ Parrot_gc_free_pmc_attributes(interp, pmc, pmc->vtable->attr_size);
+#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 0
+ PMC_data(pmc) = mem_sys_allocate_zeroed(vtable->attr_size);
+#else
+ Parrot_gc_allocate_pmc_attributes(interp, pmc, pmc->vtable->attr_size);
+#endif
+ }
+
#if GC_VERBOSE
if (Interp_flags_TEST(interp, PARROT_TRACE_FLAG)) {
/* XXX make a more verbose trace flag */
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/arrayiterator.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/arrayiterator.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/arrayiterator.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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.
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/boolean.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/boolean.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/boolean.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -21,7 +21,7 @@
*/
-pmclass Boolean extends Integer provides boolean provides scalar {
+pmclass Boolean extends Integer provides boolean provides scalar auto_attrs {
/*
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/callsignature.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/callsignature.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/callsignature.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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();
}
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/capture.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/capture.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/capture.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2001-2008, Parrot Foundation.
+Copyright (C) 2001-2009, Parrot Foundation.
$Id$
=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()>
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/class.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/class.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/class.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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).
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/codestring.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/codestring.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/codestring.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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 ])>
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/complex.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/complex.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/complex.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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;
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/continuation.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/continuation.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/continuation.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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;
}
/*
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/cpointer.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/cpointer.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/cpointer.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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;
- }
}
/*
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/default.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/default.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/default.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/exception.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/exception.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/exception.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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);
}
/*
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/exceptionhandler.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/exceptionhandler.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/exceptionhandler.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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;
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/exporter.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/exporter.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/exporter.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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()>
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/filehandle.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/filehandle.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/filehandle.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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;
}
}
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/fixedbooleanarray.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/fixedbooleanarray.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/fixedbooleanarray.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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;
}
/*
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/fixedfloatarray.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/fixedfloatarray.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/fixedfloatarray.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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;
}
/*
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/fixedintegerarray.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/fixedintegerarray.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/fixedintegerarray.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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;
}
/*
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/fixedpmcarray.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/fixedpmcarray.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/fixedpmcarray.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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;
}
/*
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/fixedstringarray.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/fixedstringarray.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/fixedstringarray.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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;
}
/*
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/float.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/float.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/float.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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()>
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/hashiterator.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/hashiterator.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/hashiterator.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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.
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/hashiteratorkey.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/hashiteratorkey.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/hashiteratorkey.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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".
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/integer.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/integer.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/integer.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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;
}
/*
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/key.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/key.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/key.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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:
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/lexpad.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/lexpad.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/lexpad.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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) {
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/managedstruct.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/managedstruct.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/managedstruct.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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;
}
/*
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/multisub.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/multisub.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/multisub.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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");
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/nci.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/nci.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/nci.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -21,11 +21,15 @@
typedef INTVAL (*nci_sub_t)(PARROT_INTERP, PMC *);
typedef INTVAL (*nci_jit_sub_t)(PARROT_INTERP, PMC *, char *);
-void pcc_params(PARROT_INTERP, STRING *sig, Parrot_NCI_attributes * const nci_info);
-void pcc_params(PARROT_INTERP, STRING *sig, Parrot_NCI_attributes * const nci_info) {
- size_t sig_length = Parrot_str_byte_length(interp, sig);
- char *param_sig = mem_allocate_n_typed(sig_length, char);
- size_t j = 0;
+void pcc_params(PARROT_INTERP, STRING *sig, Parrot_NCI_attributes * const nci_info,
+ size_t sig_length);
+void pcc_params(PARROT_INTERP, STRING *sig, Parrot_NCI_attributes * const nci_info,
+ size_t sig_length) {
+ char param_buf[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+ char *param_sig = sig_length <= 7
+ ? param_buf
+ : mem_allocate_n_typed(sig_length, char);
+ size_t j = 0;
size_t i;
for (i = 1; i < sig_length; i++) {
@@ -73,6 +77,8 @@
param_sig[j++] = 'S';
break;
default:
+ if (sig_length > 7)
+ mem_sys_free(param_sig);
Parrot_ex_throw_from_c_args(interp, NULL,
EXCEPTION_JIT_ERROR,
"Unknown param Signature %c\n", (char)c);
@@ -90,11 +96,12 @@
else
nci_info->pcc_params_signature = CONST_STRING(interp, "");
- mem_sys_free(param_sig);
+ if (sig_length > 7)
+ mem_sys_free(param_sig);
}
-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
@@ -148,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);
}
/*
@@ -176,8 +180,9 @@
}
VTABLE void set_pointer_keyed_str(STRING *key, void *func) {
- Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
- int jitted = 0;
+ Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
+ int jitted = 0;
+ size_t key_length = Parrot_str_byte_length(interp, key);
/* Store the original function and signature. */
SET_ATTR_orig_func(INTERP, SELF, func);
@@ -185,21 +190,21 @@
/* ensure that the STRING signature is constant */
if (!PObj_constant_TEST(key)) {
char * const key_c = Parrot_str_to_cstring(INTERP, key);
- key = string_make(interp, key_c, strlen(key_c),
+ key = string_make(interp, key_c, key_length,
NULL, PObj_constant_FLAG);
Parrot_str_free_cstring(key_c);
}
nci_info->signature = key;
- pcc_params(INTERP, key, nci_info);
+ pcc_params(INTERP, key, nci_info, key_length);
/* Arity is length of that string minus one (the return type). */
- nci_info->arity = Parrot_str_byte_length(INTERP, key) - 1;
+ nci_info->arity = key_length - 1;
/* Build call function. */
nci_info->func = (PMC *)(build_call_func(INTERP, SELF,
key, &jitted));
- nci_info->jitted = jitted;
+ nci_info->jitted = jitted;
}
/*
@@ -224,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.
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/orderedhashiterator.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/orderedhashiterator.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/orderedhashiterator.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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);
}
/*
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/parrotinterpreter.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/parrotinterpreter.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/parrotinterpreter.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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);
}
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/parrotlibrary.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/parrotlibrary.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/parrotlibrary.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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;
}
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/pmcproxy.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/pmcproxy.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/pmcproxy.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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;
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/pointer.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/pointer.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/pointer.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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.
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/resizablebooleanarray.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/resizablebooleanarray.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/resizablebooleanarray.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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) */
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/resizablefloatarray.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/resizablefloatarray.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/resizablefloatarray.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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)>
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/resizableintegerarray.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/resizableintegerarray.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/resizableintegerarray.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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>.
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/resizablepmcarray.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/resizablepmcarray.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/resizablepmcarray.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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);
}
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/resizablestringarray.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/resizablestringarray.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/resizablestringarray.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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>.
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/retcontinuation.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/retcontinuation.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/retcontinuation.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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;
}
/*
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/role.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/role.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/role.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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.
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/scheduler.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/scheduler.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/scheduler.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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;
}
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/schedulermessage.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/schedulermessage.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/schedulermessage.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2001-2008, Parrot Foundation.
+Copyright (C) 2001-2009, Parrot Foundation.
$Id$
=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.
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/sockaddr.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/sockaddr.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/sockaddr.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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;
}
}
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/socket.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/socket.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/socket.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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;
}
/*
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/string.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/string.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/string.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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;
}
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/stringhandle.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/stringhandle.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/stringhandle.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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.
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/stringiterator.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/stringiterator.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/stringiterator.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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);
}
/*
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/task.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/task.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/task.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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.
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/timer.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/timer.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/timer.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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;
}
/*
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/undef.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/undef.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/undef.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -57,7 +57,6 @@
VTABLE_destroy(interp, clone);
PObj_is_object_SET(SELF);
- PObj_active_destroy_SET(SELF);
}
}
Modified: branches/tt795_kill_parrot_sub_structure/src/pmc/unmanagedstruct.pmc
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/pmc/unmanagedstruct.pmc Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/pmc/unmanagedstruct.pmc Tue Aug 18 22:38:01 2009 (r40639)
@@ -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);
}
Modified: branches/tt795_kill_parrot_sub_structure/src/runcore/main.c
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/src/runcore/main.c Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/src/runcore/main.c Tue Aug 18 22:38:01 2009 (r40639)
@@ -1169,7 +1169,7 @@
* if we are running a different core, entries are
* changed below
*/
- new_evc_func_table[i] = interp->op_func_table[CORE_OPS_check_events__];
+ new_evc_func_table[i] = new_func_table[CORE_OPS_check_events__];
}
interp->evc_func_table = new_evc_func_table;
@@ -1287,7 +1287,7 @@
/* if not install wrappers */
/* fill new entries with the wrapper op */
for (i = n_old; i < n_tot; ++i)
- ops_addr[i] = (cg_lib->op_func_table)[CORE_OPS_wrapper__];
+ ops_addr[i] = ops_addr[CORE_OPS_wrapper__];
}
/* if we are running this core, update event check ops */
Modified: branches/tt795_kill_parrot_sub_structure/t/benchmark/benchmarks.t
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/t/benchmark/benchmarks.t Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/t/benchmark/benchmarks.t Tue Aug 18 22:38:01 2009 (r40639)
@@ -161,8 +161,8 @@
q{oo6.pir} => qq(500000\n),
q{oofib.pir} => qr/^fib\(24\)\s=\s46368\s\d+\.\d+s$/x,
q{overload.pir} => qq(42\n),
- q{primes.pasm} => qr/^N\sprimes\sup\sto\s1000\sis:\s168\n
- last\sis:\s1001\n
+ q{primes.pasm} => qr/^N\sprimes\sup\sto\s5000\sis:\s669\n
+ last\sis:\s5001\n
Elapsed\stime:\s\d+\.\d+\n$/x,
q{primes2.pir} => qr/^N\sprimes\scalculated\sto\s500\sis\s96\n
last\sis:\s499\n$/x,
Modified: branches/tt795_kill_parrot_sub_structure/t/op/arithmetics.t
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/t/op/arithmetics.t Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/t/op/arithmetics.t Tue Aug 18 22:38:01 2009 (r40639)
@@ -7,7 +7,7 @@
use lib qw( . lib ../lib ../../lib );
use Test::More;
-use Parrot::Test tests => 23;
+use Parrot::Test tests => 26;
# test for GMP
use Parrot::Config;
@@ -600,9 +600,73 @@
say $N0
$N0 -= $N0
say $N0
+ $N0 *= -1
+ say $N0
+ $N0 *= 0
+ say $N0
+ $N0 += 5
+ say $N0
+ $N0 -= 42
+ say $N0
+.end
+CODE
+Inf
+NaN
+NaN
+NaN
+NaN
+NaN
+OUTPUT
+
+pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - exp" );
+.sub 'test' :main
+ $N0 = 'Inf'
+ $N1 = exp $N0
+ say $N1
+ $N0 = '-Inf'
+ $N1 = exp $N0
+ say $N1
+ $N0 = 'NaN'
+ $N1 = exp $N0
+ say $N1
.end
CODE
Inf
+0
+NaN
+OUTPUT
+
+pir_output_is( <<'CODE', <<OUTPUT, "Inf - ln" );
+.sub 'test' :main
+ $N0 = 'Inf'
+ $N1 = ln $N0
+ say $N1
+ $N0 = '-Inf'
+ $N1 = ln $N0
+ say $N1
+.end
+CODE
+Inf
+NaN
+OUTPUT
+
+pir_output_is( <<'CODE', <<OUTPUT, "Mixing NaN and Inf should give NaN" );
+.sub 'test' :main
+ $N0 = 'NaN'
+ $N1 = 'Inf'
+ $N0 *= $N1
+ say $N0
+ $N0 /= $N1
+ say $N0
+ $N0 -= $N1
+ say $N0
+ $N0 += $N1
+ say $N0
+.end
+CODE
+NaN
+NaN
+NaN
NaN
OUTPUT
Modified: branches/tt795_kill_parrot_sub_structure/t/op/gc.t
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/t/op/gc.t Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/t/op/gc.t Tue Aug 18 22:38:01 2009 (r40639)
@@ -1,5 +1,5 @@
#!perl
-# Copyright (C) 2001-2005, Parrot Foundation.
+# Copyright (C) 2001-2009, Parrot Foundation.
# $Id$
use strict;
@@ -123,12 +123,11 @@
1
OUTPUT
-{
-local $TODO = 'this tests singletons but was tied to the now-gone Random PMC';
-
-pasm_output_is( <<'CODE', <<OUTPUT, "vanishing slingleton PMC" );
+pasm_output_is( <<'CODE', <<OUTPUT, "vanishing singleton PMC" );
_main:
.const 'Sub' P0 = "_rand"
+ new P16, 'Env'
+ set P16['Foo'], 'bar'
set I16, 100
set I17, 0
loop:
@@ -140,14 +139,13 @@
end
.pcc_sub _rand:
- new P16, 'Random'
- set I5, P16[10]
- gt I5, 10, err
- lt I5, 0, err
+ new P16, 'Env'
+ set P5, P16['Foo']
+ ne P5, 'bar', err
returncc
err:
- print "singleton destroyed .Random = ."
- new P16, 'Random'
+ print "singleton destroyed .Env = ."
+ new P16, 'Env'
typeof S16, P16
print S16
print "\n"
@@ -155,7 +153,6 @@
CODE
ok
OUTPUT
-}
pir_output_is( <<'CODE', <<OUTPUT, "vanishing return continuation in method calls" );
.sub main :main
Added: branches/tt795_kill_parrot_sub_structure/t/tools/pbc_disassemble.t
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/tt795_kill_parrot_sub_structure/t/tools/pbc_disassemble.t Tue Aug 18 22:38:01 2009 (r40639)
@@ -0,0 +1,106 @@
+#! perl
+# Copyright (C) 2009, Parrot Foundation
+# $Id$
+
+=head1 NAME
+
+t/tools/pbc_disassemble.t - test the Parrot Bytecode (PBC) Disassembler
+
+=head1 SYNOPSIS
+
+ % prove t/tools/pbc_disassemble.t
+
+=head1 DESCRIPTION
+
+Tests the C<pbc_disassemble> tool by providing it with a number of source
+files, and running through it with various commands.
+
+We never actually check the I<full> output of pbc_disassemble. We simply check
+several smaller components to avoid a test file that is far too unwieldy.
+
+
+=head1 REQUIREMENTS
+
+This test script requires you to build pbc_disassemble, by typing
+"make parrot_utils" (using a suitable make tool for your platform).
+If this requirement has not been met, all tests will be skipped.
+
+=cut
+
+use strict;
+use warnings;
+use lib qw(lib);
+
+use Test::More;
+use IO::File ();
+use Parrot::Config;
+use File::Spec;
+use Parrot::Test;
+
+my $path;
+
+BEGIN {
+ $path = File::Spec->catfile( ".", "pbc_disassemble" );
+ my $exefile = $path . $PConfig{exe};
+ unless ( -f $exefile ) {
+ plan skip_all => "pbc_disassemble hasn't been built. Run make parrot_utils";
+ exit(0);
+ }
+ plan tests => 4;
+}
+
+disassemble_output_like( <<PIR, "pir", qr/PMC_CONST.*set_n_nc.*print_n/ms, 'pbc_disassemble numeric ops');
+.sub main :main
+ \$N3 = 3.14159
+ print \$N3
+ print "\\n"
+.end
+PIR
+
+disassemble_output_like( <<PIR, "pir", qr/PMC_CONST.*set_i_ic.*print_i/ms, 'pbc_disassemble integer ops');
+.sub main :main
+ \$I0 = 1982
+ print \$I0
+ print "\\n"
+.end
+PIR
+
+disassemble_output_like( <<PIR, "pir", qr/PMC_CONST.*new_p_sc.*"ResizablePMCArray".*set_p_kic_ic\s*P.*set_i_p_kic\s*I.*/ms, 'pbc_disassemble pmc ops');
+.sub main :main
+ \$P0 = new 'ResizablePMCArray'
+ \$P0[0] = 42
+ \$I0 = \$P0[0]
+.end
+PIR
+
+disassemble_output_like( <<PIR, "pir", qr/PMC_CONST.*set_s_sc\s*S.*print_s\s*S.*print_sc/ms, 'pbc_disassemble string ops');
+.sub main :main
+ \$S0 = "Wheels within wheels"
+ print \$S0
+ print "\\n"
+.end
+PIR
+
+=head1 HELPER SUBROUTINES
+
+=head2 disassemble_output_like
+
+ disassemble_output_like(<<PASM, "pasm", "some output", "running $file");
+
+Takes 3-4 arguments: a file to run,
+the filename-extension of the file (probably "pir" or "pasm"),
+an arrayref or single regex string to match within pbc_disassemble's output,
+and the optional test diagnostic.
+
+=cut
+
+sub disassemble_output_like {
+ pbc_postprocess_output_like($path, @_ );
+}
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
Added: branches/tt795_kill_parrot_sub_structure/t/tools/pbc_dump.t
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/tt795_kill_parrot_sub_structure/t/tools/pbc_dump.t Tue Aug 18 22:38:01 2009 (r40639)
@@ -0,0 +1,98 @@
+#! perl
+# Copyright (C) 2009, Parrot Foundation.
+# $Id$
+
+=head1 NAME
+
+t/tools/pbc_dump.t - test the Parrot Bytecode (PBC) Dumper
+
+=head1 SYNOPSIS
+
+ % prove t/tools/pbc_dump.t
+
+=head1 DESCRIPTION
+
+Tests the C<pbc_dump> tool by providing it with a number of source
+files, and running through it with various commands.
+
+We never actually check the I<full> output of pbc_dump. We simply check
+several smaller components to avoid a test file that is far too unwieldy.
+
+
+=head1 REQUIREMENTS
+
+This test script requires you to build pbc_dump, by typing
+"make parrot_utils" (using a suitable make tool for your platform).
+If this requirement has not been met, all tests will be skipped.
+
+=cut
+
+use strict;
+use warnings;
+use lib qw(lib);
+
+use Test::More;
+use IO::File ();
+use Parrot::Config;
+use Parrot::Test;
+use File::Spec;
+
+my $path;
+
+BEGIN {
+ $path = File::Spec->catfile( ".", "pbc_dump" );
+ my $exefile = $path . $PConfig{exe};
+ unless ( -f $exefile ) {
+ plan skip_all => "pbc_dump hasn't been built. Run make parrot_utils";
+ exit(0);
+ }
+ plan tests => 7;
+}
+
+dump_output_like( <<PIR, "pir", [qr/FIXUP_t/, qr/PIC_idx/, qr/CONSTANT_t/, qr/BYTECODE_t/], 'pbc_dump basic sanity');
+.sub main :main
+ \$I0 = 42
+.end
+PIR
+
+dump_output_like( <<PIR, "pir", qr/HEADER\s*=>\s*\[.*wordsize.*byteorder.*floattype.*parrot-version.*bytecode-version.*UUID.*\]/ms, 'pbc_dump HEADER sanity');
+.sub main :main
+ \$I0 = 42
+.end
+PIR
+
+dump_output_like( <<PIR, "pir", qr/DIRECTORY\s*=>\s*\[.*offs.*op_count.*itype.*id.*size.*segments/ms, 'pbc_dump DIRECTORY sanity');
+.sub main :main
+ \$I0 = 42
+.end
+PIR
+
+dump_output_like( <<PIR, "pir", qr/BYTECODE_t.*=>.*\[.*offs.*op_count.*itype.*id.*size.*mappings/ms, 'pbc_dump BYTECODE sanity');
+.sub main :main
+ \$I0 = 42
+.end
+PIR
+
+=head1 HELPER SUBROUTINES
+
+=head2 dump_output_like
+
+ dump_output_like(<<PASM, "pasm", "some output", "running $file");
+
+Takes 3-4 arguments: a file to run,
+the filename-extension of the file (probably "pir" or "pasm"),
+an arrayref or single regex string to match within pbc_dump's output,
+and the optional test diagnostic.
+
+=cut
+
+sub dump_output_like {
+ pbc_postprocess_output_like($path, @_ );
+}
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
Modified: branches/tt795_kill_parrot_sub_structure/tools/util/release.json
==============================================================================
--- branches/tt795_kill_parrot_sub_structure/tools/util/release.json Tue Aug 18 22:20:56 2009 (r40638)
+++ branches/tt795_kill_parrot_sub_structure/tools/util/release.json Tue Aug 18 22:38:01 2009 (r40639)
@@ -1,9 +1,9 @@
{
- "release.version" : "1.4.0",
- "release.name" : "Mundo Cani",
+ "release.version" : "1.5.0",
+ "release.name" : "TEH PARROTZ!",
"release.day" : "Tuesday",
- "release.date" : "21 July 2009",
- "release.nextdate" : "18 August 2009",
+ "release.date" : "18 August 2009",
+ "release.nextdate" : "15 September 2009",
"web.root" : "http://parrot.org/",
"web.source" : "download",
@@ -11,13 +11,13 @@
"web.repository" : "https://svn.parrot.org/parrot/trunk/",
"bugday.day" : "Saturday",
- "bugday.date" : "15 August 2009",
+ "bugday.date" : "12 September 2009",
"wiki.root" : "https://trac.parrot.org/parrot/wiki/",
- "wiki.bugday" : "bug_day_2009_08_15",
+ "wiki.bugday" : "bug_day_2009_09_12",
"cpan.search" : "http://search.cpan.org/dist/parrot",
- "ftp.path" : "ftp://ftp.parrot.org/pub/parrot/releases/devel/1.4.0/",
+ "ftp.path" : "ftp://ftp.parrot.org/pub/parrot/releases/devel/1.5.0/",
"subversion.root" : "http://subversion.tigris.org/",
"svk.root" : "http://svk.bestpractical.com/"
}
More information about the parrot-commits
mailing list