[svn:parrot] r40648 - in branches/pmc_sans_unionval: . compilers/imcc compilers/tge config/auto/sizes config/gen/platform/generic docs docs/book/draft docs/book/pct docs/dev docs/pdds docs/project docs/user/pir editor examples/benchmarks examples/embed examples/languages/abc examples/languages/squaak examples/opengl examples/pge examples/pir/befunge examples/sdl/tetris include/parrot lib/Parrot lib/Parrot/Pmc2c ports/cpan ports/cygwin ports/debian ports/fedora ports/mandriva ports/suse runtime/parrot/languages runtime/parrot/library/Math src src/call src/dynoplibs src/dynpmc src/gc src/interp src/pmc src/runcore t/benchmark t/compilers/tge t/dynoplibs t/native_pbc t/oo t/op t/pmc t/src tools/dev tools/util
whiteknight at svn.parrot.org
whiteknight at svn.parrot.org
Wed Aug 19 01:26:11 UTC 2009
Author: whiteknight
Date: Wed Aug 19 01:26:03 2009
New Revision: 40648
URL: https://trac.parrot.org/parrot/changeset/40648
Log:
[pmc_sans_unionval] merge from trunk r40530:40637. Exposes one strange test failure, so need to track that down
Deleted:
branches/pmc_sans_unionval/src/pmc/random.pmc
branches/pmc_sans_unionval/t/pmc/random.t
Modified:
branches/pmc_sans_unionval/ (props changed)
branches/pmc_sans_unionval/CREDITS
branches/pmc_sans_unionval/ChangeLog
branches/pmc_sans_unionval/DEPRECATED.pod
branches/pmc_sans_unionval/MANIFEST
branches/pmc_sans_unionval/MANIFEST.generated
branches/pmc_sans_unionval/META.yml
branches/pmc_sans_unionval/NEWS
branches/pmc_sans_unionval/PBC_COMPAT
branches/pmc_sans_unionval/README
branches/pmc_sans_unionval/VERSION
branches/pmc_sans_unionval/compilers/imcc/parser_util.c
branches/pmc_sans_unionval/compilers/imcc/pbc.c
branches/pmc_sans_unionval/compilers/tge/TGE.pir
branches/pmc_sans_unionval/config/auto/sizes/intval_maxmin_c.in (props changed)
branches/pmc_sans_unionval/config/gen/platform/generic/platform_limits.h
branches/pmc_sans_unionval/docs/book/draft/README (props changed)
branches/pmc_sans_unionval/docs/book/draft/appa_glossary.pod (props changed)
branches/pmc_sans_unionval/docs/book/draft/appb_patch_submission.pod (props changed)
branches/pmc_sans_unionval/docs/book/draft/appc_command_line_options.pod (props changed)
branches/pmc_sans_unionval/docs/book/draft/appd_build_options.pod (props changed)
branches/pmc_sans_unionval/docs/book/draft/appe_source_code.pod (props changed)
branches/pmc_sans_unionval/docs/book/draft/ch01_introduction.pod (props changed)
branches/pmc_sans_unionval/docs/book/draft/ch02_getting_started.pod (props changed)
branches/pmc_sans_unionval/docs/book/draft/ch07_dynpmcs.pod (props changed)
branches/pmc_sans_unionval/docs/book/draft/ch08_dynops.pod (props changed)
branches/pmc_sans_unionval/docs/book/draft/ch10_opcode_reference.pod (props changed)
branches/pmc_sans_unionval/docs/book/draft/ch11_directive_reference.pod (props changed)
branches/pmc_sans_unionval/docs/book/draft/ch12_operator_reference.pod (props changed)
branches/pmc_sans_unionval/docs/book/draft/chXX_hlls.pod (props changed)
branches/pmc_sans_unionval/docs/book/draft/chXX_library.pod (props changed)
branches/pmc_sans_unionval/docs/book/draft/chXX_testing_and_debugging.pod (props changed)
branches/pmc_sans_unionval/docs/book/pct/ch01_introduction.pod (props changed)
branches/pmc_sans_unionval/docs/book/pct/ch02_getting_started.pod (props changed)
branches/pmc_sans_unionval/docs/book/pct/ch03_compiler_tools.pod (props changed)
branches/pmc_sans_unionval/docs/book/pct/ch04_pge.pod (props changed)
branches/pmc_sans_unionval/docs/book/pct/ch05_nqp.pod (props changed)
branches/pmc_sans_unionval/docs/dev/c_functions.pod (props changed)
branches/pmc_sans_unionval/docs/embed.pod
branches/pmc_sans_unionval/docs/parrothist.pod
branches/pmc_sans_unionval/docs/pdds/pdd17_pmc.pod
branches/pmc_sans_unionval/docs/pdds/pdd30_install.pod (props changed)
branches/pmc_sans_unionval/docs/project/release_manager_guide.pod
branches/pmc_sans_unionval/docs/user/pir/pmcs.pod
branches/pmc_sans_unionval/editor/pir-mode.el
branches/pmc_sans_unionval/examples/benchmarks/primes.pasm
branches/pmc_sans_unionval/examples/embed/cotorra.c (props changed)
branches/pmc_sans_unionval/examples/languages/abc/ (props changed)
branches/pmc_sans_unionval/examples/languages/squaak/ (props changed)
branches/pmc_sans_unionval/examples/opengl/shapes.pir
branches/pmc_sans_unionval/examples/pge/demo.pir (props changed)
branches/pmc_sans_unionval/examples/pir/befunge/flow.pir
branches/pmc_sans_unionval/examples/sdl/tetris/board.pir
branches/pmc_sans_unionval/include/parrot/call.h (props changed)
branches/pmc_sans_unionval/include/parrot/gc_api.h (contents, props changed)
branches/pmc_sans_unionval/include/parrot/runcore_api.h (props changed)
branches/pmc_sans_unionval/include/parrot/runcore_trace.h (props changed)
branches/pmc_sans_unionval/include/parrot/sub.h
branches/pmc_sans_unionval/lib/Parrot/Pmc2c/Attribute.pm
branches/pmc_sans_unionval/lib/Parrot/Pmc2c/PMCEmitter.pm
branches/pmc_sans_unionval/lib/Parrot/Pmc2c/Parser.pm
branches/pmc_sans_unionval/lib/Parrot/Test.pm
branches/pmc_sans_unionval/lib/Parrot/Vtable.pm
branches/pmc_sans_unionval/ports/cpan/pause_guide.pod (props changed)
branches/pmc_sans_unionval/ports/cygwin/parrot-1.0.0-1.cygport (props changed)
branches/pmc_sans_unionval/ports/debian/libparrot-dev.install.in (props changed)
branches/pmc_sans_unionval/ports/debian/libparrot.install.in (props changed)
branches/pmc_sans_unionval/ports/debian/parrot-doc.install.in (props changed)
branches/pmc_sans_unionval/ports/debian/parrot.install.in (props changed)
branches/pmc_sans_unionval/ports/fedora/parrot.spec.fedora (props changed)
branches/pmc_sans_unionval/ports/mandriva/parrot.spec.mandriva (props changed)
branches/pmc_sans_unionval/ports/suse/parrot.spec.suse (props changed)
branches/pmc_sans_unionval/runtime/parrot/languages/ (props changed)
branches/pmc_sans_unionval/runtime/parrot/library/Math/Rand.pir (props changed)
branches/pmc_sans_unionval/src/call/ops.c (props changed)
branches/pmc_sans_unionval/src/call/pcc.c (props changed)
branches/pmc_sans_unionval/src/dynoplibs/math.ops
branches/pmc_sans_unionval/src/dynpmc/dynlexpad.pmc
branches/pmc_sans_unionval/src/dynpmc/foo.pmc
branches/pmc_sans_unionval/src/dynpmc/foo2.pmc
branches/pmc_sans_unionval/src/dynpmc/gdbmhash.pmc
branches/pmc_sans_unionval/src/dynpmc/rotest.pmc
branches/pmc_sans_unionval/src/dynpmc/subproxy.pmc
branches/pmc_sans_unionval/src/embed.c
branches/pmc_sans_unionval/src/extend.c
branches/pmc_sans_unionval/src/gc/alloc_memory.c (props changed)
branches/pmc_sans_unionval/src/gc/alloc_register.c (contents, props changed)
branches/pmc_sans_unionval/src/gc/alloc_resources.c (contents, props changed)
branches/pmc_sans_unionval/src/gc/api.c (contents, props changed)
branches/pmc_sans_unionval/src/gc/gc_ms.c
branches/pmc_sans_unionval/src/gc/gc_private.h
branches/pmc_sans_unionval/src/gc/generational_ms.c (props changed)
branches/pmc_sans_unionval/src/gc/incremental_ms.c (props changed)
branches/pmc_sans_unionval/src/gc/malloc.c (props changed)
branches/pmc_sans_unionval/src/gc/malloc_trace.c (props changed)
branches/pmc_sans_unionval/src/gc/mark_sweep.c (contents, props changed)
branches/pmc_sans_unionval/src/gc/system.c (props changed)
branches/pmc_sans_unionval/src/global.c
branches/pmc_sans_unionval/src/interp/inter_cb.c (props changed)
branches/pmc_sans_unionval/src/interp/inter_create.c (props changed)
branches/pmc_sans_unionval/src/interp/inter_misc.c (props changed)
branches/pmc_sans_unionval/src/jit.c
branches/pmc_sans_unionval/src/multidispatch.c
branches/pmc_sans_unionval/src/packdump.c
branches/pmc_sans_unionval/src/packfile.c
branches/pmc_sans_unionval/src/pbc_merge.c
branches/pmc_sans_unionval/src/pic_jit.c
branches/pmc_sans_unionval/src/pmc.c
branches/pmc_sans_unionval/src/pmc/array.pmc
branches/pmc_sans_unionval/src/pmc/arrayiterator.pmc
branches/pmc_sans_unionval/src/pmc/boolean.pmc
branches/pmc_sans_unionval/src/pmc/callsignature.pmc
branches/pmc_sans_unionval/src/pmc/capture.pmc
branches/pmc_sans_unionval/src/pmc/class.pmc
branches/pmc_sans_unionval/src/pmc/codestring.pmc
branches/pmc_sans_unionval/src/pmc/complex.pmc
branches/pmc_sans_unionval/src/pmc/continuation.pmc
branches/pmc_sans_unionval/src/pmc/coroutine.pmc
branches/pmc_sans_unionval/src/pmc/cpointer.pmc
branches/pmc_sans_unionval/src/pmc/default.pmc
branches/pmc_sans_unionval/src/pmc/eval.pmc
branches/pmc_sans_unionval/src/pmc/exception.pmc
branches/pmc_sans_unionval/src/pmc/exceptionhandler.pmc
branches/pmc_sans_unionval/src/pmc/exporter.pmc
branches/pmc_sans_unionval/src/pmc/filehandle.pmc
branches/pmc_sans_unionval/src/pmc/fixedbooleanarray.pmc
branches/pmc_sans_unionval/src/pmc/fixedfloatarray.pmc
branches/pmc_sans_unionval/src/pmc/fixedintegerarray.pmc
branches/pmc_sans_unionval/src/pmc/fixedpmcarray.pmc
branches/pmc_sans_unionval/src/pmc/fixedstringarray.pmc
branches/pmc_sans_unionval/src/pmc/float.pmc
branches/pmc_sans_unionval/src/pmc/hashiterator.pmc
branches/pmc_sans_unionval/src/pmc/hashiteratorkey.pmc
branches/pmc_sans_unionval/src/pmc/integer.pmc
branches/pmc_sans_unionval/src/pmc/key.pmc
branches/pmc_sans_unionval/src/pmc/lexinfo.pmc
branches/pmc_sans_unionval/src/pmc/lexpad.pmc
branches/pmc_sans_unionval/src/pmc/managedstruct.pmc
branches/pmc_sans_unionval/src/pmc/multisub.pmc
branches/pmc_sans_unionval/src/pmc/namespace.pmc
branches/pmc_sans_unionval/src/pmc/nci.pmc
branches/pmc_sans_unionval/src/pmc/orderedhashiterator.pmc
branches/pmc_sans_unionval/src/pmc/parrotinterpreter.pmc
branches/pmc_sans_unionval/src/pmc/parrotlibrary.pmc
branches/pmc_sans_unionval/src/pmc/parrotthread.pmc
branches/pmc_sans_unionval/src/pmc/pmcproxy.pmc
branches/pmc_sans_unionval/src/pmc/pointer.pmc
branches/pmc_sans_unionval/src/pmc/resizablebooleanarray.pmc
branches/pmc_sans_unionval/src/pmc/resizablefloatarray.pmc
branches/pmc_sans_unionval/src/pmc/resizableintegerarray.pmc
branches/pmc_sans_unionval/src/pmc/resizablepmcarray.pmc
branches/pmc_sans_unionval/src/pmc/resizablestringarray.pmc
branches/pmc_sans_unionval/src/pmc/retcontinuation.pmc
branches/pmc_sans_unionval/src/pmc/role.pmc
branches/pmc_sans_unionval/src/pmc/scheduler.pmc
branches/pmc_sans_unionval/src/pmc/schedulermessage.pmc
branches/pmc_sans_unionval/src/pmc/sockaddr.pmc
branches/pmc_sans_unionval/src/pmc/socket.pmc
branches/pmc_sans_unionval/src/pmc/string.pmc
branches/pmc_sans_unionval/src/pmc/stringhandle.pmc
branches/pmc_sans_unionval/src/pmc/stringiterator.pmc
branches/pmc_sans_unionval/src/pmc/sub.pmc
branches/pmc_sans_unionval/src/pmc/task.pmc
branches/pmc_sans_unionval/src/pmc/timer.pmc
branches/pmc_sans_unionval/src/pmc/undef.pmc
branches/pmc_sans_unionval/src/pmc/unmanagedstruct.pmc
branches/pmc_sans_unionval/src/runcore/cores.c (props changed)
branches/pmc_sans_unionval/src/runcore/main.c (contents, props changed)
branches/pmc_sans_unionval/src/runcore/trace.c (contents, props changed)
branches/pmc_sans_unionval/src/sub.c
branches/pmc_sans_unionval/src/thread.c
branches/pmc_sans_unionval/t/benchmark/benchmarks.t
branches/pmc_sans_unionval/t/compilers/tge/NoneGrammar.tg (props changed)
branches/pmc_sans_unionval/t/dynoplibs/math.t
branches/pmc_sans_unionval/t/native_pbc/annotations.pbc
branches/pmc_sans_unionval/t/native_pbc/integer_1.pbc
branches/pmc_sans_unionval/t/native_pbc/number_1.pbc
branches/pmc_sans_unionval/t/native_pbc/number_2.pbc
branches/pmc_sans_unionval/t/native_pbc/string_1.pbc
branches/pmc_sans_unionval/t/oo/root_new.t (props changed)
branches/pmc_sans_unionval/t/op/arithmetics.t
branches/pmc_sans_unionval/t/op/gc.t
branches/pmc_sans_unionval/t/pmc/pmc.t
branches/pmc_sans_unionval/t/src/embed.t (props changed)
branches/pmc_sans_unionval/tools/dev/fetch_languages.pl (props changed)
branches/pmc_sans_unionval/tools/dev/mk_gitignore.pl (props changed)
branches/pmc_sans_unionval/tools/util/perlcritic-cage.conf (props changed)
branches/pmc_sans_unionval/tools/util/release.json
Modified: branches/pmc_sans_unionval/CREDITS
==============================================================================
--- branches/pmc_sans_unionval/CREDITS Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/CREDITS Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/ChangeLog
==============================================================================
--- branches/pmc_sans_unionval/ChangeLog Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/ChangeLog Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/DEPRECATED.pod
==============================================================================
--- branches/pmc_sans_unionval/DEPRECATED.pod Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/DEPRECATED.pod Wed Aug 19 01:26:03 2009 (r40648)
@@ -37,10 +37,6 @@
=over 4
-=item random [eligible in 1.1]
-
-L<https://trac.parrot.org/parrot/ticket/189>
-
=item moved to dynpmc [eligible in 1.1]
AddrRegistry, CodeString, Env, Eval, File, OS, PCCMETHOD_Test, StringHandle,
@@ -214,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/pmc_sans_unionval/MANIFEST
==============================================================================
--- branches/pmc_sans_unionval/MANIFEST Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/MANIFEST Wed Aug 19 01:26:03 2009 (r40648)
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Thu Aug 13 02:35:20 2009 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sat Aug 15 07:51:12 2009 UT
#
# See below for documentation on the format of this file.
#
@@ -626,6 +626,7 @@
examples/benchmarks/primes2.rb [examples]
examples/benchmarks/primes2_i.pir [examples]
examples/benchmarks/primes_i.pasm [examples]
+examples/benchmarks/rand.pir [examples]
examples/benchmarks/stress.pasm [examples]
examples/benchmarks/stress.pl [examples]
examples/benchmarks/stress.rb [examples]
@@ -1247,8 +1248,8 @@
src/debug.c []
src/dynext.c []
src/dynoplibs/README []doc
-src/dynoplibs/obscure.ops []
src/dynoplibs/math.ops []
+src/dynoplibs/obscure.ops []
src/dynpmc/README.pod []doc
src/dynpmc/dynlexpad.pmc [devel]src
src/dynpmc/ext.pir []
@@ -1444,7 +1445,6 @@
src/pmc/pmc.num []
src/pmc/pmcproxy.pmc [devel]src
src/pmc/pointer.pmc [devel]src
-src/pmc/random.pmc [devel]src
src/pmc/resizablebooleanarray.pmc [devel]src
src/pmc/resizablefloatarray.pmc [devel]src
src/pmc/resizableintegerarray.pmc [devel]src
@@ -1674,8 +1674,8 @@
t/distro/file_metadata.t [test]
t/distro/manifest.t [test]
t/distro/meta_yml.t [test]
-t/dynoplibs/obscure.t [test]
t/dynoplibs/math.t [test]
+t/dynoplibs/obscure.t [test]
t/dynpmc/dynlexpad.t [test]
t/dynpmc/foo.t [test]
t/dynpmc/foo2.t [test]
@@ -1909,7 +1909,6 @@
t/pmc/pmcproxy.t [test]
t/pmc/pointer.t [test]
t/pmc/prop.t [test]
-t/pmc/random.t [test]
t/pmc/resizablebooleanarray.t [test]
t/pmc/resizablefloatarray.t [test]
t/pmc/resizableintegerarray.t [test]
@@ -2088,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/pmc_sans_unionval/MANIFEST.generated
==============================================================================
--- branches/pmc_sans_unionval/MANIFEST.generated Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/MANIFEST.generated Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/META.yml
==============================================================================
--- branches/pmc_sans_unionval/META.yml Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/META.yml Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/NEWS
==============================================================================
--- branches/pmc_sans_unionval/NEWS Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/NEWS Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/PBC_COMPAT
==============================================================================
--- branches/pmc_sans_unionval/PBC_COMPAT Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/PBC_COMPAT Wed Aug 19 01:26:03 2009 (r40648)
@@ -27,6 +27,7 @@
# please insert tab separated entries at the top of the list
+5.2 2009.08.06 dukeleto remove Random PMC
5.1 2009.08.06 cotto remove branch_cs opcode
5.0 2009.07.21 cotto released 1.4.0
4.0 2009.03.17 allison released 1.0.0
Modified: branches/pmc_sans_unionval/README
==============================================================================
--- branches/pmc_sans_unionval/README Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/README Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/VERSION
==============================================================================
--- branches/pmc_sans_unionval/VERSION Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/VERSION Wed Aug 19 01:26:03 2009 (r40648)
@@ -1 +1 @@
-1.4.0
+1.5.0
Modified: branches/pmc_sans_unionval/compilers/imcc/parser_util.c
==============================================================================
--- branches/pmc_sans_unionval/compilers/imcc/parser_util.c Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/compilers/imcc/parser_util.c Wed Aug 19 01:26:03 2009 (r40648)
@@ -693,7 +693,7 @@
IMCC_pop_parser_state(interp, yyscanner);
if (!IMCC_INFO(interp)->error_code) {
- Parrot_sub *sub_data;
+ Parrot_Sub_attributes *sub_data;
/*
* create sub PMC
Modified: branches/pmc_sans_unionval/compilers/imcc/pbc.c
==============================================================================
--- branches/pmc_sans_unionval/compilers/imcc/pbc.c Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/compilers/imcc/pbc.c Wed Aug 19 01:26:03 2009 (r40648)
@@ -1205,7 +1205,7 @@
while (n) {
STRING *lex_name;
const int k = n->color;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PARROT_ASSERT(k >= 0);
lex_name = constants[k]->u.string;
@@ -1255,7 +1255,7 @@
subs_t *s;
PMC *current;
STRING *cur_name;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
size_t len;
if (!unit->outer)
@@ -1320,9 +1320,9 @@
add_const_pmc_sub(PARROT_INTERP, ARGMOD(SymReg *r), size_t offs, size_t end)
{
ASSERT_ARGS(add_const_pmc_sub)
- PMC *ns_pmc;
- PMC *sub_pmc;
- Parrot_sub *sub, *outer_sub;
+ PMC *ns_pmc;
+ PMC *sub_pmc;
+ Parrot_Sub_attributes *sub, *outer_sub;
const int k = add_const_table(interp);
PackFile_ConstTable * const ct = interp->code->const_table;
Modified: branches/pmc_sans_unionval/compilers/tge/TGE.pir
==============================================================================
--- branches/pmc_sans_unionval/compilers/tge/TGE.pir Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/compilers/tge/TGE.pir Wed Aug 19 01:26:03 2009 (r40648)
@@ -113,6 +113,46 @@
.end
+.namespace [ 'PGE';'Match' ]
+
+=over 4
+
+=item C<find_key([ key1, key2, ... ])>
+
+Find the first of C<key1>, C<key2>, etc. in the current
+Match object, and return it. Returns '' if none of
+the specified keys are found. If no keys are specified,
+then simply return the first key found.
+
+=back
+
+=cut
+
+.sub 'find_key' :method
+ .param pmc keys :slurpy
+ if null keys goto first_key
+ unless keys goto first_key
+ loop:
+ unless keys goto not_found
+ $S0 = shift keys
+ $I0 = exists self[$S0]
+ unless $I0 goto loop
+ .return ($S0)
+ first_key:
+ $P0 = self.'hash'()
+ $P1 = iter $P0
+ unless $P1 goto not_found
+ next:
+ $S0 = shift $P1
+ $P2 = $P0[$S0]
+ $I0 = isa $P2, 'Capture'
+ unless $I0 goto next
+ .return ($S0)
+ not_found:
+ .return ('')
+.end
+
+
# Local Variables:
# mode: pir
# fill-column: 100
Modified: branches/pmc_sans_unionval/config/gen/platform/generic/platform_limits.h
==============================================================================
--- branches/pmc_sans_unionval/config/gen/platform/generic/platform_limits.h Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/config/gen/platform/generic/platform_limits.h Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/docs/embed.pod
==============================================================================
--- branches/pmc_sans_unionval/docs/embed.pod Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/docs/embed.pod Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/docs/parrothist.pod
==============================================================================
--- branches/pmc_sans_unionval/docs/parrothist.pod Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/docs/parrothist.pod Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/docs/pdds/pdd17_pmc.pod
==============================================================================
--- branches/pmc_sans_unionval/docs/pdds/pdd17_pmc.pod Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/docs/pdds/pdd17_pmc.pod Wed Aug 19 01:26:03 2009 (r40648)
@@ -1694,11 +1694,6 @@
to reference that PMC rather than calling the assign v-table call on the PMC
in that register. This is not the same behaviour as the Ref PMC.
-=item Random
-
-A singleton PMC that generates a random number. {{ NOTE: Why do we have
-this? }}
-
=item Exception
The base class for all exceptions. Currently based on
Modified: branches/pmc_sans_unionval/docs/project/release_manager_guide.pod
==============================================================================
--- branches/pmc_sans_unionval/docs/project/release_manager_guide.pod Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/docs/project/release_manager_guide.pod Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/docs/user/pir/pmcs.pod
==============================================================================
--- branches/pmc_sans_unionval/docs/user/pir/pmcs.pod Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/docs/user/pir/pmcs.pod Wed Aug 19 01:26:03 2009 (r40648)
@@ -60,7 +60,6 @@
Iterator iterate over aggregates such as arrays or hashes
Array A generic, resizable array
Hash A generic, resizable hash
- Random Obtain a random number
String Similar to a string register but in PMC form
Integer Similar to an int register but in PMC form
Float Similar to a num register but in PMC form
@@ -304,23 +303,7 @@
A good place to start is the docs directory in the Parrot
distribution (parrot/docs)
-=head3 Example 7: Output random numbers
-
-=begin PIR
-
- .sub _ :main
- $P0 = new 'Random'
- $N0 = $P0
- print $N0
- print "\n"
- $N0 = $P0
- print $N0
- print "\n"
- .end
-
-=end PIR
-
-=head3 Example 8: Triggering an exception
+=head3 Example 7: Triggering an exception
=begin PIR
@@ -332,7 +315,7 @@
=end PIR
-=head3 Example 9: Setting a timer
+=head3 Example 8: Setting a timer
=begin PIR
Modified: branches/pmc_sans_unionval/editor/pir-mode.el
==============================================================================
--- branches/pmc_sans_unionval/editor/pir-mode.el Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/editor/pir-mode.el Wed Aug 19 01:26:03 2009 (r40648)
@@ -1,5 +1,5 @@
;;; pir-mode.el --- pir-mode.el --- editing IMCC source files under Emacs
-
+;;; $Id $
;;; Commentary:
;; This package provides Emacs support for PIR.
@@ -153,7 +153,7 @@
"ManagedStruct" "MultiSub" "NCI" "NameSpace" "Null"
"OS" "Object" "OrderedHash" "PMCProxy" "ParrotClass"
"ParrotIO" "ParrotInterpreter" "ParrotLibrary" "ParrotObject"
- "ParrotRunningThread" "ParrotThread" "Pointer" "Random"
+ "ParrotRunningThread" "ParrotThread" "Pointer"
"ResizableBooleanArray" "ResizableFloatArray" "ResizableIntegerArray"
"ResizablePMCArray" "ResizableStringArray" "RetContinuation"
"Role" "Scalar" "String" "Sub" "Super"
Modified: branches/pmc_sans_unionval/examples/benchmarks/primes.pasm
==============================================================================
--- branches/pmc_sans_unionval/examples/benchmarks/primes.pasm Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/examples/benchmarks/primes.pasm Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/examples/opengl/shapes.pir
==============================================================================
--- branches/pmc_sans_unionval/examples/opengl/shapes.pir Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/examples/opengl/shapes.pir Wed Aug 19 01:26:03 2009 (r40648)
@@ -24,6 +24,7 @@
=cut
+.loadlib 'math_ops'
.include 'datatypes.pasm'
.include 'opengl_defines.pasm'
@@ -396,31 +397,26 @@
vy = 0.135
vz = 0.0
- .local pmc random
- .local num rand
- random = new 'Random'
- rand = random
- rand *= .1
- x += rand
- rand = random
- rand *= .1
- y += rand
- rand = random
- rand *= .1
- z += rand
-
- rand = random
- rand -= .5
- rand *= .01
- vx += rand
- rand = random
- rand -= .5
- rand *= .01
- vy += rand
- rand = random
- rand -= .5
- rand *= .01
- vz += rand
+ .local num random
+ random = rand 0, 0.1
+ x += random
+ random = rand 0, 0.1
+ y += random
+ random = rand 0, 0.1
+ z += random
+
+ random = rand
+ random -= .5
+ random *= .01
+ vx += random
+ random = rand
+ random -= .5
+ random *= .01
+ vy += random
+ random = rand
+ random -= .5
+ random *= .01
+ vz += random
.local pmc pos
pos = new 'FixedFloatArray'
@@ -457,12 +453,9 @@
.local int count
count = pfx_pos
if count > 1000 goto update_particles
- .local pmc random
- .local num rand
- random = new 'Random'
- rand = random
- rand *= 4
- if rand > dt goto update_particles
+ .local num random
+ random = rand 0, 4
+ if random > dt goto update_particles
new_particle(count, pfx_pos, pfx_vel)
# Update all particles
Modified: branches/pmc_sans_unionval/examples/pir/befunge/flow.pir
==============================================================================
--- branches/pmc_sans_unionval/examples/pir/befunge/flow.pir Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/examples/pir/befunge/flow.pir Wed Aug 19 01:26:03 2009 (r40648)
@@ -3,6 +3,8 @@
# ** direction changing
+.loadlib 'math_ops'
+
#
# flow__go_east()
#
@@ -69,10 +71,7 @@
# no return value
#
.sub "flow__go_away"
- $P0 = new 'Random'
- $N0 = $P0
- $N0 = $N0 * 4
- $I0 = $N0
+ rand $I0, 0, 4
$P0 = get_global "status"
$P0["dir"] = $I0
set_global "status", $P0
Modified: branches/pmc_sans_unionval/examples/sdl/tetris/board.pir
==============================================================================
--- branches/pmc_sans_unionval/examples/sdl/tetris/board.pir Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/examples/sdl/tetris/board.pir Wed Aug 19 01:26:03 2009 (r40648)
@@ -18,6 +18,7 @@
=cut
.namespace ["Tetris::Board"]
+.loadlib 'math_ops'
.sub __onload :load
$P0 = get_class "Tetris::Board"
@@ -885,8 +886,7 @@
$I0 = blocks
# get a random block id
- $P0 = new 'Random'
- $N0 = $P0
+ rand $N0
$N0 = $N0 * $I0
id = $N0
Modified: branches/pmc_sans_unionval/include/parrot/gc_api.h
==============================================================================
--- branches/pmc_sans_unionval/include/parrot/gc_api.h Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/include/parrot/gc_api.h Wed Aug 19 01:26:03 2009 (r40648)
@@ -17,6 +17,10 @@
#include "parrot/parrot.h"
+/* Set to 1 if we want to use the fixed-size allocator. Set to 0 if we want
+ to allocate these things using mem_sys_allocate instead */
+#define GC_USE_FIXED_SIZE_ALLOCATOR 1
+
/*
* we need an alignment that is the same as malloc(3) have for
* allocating Buffer items like FLOATVAL (double)
Modified: branches/pmc_sans_unionval/include/parrot/sub.h
==============================================================================
--- branches/pmc_sans_unionval/include/parrot/sub.h Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/include/parrot/sub.h Wed Aug 19 01:26:03 2009 (r40648)
@@ -136,37 +136,6 @@
Parrot_UInt1 named_slurpy;
} Parrot_sub_arginfo;
-
-typedef struct Parrot_sub {
- PackFile_ByteCode *seg; /* bytecode segment */
- size_t start_offs; /* sub entry in ops from seg->base.data */
- size_t end_offs;
-
- INTVAL HLL_id; /* see src/hll.c XXX or per segment? */
- PMC *namespace_name; /* where this Sub is in - this is either
- * a String or a [Key] and describes
- * the relative path in the NameSpace
- */
- PMC *namespace_stash; /* the actual hash, HLL::namespace */
- STRING *name; /* name of the sub */
- STRING *method_name; /* method name of the sub */
- STRING *ns_entry_name; /* ns entry name of the sub */
- STRING *subid; /* The ID of the sub. */
- INTVAL vtable_index; /* index in Parrot_vtable_slot_names */
- PMC *multi_signature; /* list of types for MMD */
- INTVAL n_regs_used[4]; /* INSP in PBC */
-
- PMC *lex_info; /* LexInfo PMC */
- PMC *outer_sub; /* :outer for closures */
- PMC *eval_pmc; /* eval container / NULL */
- Parrot_Context *ctx; /* the context this sub is in */
- UINTVAL comp_flags; /* compile time and additional flags */
- Parrot_sub_arginfo *arg_info;/* Argument counts and flags. */
-
- /* - end common */
- struct Parrot_Context *outer_ctx; /* outer context, if a closure */
-} Parrot_sub;
-
#define PMC_get_sub(interp, pmc, sub) \
do { \
const INTVAL type = (pmc)->vtable->base_type; \
@@ -174,47 +143,13 @@
type == enum_class_Coroutine || \
type == enum_class_Eval) \
{\
- GETATTR_Sub_sub((interp), (pmc), (sub)); \
+ (sub) = PARROT_SUB((pmc)); \
} \
else { \
- (sub) = Parrot_get_sub_pmc_from_subclass((interp), (pmc)); \
+ (sub) = (Parrot_Sub_attributes*)Parrot_get_sub_pmc_from_subclass((interp), (pmc)); \
} \
} while (0)
-/* the first entries must match Parrot_sub, so we can cast
- * these two to the other type
- */
-typedef struct Parrot_coro {
- PackFile_ByteCode *seg; /* bytecode segment */
- size_t start_offs; /* sub entry in ops from seg->base.data */
- size_t end_offs;
-
- INTVAL HLL_id; /* see src/hll.c XXX or per segment? */
- PMC *_namespace; /* where this Sub is in - this is either
- * a String or a [Key] and describes
- * the relative path in the NameSpace
- */
- PMC *namespace_stash; /* the actual hash, HLL::namespace */
- STRING *name; /* name of the sub */
- STRING *method_name; /* method name of the sub */
- STRING *ns_entry_name; /* ns entry name of the sub */
- STRING *subid; /* The ID of the sub. */
- INTVAL vtable_index; /* index in Parrot_vtable_slot_names */
- PMC *multi_signature; /* list of types for MMD */
- INTVAL n_regs_used[4]; /* INSP in PBC */
-
- PMC *lex_info; /* LexInfo PMC */
- PMC *outer_sub; /* :outer for closures */
- PMC *eval_pmc; /* eval container / NULL */
- struct Parrot_Context *ctx; /* coroutine context */
- UINTVAL comp_flags; /* compile time and additional flags */
- Parrot_sub_arginfo arg_info; /* Argument counts and flags. */
-
- /* - end common */
-
- PackFile_ByteCode *caller_seg; /* bytecode segment */
- opcode_t *address; /* next address to run - toggled each time */
-} Parrot_coro;
typedef struct Parrot_cont {
/* continuation destination */
@@ -276,8 +211,7 @@
PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
-Parrot_sub * Parrot_get_sub_pmc_from_subclass(PARROT_INTERP,
- ARGIN(PMC *subclass))
+void * Parrot_get_sub_pmc_from_subclass(PARROT_INTERP, ARGIN(PMC *subclass))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
@@ -307,19 +241,9 @@
PARROT_MALLOC
PARROT_CANNOT_RETURN_NULL
-Parrot_coro * new_coroutine(PARROT_INTERP)
- __attribute__nonnull__(1);
-
-PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
Parrot_cont * new_ret_continuation(PARROT_INTERP)
__attribute__nonnull__(1);
-PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
-Parrot_sub * new_sub(PARROT_INTERP)
- __attribute__nonnull__(1);
-
void Parrot_capture_lex(PARROT_INTERP, ARGMOD(PMC *sub_pmc))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
@@ -374,12 +298,8 @@
#define ASSERT_ARGS_mark_context_start __attribute__unused__ int _ASSERT_ARGS_CHECK = 0
#define ASSERT_ARGS_new_continuation __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp)
-#define ASSERT_ARGS_new_coroutine __attribute__unused__ int _ASSERT_ARGS_CHECK = \
- PARROT_ASSERT_ARG(interp)
#define ASSERT_ARGS_new_ret_continuation __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp)
-#define ASSERT_ARGS_new_sub __attribute__unused__ int _ASSERT_ARGS_CHECK = \
- PARROT_ASSERT_ARG(interp)
#define ASSERT_ARGS_Parrot_capture_lex __attribute__unused__ int _ASSERT_ARGS_CHECK = \
PARROT_ASSERT_ARG(interp) \
|| PARROT_ASSERT_ARG(sub_pmc)
Modified: branches/pmc_sans_unionval/lib/Parrot/Pmc2c/Attribute.pm
==============================================================================
--- branches/pmc_sans_unionval/lib/Parrot/Pmc2c/Attribute.pm Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/lib/Parrot/Pmc2c/Attribute.pm Wed Aug 19 01:26:03 2009 (r40648)
@@ -10,9 +10,10 @@
my ( $class, $self_hash ) = @_;
my $self = {
(
- name => "",
- type => "",
- modifiers => [],
+ name => "",
+ type => "",
+ array_size => "",
+ modifiers => [],
%{ $self_hash || {} }
)
};
@@ -36,7 +37,7 @@
sub generate_declaration {
my ( $self, $pmc ) = @_;
my $h = $pmc->{emitter};
- my $decl = ' ' . $self->{type} . ' ' . $self->{name} . ";\n";
+ my $decl = ' ' . $self->{type} . ' ' . $self->{name} . $self->{array_size} . ";\n";
$h->emit($decl);
Modified: branches/pmc_sans_unionval/lib/Parrot/Pmc2c/PMCEmitter.pm
==============================================================================
--- branches/pmc_sans_unionval/lib/Parrot/Pmc2c/PMCEmitter.pm Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/lib/Parrot/Pmc2c/PMCEmitter.pm Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/lib/Parrot/Pmc2c/Parser.pm
==============================================================================
--- branches/pmc_sans_unionval/lib/Parrot/Pmc2c/Parser.pm Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/lib/Parrot/Pmc2c/Parser.pm Wed Aug 19 01:26:03 2009 (r40648)
@@ -146,6 +146,9 @@
| \(\*\w*\)\(.*?\)
)
+ # Array size
+ (\[\d+\])?
+
# modifiers
\s*
((?::\w+\s*)*)
@@ -159,19 +162,21 @@
}sx;
while ($pmcbody =~ s/($attr_re)//o) {
- my ($type, $name, @modifiers, $comment);
+ my ($type, $name, $array_size, @modifiers, $comment);
$type = $2;
$name = $3;
- @modifiers = split /\s/, $4;
- $comment = $5;
+ $array_size = $4 || '';
+ @modifiers = split /\s/, $5;
+ $comment = $6;
$lineno += count_newlines($1);
$pmc->add_attribute(Parrot::Pmc2c::Attribute->new(
{
- name => $name,
- type => $type,
- modifiers => \@modifiers,
+ name => $name,
+ type => $type,
+ array_size => $array_size,
+ modifiers => \@modifiers,
}
));
}
Modified: branches/pmc_sans_unionval/lib/Parrot/Test.pm
==============================================================================
--- branches/pmc_sans_unionval/lib/Parrot/Test.pm Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/lib/Parrot/Test.pm Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/lib/Parrot/Vtable.pm
==============================================================================
--- branches/pmc_sans_unionval/lib/Parrot/Vtable.pm Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/lib/Parrot/Vtable.pm Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/dynoplibs/math.ops
==============================================================================
--- branches/pmc_sans_unionval/src/dynoplibs/math.ops Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/dynoplibs/math.ops Wed Aug 19 01:26:03 2009 (r40648)
@@ -37,6 +37,16 @@
$1 = Parrot_float_rand(0);
}
+=item B<rand>(out INT)
+
+Set $1 to a random integer between C<[-2^31, 2^31)> .
+
+=cut
+
+inline op rand(out INT) {
+ $1 = Parrot_int_rand(0);
+}
+
=item B<rand>(out NUM, in NUM)
Set $1 to a random floating point number between 0 and and $2, inclusive.
@@ -47,6 +57,16 @@
$1 = $2 * Parrot_float_rand(0);
}
+=item B<rand>(out INT, in INT)
+
+Set $1 to a integer between 0 and and $2, inclusive.
+
+=cut
+
+inline op rand(out INT, in INT) {
+ $1 = Parrot_range_rand(0, $2, 0);
+}
+
=item B<rand>(out NUM, in NUM, in NUM)
Set $1 to a random floating point number between $2 and and $3, inclusive.
@@ -57,6 +77,36 @@
$1 = $2 + ($3 - $2) * Parrot_float_rand(0);
}
+=item B<srand>(in NUM)
+
+Set the random number seed to $1. $1 is casted to an INTVAL.
+
+=cut
+
+inline op srand(in NUM) {
+ Parrot_srand((INTVAL)$1);
+}
+
+=item B<srand>(in INT)
+
+Set the random number seed to $1.
+
+=cut
+
+inline op srand(in INT) {
+ Parrot_srand((INTVAL)$1);
+}
+
+=item B<rand>(out INT, in INT, in INT)
+
+Set $1 to a integer between $2 and and $3, inclusive.
+
+=cut
+
+inline op rand(out INT, in INT, in INT) {
+ $1 = Parrot_range_rand($2, $3, 0);
+}
+
=back
=head1 COPYRIGHT
Modified: branches/pmc_sans_unionval/src/dynpmc/dynlexpad.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/dynpmc/dynlexpad.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/dynpmc/dynlexpad.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/dynpmc/foo.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/dynpmc/foo.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/dynpmc/foo.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/dynpmc/foo2.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/dynpmc/foo2.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/dynpmc/foo2.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/dynpmc/gdbmhash.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/dynpmc/gdbmhash.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/dynpmc/gdbmhash.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -92,13 +92,11 @@
*/
VTABLE void class_init() {
- if (pass) {
#ifdef WIN32
- /* RT #46393: What if libgdbm.so cannot be loaded */
- /* Parrot_load_lib(interp, slib, NULL); */
- STRING *slib = CONST_STRING(interp, "gdbm3");
+ /* RT #46393: What if libgdbm.so cannot be loaded */
+ /* Parrot_load_lib(interp, slib, NULL); */
+ STRING *slib = CONST_STRING(interp, "gdbm3");
#endif
- }
}
VTABLE void init() {
Modified: branches/pmc_sans_unionval/src/dynpmc/rotest.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/dynpmc/rotest.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/dynpmc/rotest.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/dynpmc/subproxy.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/dynpmc/subproxy.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/dynpmc/subproxy.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -31,7 +31,7 @@
PMC *key = PMC_data_typed(SELF, PMC *);
STRING *file;
PMC *rsub_pmc, *sub_pmc;
- Parrot_sub *rsub, *my_sub;
+ Parrot_Sub_attributes *rsub, *my_sub;
if (!key)
Parrot_ex_throw_from_c_args(interp, NULL, 1, "SubProxy: no key");
Modified: branches/pmc_sans_unionval/src/embed.c
==============================================================================
--- branches/pmc_sans_unionval/src/embed.c Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/embed.c Wed Aug 19 01:26:03 2009 (r40648)
@@ -885,7 +885,7 @@
set_current_sub(PARROT_INTERP)
{
ASSERT_ARGS(set_current_sub)
- Parrot_sub *sub_pmc_sub;
+ Parrot_Sub_attributes *sub_pmc_sub;
PMC *sub_pmc;
PackFile_ByteCode * const cur_cs = interp->code;
@@ -903,7 +903,7 @@
if (ft->fixups[i]->type == enum_fixup_sub) {
const opcode_t ci = ft->fixups[i]->offset;
PMC *sub_pmc = ct->constants[ci]->u.key;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PMC_get_sub(interp, sub_pmc, sub);
if (sub->seg == cur_cs) {
Modified: branches/pmc_sans_unionval/src/extend.c
==============================================================================
--- branches/pmc_sans_unionval/src/extend.c Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/extend.c Wed Aug 19 01:26:03 2009 (r40648)
@@ -1040,7 +1040,7 @@
ASSERT_ARGS(Parrot_call_sub)
va_list ap;
void *result;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PARROT_CALLIN_START(interp);
@@ -1073,7 +1073,7 @@
ASSERT_ARGS(Parrot_call_sub_ret_int)
va_list ap;
Parrot_Int result;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PARROT_CALLIN_START(interp);
@@ -1106,7 +1106,7 @@
ASSERT_ARGS(Parrot_call_sub_ret_float)
va_list ap;
Parrot_Float result;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PARROT_CALLIN_START(interp);
Modified: branches/pmc_sans_unionval/src/gc/alloc_register.c
==============================================================================
--- branches/pmc_sans_unionval/src/gc/alloc_register.c Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/gc/alloc_register.c Wed Aug 19 01:26:03 2009 (r40648)
@@ -585,7 +585,7 @@
if (Interp_debug_TEST(interp, PARROT_CTX_DESTROY_DEBUG_FLAG)
&& ctx->current_sub) {
/* can't probably Parrot_io_eprintf here */
- Parrot_sub *doomed;
+ Parrot_Sub_attributes *doomed;
PMC_get_sub(interp, ctx->current_sub, doomed);
if (doomed) {
@@ -670,7 +670,7 @@
const char *name = "unknown";
if (ctx->current_sub) {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PMC_get_sub(interp, ctx->current_sub, sub);
name = (char *)(sub->name->strstart);
}
Modified: branches/pmc_sans_unionval/src/gc/alloc_resources.c
==============================================================================
--- branches/pmc_sans_unionval/src/gc/alloc_resources.c Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/gc/alloc_resources.c Wed Aug 19 01:26:03 2009 (r40648)
@@ -419,8 +419,9 @@
cur_buffer_arena = cur_buffer_arena->prev) {
Buffer *b = (Buffer *)ARENA_to_PObj(cur_buffer_arena->start_objects);
UINTVAL i;
+ const size_t objects_end = cur_buffer_arena->used;
- for (i = cur_buffer_arena->used; i; --i) {
+ for (i = objects_end; i; --i) {
INTVAL *ref_count = NULL;
/* ! (on_free_list | constant | external | sysmem) */
Modified: branches/pmc_sans_unionval/src/gc/api.c
==============================================================================
--- branches/pmc_sans_unionval/src/gc/api.c Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/gc/api.c Wed Aug 19 01:26:03 2009 (r40648)
@@ -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>
@@ -368,6 +369,16 @@
Parrot_gc_free_pmc_sync(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));
+
PObj_flags_SETTO((PObj *)pmc, PObj_on_free_list_FLAG);
pool->add_free_object(interp, pool, (PObj *)pmc);
pool->num_free_objects++;
Modified: branches/pmc_sans_unionval/src/gc/gc_ms.c
==============================================================================
--- branches/pmc_sans_unionval/src/gc/gc_ms.c Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/gc/gc_ms.c Wed Aug 19 01:26:03 2009 (r40648)
@@ -102,16 +102,6 @@
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
-/* the percent of used Arena items at which to trace next time through */
-#define GC_DEBUG_REPLENISH_LEVEL_FACTOR 0.0
-#define GC_DEBUG_UNITS_PER_ALLOC_GROWTH_FACTOR 1
-#define REPLENISH_LEVEL_FACTOR 0.3
-
-/* this factor is totally arbitrary, but gives good timings for stress.pasm */
-#define UNITS_PER_ALLOC_GROWTH_FACTOR 1.75
-
-#define POOL_MAX_BYTES 65536 * 128
-
/*
=head2 Primary MS Functions
@@ -409,6 +399,28 @@
PObj *ptr;
PObj *free_list = (PObj *)pool->free_list;
+#if GC_USE_LAZY_ALLOCATOR
+ if (!free_list && !pool->newfree) {
+ (*pool->more_objects)(interp, pool);
+ free_list = (PObj *)pool->free_list;
+ }
+
+ if (!free_list) {
+ Small_Object_Arena * const arena = pool->last_Arena;
+ ptr = (PObj *)pool->newfree;
+ pool->newfree = (void *)((char *)pool->newfree + pool->object_size);
+ arena->used++;
+
+ if (pool->newfree >= pool->newlast)
+ pool->newfree = NULL;
+
+ PARROT_ASSERT(ptr < (PObj *)pool->newlast);
+ }
+ else {
+ ptr = free_list;
+ pool->free_list = ((GC_MS_PObj_Wrapper *)ptr)->next_ptr;
+ }
+#else
/* if we don't have any objects */
if (!free_list) {
(*pool->more_objects)(interp, pool);
@@ -417,6 +429,7 @@
ptr = free_list;
pool->free_list = ((GC_MS_PObj_Wrapper*)ptr)->next_ptr;
+#endif
/* PObj_flags_SETTO(ptr, 0); */
memset(ptr, 0, pool->object_size);
@@ -426,6 +439,7 @@
return ptr;
}
+
/*
=item C<static void gc_ms_alloc_objects(PARROT_INTERP, Small_Object_Pool *pool)>
Modified: branches/pmc_sans_unionval/src/gc/gc_private.h
==============================================================================
--- branches/pmc_sans_unionval/src/gc/gc_private.h Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/gc/gc_private.h Wed Aug 19 01:26:03 2009 (r40648)
@@ -36,10 +36,40 @@
#endif /* __ia64__ */
+/* the percent of used Arena items at which to trace next time through */
+#define GC_DEBUG_REPLENISH_LEVEL_FACTOR 0.0
+#define GC_DEBUG_UNITS_PER_ALLOC_GROWTH_FACTOR 1
+#define REPLENISH_LEVEL_FACTOR 0.3
+
+/* this factor is totally arbitrary, but gives good timings for stress.pasm */
+#define UNITS_PER_ALLOC_GROWTH_FACTOR 1.75
+
+#define POOL_MAX_BYTES 65536 * 128
+
+#ifndef GC_IS_MALLOC
+# define PMC_HEADERS_PER_ALLOC 10240 / sizeof (PMC)
+# define BUFFER_HEADERS_PER_ALLOC 5120 / sizeof (Buffer)
+# define STRING_HEADERS_PER_ALLOC 5120 / sizeof (STRING)
+#else /* GC_IS_MALLOC */
+# define PMC_HEADERS_PER_ALLOC 10240 / sizeof (PMC)
+# define BUFFER_HEADERS_PER_ALLOC 10240 / sizeof (Buffer)
+# define STRING_HEADERS_PER_ALLOC 10240 / sizeof (STRING)
+#endif /* GC_IS_MALLOC */
+
+#define CONSTANT_PMC_HEADERS_PER_ALLOC 64
+#define GET_SIZED_POOL_IDX(x) ((x) / sizeof (void *))
+
+
/* these values are used for the attribute allocator */
#define GC_ATTRIB_POOLS_HEADROOM 8
#define GC_FIXED_SIZE_POOL_SIZE 4096
+/* Use the lazy allocator. Since it amortizes arena allocation costs, turn
+ this on at the same time that you increase the size of allocated arenas.
+ increase *_HEADERS_PER_ALLOC and GC_FIXED_SIZE_POOL_SIZE to be large
+ enough to satisfy most startup costs. */
+#define GC_USE_LAZY_ALLOCATOR 0
+
/* We're using this here to add an additional pointer to a PObj without
having to actually add an entire pointer to every PObj-alike structure
in Parrot. Astute observers may notice that if the PObj is comprised of
@@ -124,8 +154,6 @@
#endif /* PARROT_GC_GMS */
-#define GC_USE_LAZY_ALLOCATOR 1
-
typedef struct PMC_Attribute_Pool {
size_t attr_size;
size_t total_objects;
@@ -165,6 +193,10 @@
size_t start_arena_memory;
size_t end_arena_memory;
PARROT_OBSERVER const char *name;
+#if GC_USE_LAZY_ALLOCATOR
+ void *newfree;
+ void *newlast;
+#endif
#if PARROT_GC_GMS
struct _gc_gms_hdr marker; /* limit of list */
struct _gc_gms_hdr *black; /* alive */
Modified: branches/pmc_sans_unionval/src/gc/mark_sweep.c
==============================================================================
--- branches/pmc_sans_unionval/src/gc/mark_sweep.c Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/gc/mark_sweep.c Wed Aug 19 01:26:03 2009 (r40648)
@@ -297,10 +297,12 @@
/* Run through all the PObj header pools and mark */
for (cur_arena = pool->last_Arena; cur_arena; cur_arena = cur_arena->prev) {
- b = (PObj*)cur_arena->start_objects;
+ const size_t objects_end = cur_arena->used;
+ b = (PObj *)cur_arena->start_objects;
+ UINTVAL i;
/* loop only while there are objects in the arena */
- for (i = cur_arena->total_objects; i; i--) {
+ for (i = objects_end; i; i--) {
if (PObj_on_free_list_TEST(b))
; /* if it's on free list, do nothing */
@@ -605,16 +607,24 @@
const UINTVAL num_objects = pool->objects_per_alloc;
pool->total_objects += num_objects;
- arena->used = num_objects;
-
- /* Move all the new objects into the free list */
object = (void *)arena->start_objects;
-
+#if GC_USE_LAZY_ALLOCATOR
+ /* Don't move anything onto the free list. Set the pointers and do it
+ lazily when we allocate. */
+ {
+ const size_t total_size = num_objects * pool->object_size;
+ pool->newfree = arena->start_objects;
+ pool->newlast = (void*)((char*)object + total_size);
+ arena->used = 0;
+ }
+#else
+ /* Move all the new objects into the free list */
+ arena->used = num_objects;
for (i = 0; i < num_objects; i++) {
pool->add_free_object(interp, pool, object);
object = (void *)((char *)object + pool->object_size);
}
-
+#endif
pool->num_free_objects += num_objects;
}
@@ -713,21 +723,6 @@
}
}
-#ifndef GC_IS_MALLOC
-# define PMC_HEADERS_PER_ALLOC 10240 / sizeof (PMC)
-# define BUFFER_HEADERS_PER_ALLOC 5120 / sizeof (Buffer)
-# define STRING_HEADERS_PER_ALLOC 5120 / sizeof (STRING)
-#else /* GC_IS_MALLOC */
-# define PMC_HEADERS_PER_ALLOC 10240 / sizeof (PMC)
-# define BUFFER_HEADERS_PER_ALLOC 10240 / sizeof (Buffer)
-# define STRING_HEADERS_PER_ALLOC 10240 / sizeof (STRING)
-#endif /* GC_IS_MALLOC */
-
-#define CONSTANT_PMC_HEADERS_PER_ALLOC 64
-#define GET_SIZED_POOL_IDX(x) ((x) / sizeof (void *))
-
-
-
/*
=back
@@ -860,6 +855,10 @@
pool->mem_pool = NULL;
pool->object_size = object_size;
pool->objects_per_alloc = objects_per_alloc;
+#if GC_USE_LAZY_ALLOCATOR
+ pool->newfree = NULL;
+ pool->newlast = NULL;
+#endif
return pool;
}
Modified: branches/pmc_sans_unionval/src/global.c
==============================================================================
--- branches/pmc_sans_unionval/src/global.c Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/global.c Wed Aug 19 01:26:03 2009 (r40648)
@@ -718,7 +718,7 @@
get_namespace_pmc(PARROT_INTERP, ARGIN(PMC *sub_pmc))
{
ASSERT_ARGS(get_namespace_pmc)
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PMC *nsname, *nsroot;
PMC_get_sub(interp, sub_pmc, sub);
@@ -752,7 +752,7 @@
store_sub_in_multi(PARROT_INTERP, ARGIN(PMC *sub_pmc), ARGIN(PMC *ns))
{
ASSERT_ARGS(store_sub_in_multi)
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
STRING *ns_entry_name;
PMC *multisub;
@@ -791,7 +791,7 @@
const INTVAL cur_id = CONTEXT(interp)->current_HLL;
PMC *ns;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
/* PF structures aren't fully constructed yet */
Parrot_block_GC_mark(interp);
Modified: branches/pmc_sans_unionval/src/jit.c
==============================================================================
--- branches/pmc_sans_unionval/src/jit.c Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/jit.c Wed Aug 19 01:26:03 2009 (r40648)
@@ -1294,10 +1294,10 @@
for (i = 0; i < ft->fixup_count; i++) {
if (ft->fixups[i]->type == enum_fixup_sub) {
const int ci = ft->fixups[i]->offset;
- PMC * const sub_pmc = ct->constants[ci]->u.key;
- Parrot_sub *sub;
- size_t offs;
- int i;
+ PMC * const sub_pmc = ct->constants[ci]->u.key;
+ Parrot_Sub_attributes *sub;
+ size_t offs;
+ int i;
PMC_get_sub(interp, sub_pmc, sub);
offs = pc - sub->seg->base.data;
Modified: branches/pmc_sans_unionval/src/multidispatch.c
==============================================================================
--- branches/pmc_sans_unionval/src/multidispatch.c Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/multidispatch.c Wed Aug 19 01:26:03 2009 (r40648)
@@ -816,8 +816,8 @@
{
ASSERT_ARGS(Parrot_mmd_get_cached_multi_sig)
if (VTABLE_isa(interp, sub_pmc, CONST_STRING(interp, "Sub"))) {
- Parrot_sub *sub;
- PMC *multi_sig;
+ Parrot_Sub_attributes *sub;
+ PMC *multi_sig;
PMC_get_sub(interp, sub_pmc, sub);
multi_sig = sub->multi_signature;
@@ -856,7 +856,7 @@
{
ASSERT_ARGS(mmd_distance)
PMC *multi_sig, *mro;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
INTVAL args, dist, i, j, n, m;
/* has to be a builtin multi method */
@@ -1261,7 +1261,7 @@
ARGIN(STRING *sub_name), ARGIN(STRING *long_sig), ARGIN(PMC *sub_obj))
{
ASSERT_ARGS(Parrot_mmd_add_multi_from_long_sig)
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
STRING *sub_str = CONST_STRING(interp, "Sub");
STRING *closure_str = CONST_STRING(interp, "Closure");
PMC *type_list = Parrot_str_split(interp, CONST_STRING(interp, ","), long_sig);
Modified: branches/pmc_sans_unionval/src/packdump.c
==============================================================================
--- branches/pmc_sans_unionval/src/packdump.c Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/packdump.c Wed Aug 19 01:26:03 2009 (r40648)
@@ -269,7 +269,7 @@
Parrot_io_printf(interp, " [ 'PFC_PMC', {\n");
{
PMC * const pmc = self->u.key;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
STRING * const null = Parrot_str_new_constant(interp, "(null)");
STRING *namespace_description;
Modified: branches/pmc_sans_unionval/src/packfile.c
==============================================================================
--- branches/pmc_sans_unionval/src/packfile.c Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/packfile.c Wed Aug 19 01:26:03 2009 (r40648)
@@ -618,7 +618,7 @@
* These casts are a quick fix to allow parrot build with c++,
* a refactor of the macros will be a cleaner solution. */
DECL_CONST_CAST;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
int todo = 0;
const int pragmas = PObj_get_FLAGS(sub_pmc) & SUB_FLAG_PF_MASK
& ~SUB_FLAG_IS_OUTER;
@@ -707,7 +707,7 @@
do_1_sub_pragma(PARROT_INTERP, ARGMOD(PMC *sub_pmc), pbc_action_enum_t action)
{
ASSERT_ARGS(do_1_sub_pragma)
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PMC_get_sub(interp, sub_pmc, sub);
switch (action) {
@@ -922,7 +922,7 @@
{
/* offset is an index into const_table holding the Sub PMC */
PMC *sub_pmc;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
const opcode_t ci = ft->fixups[i]->offset;
if (ci < 0 || ci >= ct->const_count)
@@ -1005,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) {
@@ -3119,7 +3119,7 @@
if (old_const->type == PFC_PMC
&& VTABLE_isa(interp, old_const->u.key, _sub)) {
PMC *old_sub_pmc, *new_sub_pmc;
- Parrot_sub *old_sub, *new_sub;
+ Parrot_Sub_attributes *old_sub, *new_sub;
PackFile_Constant * const ret = mem_allocate_typed(PackFile_Constant);
ret->type = old_const->type;
Modified: branches/pmc_sans_unionval/src/pbc_merge.c
==============================================================================
--- branches/pmc_sans_unionval/src/pbc_merge.c Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pbc_merge.c Wed Aug 19 01:26:03 2009 (r40648)
@@ -457,7 +457,7 @@
case enum_class_Sub:
case enum_class_Coroutine:
{
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PMC_get_sub(interp, copy->u.key, sub);
sub->start_offs += inputs[i]->code_start;
sub->end_offs += inputs[i]->code_start;
Modified: branches/pmc_sans_unionval/src/pic_jit.c
==============================================================================
--- branches/pmc_sans_unionval/src/pic_jit.c Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pic_jit.c Wed Aug 19 01:26:03 2009 (r40648)
@@ -212,7 +212,7 @@
const jit_arch_info * const info = Parrot_jit_init(interp);
const jit_arch_regs * const regs = info->regs + JIT_CODE_SUB_REGS_ONLY;
INTVAL *n_regs_used;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PMC_get_sub(interp, sub_pmc, sub);
n_regs_used = sub->n_regs_used;
@@ -349,7 +349,7 @@
{
ASSERT_ARGS(call_is_safe)
PMC *called, *sig_results;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PMC *sig_args;
opcode_t *pc = *set_args;
@@ -480,7 +480,7 @@
ASSERT_ARGS(parrot_pic_is_safe_to_jit)
#ifdef HAS_JIT
opcode_t *base, *start, *end;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
*flags = 0;
@@ -549,11 +549,11 @@
/*
* create JIT code - just a test
*/
- Parrot_sub *sub;
- opcode_t *base;
- opcode_t *start;
- opcode_t *end;
- Parrot_jit_info_t *jit_info;
+ Parrot_Sub_attributes *sub;
+ opcode_t *base;
+ opcode_t *start;
+ opcode_t *end;
+ Parrot_jit_info_t *jit_info;
PMC_get_sub(interp, sub_pmc, sub);
base = sub->seg->base.data;
Modified: branches/pmc_sans_unionval/src/pmc.c
==============================================================================
--- branches/pmc_sans_unionval/src/pmc.c Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc.c Wed Aug 19 01:26:03 2009 (r40648)
@@ -228,6 +228,24 @@
/* Set the right vtable */
pmc->vtable = new_vtable;
+ if (PMC_data(pmc) && pmc->vtable->attr_size) {
+#if GC_USE_FIXED_SIZE_ALLOCATOR
+ Parrot_gc_free_pmc_attributes(interp, pmc, pmc->vtable->attr_size);
+#else
+ mem_sys_free(PMC_data(pmc));
+#endif
+ }
+
+ if (new_vtable->attr_size) {
+#if GC_USE_FIXED_SIZE_ALLOCATOR
+ Parrot_gc_allocate_pmc_attributes(interp, pmc, pmc->vtable->attr_size);
+#else
+ PMC_data(pmc) = mem_sys_allocate_zeroed(new_vtable->attr_size);
+#endif
+ }
+ else
+ PMC_data(pmc) = NULL;
+
return pmc;
}
@@ -267,9 +285,21 @@
if (PObj_active_destroy_TEST(pmc))
VTABLE_destroy(interp, pmc);
- /* we are a PMC + maybe is_PMC_EXT */
+ /* we are a PMC */
PObj_flags_SETTO(pmc, PObj_is_PMC_FLAG | new_flags);
+/*
+ if (new_vtable->attr_size) {
+#if GC_USE_FIXED_SIZE_ALLOCATOR
+ Parrot_gc_allocate_pmc_attributes(interp, pmc, pmc->vtable->attr_size);
+#else
+ PMC_data(pmc) = mem_sys_allocate_zeroed(new_vtable->attr_size);
+#endif
+ }
+ else
+ PMC_data(pmc) = NULL;
+*/
+
/* Set the right vtable */
pmc->vtable = new_vtable;
@@ -407,6 +437,14 @@
pmc = Parrot_gc_new_pmc_header(interp, flags);
pmc->vtable = vtable;
+ if (vtable->attr_size) {
+#if GC_USE_FIXED_SIZE_ALLOCATOR
+ Parrot_gc_allocate_pmc_attributes(interp, pmc, pmc->vtable->attr_size);
+#else
+ PMC_data(pmc) = mem_sys_allocate_zeroed(vtable->attr_size);
+#endif
+ }
+
#if GC_VERBOSE
if (Interp_flags_TEST(interp, PARROT_TRACE_FLAG)) {
/* XXX make a more verbose trace flag */
Modified: branches/pmc_sans_unionval/src/pmc/array.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/array.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/array.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -108,20 +108,6 @@
=over 4
-=item C<void class_init()>
-
-Class initialization. Creates the required memory pools.
-
-=cut
-
-*/
-
- void class_init() {
-
- }
-
-/*
-
=item C<void init()>
Initializes the PMC by calling the underlying C<list_new()> function.
Modified: branches/pmc_sans_unionval/src/pmc/arrayiterator.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/arrayiterator.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/arrayiterator.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/boolean.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/boolean.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/boolean.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -21,7 +21,7 @@
*/
-pmclass Boolean extends Integer provides boolean provides scalar {
+pmclass Boolean extends Integer provides boolean provides scalar auto_attrs {
/*
Modified: branches/pmc_sans_unionval/src/pmc/callsignature.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/callsignature.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/callsignature.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/capture.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/capture.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/capture.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/class.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/class.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/class.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/codestring.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/codestring.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/codestring.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/complex.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/complex.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/complex.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/continuation.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/continuation.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/continuation.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -45,7 +45,7 @@
* need the next_for_GC pointer.
*/
-pmclass Continuation need_ext {
+pmclass Continuation need_ext auto_attrs {
ATTR struct Parrot_cont *cont; /* the continuation struct */
/*
@@ -60,8 +60,7 @@
VTABLE void init() {
Parrot_Continuation_attributes *attrs =
- mem_allocate_zeroed_typed(Parrot_Continuation_attributes);
- PMC_data(SELF) = attrs;
+ (Parrot_Continuation_attributes *) PMC_data(SELF);
PMC_cont(SELF) = new_continuation(INTERP, NULL);
PObj_custom_mark_destroy_SETALL(SELF);
@@ -120,8 +119,6 @@
mem_sys_free(cc);
}
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
}
/*
@@ -302,7 +299,7 @@
METHOD caller() {
Parrot_cont *cc = PMC_cont(SELF);
PMC *caller = cc->to_ctx->current_sub;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
if (!caller)
caller = PMCNULL;
Modified: branches/pmc_sans_unionval/src/pmc/coroutine.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/coroutine.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/coroutine.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -36,13 +36,11 @@
print_sub_name(PARROT_INTERP, PMC *sub_pmc)
{
/* It's actually a Parrot_coro, but this avoids casting warnings. */
- Parrot_sub *co;
+ Parrot_Sub_attributes *co = PARROT_SUB(sub_pmc);
Interp * const tracer = (interp->pdb && interp->pdb->debugger) ?
interp->pdb->debugger :
interp;
- GETATTR_Coroutine_sub(interp, sub_pmc, co);
-
Parrot_io_eprintf(tracer, "# %s coro '%Ss'",
!(PObj_get_FLAGS(sub_pmc) & SUB_FLAG_CORO_FF) ?
"Calling" : "yielding from",
@@ -59,6 +57,8 @@
}
pmclass Coroutine extends Sub need_ext {
+ ATTR PackFile_ByteCode *caller_seg; /* bytecode segment */
+ ATTR opcode_t *address; /* next address to run - toggled each time */
/*
@@ -76,9 +76,10 @@
VTABLE void init() {
Parrot_Coroutine_attributes *attrs =
- mem_allocate_typed(Parrot_Coroutine_attributes);
+ mem_allocate_zeroed_typed(Parrot_Coroutine_attributes);
- attrs->sub = (Parrot_sub *)new_coroutine(INTERP);
+ attrs->seg = INTERP->code;
+ attrs->ctx = NULL;
PMC_data(SELF) = attrs;
PObj_custom_mark_destroy_SETALL(SELF);
@@ -97,14 +98,12 @@
VTABLE PMC *clone() {
PMC * const ret = pmc_new(INTERP, SELF->vtable->base_type);
- Parrot_sub *sub;
- Parrot_sub *coro_sub;
+ Parrot_Coroutine_attributes *sub = PARROT_COROUTINE(SELF);
+ Parrot_Coroutine_attributes *coro_sub = PARROT_COROUTINE(ret);
PObj_custom_mark_destroy_SETALL(ret);
- PMC_get_sub(INTERP, ret, coro_sub);
- PMC_get_sub(INTERP, SELF, sub);
- memcpy(coro_sub, sub, sizeof (Parrot_coro));
+ memcpy(coro_sub, sub, sizeof (Parrot_Coroutine_attributes));
coro_sub->name = Parrot_str_copy(INTERP, coro_sub->name);
@@ -123,8 +122,7 @@
VTABLE opcode_t *invoke(void *next) {
PackFile_ByteCode *wanted_seg;
- Parrot_Coroutine_attributes *attrs = PARROT_COROUTINE(SELF);
- Parrot_coro * const co = (Parrot_coro *)attrs->sub;
+ Parrot_Coroutine_attributes *co = PARROT_COROUTINE(SELF);
opcode_t * dest = co->address;
if (Interp_trace_TEST(INTERP, PARROT_TRACE_SUB_CALL_FLAG))
@@ -244,8 +242,7 @@
*/
VTABLE void mark() {
- Parrot_Coroutine_attributes *attrs = PARROT_COROUTINE(SELF);
- Parrot_coro * const co = (Parrot_coro *)attrs->sub;
+ Parrot_Coroutine_attributes *co = PARROT_COROUTINE(SELF);
/* co->ctx marked in SUPER(), so do not mark here */
if (co) {
Modified: branches/pmc_sans_unionval/src/pmc/cpointer.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/cpointer.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/cpointer.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/default.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/default.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/default.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -324,6 +324,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/pmc_sans_unionval/src/pmc/eval.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/eval.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/eval.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -22,7 +22,7 @@
#include "pmc_sub.h"
static void
-clear_fixups(PARROT_INTERP, Parrot_sub *sub_data)
+clear_fixups(PARROT_INTERP, Parrot_Sub_attributes *sub_data)
{
INTVAL i;
PackFile_ByteCode *seg = sub_data->seg;
@@ -55,11 +55,11 @@
static PMC*
get_sub(PARROT_INTERP, PMC *self, int idx)
{
- INTVAL i, n;
- Parrot_sub *sub;
- PackFile_ByteCode *seg;
- PackFile_FixupTable *ft;
- PackFile_ConstTable *ct;
+ INTVAL i, n;
+ Parrot_Sub_attributes *sub;
+ PackFile_ByteCode *seg;
+ PackFile_FixupTable *ft;
+ PackFile_ConstTable *ct;
PMC_get_sub(interp, self, sub);
seg = sub->seg;
@@ -92,7 +92,7 @@
static void
mark_subs(PARROT_INTERP, PMC *self)
{
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PackFile_ByteCode *seg;
PackFile_FixupTable *ft;
PackFile_ConstTable *ct;
@@ -128,7 +128,7 @@
pmclass Eval extends Sub need_ext {
VTABLE void init() {
- Parrot_sub *sub_data;
+ Parrot_Sub_attributes *sub_data;
SUPER();
PMC_get_sub(INTERP, SELF, sub_data);
@@ -168,7 +168,7 @@
*/
PackFile_Segment *seg;
PackFile_ByteCode *cur_cs;
- Parrot_sub *sub_data;
+ Parrot_Sub_attributes *sub_data;
PMC_get_sub(INTERP, SELF, sub_data);
@@ -229,7 +229,7 @@
*/
VTABLE STRING *get_string() {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PackFile *pf = PackFile_new(INTERP, 0);
PackFile_ByteCode *seg;
STRING *res;
@@ -336,7 +336,7 @@
STRING *packed = VTABLE_shift_string(INTERP, io);
PackFile *pf;
PackFile_Segment *seg;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
size_t i;
SUPER(info);
@@ -371,7 +371,7 @@
VTABLE INTVAL elements() {
INTVAL i, n;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PackFile_ByteCode *seg;
PackFile_FixupTable *ft;
Modified: branches/pmc_sans_unionval/src/pmc/exception.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/exception.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/exception.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -52,7 +52,7 @@
#include "parrot/exceptions.h"
#include "pmc_sub.h"
-pmclass Exception {
+pmclass Exception auto_attrs {
ATTR INTVAL id; /* The task ID in the scheduler. */
ATTR FLOATVAL birthtime; /* The creation time stamp of the exception. */
@@ -83,15 +83,9 @@
*/
VTABLE void init() {
- Parrot_Exception_attributes * const core_struct =
- mem_allocate_zeroed_typed(Parrot_Exception_attributes);
-
- /* Set up the core struct and default values for the exception object. */
- PMC_data(SELF) = core_struct;
-
/* Set flags for custom GC mark and destroy. */
- PObj_custom_mark_SET(SELF);
PObj_active_destroy_SET(SELF);
+ PObj_custom_mark_SET(SELF);
SET_ATTR_severity(INTERP, SELF, EXCEPT_error);
SET_ATTR_handled(INTERP, SELF, 0);
@@ -116,9 +110,6 @@
INTVAL severity_val;
STRING *message_val;
- Parrot_Exception_attributes * const core_struct =
- mem_allocate_zeroed_typed(Parrot_Exception_attributes);
-
INTVAL ishash = VTABLE_isa(interp, values, CONST_STRING(interp, 'Hash'));
if (ishash) {
@@ -132,10 +123,9 @@
message_val = VTABLE_get_string(interp, values);
}
- PMC_data(SELF) = core_struct;
- /* Set flags for custom GC mark and destroy. */
- PObj_custom_mark_SET(SELF);
+ /* Set flags for custom GC mark. */
PObj_active_destroy_SET(SELF);
+ PObj_custom_mark_SET(SELF);
/* Set up the core struct and default values for the exception object. */
@@ -185,11 +175,8 @@
VTABLE void destroy() {
Parrot_Exception_attributes * const core_struct = PARROT_EXCEPTION(SELF);
- if (core_struct) {
- if (core_struct->thrower)
- Parrot_free_context(interp, core_struct->thrower, 1);
- mem_sys_free(core_struct);
- }
+ if (core_struct && core_struct->thrower)
+ Parrot_free_context(interp, core_struct->thrower, 1);
}
/*
@@ -794,7 +781,7 @@
while (cur_ctx) {
PMC *frame = pmc_new(interp, enum_class_Hash);
PMC *annotations = NULL;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
/* Get sub and put it in the hash. */
PMC *sub_pmc = cur_ctx->current_sub;
Modified: branches/pmc_sans_unionval/src/pmc/exceptionhandler.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/exceptionhandler.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/exceptionhandler.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/exporter.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/exporter.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/exporter.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/filehandle.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/filehandle.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/filehandle.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/fixedbooleanarray.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/fixedbooleanarray.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/fixedbooleanarray.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/fixedfloatarray.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/fixedfloatarray.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/fixedfloatarray.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/fixedintegerarray.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/fixedintegerarray.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/fixedintegerarray.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/fixedpmcarray.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/fixedpmcarray.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/fixedpmcarray.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/fixedstringarray.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/fixedstringarray.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/fixedstringarray.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/float.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/float.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/float.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/hashiterator.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/hashiterator.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/hashiterator.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/hashiteratorkey.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/hashiteratorkey.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/hashiteratorkey.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/integer.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/integer.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/integer.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/key.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/key.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/key.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/lexinfo.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/lexinfo.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/lexinfo.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -48,8 +48,7 @@
void class_init() {
/* there is no pmclass const_pmc flag yet */
- if (pass == 1)
- interp->vtables[entry]->flags |= VTABLE_IS_CONST_PMC_FLAG;
+ interp->vtables[entry]->flags |= VTABLE_IS_CONST_PMC_FLAG;
}
Modified: branches/pmc_sans_unionval/src/pmc/lexpad.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/lexpad.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/lexpad.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/managedstruct.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/managedstruct.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/managedstruct.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/multisub.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/multisub.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/multisub.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/namespace.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/namespace.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/namespace.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -50,7 +50,7 @@
PMC * vtable = nsinfo->vtable;
PMC * const classobj = VTABLE_get_class(interp, self);
STRING * vtable_key = NULL;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PMC_get_sub(interp, value, sub);
@@ -276,7 +276,7 @@
/* Extract the first alternate and check if it is a method */
PMC *pmc_sub = VTABLE_get_pmc_keyed_int(interp, value, 0);
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PMC_get_sub(INTERP, pmc_sub, sub);
if (sub->comp_flags & SUB_COMP_FLAG_METHOD) {
Modified: branches/pmc_sans_unionval/src/pmc/nci.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/nci.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/nci.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/orderedhashiterator.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/orderedhashiterator.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/orderedhashiterator.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/parrotinterpreter.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/parrotinterpreter.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/parrotinterpreter.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -209,15 +209,13 @@
void class_init() {
const int typ = enum_class_ParrotInterpreter;
- if (pass) {
- /* TODO unify and fix signatures */
- register_nci_method(INTERP, typ,
- F2DPTR(pt_thread_yield), "yield", "v");
-
- /* misc functions */
- register_nci_method(INTERP, typ,
- F2DPTR(recursion_limit), "recursion_limit", "iJOi");
- }
+ /* TODO unify and fix signatures */
+ register_nci_method(INTERP, typ,
+ F2DPTR(pt_thread_yield), "yield", "v");
+
+ /* misc functions */
+ register_nci_method(INTERP, typ,
+ F2DPTR(recursion_limit), "recursion_limit", "iJOi");
}
/*
@@ -240,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);
}
@@ -261,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);
}
@@ -534,9 +540,9 @@
}
if (!PMC_IS_NULL(sub_pmc)
&& sub_pmc->vtable->base_type == enum_class_Sub) {
- Parrot_sub *sub;
- PackFile_ByteCode *seg;
- opcode_t *pc = ctx->current_pc;
+ Parrot_Sub_attributes *sub;
+ PackFile_ByteCode *seg;
+ opcode_t *pc = ctx->current_pc;
PMC_get_sub(interp, sub_pmc, sub);
seg = sub->seg;
Modified: branches/pmc_sans_unionval/src/pmc/parrotlibrary.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/parrotlibrary.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/parrotlibrary.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/parrotthread.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/parrotthread.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/parrotthread.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -103,14 +103,12 @@
void class_init() {
const int typ = enum_class_ParrotThread;
- if (pass) {
- register_nci_method(INTERP, typ,
- F2DPTR(do_thread_run), "run", "IJOIP@");
-
- /* XXX appropriate name given that this won't clone globals? */
- register_nci_method(INTERP, typ,
- F2DPTR(do_thread_run_clone_default), "run_clone", "IJOP@");
- }
+ register_nci_method(INTERP, typ,
+ F2DPTR(do_thread_run), "run", "IJOIP@");
+
+ /* XXX appropriate name given that this won't clone globals? */
+ register_nci_method(INTERP, typ,
+ F2DPTR(do_thread_run_clone_default), "run_clone", "IJOP@");
}
/*
Modified: branches/pmc_sans_unionval/src/pmc/pmcproxy.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/pmcproxy.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/pmcproxy.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/pointer.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/pointer.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/pointer.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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.
Deleted: branches/pmc_sans_unionval/src/pmc/random.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/random.pmc Wed Aug 19 01:26:03 2009 (r40647)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,145 +0,0 @@
-/*
-Copyright (C) 2001-2007, Parrot Foundation.
-$Id$
-
-=head1 NAME
-
-src/pmc/random.pmc - Random Numbers
-
-=head1 DESCRIPTION
-
-These are the vtable functions for the Random base class.
-
-This is a singleton (monadic) class - only one instance exists.
-
-=head2 Methods
-
-=over 4
-
-=cut
-
-*/
-
-static PMC *Rand_PMC;
-
-pmclass Random singleton {
-
-/*
-
-=item C<void class_init()>
-
-Class initialization. Clears the singleton PMC.
-
-=cut
-
-*/
-
- void class_init() {
- Rand_PMC = NULL;
- }
-
-/*
-
-=item C<void *get_pointer()>
-
-=cut
-
-*/
-
- VTABLE void *get_pointer() {
- return Rand_PMC;
- }
-
-/*
-
-=item C<void set_pointer(void *ptr)>
-
-These two functions are part of the singleton creation interface. For more
-information see F<src/pmc.c>.
-
-=cut
-
-*/
-
- VTABLE void set_pointer(void *ptr) {
- PARROT_ASSERT(!Rand_PMC);
- Rand_PMC = (PMC *)ptr;
- }
-
-/*
-
-=item C<void set_integer_native(INTVAL seed)>
-
-Sets the random number seed to C<seed>.
-
-=cut
-
-*/
-
- VTABLE void set_integer_native(INTVAL seed) {
- Parrot_srand(seed);
- }
-
-/*
-
-=item C<INTVAL get_integer()>
-
-Returns a random integer in the range C<-2^31..2^31>.
-
-=cut
-
-*/
-
- VTABLE INTVAL get_integer() {
- return Parrot_int_rand(0);
- }
-
-/*
-
-=item C<INTVAL get_integer_keyed_int(INTVAL max)>
-
-Returns a random integer in the range C<0..max>.
-
-=cut
-
-*/
-
- VTABLE INTVAL get_integer_keyed_int(INTVAL max) {
- return Parrot_range_rand(0, max, 0);
- }
-
-/*
-
-=item C<FLOATVAL get_number()>
-
-Returns a random floating-point number in the range C<0.0..1.0>.
-
-=cut
-
-*/
-
- VTABLE FLOATVAL get_number() {
- return Parrot_float_rand(0);
- }
-
-}
-
-/*
-
-=back
-
-=head1 HISTORY
-
-2003.12.10 first rev by leo.
-
-=cut
-
-*/
-
-
-/*
- * Local variables:
- * c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */
Modified: branches/pmc_sans_unionval/src/pmc/resizablebooleanarray.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/resizablebooleanarray.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/resizablebooleanarray.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/resizablefloatarray.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/resizablefloatarray.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/resizablefloatarray.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/resizableintegerarray.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/resizableintegerarray.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/resizableintegerarray.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/resizablepmcarray.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/resizablepmcarray.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/resizablepmcarray.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/resizablestringarray.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/resizablestringarray.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/resizablestringarray.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/retcontinuation.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/retcontinuation.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/retcontinuation.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -23,7 +23,7 @@
#include "parrot/oplib/ops.h"
-pmclass RetContinuation extends Continuation need_ext {
+pmclass RetContinuation extends Continuation need_ext auto_attrs {
/*
@@ -37,27 +37,17 @@
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);
}
- /*
- * XXX when reusing SUPER.destroy() RetContinuations
- * have to set ref_count initially to 1
- */
-
VTABLE void destroy() {
Parrot_cont * const cc = PMC_cont(SELF);
- if (cc)
+ if (cc)
mem_sys_free(cc);
-
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
}
/*
Modified: branches/pmc_sans_unionval/src/pmc/role.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/role.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/role.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/scheduler.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/scheduler.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/scheduler.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/schedulermessage.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/schedulermessage.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/schedulermessage.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/sockaddr.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/sockaddr.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/sockaddr.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/socket.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/socket.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/socket.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/string.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/string.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/string.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/stringhandle.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/stringhandle.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/stringhandle.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/stringiterator.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/stringiterator.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/stringiterator.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/sub.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/sub.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/sub.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -40,7 +40,33 @@
* effectively a container. Therefore need_ext has to be set
*/
pmclass Sub need_ext {
- ATTR struct Parrot_sub * sub; /* the Parrot sub structure */
+ ATTR PackFile_ByteCode *seg; /* bytecode segment */
+ ATTR size_t start_offs; /* sub entry in ops from seg->base.data */
+ ATTR size_t end_offs;
+
+ ATTR INTVAL HLL_id; /* see src/hll.c XXX or per segment? */
+ ATTR PMC *namespace_name; /* where this Sub is in - this is either
+ * a String or a [Key] and describes
+ * the relative path in the NameSpace
+ */
+ ATTR PMC *namespace_stash; /* the actual hash, HLL::namespace */
+ ATTR STRING *name; /* name of the sub */
+ ATTR STRING *method_name; /* method name of the sub */
+ ATTR STRING *ns_entry_name; /* ns entry name of the sub */
+ ATTR STRING *subid; /* The ID of the sub. */
+ ATTR INTVAL vtable_index; /* index in Parrot_vtable_slot_names */
+ ATTR PMC *multi_signature; /* list of types for MMD */
+ ATTR INTVAL n_regs_used[4]; /* INSP in PBC */
+
+ ATTR PMC *lex_info; /* LexInfo PMC */
+ ATTR PMC *outer_sub; /* :outer for closures */
+ ATTR PMC *eval_pmc; /* eval container / NULL */
+ ATTR Parrot_Context *ctx; /* the context this sub is in */
+ ATTR UINTVAL comp_flags; /* compile time and additional flags */
+ ATTR Parrot_sub_arginfo *arg_info;/* Argument counts and flags. */
+
+ /* - end common */
+ ATTR Parrot_Context *outer_ctx; /* outer context, if a closure */
/*
@@ -68,9 +94,10 @@
*/
VTABLE void init() {
Parrot_Sub_attributes * const attrs =
- mem_allocate_typed(Parrot_Sub_attributes);
+ mem_allocate_zeroed_typed(Parrot_Sub_attributes);
+
+ attrs->seg = INTERP->code;
- attrs->sub = new_sub(INTERP);
PMC_data(SELF) = attrs;
PObj_custom_mark_destroy_SETALL(SELF);
}
@@ -86,8 +113,7 @@
*/
VTABLE void destroy() {
- Parrot_sub *sub;
- GET_ATTR_sub(INTERP, SELF, sub);
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
if (sub) {
if (sub->arg_info)
@@ -100,7 +126,6 @@
mem_sys_free(sub);
}
- mem_sys_free(PMC_data(SELF));
PMC_data(SELF) = NULL;
}
@@ -119,8 +144,7 @@
*/
VTABLE STRING *get_string() {
- Parrot_sub *sub;
- PMC_get_sub(INTERP, SELF, sub);
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
if (sub->name)
return Parrot_str_copy(INTERP, sub->name);
@@ -129,8 +153,7 @@
}
VTABLE void set_string_native(STRING *subname) {
- Parrot_sub *sub;
- PMC_get_sub(INTERP, SELF, sub);
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
sub->name = Parrot_str_copy(INTERP, subname);
}
@@ -163,8 +186,7 @@
*/
VTABLE void *get_pointer() {
- Parrot_sub *sub;
- PMC_get_sub(INTERP, SELF, sub);
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
return sub->seg->base.data + sub->start_offs;
}
@@ -181,10 +203,9 @@
*/
VTABLE INTVAL get_integer_keyed(PMC *key) {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
UNUSED(key)
- PMC_get_sub(INTERP, SELF, sub);
return (INTVAL) (sub->seg->base.data);
}
@@ -219,7 +240,7 @@
*/
VTABLE opcode_t *invoke(void *next) {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
Parrot_Context *caller_ctx;
Parrot_Context *context;
PMC *ccont;
@@ -321,15 +342,15 @@
for (c = context; !c->outer_ctx; c = c->outer_ctx) {
PMC *outer_pmc;
- Parrot_sub *current_sub, *outer_sub;
+ Parrot_Sub_attributes *current_sub, *outer_sub;
- PMC_get_sub(INTERP, c->current_sub, current_sub);
+ current_sub = PARROT_SUB(c->current_sub);
outer_pmc = current_sub->outer_sub;
if (PMC_IS_NULL(outer_pmc))
break;
- PMC_get_sub(INTERP, outer_pmc, outer_sub);
+ outer_sub = PARROT_SUB(outer_pmc);
if (!outer_sub->ctx) {
Parrot_Context * const dummy = Parrot_alloc_context(INTERP,
@@ -388,13 +409,14 @@
VTABLE PMC *clone() {
PMC * const ret = pmc_new(INTERP, SELF->vtable->base_type);
- Parrot_sub *dest_sub;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *dest_sub = PARROT_SUB(SELF);
+ Parrot_Sub_attributes *sub;
+ /* XXX Why? */
/* we have to mark it ourselves */
PObj_custom_mark_destroy_SETALL(ret);
- PMC_get_sub(INTERP, ret, sub);
+ sub = PARROT_SUB(ret);
/* release any previously held contexts */
if (sub->ctx)
@@ -402,8 +424,6 @@
if (sub->outer_ctx)
Parrot_free_context(INTERP, sub->outer_ctx, 1);
- PMC_get_sub(INTERP, SELF, dest_sub);
-
/* first set the sub struct, Parrot_str_copy may cause GC */
*sub = *dest_sub;
@@ -439,10 +459,8 @@
VTABLE void assign_pmc(PMC *other) {
/* only handle the case where the other PMC is the same type */
if (other->vtable->base_type == SELF->vtable->base_type) {
- Parrot_sub *my_sub;
- Parrot_sub *other_sub;
- PMC_get_sub(INTERP, SELF, my_sub);
- PMC_get_sub(INTERP, other, other_sub);
+ Parrot_Sub_attributes *my_sub = PARROT_SUB(SELF);
+ Parrot_Sub_attributes *other_sub = PARROT_SUB(other);
/* Increase reference count of destination before
* freeing the one in self, to avoid problems in
@@ -454,7 +472,7 @@
Parrot_free_context(INTERP, my_sub->ctx, 1);
/* copy the sub struct */
- memmove(my_sub, other_sub, sizeof (Parrot_sub));
+ memmove(my_sub, other_sub, sizeof (Parrot_Sub_attributes));
/* copy the name so it's a different string in memory */
if (my_sub->name)
@@ -477,8 +495,7 @@
*/
VTABLE void mark() {
- Parrot_sub *sub;
- PMC_get_sub(INTERP, SELF, sub);
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
if (!sub)
return;
@@ -520,10 +537,8 @@
*/
MULTI INTVAL is_equal(PMC *value) {
- Parrot_sub *my_sub, *value_sub;
-
- PMC_get_sub(INTERP, SELF, my_sub);
- PMC_get_sub(INTERP, value, value_sub);
+ Parrot_Sub_attributes *my_sub = PARROT_SUB(SELF);
+ Parrot_Sub_attributes *value_sub = PARROT_SUB(value);
return SELF->vtable == value->vtable
&& (my_sub)->start_offs == (value_sub)->start_offs
@@ -545,7 +560,7 @@
*/
VTABLE void visit(visit_info *info) {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PMC_get_sub(INTERP, SELF, sub);
@@ -573,12 +588,10 @@
VTABLE void freeze(visit_info *info) {
IMAGE_IO * const io = info->image_io;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
STRING *hll_name;
int i;
- PMC_get_sub(INTERP, SELF, sub);
-
SUPER(info);
/*
* we currently need to write these items:
@@ -644,7 +657,7 @@
SUPER(info);
if (info->extra_flags == EXTRA_IS_NULL) {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
INTVAL flags;
int i;
@@ -756,11 +769,9 @@
VTABLE PMC *inspect_str(STRING *what)
{
- Parrot_sub *sub;
- PMC *retval;
- INTVAL count_found = -1;
-
- PMC_get_sub(INTERP, SELF, sub);
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
+ PMC *retval;
+ INTVAL count_found = -1;
/* If the argument info hasn't been generated yet, generate it. */
if (!sub->arg_info) {
@@ -882,11 +893,8 @@
*/
METHOD get_namespace() {
- Parrot_sub *sub;
- PMC *_namespace;
-
- PMC_get_sub(INTERP, SELF, sub);
- _namespace = sub->namespace_stash;
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
+ PMC *_namespace = sub->namespace_stash;
RETURN(PMC *_namespace);
}
@@ -896,11 +904,9 @@
* see also imcc/reg_alloc.c */
static const char types[] = "INSP";
char *p;
- Parrot_sub *sub;
- char * const kind = Parrot_str_to_cstring(interp, reg);
- INTVAL regs_used;
-
- PMC_get_sub(INTERP, SELF, sub);
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
+ char * const kind = Parrot_str_to_cstring(interp, reg);
+ INTVAL regs_used;
PARROT_ASSERT(sub->n_regs_used);
@@ -922,37 +928,33 @@
}
METHOD get_lexinfo() {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
PMC *lexinfo;
- PMC_get_sub(INTERP, SELF, sub);
lexinfo = sub->lex_info ? sub->lex_info : PMCNULL;
RETURN(PMC *lexinfo);
}
METHOD get_subid() {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
STRING *subid;
- PMC_get_sub(INTERP, SELF, sub);
subid = sub->subid ? sub->subid : CONST_STRING(interp, "");
RETURN(STRING *subid);
}
METHOD get_outer() {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
PMC *outersub;
- PMC_get_sub(INTERP, SELF, sub);
outersub = sub->outer_sub ? sub->outer_sub : PMCNULL;
RETURN(PMC *outersub);
}
METHOD set_outer(PMC *outer) {
/* Set outer sub. */
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
- PMC_get_sub(INTERP, SELF, sub);
sub->outer_sub = outer;
/* Make sure outer flag of that sub is set. */
@@ -974,10 +976,9 @@
}
METHOD get_multisig() {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub = PARROT_SUB(SELF);
PMC *multisig;
- PMC_get_sub(INTERP, SELF, sub);
multisig = sub->multi_signature ? sub->multi_signature : PMCNULL;
RETURN(PMC *multisig);
}
Modified: branches/pmc_sans_unionval/src/pmc/task.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/task.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/task.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/timer.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/timer.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/timer.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/pmc/undef.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/undef.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/undef.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -57,7 +57,6 @@
VTABLE_destroy(interp, clone);
PObj_is_object_SET(SELF);
- PObj_active_destroy_SET(SELF);
}
}
Modified: branches/pmc_sans_unionval/src/pmc/unmanagedstruct.pmc
==============================================================================
--- branches/pmc_sans_unionval/src/pmc/unmanagedstruct.pmc Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/pmc/unmanagedstruct.pmc Wed Aug 19 01:26:03 2009 (r40648)
@@ -650,7 +650,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 */
@@ -663,39 +663,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.
@@ -723,9 +690,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/pmc_sans_unionval/src/runcore/main.c
==============================================================================
--- branches/pmc_sans_unionval/src/runcore/main.c Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/runcore/main.c Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/src/runcore/trace.c
==============================================================================
--- branches/pmc_sans_unionval/src/runcore/trace.c Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/runcore/trace.c Wed Aug 19 01:26:03 2009 (r40648)
@@ -105,7 +105,7 @@
{
ASSERT_ARGS(trace_pmc_dump)
Interp * const debugger = debugger_or_interp(interp);
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
if (!pmc) {
Parrot_io_eprintf(debugger, "(null)");
Modified: branches/pmc_sans_unionval/src/sub.c
==============================================================================
--- branches/pmc_sans_unionval/src/sub.c Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/sub.c Wed Aug 19 01:26:03 2009 (r40648)
@@ -127,28 +127,6 @@
/*
-=item C<Parrot_sub * new_sub(PARROT_INTERP)>
-
-Returns a new C<Parrot_sub>.
-
-=cut
-
-*/
-
-PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
-Parrot_sub *
-new_sub(PARROT_INTERP)
-{
- ASSERT_ARGS(new_sub)
- /* Using system memory until I figure out GC issues */
- Parrot_sub * const newsub = mem_allocate_zeroed_typed(Parrot_sub);
- newsub->seg = interp->code;
- return newsub;
-}
-
-/*
-
=item C<Parrot_cont * new_continuation(PARROT_INTERP, const Parrot_cont *to)>
Returns a new C<Parrot_cont> to the context of C<to> with its own copy of the
@@ -213,32 +191,6 @@
/*
-=item C<Parrot_coro * new_coroutine(PARROT_INTERP)>
-
-Returns a new C<Parrot_coro>.
-
-XXX: Need to document semantics in detail.
-
-=cut
-
-*/
-
-PARROT_MALLOC
-PARROT_CANNOT_RETURN_NULL
-Parrot_coro *
-new_coroutine(PARROT_INTERP)
-{
- ASSERT_ARGS(new_coroutine)
- Parrot_coro * const co = mem_allocate_zeroed_typed(Parrot_coro);
-
- co->seg = interp->code;
- co->ctx = NULL;
-
- return co;
-}
-
-/*
-
=item C<PMC * new_ret_continuation_pmc(PARROT_INTERP, opcode_t *address)>
Returns a new C<RetContinuation> PMC. Uses one from the cache,
@@ -312,7 +264,7 @@
{
ASSERT_ARGS(Parrot_full_sub_name)
if (sub_pmc && VTABLE_defined(interp, sub_pmc)) {
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
PMC_get_sub(interp, sub_pmc, sub);
@@ -381,7 +333,7 @@
ARGOUT(Parrot_Context_info *info))
{
ASSERT_ARGS(Parrot_Context_get_info)
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
/* set file/line/pc defaults */
info->file = CONST_STRING(interp, "(unknown file)");
@@ -550,8 +502,8 @@
{
ASSERT_ARGS(Parrot_capture_lex)
Parrot_Context * const ctx = CONTEXT(interp);
- Parrot_sub *current_sub;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *current_sub;
+ Parrot_Sub_attributes *sub;
Parrot_Context *old;
PMC_get_sub(interp, ctx->current_sub, current_sub);
@@ -564,7 +516,7 @@
while (VTABLE_get_bool(interp, iter)) {
PMC * const child_pmc = VTABLE_shift_pmc(interp, iter);
- Parrot_sub *child_sub, *child_outer_sub;
+ Parrot_Sub_attributes *child_sub, *child_outer_sub;
PMC_get_sub(interp, child_pmc, child_sub);
@@ -702,8 +654,7 @@
/*
-=item C<Parrot_sub * Parrot_get_sub_pmc_from_subclass(PARROT_INTERP, PMC
-*subclass)>
+=item C<void * Parrot_get_sub_pmc_from_subclass(PARROT_INTERP, PMC *subclass)>
Gets a Parrot_sub structure from something that isn't a Sub PMC, but rather a
subclass.
@@ -714,19 +665,18 @@
PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
-Parrot_sub *
+void *
Parrot_get_sub_pmc_from_subclass(PARROT_INTERP, ARGIN(PMC *subclass)) {
ASSERT_ARGS(Parrot_get_sub_pmc_from_subclass)
PMC *key, *sub_pmc;
- Parrot_sub *sub;
+ Parrot_Sub_attributes *sub;
/* Ensure we really do have a subclass of sub. */
if (VTABLE_isa(interp, subclass, CONST_STRING(interp, "Sub"))) {
/* If it's actually a PMC still, probably does the same structure
* underneath. */
if (!PObj_is_object_TEST(subclass)) {
- GETATTR_Sub_sub(interp, subclass, sub);
- return sub;
+ return PARROT_SUB(subclass);
}
/* Get the Sub PMC itself. */
@@ -734,8 +684,7 @@
VTABLE_set_string_native(interp, key, CONST_STRING(interp, "Sub"));
sub_pmc = VTABLE_get_attr_keyed(interp, subclass, key, CONST_STRING(interp, "proxy"));
if (sub_pmc->vtable->base_type == enum_class_Sub) {
- GETATTR_Sub_sub(interp, sub_pmc, sub);
- return sub;
+ return PARROT_SUB(sub_pmc);
}
}
Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
Modified: branches/pmc_sans_unionval/src/thread.c
==============================================================================
--- branches/pmc_sans_unionval/src/thread.c Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/src/thread.c Wed Aug 19 01:26:03 2009 (r40648)
@@ -201,7 +201,7 @@
* working as one might expect mainly because the segment is
* not correctly copied
*/
- Parrot_sub *ret_val_sub, *arg_sub;
+ Parrot_Sub_attributes *ret_val_sub, *arg_sub;
ret_val = Parrot_clone(interp, arg);
PMC_get_sub(interp, ret_val, ret_val_sub);
@@ -632,7 +632,7 @@
if (PMC_IS_NULL(dval)) {
PMC * const copy = make_local_copy(d, s, val);
- Parrot_sub *val_sub;
+ Parrot_Sub_attributes *val_sub;
if (val->vtable->base_type == enum_class_Sub)
PMC_get_sub(interp, val, val_sub);
Modified: branches/pmc_sans_unionval/t/benchmark/benchmarks.t
==============================================================================
--- branches/pmc_sans_unionval/t/benchmark/benchmarks.t Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/t/benchmark/benchmarks.t Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/t/dynoplibs/math.t
==============================================================================
--- branches/pmc_sans_unionval/t/dynoplibs/math.t Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/t/dynoplibs/math.t Wed Aug 19 01:26:03 2009 (r40648)
@@ -19,14 +19,54 @@
.loadlib 'math_ops'
.sub main :main
.include 'test_more.pir'
- plan(7)
+ .include 'fp_equality.pasm'
+ plan(20)
ok(1, "load math_ops")
- basic_test_1_arg()
- basic_test_2_arg()
- basic_test_3_arg()
+ rand $I0
+ test_2_arg_int()
+ test_3_arg_int()
+ test_1_arg_num()
+ test_2_arg_num()
+ test_3_arg_num()
+ test_srand()
+ test_local_nums()
+ test_local_nums_2_arg()
+ test_local_ints()
.end
-.sub basic_test_1_arg
+.sub test_2_arg_int
+ rand $I0, 5
+ lt $I0, 0, fail1
+ ok(1, 'rand returns a number greater than or equal to 0')
+ goto upper
+fail1:
+ ok(0, 'rand returns a number greater than or equal to 0')
+upper:
+ gt $I0, 5, fail2
+ ok(1, 'rand returns a number less than or equal to 5')
+ goto finish
+fail2:
+ ok(0, 'rand returns a number less than or equal to 5')
+finish:
+.end
+
+.sub test_3_arg_int
+ rand $I0, 5, 25
+ lt $I0, 5, fail1
+ ok(1, 'rand returns a number greater than or equal to 5')
+ goto upper
+fail1:
+ ok(0, 'rand returns a number greater than or equal to 5')
+upper:
+ gt $I0, 25, fail2
+ ok(1, 'rand returns a number less than or equal to 25')
+ goto finish
+fail2:
+ ok(0, 'rand returns a number less than or equal to 25')
+finish:
+.end
+
+.sub test_1_arg_num
rand $N0
lt $N0, 0, fail1
ok(1, 'rand returns a number greater than or equal to 0')
@@ -42,7 +82,7 @@
finish:
.end
-.sub basic_test_2_arg
+.sub test_2_arg_num
rand $N0, 5
lt $N0, 0, fail1
ok(1, 'rand returns a number greater than or equal to 0')
@@ -58,7 +98,7 @@
finish:
.end
-.sub basic_test_3_arg
+.sub test_3_arg_num
rand $N0, 5, 25
lt $N0, 5, fail1
ok(1, 'rand returns a number greater than or equal to 5')
@@ -74,6 +114,70 @@
finish:
.end
+.sub test_srand
+ srand 42
+ ok(1, 'call srand with int')
+ srand 42.0
+ ok(1, 'call srand with num')
+ rand $N0
+ srand 5
+ rand $N2
+ srand 42.0
+ rand $N1
+ .fp_eq_ok($N0, $N1, 'having the same seed generates the same numbers')
+.end
+
+.sub test_local_nums_2_arg
+ .local num foo, bar
+ foo = rand 5.0, 25.0
+ lt foo, 5, fail1
+ ok(1, 'rand returns a number greater than or equal to 5')
+ goto upper
+fail1:
+ ok(0, 'rand returns a number greater than or equal to 5')
+upper:
+ gt foo, 25, fail2
+ ok(1, 'rand returns a number less than or equal to 25')
+ goto finish
+fail2:
+ ok(0, 'rand returns a number less than or equal to 25')
+finish:
+.end
+
+.sub test_local_nums
+ .local num foo, bar
+ foo = rand
+ lt foo, 0, fail1
+ ok(1, 'rand returns a number greater than or equal to 0')
+ goto upper
+fail1:
+ ok(0, 'rand returns a number greater than or equal to 0')
+upper:
+ gt foo, 1, fail2
+ ok(1, 'rand returns a number less than or equal to 1')
+ goto finish
+fail2:
+ ok(0, 'rand returns a number less than or equal to 1')
+finish:
+.end
+
+.sub test_local_ints
+ .local int foo, bar
+ foo = rand 5, 25
+ lt foo, 5, fail1
+ ok(1, 'rand returns a number greater than or equal to 5')
+ goto upper
+fail1:
+ ok(0, 'rand returns a number greater than or equal to 5')
+upper:
+ gt foo, 25, fail2
+ ok(1, 'rand returns a number less than or equal to 25')
+ goto finish
+fail2:
+ ok(0, 'rand returns a number less than or equal to 25')
+finish:
+.end
+
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
Modified: branches/pmc_sans_unionval/t/native_pbc/annotations.pbc
==============================================================================
Binary file (source and/or target). No diff available.
Modified: branches/pmc_sans_unionval/t/native_pbc/integer_1.pbc
==============================================================================
Binary file (source and/or target). No diff available.
Modified: branches/pmc_sans_unionval/t/native_pbc/number_1.pbc
==============================================================================
Binary file (source and/or target). No diff available.
Modified: branches/pmc_sans_unionval/t/native_pbc/number_2.pbc
==============================================================================
Binary file (source and/or target). No diff available.
Modified: branches/pmc_sans_unionval/t/native_pbc/string_1.pbc
==============================================================================
Binary file (source and/or target). No diff available.
Modified: branches/pmc_sans_unionval/t/op/arithmetics.t
==============================================================================
--- branches/pmc_sans_unionval/t/op/arithmetics.t Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/t/op/arithmetics.t Wed Aug 19 01:26:03 2009 (r40648)
@@ -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/pmc_sans_unionval/t/op/gc.t
==============================================================================
--- branches/pmc_sans_unionval/t/op/gc.t Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/t/op/gc.t Wed Aug 19 01:26:03 2009 (r40648)
@@ -1,5 +1,5 @@
#!perl
-# Copyright (C) 2001-2005, Parrot Foundation.
+# Copyright (C) 2001-2009, Parrot Foundation.
# $Id$
use strict;
@@ -123,9 +123,11 @@
1
OUTPUT
-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:
@@ -137,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"
Modified: branches/pmc_sans_unionval/t/pmc/pmc.t
==============================================================================
--- branches/pmc_sans_unionval/t/pmc/pmc.t Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/t/pmc/pmc.t Wed Aug 19 01:26:03 2009 (r40648)
@@ -142,9 +142,9 @@
ok 2
OUTPUT
-pasm_output_is( <<'CODE', <<'OUTPUT', "Random PMCs are singletons" );
- new P0, ['Random']
- new P1, ['Random']
+pasm_output_is( <<'CODE', <<'OUTPUT', "Env PMCs are singletons" );
+ new P0, ['Env']
+ new P1, ['Env']
eq_addr P0, P1, ok
print "not the same "
ok: print "ok\n"
Deleted: branches/pmc_sans_unionval/t/pmc/random.t
==============================================================================
--- branches/pmc_sans_unionval/t/pmc/random.t Wed Aug 19 01:26:03 2009 (r40647)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,34 +0,0 @@
-#! parrot
-# Copyright (C) 2001-2008, Parrot Foundation.
-# $Id$
-
-=head1 NAME
-
-t/pmc/random.t - Random numbers
-
-=head1 SYNOPSIS
-
- % prove t/pmc/random.t
-
-=head1 DESCRIPTION
-
-Tests random number generation
-
-=cut
-
-.sub main :main
- .include 'test_more.pir'
-
- plan(2)
-
- new $P0, ['Random']
- ok(1, 'Instantiated Random PMC')
- set $I0, $P0
- ok(1, 'Got (unknown) random int')
-.end
-
-# Local Variables:
-# mode: pir
-# fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:
Modified: branches/pmc_sans_unionval/tools/util/release.json
==============================================================================
--- branches/pmc_sans_unionval/tools/util/release.json Wed Aug 19 00:41:33 2009 (r40647)
+++ branches/pmc_sans_unionval/tools/util/release.json Wed Aug 19 01:26:03 2009 (r40648)
@@ -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