[svn:parrot] r40288 - in trunk: . config/auto/sizes config/gen/makefiles docs/book/draft docs/dev docs/pdds examples/languages/abc examples/languages/squaak examples/pge include/parrot lib/Parrot lib/Parrot/OpTrans ports/cpan ports/cygwin ports/debian ports/fedora ports/mandriva ports/suse runtime/parrot/languages runtime/parrot/library/Math src src/call src/gc src/interp src/ops src/pmc src/runcore t/compilers/tge t/oo t/src tools/dev tools/util

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Sun Jul 26 22:03:42 UTC 2009


Author: whiteknight
Date: Sun Jul 26 22:03:33 2009
New Revision: 40288
URL: https://trac.parrot.org/parrot/changeset/40288

Log:
[kill_stacks] merge in the kill_stacks branch. Stacks are no more

Deleted:
   trunk/include/parrot/stacks.h
   trunk/src/stacks.c
Modified:
   trunk/   (props changed)
   trunk/MANIFEST
   trunk/config/auto/sizes/intval_maxmin_c.in   (props changed)
   trunk/config/gen/makefiles/root.in
   trunk/docs/book/draft/README   (props changed)
   trunk/docs/book/draft/appa_glossary.pod   (props changed)
   trunk/docs/book/draft/appb_patch_submission.pod   (props changed)
   trunk/docs/book/draft/appc_command_line_options.pod   (props changed)
   trunk/docs/book/draft/appd_build_options.pod   (props changed)
   trunk/docs/book/draft/appe_source_code.pod   (props changed)
   trunk/docs/book/draft/ch01_introduction.pod   (props changed)
   trunk/docs/book/draft/ch02_getting_started.pod   (props changed)
   trunk/docs/book/draft/ch04_compiler_tools.pod   (props changed)
   trunk/docs/book/draft/ch05_pge.pod   (props changed)
   trunk/docs/book/draft/ch06_nqp.pod   (props changed)
   trunk/docs/book/draft/ch07_dynpmcs.pod   (props changed)
   trunk/docs/book/draft/ch08_dynops.pod   (contents, props changed)
   trunk/docs/book/draft/ch10_opcode_reference.pod   (props changed)
   trunk/docs/book/draft/ch11_directive_reference.pod   (props changed)
   trunk/docs/book/draft/ch12_operator_reference.pod   (props changed)
   trunk/docs/book/draft/chXX_hlls.pod   (props changed)
   trunk/docs/book/draft/chXX_library.pod   (props changed)
   trunk/docs/book/draft/chXX_testing_and_debugging.pod   (props changed)
   trunk/docs/dev/c_functions.pod   (props changed)
   trunk/docs/pdds/pdd30_install.pod   (props changed)
   trunk/examples/languages/abc/   (props changed)
   trunk/examples/languages/squaak/   (props changed)
   trunk/examples/pge/demo.pir   (props changed)
   trunk/include/parrot/call.h   (props changed)
   trunk/include/parrot/gc_api.h   (props changed)
   trunk/include/parrot/interpreter.h
   trunk/include/parrot/parrot.h
   trunk/include/parrot/register.h
   trunk/include/parrot/runcore_api.h   (props changed)
   trunk/include/parrot/runcore_trace.h   (props changed)
   trunk/include/parrot/sub.h
   trunk/lib/Parrot/Op.pm
   trunk/lib/Parrot/OpTrans.pm
   trunk/lib/Parrot/OpTrans/C.pm
   trunk/lib/Parrot/OpTrans/CGP.pm
   trunk/lib/Parrot/OpTrans/CGoto.pm
   trunk/lib/Parrot/OpTrans/CSwitch.pm
   trunk/lib/Parrot/OpsFile.pm
   trunk/ports/cpan/pause_guide.pod   (props changed)
   trunk/ports/cygwin/parrot-1.0.0-1.cygport   (props changed)
   trunk/ports/debian/libparrot-dev.install.in   (props changed)
   trunk/ports/debian/libparrot.install.in   (props changed)
   trunk/ports/debian/parrot-doc.install.in   (props changed)
   trunk/ports/debian/parrot.install.in   (props changed)
   trunk/ports/fedora/parrot.spec.fedora   (props changed)
   trunk/ports/mandriva/parrot.spec.mandriva   (props changed)
   trunk/ports/suse/parrot.spec.suse   (props changed)
   trunk/runtime/parrot/languages/   (props changed)
   trunk/runtime/parrot/library/Math/Rand.pir   (props changed)
   trunk/src/call/ops.c   (props changed)
   trunk/src/call/pcc.c   (props changed)
   trunk/src/gc/alloc_memory.c   (props changed)
   trunk/src/gc/alloc_register.c   (props changed)
   trunk/src/gc/alloc_resources.c   (props changed)
   trunk/src/gc/api.c   (contents, props changed)
   trunk/src/gc/generational_ms.c   (props changed)
   trunk/src/gc/incremental_ms.c   (props changed)
   trunk/src/gc/malloc.c   (props changed)
   trunk/src/gc/malloc_trace.c   (props changed)
   trunk/src/gc/mark_sweep.c   (contents, props changed)
   trunk/src/gc/system.c   (props changed)
   trunk/src/interp/inter_cb.c   (props changed)
   trunk/src/interp/inter_create.c   (contents, props changed)
   trunk/src/interp/inter_misc.c   (props changed)
   trunk/src/ops/core.ops
   trunk/src/pmc/coroutine.pmc
   trunk/src/runcore/cores.c   (props changed)
   trunk/src/runcore/main.c   (props changed)
   trunk/src/runcore/trace.c   (props changed)
   trunk/src/sub.c
   trunk/t/compilers/tge/NoneGrammar.tg   (props changed)
   trunk/t/oo/root_new.t   (props changed)
   trunk/t/src/embed.t   (props changed)
   trunk/tools/dev/fetch_languages.pl   (props changed)
   trunk/tools/dev/mk_gitignore.pl   (props changed)
   trunk/tools/util/perlcritic-cage.conf   (props changed)

Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST	Sun Jul 26 20:33:00 2009	(r40287)
+++ trunk/MANIFEST	Sun Jul 26 22:03:33 2009	(r40288)
@@ -994,7 +994,6 @@
 include/parrot/scheduler_private.h                          [main]include
 include/parrot/settings.h                                   [main]include
 include/parrot/slice.h                                      [main]include
-include/parrot/stacks.h                                     [main]include
 include/parrot/stat.h                                       [main]include
 include/parrot/string.h                                     [main]include
 include/parrot/string_funcs.h                               [main]include
@@ -1468,7 +1467,6 @@
 src/scheduler.c                                             []
 src/spf_render.c                                            []
 src/spf_vtable.c                                            []
-src/stacks.c                                                []
 src/string/api.c                                            []
 src/string/charset.c                                        []
 src/string/charset/ascii.c                                  []

Modified: trunk/config/gen/makefiles/root.in
==============================================================================
--- trunk/config/gen/makefiles/root.in	Sun Jul 26 20:33:00 2009	(r40287)
+++ trunk/config/gen/makefiles/root.in	Sun Jul 26 22:03:33 2009	(r40288)
@@ -460,7 +460,6 @@
     $(SRC_DIR)/scheduler$(O) \
     $(SRC_DIR)/spf_render$(O) \
     $(SRC_DIR)/spf_vtable$(O) \
-    $(SRC_DIR)/stacks$(O) \
     $(SRC_DIR)/string/primitives$(O) \
     $(SRC_DIR)/sub$(O) \
     $(SRC_DIR)/thread$(O) \
@@ -636,7 +635,6 @@
     $(SRC_DIR)/spf_vtable.str \
     $(SRC_DIR)/string/api.str \
     $(SRC_DIR)/sub.str \
-    $(SRC_DIR)/stacks.str \
     \
     $(CLASS_STR_FILES)
 
@@ -1196,8 +1194,6 @@
 
 $(SRC_DIR)/runcore/cores$(O) : $(GENERAL_H_FILES)
 
-$(SRC_DIR)/stacks$(O) : $(GENERAL_H_FILES)
-
 $(SRC_DIR)/tsq$(O) : $(GENERAL_H_FILES)
 
 $(SRC_DIR)/embed$(O) : $(GENERAL_H_FILES) $(INC_DIR)/debugger.h \

Modified: trunk/docs/book/draft/ch08_dynops.pod
==============================================================================
--- trunk/docs/book/draft/ch08_dynops.pod	Sun Jul 26 20:33:00 2009	(r40287)
+++ trunk/docs/book/draft/ch08_dynops.pod	Sun Jul 26 22:03:33 2009	(r40288)
@@ -206,13 +206,6 @@
 Here, C<x> is an offset in C<size_t> units that represents how far forward
 (positive) or how far backwards (negative) to jump to.
 
-=item * POP()
-
-C<POP> pops the next opcode address off the control stack. To put an address
-onto the control stack, use the C<PUSH> keyword instead. C<PUSH> takes a single
-C<opcode_t *> argument to store, and C<POP> returns a single C<opcode_ *>
-value.
-
 =back
 
 =head2 The Opcode Compiler

Modified: trunk/include/parrot/interpreter.h
==============================================================================
--- trunk/include/parrot/interpreter.h	Sun Jul 26 20:33:00 2009	(r40287)
+++ trunk/include/parrot/interpreter.h	Sun Jul 26 22:03:33 2009	(r40288)
@@ -356,7 +356,7 @@
 
     PDB_t  *pdb;                              /* debug /trace system */
 
-    struct Stack_Chunk *dynamic_env;          /* current dynamic environment */
+    PMC * dynamic_env;                        /* Dynamic environment stack */
 
     void *lo_var_ptr;                         /* Pointer to memory on runops
                                                * system stack */

Modified: trunk/include/parrot/parrot.h
==============================================================================
--- trunk/include/parrot/parrot.h	Sun Jul 26 20:33:00 2009	(r40287)
+++ trunk/include/parrot/parrot.h	Sun Jul 26 22:03:33 2009	(r40288)
@@ -267,7 +267,6 @@
 #include "parrot/list.h"
 #include "parrot/pmc_freeze.h"
 #include "parrot/vtable.h"
-#include "parrot/stacks.h"
 #include "parrot/register.h"
 #include "parrot/exceptions.h"
 #include "parrot/warnings.h"

Modified: trunk/include/parrot/register.h
==============================================================================
--- trunk/include/parrot/register.h	Sun Jul 26 20:33:00 2009	(r40287)
+++ trunk/include/parrot/register.h	Sun Jul 26 22:03:33 2009	(r40288)
@@ -15,7 +15,6 @@
 
 #include "parrot/string.h"
 #include "parrot/compiler.h"
-#include "parrot/stacks.h"
 
 /*
  * Macros to make accessing registers more convenient/readable.
@@ -57,7 +56,6 @@
 #define REG_OFFS_STR(x) (sizeof (STRING*) * (x) + _SIZEOF_INTS + _SIZEOF_PMCS)
 
 
-struct Stack_Chunk;
 typedef struct Parrot_Context Parrot_Context; /* parrot/interpreter.h */
 
 /* HEADERIZER BEGIN: src/gc/alloc_register.c */

Deleted: trunk/include/parrot/stacks.h
==============================================================================
--- trunk/include/parrot/stacks.h	Sun Jul 26 22:03:33 2009	(r40287)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,223 +0,0 @@
-/* stacks.h
- *  Copyright (C) 2001-2008, Parrot Foundation.
- *  SVN Info
- *     $Id$
- *  Overview:
- *     Stack handling routines for Parrot
- *  Data Structure and Algorithms:
- *  History:
- *  Notes:
- *  References: See also enums.h
- */
-
-#ifndef PARROT_STACKS_H_GUARD
-#define PARROT_STACKS_H_GUARD
-
-#include "parrot/parrot.h"
-#include "parrot/compiler.h"
-
-#define STACK_CHUNK_LIMIT 100000
-
-typedef struct Stack_Entry {
-    UnionVal entry;
-    Stack_entry_type  entry_type;
-    void (*cleanup)(PARROT_INTERP, ARGIN(struct Stack_Entry *));
-} Stack_Entry_t;
-
-typedef struct Stack_Chunk {
-    UnionVal            cache;
-    Parrot_UInt         flags;
-    const char         *name;
-    struct Stack_Chunk *prev;
-    Parrot_UInt         refcount;
-    Stack_Entry_t       data;
-} Stack_Chunk_t;
-
-#define STACK_DATAP(chunk)    &((chunk)->data)
-/* #define STACK_ITEMSIZE(chunk) PObj_buflen(chunk) */
-
-
-typedef void (*Stack_cleanup_method)(PARROT_INTERP, ARGIN(struct Stack_Entry *));
-
-#define STACK_CLEANUP_NULL ((Stack_cleanup_method)NULLfunc)
-
-/* HEADERIZER BEGIN: src/stacks.c */
-/* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-Stack_Chunk_t * cst_new_stack_chunk(PARROT_INTERP,
-    ARGIN(const Stack_Chunk_t *chunk))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
-PARROT_EXPORT
-void mark_stack(PARROT_INTERP, ARGMOD(Stack_Chunk_t *chunk))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        FUNC_MODIFIES(*chunk);
-
-PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
-PARROT_WARN_UNUSED_RESULT
-Stack_Chunk_t * new_stack(PARROT_INTERP, ARGIN(const char *name))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
-PARROT_EXPORT
-void Parrot_dump_dynamic_environment(PARROT_INTERP,
-    ARGIN(Stack_Chunk_t *dynamic_env))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
-PARROT_EXPORT
-void Parrot_pop_mark(PARROT_INTERP, INTVAL mark)
-        __attribute__nonnull__(1);
-
-PARROT_EXPORT
-void Parrot_push_action(PARROT_INTERP, ARGIN(PMC *sub))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
-PARROT_EXPORT
-void Parrot_push_mark(PARROT_INTERP, INTVAL mark)
-        __attribute__nonnull__(1);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-void * pop_dest(PARROT_INTERP)
-        __attribute__nonnull__(1);
-
-PARROT_EXPORT
-PARROT_CAN_RETURN_NULL
-PARROT_WARN_UNUSED_RESULT
-Stack_Entry_t * stack_entry(SHIM_INTERP,
-    ARGIN(Stack_Chunk_t *stack),
-    INTVAL depth)
-        __attribute__nonnull__(2);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-size_t stack_height(SHIM_INTERP, ARGIN(const Stack_Chunk_t *chunk))
-        __attribute__nonnull__(2);
-
-PARROT_EXPORT
-PARROT_CAN_RETURN_NULL
-PARROT_WARN_UNUSED_RESULT
-void * stack_peek(PARROT_INTERP,
-    ARGIN(Stack_Chunk_t *stack_base),
-    ARGMOD_NULLOK(Stack_entry_type *type))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        FUNC_MODIFIES(*type);
-
-PARROT_EXPORT
-PARROT_CAN_RETURN_NULL
-void * stack_pop(PARROT_INTERP,
-    ARGMOD(Stack_Chunk_t **stack_p),
-    ARGOUT_NULLOK(void *where),
-    Stack_entry_type type)
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        FUNC_MODIFIES(*stack_p)
-        FUNC_MODIFIES(*where);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-Stack_Entry_t* stack_prepare_pop(PARROT_INTERP,
-    ARGMOD(Stack_Chunk_t **stack_p))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        FUNC_MODIFIES(*stack_p);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-Stack_Entry_t* stack_prepare_push(PARROT_INTERP,
-    ARGMOD(Stack_Chunk_t **stack_p))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        FUNC_MODIFIES(*stack_p);
-
-PARROT_EXPORT
-void stack_push(PARROT_INTERP,
-    ARGMOD(Stack_Chunk_t **stack_p),
-    ARGIN(void *thing),
-    Stack_entry_type type,
-    NULLOK(Stack_cleanup_method cleanup))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        __attribute__nonnull__(3)
-        FUNC_MODIFIES(*stack_p);
-
-PARROT_EXPORT
-void stack_system_init(SHIM_INTERP);
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_PURE_FUNCTION
-Stack_entry_type get_entry_type(ARGIN(const Stack_Entry_t *entry))
-        __attribute__nonnull__(1);
-
-#define ASSERT_ARGS_cst_new_stack_chunk __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(interp) \
-    || PARROT_ASSERT_ARG(chunk)
-#define ASSERT_ARGS_mark_stack __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(interp) \
-    || PARROT_ASSERT_ARG(chunk)
-#define ASSERT_ARGS_new_stack __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(interp) \
-    || PARROT_ASSERT_ARG(name)
-#define ASSERT_ARGS_Parrot_dump_dynamic_environment \
-     __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(interp) \
-    || PARROT_ASSERT_ARG(dynamic_env)
-#define ASSERT_ARGS_Parrot_pop_mark __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(interp)
-#define ASSERT_ARGS_Parrot_push_action __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(interp) \
-    || PARROT_ASSERT_ARG(sub)
-#define ASSERT_ARGS_Parrot_push_mark __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(interp)
-#define ASSERT_ARGS_pop_dest __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(interp)
-#define ASSERT_ARGS_stack_entry __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(stack)
-#define ASSERT_ARGS_stack_height __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(chunk)
-#define ASSERT_ARGS_stack_peek __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(interp) \
-    || PARROT_ASSERT_ARG(stack_base)
-#define ASSERT_ARGS_stack_pop __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(interp) \
-    || PARROT_ASSERT_ARG(stack_p)
-#define ASSERT_ARGS_stack_prepare_pop __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(interp) \
-    || PARROT_ASSERT_ARG(stack_p)
-#define ASSERT_ARGS_stack_prepare_push __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(interp) \
-    || PARROT_ASSERT_ARG(stack_p)
-#define ASSERT_ARGS_stack_push __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(interp) \
-    || PARROT_ASSERT_ARG(stack_p) \
-    || PARROT_ASSERT_ARG(thing)
-#define ASSERT_ARGS_stack_system_init __attribute__unused__ int _ASSERT_ARGS_CHECK = 0
-#define ASSERT_ARGS_get_entry_type __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(entry)
-/* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
-/* HEADERIZER END: src/stacks.c */
-
-#define ERROR_STACK_EMPTY 1
-#define ERROR_STACK_SHALLOW 1
-#define ERROR_BAD_STACK_TYPE 1
-
-#endif /* PARROT_STACKS_H_GUARD */
-
-/*
- * Local variables:
- *   c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */

Modified: trunk/include/parrot/sub.h
==============================================================================
--- trunk/include/parrot/sub.h	Sun Jul 26 20:33:00 2009	(r40287)
+++ trunk/include/parrot/sub.h	Sun Jul 26 22:03:33 2009	(r40288)
@@ -214,7 +214,6 @@
 
     PackFile_ByteCode *caller_seg;  /* bytecode segment */
     opcode_t *address;           /* next address to run - toggled each time */
-    struct Stack_Chunk *dynamic_state; /* next dynamic state */
 } Parrot_coro;
 
 typedef struct Parrot_cont {
@@ -222,7 +221,6 @@
     PackFile_ByteCode *seg;          /* bytecode segment */
     opcode_t *address;               /* start of bytecode, addr to continue */
     struct Parrot_Context *to_ctx;   /* pointer to dest context */
-    struct Stack_Chunk *dynamic_state; /* dest dynamic state */
     /* a Continuation keeps the from_ctx alive */
     struct Parrot_Context *from_ctx; /* sub, this cont is returning from */
     opcode_t *current_results;       /* ptr into code with get_results opcode

Modified: trunk/lib/Parrot/Op.pm
==============================================================================
--- trunk/lib/Parrot/Op.pm	Sun Jul 26 20:33:00 2009	(r40287)
+++ trunk/lib/Parrot/Op.pm	Sun Jul 26 22:03:33 2009	(r40288)
@@ -329,8 +329,6 @@
     s/{{=0,\+=([^{]*?)}}/ $trans->restart_offset($1)  . "; {{=0}}"; /me;
     s/{{=0,-=([^{]*?)}}/  $trans->restart_offset(-$1) . "; {{=0}}"; /me;
 
-    s/{{=\*}}/            $trans->goto_pop();       /me;
-
     s/{{\+=([^{]*?)}}/    $trans->goto_offset($1);  /me;
     s/{{-=([^{]*?)}}/     $trans->goto_offset(-$1); /me;
     s/{{=([^*][^{]*?)}}/  $trans->goto_address($1); /me;

Modified: trunk/lib/Parrot/OpTrans.pm
==============================================================================
--- trunk/lib/Parrot/OpTrans.pm	Sun Jul 26 20:33:00 2009	(r40287)
+++ trunk/lib/Parrot/OpTrans.pm	Sun Jul 26 22:03:33 2009	(r40288)
@@ -220,19 +220,6 @@
     return $self->gen_goto( $self->expr_offset(@_) );
 }
 
-=item C<goto_pop()>
-
-Transforms the C<goto POP($address)> macro in an ops file into the
-relevant C code.
-
-=cut
-
-sub goto_pop {
-    my ($self) = @_;
-
-    return $self->gen_goto( $self->expr_pop(@_) );
-}
-
 =item C<expr_offset($offset)>
 
 Implemented in subclasses to return the C code for C<OFFSET($offset)>.

Modified: trunk/lib/Parrot/OpTrans/C.pm
==============================================================================
--- trunk/lib/Parrot/OpTrans/C.pm	Sun Jul 26 20:33:00 2009	(r40287)
+++ trunk/lib/Parrot/OpTrans/C.pm	Sun Jul 26 22:03:33 2009	(r40288)
@@ -100,18 +100,6 @@
     return "cur_opcode + $offset";
 }
 
-=item C<expr_pop()>
-
-Returns the C code for C<POP()>. Called by C<goto_offset()>.
-
-=cut
-
-sub expr_pop {
-    my ($self) = @_;
-
-    return "pop_dest(interp)";
-}
-
 our %arg_maps = (
     'op' => "cur_opcode[%ld]",
 

Modified: trunk/lib/Parrot/OpTrans/CGP.pm
==============================================================================
--- trunk/lib/Parrot/OpTrans/CGP.pm	Sun Jul 26 20:33:00 2009	(r40287)
+++ trunk/lib/Parrot/OpTrans/CGP.pm	Sun Jul 26 22:03:33 2009	(r40288)
@@ -111,20 +111,6 @@
     .      "goto **(void **)(cur_opcode += $offset);\n} while (1)";
 }
 
-=item C<goto_pop()>
-
-Transforms the C<goto POP()> macro in an ops file into the relevant C
-code.
-
-=cut
-
-sub goto_pop {
-    my ($self) = @_;
-
-    return "goto **(void **)(cur_opcode = opcode_to_prederef(interp,
-        (opcode_t*)pop_dest(interp)))";
-}
-
 sub run_core_func_start {
     my $type = __PACKAGE__;
     return <<END_C;

Modified: trunk/lib/Parrot/OpTrans/CGoto.pm
==============================================================================
--- trunk/lib/Parrot/OpTrans/CGoto.pm	Sun Jul 26 20:33:00 2009	(r40287)
+++ trunk/lib/Parrot/OpTrans/CGoto.pm	Sun Jul 26 22:03:33 2009	(r40288)
@@ -174,20 +174,6 @@
     return "goto *ops_addr[*(cur_opcode += $offset)]";
 }
 
-=item C<goto_pop()>
-
-Transforms the C<goto POP()> macro in an ops file into the relevant C
-code.
-
-=cut
-
-sub goto_pop {
-    my ($self) = @_;
-
-    return
-"opcode_t* pop_addr = (opcode_t*)pop_dest(interp);\ncur_opcode = pop_addr;goto *ops_addr[*(pop_addr)]";
-}
-
 my %arg_maps = (
     'op' => "cur_opcode[%ld]",
 

Modified: trunk/lib/Parrot/OpTrans/CSwitch.pm
==============================================================================
--- trunk/lib/Parrot/OpTrans/CSwitch.pm	Sun Jul 26 20:33:00 2009	(r40287)
+++ trunk/lib/Parrot/OpTrans/CSwitch.pm	Sun Jul 26 22:03:33 2009	(r40288)
@@ -117,20 +117,6 @@
     return "{ cur_opcode += $offset; goto SWITCH_AGAIN; }";
 }
 
-=item C<goto_pop()>
-
-Transforms the C<goto POP()> macro in an ops file into the relevant C
-code.
-
-=cut
-
-sub goto_pop {
-    my ($self) = @_;
-    return "{ opcode_t *dest = (opcode_t*)pop_dest(interp);
-              cur_opcode = opcode_to_prederef(interp, dest);
-              goto SWITCH_AGAIN; }";
-}
-
 =item C<init_func_init1($base)>
 
 Returns the C code for the init function.

Modified: trunk/lib/Parrot/OpsFile.pm
==============================================================================
--- trunk/lib/Parrot/OpsFile.pm	Sun Jul 26 20:33:00 2009	(r40287)
+++ trunk/lib/Parrot/OpsFile.pm	Sun Jul 26 22:03:33 2009	(r40288)
@@ -114,10 +114,6 @@
 
 Transforms to C<PC' = X>. This is used for absolute jumps.
 
-=item C<goto POP()>
-
-Transforms to C<< PC' = <pop> >>. Pops the address off control stack.
-
 =item C<expr OFFSET(X)>
 
 Transforms to C<PC + X>. This is used to give a relative address.
@@ -500,7 +496,6 @@
         #   goto OFFSET(X)     {{+=X}}  PC' = PC + X  Used for branches
         #   goto NEXT()        {{+=S}}  PC' = PC + S  Where S is op size
         #   goto ADDRESS(X)    {{=X}}   PC' = X       Used for absolute jumps
-        #   goto POP()         {{=*}}   PC' = <pop>   Pop address off control stack
         #   expr OFFSET(X)     {{^+X}}  PC + X        Relative address
         #   expr NEXT()        {{^+S}}  PC + S        Where S is op size
         #   expr ADDRESS(X)    {{^X}}   X             Absolute address
@@ -536,9 +531,6 @@
         $branch   ||= $body =~ s/\bgoto\s+OFFSET\((.*?)\)/{{+=$1}}/mg;
                       $body =~ s/\bexpr\s+OFFSET\((.*?)\)/{{^+$1}}/mg;
 
-        $pop      ||= $body =~ s/\bgoto\s+POP\(\)/{{=*}}/mg;
-                      $body =~ s/\bexpr\s+POP\(\)/{{^*}}/mg;
-
         $next     ||= $short_name =~ /runinterp/;
         $next     ||= $body =~ s/\bexpr\s+NEXT\(\)/{{^+$op_size}}/mg;
                       $body =~ s/\bgoto\s+NEXT\(\)/{{+=$op_size}}/mg;
@@ -579,7 +571,6 @@
         # Constants here are defined in include/parrot/op.h
         or_flag( \$jumps, "PARROT_JUMP_ADDRESS"  ) if $absolute;
         or_flag( \$jumps, "PARROT_JUMP_RELATIVE" ) if $branch;
-        or_flag( \$jumps, "PARROT_JUMP_POP"      ) if $pop;
         or_flag( \$jumps, "PARROT_JUMP_ENEXT"    ) if $next;
         or_flag( \$jumps, "PARROT_JUMP_RESTART"  ) if $restart;
 
@@ -675,7 +666,6 @@
 
         #s/goto\s+NEXT\(\)/{{+=$op_size}}/mg;   #not supported--dependent on op size
         s/goto\s+ADDRESS\((.*)\)/{{=$1}}/mg;
-        s/goto\s+POP\(\)/{{=*}}/mg;
         s/HALT\(\)/{{=0}}/mg;
 
         # RT#43721: This ought to throw errors when attempting to rewrite $n

Modified: trunk/src/gc/api.c
==============================================================================
--- trunk/src/gc/api.c	Sun Jul 26 20:33:00 2009	(r40287)
+++ trunk/src/gc/api.c	Sun Jul 26 22:03:33 2009	(r40288)
@@ -538,8 +538,7 @@
 Returns a new buffer-like header from the appropriate sized pool.
 A "bufferlike object" is an object that is considered to be isomorphic to the
 PObj, so it will participate in normal GC. At the moment these are only used
-to create ListChunk objects in src/list.c and Stack_Chunk objects in
-src/stacks.c.
+to create ListChunk objects in src/list.c.
 
 =cut
 

Modified: trunk/src/gc/mark_sweep.c
==============================================================================
--- trunk/src/gc/mark_sweep.c	Sun Jul 26 20:33:00 2009	(r40287)
+++ trunk/src/gc/mark_sweep.c	Sun Jul 26 22:03:33 2009	(r40288)
@@ -195,7 +195,7 @@
     mark_context(interp, ctx);
 
     /* mark the dynamic environment. */
-    mark_stack(interp, interp->dynamic_env);
+    Parrot_gc_mark_PObj_alive(interp, (PObj*)interp->dynamic_env);
 
     /* mark the vtables: the data, Class PMCs, etc. */
     mark_vtables(interp);

Modified: trunk/src/interp/inter_create.c
==============================================================================
--- trunk/src/interp/inter_create.c	Sun Jul 26 20:33:00 2009	(r40287)
+++ trunk/src/interp/inter_create.c	Sun Jul 26 22:03:33 2009	(r40288)
@@ -210,12 +210,6 @@
     PARROT_ERRORS_on(interp, PARROT_ERRORS_RESULT_COUNT_FLAG);
 #endif
 
-    /* allocate stack chunk cache */
-    stack_system_init(interp);
-
-    /* And a dynamic environment stack */
-    interp->dynamic_env = new_stack(interp, "DynamicEnv");
-
     /* clear context introspection vars */
     CONTEXT(interp)->current_sub    = NULL;
     CONTEXT(interp)->current_cont   = NULL;
@@ -235,6 +229,10 @@
     /* create the root set registry */
     interp->gc_registry     = pmc_new(interp, enum_class_AddrRegistry);
 
+    /* And a dynamic environment stack */
+    /* TODO: We should really consider removing this (TT #876) */
+    interp->dynamic_env = pmc_new(interp, enum_class_ResizablePMCArray);
+
     /* create exceptions list */
     interp->current_runloop_id    = 0;
     interp->current_runloop_level = 0;

Modified: trunk/src/ops/core.ops
==============================================================================
--- trunk/src/ops/core.ops	Sun Jul 26 20:33:00 2009	(r40287)
+++ trunk/src/ops/core.ops	Sun Jul 26 22:03:33 2009	(r40288)
@@ -923,15 +923,33 @@
 }
 
 inline op pushmark(in INT) {
-    Parrot_push_mark(interp, $1);
+    PMC * const newint = pmc_new(interp, enum_class_Integer);
+    VTABLE_set_integer_native(interp, newint, $1);
+    VTABLE_push_pmc(interp, interp->dynamic_env, newint);
 }
 
 inline op popmark(in INT) {
-    Parrot_pop_mark(interp, $1);
+    opcode_t * dest;
+    opcode_t * const ret = expr NEXT();
+    int found = 0;
+    while (VTABLE_elements(interp, interp->dynamic_env)) {
+        PMC * const item = VTABLE_pop_pmc(interp, interp->dynamic_env);
+        if (item->vtable->base_type == enum_class_Integer
+           && VTABLE_get_integer(interp, item) == $1) {
+           found = 1;
+           break;
+        }
+
+        else if (item->vtable->base_type == enum_class_Sub
+                 || item->vtable->base_type == enum_class_NCI)
+            Parrot_pcc_invoke_sub_from_c_args(interp, item, "I->", 0);
+    }
+    if (!found)
+        dest = Parrot_ex_throw_from_op_args(interp, ret, 1, "Mark %d not found", $1);
 }
 
 inline op pushaction(invar PMC) {
-    Parrot_push_action(interp, $1);
+    VTABLE_push_pmc(interp, interp->dynamic_env, $1);
 }
 
 =back

Modified: trunk/src/pmc/coroutine.pmc
==============================================================================
--- trunk/src/pmc/coroutine.pmc	Sun Jul 26 20:33:00 2009	(r40287)
+++ trunk/src/pmc/coroutine.pmc	Sun Jul 26 22:03:33 2009	(r40288)
@@ -150,7 +150,6 @@
             ctx        = Parrot_set_new_context(INTERP, co->n_regs_used);
 
             co->ctx                   = Parrot_context_ref(interp, ctx);
-            co->dynamic_state         = interp->dynamic_env;
 
             ctx->caller_ctx           = caller_ctx;
             PMC_cont(ccont)->from_ctx = ctx;
@@ -179,7 +178,6 @@
         /* if calling the Coro we need the segment of the Coro */
         else if (!(PObj_get_FLAGS(SELF) & SUB_FLAG_CORO_FF)) {
             PMC *ccont;
-            Stack_Chunk_t    *state;
             Parrot_Context   *ctx;
 
             PObj_get_FLAGS(SELF) |= SUB_FLAG_CORO_FF;
@@ -195,16 +193,12 @@
                                   = CONTEXT(interp);
 
             /* set context to coro context */
-            state                 = interp->dynamic_env;
-            interp->dynamic_env   = co->dynamic_state;
-            co->dynamic_state     = state;
             CONTEXT(interp)       = ctx;
             INTERP->ctx.bp        = ctx->bp;
             INTERP->ctx.bp_ps     = ctx->bp_ps;
         }
         else {
             PMC *ccont;
-            Stack_Chunk_t    *state;
             Parrot_Context   *ctx;
 
             PObj_get_FLAGS(SELF) &= ~SUB_FLAG_CORO_FF;
@@ -224,9 +218,6 @@
                                "Cannot resume dead coroutine.");
             }
 
-            state                = interp->dynamic_env;
-            interp->dynamic_env  = co->dynamic_state;
-            co->dynamic_state    = state;
             CONTEXT(interp)      = ctx;
             INTERP->ctx.bp       = ctx->bp;
             INTERP->ctx.bp_ps    = ctx->bp_ps;
@@ -258,9 +249,6 @@
 
         /* co->ctx marked in SUPER(), so do not mark here */
         if (co) {
-            if (co->dynamic_state)
-                mark_stack(INTERP, co->dynamic_state);
-
             SUPER();
         }
     }

Deleted: trunk/src/stacks.c
==============================================================================
--- trunk/src/stacks.c	Sun Jul 26 22:03:33 2009	(r40287)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,618 +0,0 @@
-/*
-Copyright (C) 2001-2009, Parrot Foundation.
-$Id$
-
-=head1 NAME
-
-src/stacks.c - Stack handling routines for Parrot
-
-=head1 DESCRIPTION
-
-The stack is stored as a linked list of chunks (C<Stack_Chunk>),
-where each chunk has room for one entry.
-
-=head2 Functions
-
-=over 4
-
-=cut
-
-*/
-
-#include "parrot/parrot.h"
-#include "parrot/stacks.h"
-#include "stacks.str"
-
-/* HEADERIZER HFILE: include/parrot/stacks.h */
-
-/* HEADERIZER BEGIN: static */
-/* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
-
-static void run_cleanup_action(PARROT_INTERP, ARGIN(Stack_Entry_t *e))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
-#define ASSERT_ARGS_run_cleanup_action __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(interp) \
-    || PARROT_ASSERT_ARG(e)
-/* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
-/* HEADERIZER END: static */
-
-/*
-
-=item C<void stack_system_init(PARROT_INTERP)>
-
-Called from C<make_interpreter()> to initialize the interpreter's
-register stacks.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-void
-stack_system_init(SHIM_INTERP)
-{
-    ASSERT_ARGS(stack_system_init)
-}
-
-/*
-
-=item C<Stack_Chunk_t * cst_new_stack_chunk(PARROT_INTERP, const Stack_Chunk_t
-*chunk)>
-
-Get a new chunk either from the freelist or allocate one.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-Stack_Chunk_t *
-cst_new_stack_chunk(PARROT_INTERP, ARGIN(const Stack_Chunk_t *chunk))
-{
-    ASSERT_ARGS(cst_new_stack_chunk)
-    Stack_Chunk_t * const new_chunk =
-        (Stack_Chunk_t *)Parrot_gc_new_bufferlike_header(interp, sizeof (Stack_Chunk_t));
-
-    PObj_bufstart(new_chunk) = NULL;
-    PObj_buflen(new_chunk)   = 0;
-
-    new_chunk->name          = chunk->name;
-
-    return new_chunk;
-}
-
-/*
-
-=item C<Stack_Chunk_t * new_stack(PARROT_INTERP, const char *name)>
-
-Create a new stack and name it. C<< stack->name >> is used for
-debugging/error reporting.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
-PARROT_WARN_UNUSED_RESULT
-Stack_Chunk_t *
-new_stack(PARROT_INTERP, ARGIN(const char *name))
-{
-    ASSERT_ARGS(new_stack)
-    Stack_Chunk_t * const chunk =
-        (Stack_Chunk_t *)Parrot_gc_new_bufferlike_header(interp, sizeof (Stack_Chunk_t));
-
-    chunk->prev = chunk;        /* mark the top of the stack */
-    chunk->name = name;
-
-    return chunk;
-}
-
-
-/*
-
-=item C<void mark_stack(PARROT_INTERP, Stack_Chunk_t *chunk)>
-
-Mark entries in a stack structure during GC.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-void
-mark_stack(PARROT_INTERP, ARGMOD(Stack_Chunk_t *chunk))
-{
-    ASSERT_ARGS(mark_stack)
-    for (; ; chunk = chunk->prev) {
-        Stack_Entry_t  *entry;
-
-        Parrot_gc_mark_PObj_alive(interp, (PObj *)chunk);
-
-        if (chunk == chunk->prev)
-            break;
-
-        entry = STACK_DATAP(chunk);
-
-        if (entry->entry_type == STACK_ENTRY_PMC && UVal_pmc(entry->entry))
-            Parrot_gc_mark_PObj_alive(interp, (PObj *)UVal_pmc(entry->entry));
-    }
-}
-
-/*
-
-=item C<size_t stack_height(PARROT_INTERP, const Stack_Chunk_t *chunk)>
-
-Returns the height of the stack. The maximum "depth" is height - 1.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-size_t
-stack_height(SHIM_INTERP, ARGIN(const Stack_Chunk_t *chunk))
-{
-    ASSERT_ARGS(stack_height)
-    size_t height = 0;
-
-    for (; ; chunk = chunk->prev) {
-        if (chunk == chunk->prev)
-            break;
-        ++height;
-    }
-
-    return height;
-}
-
-
-/*
-
-=item C<Stack_Entry_t * stack_entry(PARROT_INTERP, Stack_Chunk_t *stack, INTVAL
-depth)>
-
-If C<< depth >= 0 >>, return the entry at that depth from the top of the
-stack, with 0 being the top entry. If C<depth < 0>, then return the
-entry C<|depth|> entries from the bottom of the stack. Returns C<NULL>
-if C<|depth| > number> of entries in stack.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_CAN_RETURN_NULL
-PARROT_WARN_UNUSED_RESULT
-Stack_Entry_t *
-stack_entry(SHIM_INTERP, ARGIN(Stack_Chunk_t *stack), INTVAL depth)
-{
-    ASSERT_ARGS(stack_entry)
-    Stack_Chunk_t *chunk;
-    size_t         offset = (size_t)depth;
-
-    if (depth < 0)
-        return NULL;
-
-    /* Start at top */
-    chunk = stack;
-
-    while (offset) {
-        if (chunk == chunk->prev)
-            break;
-        --offset;
-        chunk = chunk->prev;
-    }
-
-    if (chunk == chunk->prev)
-        return NULL;
-
-    return STACK_DATAP(chunk);
-}
-
-/*
-
-=item C<Stack_Entry_t* stack_prepare_push(PARROT_INTERP, Stack_Chunk_t
-**stack_p)>
-
-Return a pointer, where new entries go for push.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-Stack_Entry_t*
-stack_prepare_push(PARROT_INTERP, ARGMOD(Stack_Chunk_t **stack_p))
-{
-    ASSERT_ARGS(stack_prepare_push)
-    Stack_Chunk_t * const chunk     = *stack_p;
-    Stack_Chunk_t * const new_chunk = cst_new_stack_chunk(interp, chunk);
-
-    new_chunk->prev = chunk;
-    *stack_p        = new_chunk;
-
-    return STACK_DATAP(new_chunk);
-}
-
-/*
-
-=item C<void stack_push(PARROT_INTERP, Stack_Chunk_t **stack_p, void *thing,
-Stack_entry_type type, Stack_cleanup_method cleanup)>
-
-Push something on the generic stack.
-
-Note that the cleanup pointer, if non-C<NULL>, points to a routine
-that'll be called when the entry is removed from the stack. This is
-handy for those cases where you need some sort of activity to take place
-when an entry is removed, such as when you push a lexical lock onto the
-call stack, or localize (or tempify, or whatever we're calling it)
-variable or something.
-
-*/
-
-PARROT_EXPORT
-void
-stack_push(PARROT_INTERP, ARGMOD(Stack_Chunk_t **stack_p),
-           ARGIN(void *thing), Stack_entry_type type, NULLOK(Stack_cleanup_method cleanup))
-{
-    ASSERT_ARGS(stack_push)
-    Stack_Entry_t * const entry = (Stack_Entry_t *)stack_prepare_push(interp, stack_p);
-
-    /* Remember the type */
-    entry->entry_type = type;
-
-    /* Remember the cleanup function */
-    entry->cleanup = cleanup;
-
-    /* Store our thing */
-    switch (type) {
-        case STACK_ENTRY_MARK:
-            UVal_int(entry->entry) = *(INTVAL *)thing;
-            break;
-        case STACK_ENTRY_DESTINATION:
-            UVal_ptr(entry->entry) = thing;
-            break;
-        case STACK_ENTRY_ACTION:
-        case STACK_ENTRY_PMC:
-            UVal_pmc(entry->entry) = (PMC *)thing;
-            break;
-        default:
-            Parrot_ex_throw_from_c_args(interp, NULL, ERROR_BAD_STACK_TYPE,
-                "Invalid Stack_Entry_type!");
-    }
-}
-
-/*
-
-=item C<Stack_Entry_t* stack_prepare_pop(PARROT_INTERP, Stack_Chunk_t
-**stack_p)>
-
-Return a pointer, where new entries are popped off.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-Stack_Entry_t*
-stack_prepare_pop(PARROT_INTERP, ARGMOD(Stack_Chunk_t **stack_p))
-{
-    ASSERT_ARGS(stack_prepare_pop)
-    Stack_Chunk_t * const chunk = *stack_p;
-
-    /* the first entry (initial top) refers to itself */
-    if (chunk == chunk->prev)
-        Parrot_ex_throw_from_c_args(interp, NULL, ERROR_STACK_EMPTY,
-            "No entries on %s Stack!", chunk->name);
-
-    *stack_p = chunk->prev;
-
-    return STACK_DATAP(chunk);
-}
-
-/*
-
-=item C<void * stack_pop(PARROT_INTERP, Stack_Chunk_t **stack_p, void *where,
-Stack_entry_type type)>
-
-Pop off an entry and return a pointer to the contents.
-
-*/
-
-PARROT_EXPORT
-PARROT_CAN_RETURN_NULL
-void *
-stack_pop(PARROT_INTERP, ARGMOD(Stack_Chunk_t **stack_p),
-          ARGOUT_NULLOK(void *where), Stack_entry_type type)
-{
-    ASSERT_ARGS(stack_pop)
-    Stack_Chunk_t * const cur_chunk = *stack_p;
-    Stack_Entry_t * const entry =
-        (Stack_Entry_t *)stack_prepare_pop(interp, stack_p);
-
-    /* Types of 0 mean we don't care */
-    if (type && entry->entry_type != type)
-        Parrot_ex_throw_from_c_args(interp, NULL, ERROR_BAD_STACK_TYPE,
-            "Wrong type on top of stack!\n");
-
-    /* Cleanup routine? */
-    if (entry->cleanup != STACK_CLEANUP_NULL)
-        (*entry->cleanup) (interp, entry);
-
-    /* Sometimes the caller cares what the value was */
-    if (where) {
-        /* Snag the value */
-        switch (type) {
-        case STACK_ENTRY_MARK:
-            *(INTVAL *)where   = UVal_int(entry->entry);
-            break;
-        case STACK_ENTRY_DESTINATION:
-            *(void **)where    = UVal_ptr(entry->entry);
-            break;
-        case STACK_ENTRY_ACTION:
-        case STACK_ENTRY_PMC:
-            *(PMC **)where     = UVal_pmc(entry->entry);
-            break;
-        default:
-            Parrot_ex_throw_from_c_args(interp, NULL, ERROR_BAD_STACK_TYPE,
-                "Wrong type on top of stack!\n");
-        }
-    }
-
-    /* recycle this chunk to the free list if it's otherwise unreferenced */
-    if (cur_chunk->refcount <= 0)
-        Parrot_gc_free_bufferlike_header(interp, (PObj *)cur_chunk, sizeof (Stack_Chunk_t));
-
-    return where;
-}
-
-/*
-
-=item C<void * pop_dest(PARROT_INTERP)>
-
-Pop off a destination entry and return a pointer to the contents.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-void *
-pop_dest(PARROT_INTERP)
-{
-    ASSERT_ARGS(pop_dest)
-    /* We don't mind the extra call, so we do this: (previous comment
-     * said we *do* mind, but I say let the compiler decide) */
-    void *dest;
-    (void)stack_pop(interp, &interp->dynamic_env,
-                    &dest, STACK_ENTRY_DESTINATION);
-    return dest;
-}
-
-/*
-
-=item C<void * stack_peek(PARROT_INTERP, Stack_Chunk_t *stack_base,
-Stack_entry_type *type)>
-
-Peek at stack and return pointer to entry and the type of the entry.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_CAN_RETURN_NULL
-PARROT_WARN_UNUSED_RESULT
-void *
-stack_peek(PARROT_INTERP, ARGIN(Stack_Chunk_t *stack_base),
-           ARGMOD_NULLOK(Stack_entry_type *type))
-{
-    ASSERT_ARGS(stack_peek)
-    const Stack_Entry_t * const entry = stack_entry(interp, stack_base, 0);
-    if (entry == NULL)
-        return NULL;
-
-    if (type != NULL)
-        *type = entry->entry_type;
-
-    if (entry->entry_type == STACK_ENTRY_DESTINATION)
-        return UVal_ptr(entry->entry);
-
-    return (void *) UVal_pmc(entry->entry);
-}
-
-/*
-
-=item C<Stack_entry_type get_entry_type(const Stack_Entry_t *entry)>
-
-Returns the stack entry type of C<entry>.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_PURE_FUNCTION
-Stack_entry_type
-get_entry_type(ARGIN(const Stack_Entry_t *entry))
-{
-    ASSERT_ARGS(get_entry_type)
-    return entry->entry_type;
-}
-
-/*
-
-=item C<void Parrot_dump_dynamic_environment(PARROT_INTERP, Stack_Chunk_t
-*dynamic_env)>
-
-Print a representation of the dynamic stack to the standard error (using
-C<Parrot_io_eprintf>).  This is used only temporarily for debugging.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-void
-Parrot_dump_dynamic_environment(PARROT_INTERP, ARGIN(Stack_Chunk_t *dynamic_env))
-{
-    ASSERT_ARGS(Parrot_dump_dynamic_environment)
-    int height = (int) stack_height(interp, dynamic_env);
-
-    while (dynamic_env->prev != dynamic_env) {
-        const Stack_Entry_t * const e = stack_entry(interp, dynamic_env, 0);
-
-        if (! e)
-            Parrot_ex_throw_from_c_args(interp, NULL, 1, "Dynamic environment stack damaged");
-
-        Parrot_io_eprintf(interp, "[%4d:  chunk %p entry %p "
-                                 "type %d cleanup %p]\n",
-                    height, dynamic_env, e,
-                    e->entry_type, e->cleanup);
-        if (e->entry_type == STACK_ENTRY_PMC
-                || e->entry_type == STACK_ENTRY_ACTION) {
-            PMC * const thing = UVal_pmc(e->entry);
-
-            Parrot_io_eprintf(interp, "[        PMC %p type %d => %Ss]\n",
-                        thing, thing->vtable->base_type,
-                        VTABLE_get_string(interp, thing));
-        }
-        else if (e->entry_type == STACK_ENTRY_MARK) {
-            Parrot_io_eprintf(interp, "[        mark %d]\n",
-                        UVal_int(e->entry));
-        }
-        dynamic_env = dynamic_env->prev;
-        height--;
-    }
-    Parrot_io_eprintf(interp, "[%4d:  chunk %p %s base]\n",
-                height, dynamic_env, dynamic_env->name);
-}
-
-
-/*
-
-=item C<static void run_cleanup_action(PARROT_INTERP, Stack_Entry_t *e)>
-
-Runs the sub PMC from the Stack_Entry_t pointer with an INTVAL arg of 0.  Used
-in C<Parrot_push_action>.
-
-=cut
-
-*/
-
-static void
-run_cleanup_action(PARROT_INTERP, ARGIN(Stack_Entry_t *e))
-{
-    ASSERT_ARGS(run_cleanup_action)
-    /*
-     * this is called during normal stack_pop of the control
-     * stack - run the action subroutine with an INTVAL arg of 0
-     */
-    PMC * const sub = UVal_pmc(e->entry);
-    Parrot_runops_fromc_args(interp, sub, "vI", 0);
-}
-
-/*
-
-=item C<void Parrot_push_action(PARROT_INTERP, PMC *sub)>
-
-Pushes an action handler onto the dynamic environment.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-void
-Parrot_push_action(PARROT_INTERP, ARGIN(PMC *sub))
-{
-    ASSERT_ARGS(Parrot_push_action)
-    if (!VTABLE_isa(interp, sub, CONST_STRING(interp, "Sub")))
-        Parrot_ex_throw_from_c_args(interp, NULL, 1,
-            "Tried to push a non Sub PMC action");
-
-    stack_push(interp, &interp->dynamic_env, sub,
-               STACK_ENTRY_ACTION, run_cleanup_action);
-}
-
-/*
-
-=item C<void Parrot_push_mark(PARROT_INTERP, INTVAL mark)>
-
-Push a cleanup mark onto the dynamic environment.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-void
-Parrot_push_mark(PARROT_INTERP, INTVAL mark)
-{
-    ASSERT_ARGS(Parrot_push_mark)
-    stack_push(interp, &interp->dynamic_env, &mark,
-               STACK_ENTRY_MARK, STACK_CLEANUP_NULL);
-}
-
-/*
-
-=item C<void Parrot_pop_mark(PARROT_INTERP, INTVAL mark)>
-
-Pop items off the dynamic environment up to the mark.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-void
-Parrot_pop_mark(PARROT_INTERP, INTVAL mark)
-{
-    ASSERT_ARGS(Parrot_pop_mark)
-    do {
-        const Stack_Entry_t * const e
-            = stack_entry(interp, interp->dynamic_env, 0);
-        if (!e)
-            Parrot_ex_throw_from_c_args(interp, NULL, 1, "Mark %ld not found.",
-                (long)mark);
-
-        (void)stack_pop(interp, &interp->dynamic_env,
-                        NULL, e->entry_type);
-        if (e->entry_type == STACK_ENTRY_MARK) {
-            if (UVal_int(e->entry) == mark)
-                return;
-        }
-    } while (1);
-}
-
-
-/*
-
-=back
-
-=head1 SEE ALSO
-
-F<include/parrot/stacks.h> and F<include/parrot/enums.h>.
-
-=cut
-
-*/
-
-
-/*
- * Local variables:
- *   c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */

Modified: trunk/src/sub.c
==============================================================================
--- trunk/src/sub.c	Sun Jul 26 20:33:00 2009	(r40287)
+++ trunk/src/sub.c	Sun Jul 26 22:03:33 2009	(r40288)
@@ -192,7 +192,6 @@
 
     cc->to_ctx        = to_ctx;
     cc->from_ctx      = Parrot_context_ref(interp, CONTEXT(interp));
-    cc->dynamic_state = NULL;
     cc->runloop_id    = 0;
     if (to) {
         cc->seg       = to->seg;
@@ -227,7 +226,6 @@
 
     cc->to_ctx          = CONTEXT(interp);
     cc->from_ctx        = CONTEXT(interp);    /* filled in during a call */
-    cc->dynamic_state   = NULL;
     cc->runloop_id      = 0;
     cc->seg             = interp->code;
     cc->current_results = NULL;
@@ -257,7 +255,6 @@
 
     co->seg                = interp->code;
     co->ctx                = NULL;
-    co->dynamic_state      = NULL;
 
     return co;
 }


More information about the parrot-commits mailing list