[svn:parrot] r37123 - in trunk: config/auto config/gen/makefiles include/parrot lib/Parrot/Pmc2c src src/call src/ops src/pmc
Reini Urban
rurban at x-ray.at
Thu Mar 5 12:42:01 UTC 2009
2009/3/5 <cotto at svn.parrot.org>:
> Author: cotto
> Date: Thu Mar 5 10:31:41 2009
> New Revision: 37123
> URL: https://trac.parrot.org/parrot/changeset/37123
>
> Log:
> [PMC] use ATTRs in Continuation family PMCs
> --This line, and those[PMC] below, will be ignored--
>
> M src/ops/core.ops
> M src/debug.c
> M src/pic.c
> M src/pmc/retcontinuation.pmc
> M src/pmc/continuation.pmc
> M src/pmc/exceptionhandler.pmc
> M src/exceptions.c
> M src/sub.c
> M src/call/ops.c
> M src/call/pcc.c
> M lib/Parrot/Pmc2c/PMCEmitter.pm
> M include/parrot/sub.h
> M config/auto/pmc.pm
> M config/gen/makefiles/root.in
Hi Cotto,
Did you test this on rakudo or any other language also?
In light of TT #388 and "Proposed critical step in cutting 1.0 release
(or any major release)"
>
> Modified:
> trunk/config/auto/pmc.pm
> trunk/config/gen/makefiles/root.in
> trunk/include/parrot/sub.h
> trunk/lib/Parrot/Pmc2c/PMCEmitter.pm
> trunk/src/call/ops.c
> trunk/src/call/pcc.c
> trunk/src/debug.c
> trunk/src/exceptions.c
> trunk/src/ops/core.ops
> trunk/src/pic.c
> trunk/src/pmc/continuation.pmc
> trunk/src/pmc/exceptionhandler.pmc
> trunk/src/pmc/retcontinuation.pmc
> trunk/src/sub.c
>
> Modified: trunk/config/auto/pmc.pm
> ==============================================================================
> --- trunk/config/auto/pmc.pm Thu Mar 5 06:01:48 2009 (r37122)
> +++ trunk/config/auto/pmc.pm Thu Mar 5 10:31:41 2009 (r37123)
> @@ -105,7 +105,7 @@
> src/pmc/pmc_$pmc.h: src/pmc/$pmc.c
>
> src/pmc/$pmc\$(O): src/pmc/$pmc.str \$(NONGEN_HEADERS) \\
> - $parent_headers $include_headers
> + $parent_headers $include_headers src/pmc/pmc_continuation.h
>
> END
> }
>
> Modified: trunk/config/gen/makefiles/root.in
> ==============================================================================
> --- trunk/config/gen/makefiles/root.in Thu Mar 5 06:01:48 2009 (r37122)
> +++ trunk/config/gen/makefiles/root.in Thu Mar 5 10:31:41 2009 (r37123)
> @@ -1084,10 +1084,10 @@
> $(SRC_DIR)/trace$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/pmc/pmc_sub.h
>
> $(SRC_DIR)/debug$(O) : $(GENERAL_H_FILES) $(INC_DIR)/debugger.h \
> - $(SRC_DIR)/debug.str $(SRC_DIR)/pmc/pmc_key.h
> + $(SRC_DIR)/debug.str $(SRC_DIR)/pmc/pmc_key.h $(SRC_DIR)/pmc/pmc_continuation.h
>
> $(SRC_DIR)/sub$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/sub.str \
> - $(SRC_DIR)/pmc/pmc_sub.h
> + $(SRC_DIR)/pmc/pmc_sub.h $(SRC_DIR)/pmc/pmc_continuation.h
>
> $(SRC_DIR)/string/api$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/string/private_cstring.h
>
> @@ -1097,7 +1097,8 @@
>
> $(SRC_DIR)/dynext$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/dynext.str
>
> -$(SRC_DIR)/exceptions$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/exceptions.str
> +$(SRC_DIR)/exceptions$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/exceptions.str \
> + $(SRC_DIR)/pmc/pmc_continuation.h
>
> $(SRC_DIR)/events$(O) : $(GENERAL_H_FILES)
>
> @@ -1110,7 +1111,7 @@
>
> $(SRC_DIR)/call/pcc$(O) : $(SRC_DIR)/call/pcc.c $(GENERAL_H_FILES) \
> $(SRC_DIR)/call/pcc.str $(SRC_DIR)/pmc/pmc_fixedintegerarray.h \
> - $(SRC_DIR)/pmc/pmc_key.h
> + $(SRC_DIR)/pmc/pmc_key.h $(SRC_DIR)/pmc/pmc_continuation.h
>
> $(SRC_DIR)/inter_cb$(O) : $(SRC_DIR)/inter_cb.c $(GENERAL_H_FILES) \
> $(SRC_DIR)/inter_cb.str
> @@ -1121,7 +1122,8 @@
> $(SRC_DIR)/inter_create$(O) : $(SRC_DIR)/inter_create.c $(GENERAL_H_FILES) \
> $(SRC_DIR)/inter_create.str
>
> -$(SRC_DIR)/call/ops$(O) : $(SRC_DIR)/call/ops.c $(GENERAL_H_FILES)
> +$(SRC_DIR)/call/ops$(O) : $(SRC_DIR)/call/ops.c $(GENERAL_H_FILES) \
> + $(SRC_DIR)/pmc/pmc_continuation.h
>
> $(IO_DIR)/api$(O) : $(GENERAL_H_FILES) $(IO_DIR)/io_private.h $(IO_DIR)/api.str
>
> @@ -1139,7 +1141,8 @@
>
> $(SRC_DIR)/main$(O) : $(SRC_DIR)/main.c $(GENERAL_H_FILES)
>
> -$(SRC_DIR)/pic$(O) : $(GENERAL_H_FILES)
> +$(SRC_DIR)/pic$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/pmc/pmc_fixedintegerarray.h \
> + $(SRC_DIR)/pmc/pmc_continuation.h
>
> $(SRC_DIR)/pic_jit$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/pmc/pmc_sub.h
>
> @@ -1199,7 +1202,8 @@
>
> $(IO_DIR)/filehandle$(O) : $(SRC_DIR)/pmc/pmc_filehandle.h $(SRC_DIR)/io/io_private.h
>
> -$(OPS_DIR)/core_ops$(O) : $(GENERAL_H_FILES) $(OPS_DIR)/core_ops.c
> +$(OPS_DIR)/core_ops$(O) : $(GENERAL_H_FILES) $(OPS_DIR)/core_ops.c \
> + $(SRC_DIR)/pmc/pmc_continuation.h
>
> $(OPS_DIR)/pic.ops : $(SRC_DIR)/pmc/pmc_fixedintegerarray.h
>
>
> Modified: trunk/include/parrot/sub.h
> ==============================================================================
> --- trunk/include/parrot/sub.h Thu Mar 5 06:01:48 2009 (r37122)
> +++ trunk/include/parrot/sub.h Thu Mar 5 10:31:41 2009 (r37123)
> @@ -230,7 +230,7 @@
> int invoked; /* flag when a handler has been invoked. */
> } Parrot_cont;
>
> -#define PMC_cont(pmc) ((Parrot_cont *)PMC_struct_val(pmc))
> +#define PMC_cont(pmc) (PARROT_CONTINUATION(pmc)->cont)
>
> typedef struct Parrot_Context_info {
> STRING *subname;
>
> Modified: trunk/lib/Parrot/Pmc2c/PMCEmitter.pm
> ==============================================================================
> --- trunk/lib/Parrot/Pmc2c/PMCEmitter.pm Thu Mar 5 06:01:48 2009 (r37122)
> +++ trunk/lib/Parrot/Pmc2c/PMCEmitter.pm Thu Mar 5 10:31:41 2009 (r37123)
> @@ -75,6 +75,9 @@
>
> $self->gen_includes;
>
> + # The PCC code needs Continuation-related macros from these headers.
> + $c->emit("#include \"pmc_continuation.h\"\n");
> +
> $c->emit( $self->preamble );
>
> $self->gen_methods;
>
> Modified: trunk/src/call/ops.c
> ==============================================================================
> --- trunk/src/call/ops.c Thu Mar 5 06:01:48 2009 (r37122)
> +++ trunk/src/call/ops.c Thu Mar 5 10:31:41 2009 (r37123)
> @@ -19,6 +19,7 @@
>
> #include "parrot/parrot.h"
> #include "parrot/oplib/ops.h"
> +#include "../pmc/pmc_continuation.h"
>
> /* HEADERIZER HFILE: include/parrot/call.h */
>
>
> Modified: trunk/src/call/pcc.c
> ==============================================================================
> --- trunk/src/call/pcc.c Thu Mar 5 06:01:48 2009 (r37122)
> +++ trunk/src/call/pcc.c Thu Mar 5 10:31:41 2009 (r37123)
> @@ -21,6 +21,7 @@
> #include "parrot/oplib/ops.h"
> #include "pcc.str"
> #include "../pmc/pmc_key.h"
> +#include "../pmc/pmc_continuation.h"
>
> /* HEADERIZER HFILE: include/parrot/call.h */
>
>
> Modified: trunk/src/debug.c
> ==============================================================================
> --- trunk/src/debug.c Thu Mar 5 06:01:48 2009 (r37122)
> +++ trunk/src/debug.c Thu Mar 5 10:31:41 2009 (r37123)
> @@ -31,6 +31,7 @@
> #include "interp_guts.h"
> #include "trace.h"
> #include "debug.str"
> +#include "pmc/pmc_continuation.h"
>
> /* Hand switched debugger tracing
> * Set to 1 to enable tracing to stderr
>
> Modified: trunk/src/exceptions.c
> ==============================================================================
> --- trunk/src/exceptions.c Thu Mar 5 06:01:48 2009 (r37122)
> +++ trunk/src/exceptions.c Thu Mar 5 10:31:41 2009 (r37123)
> @@ -21,6 +21,7 @@
> #include "parrot/parrot.h"
> #include "parrot/exceptions.h"
> #include "exceptions.str"
> +#include "pmc/pmc_continuation.h"
>
> #ifdef PARROT_HAS_BACKTRACE
> # include <execinfo.h>
>
> Modified: trunk/src/ops/core.ops
> ==============================================================================
> --- trunk/src/ops/core.ops Thu Mar 5 06:01:48 2009 (r37122)
> +++ trunk/src/ops/core.ops Thu Mar 5 10:31:41 2009 (r37123)
> @@ -6,6 +6,7 @@
> #include "parrot/dynext.h"
> #include "parrot/embed.h"
> #include "../interp_guts.h"
> +#include "../pmc/pmc_continuation.h"
>
> VERSION = PARROT_VERSION;
>
>
> Modified: trunk/src/pic.c
> ==============================================================================
> --- trunk/src/pic.c Thu Mar 5 06:01:48 2009 (r37122)
> +++ trunk/src/pic.c Thu Mar 5 10:31:41 2009 (r37123)
> @@ -79,6 +79,7 @@
> #include "parrot/parrot.h"
> #include "parrot/oplib/ops.h"
> #include "pmc/pmc_fixedintegerarray.h"
> +#include "pmc/pmc_continuation.h"
> #ifdef HAVE_COMPUTED_GOTO
> # include "parrot/oplib/core_ops_cgp.h"
> #endif
>
> Modified: trunk/src/pmc/continuation.pmc
> ==============================================================================
> --- trunk/src/pmc/continuation.pmc Thu Mar 5 06:01:48 2009 (r37122)
> +++ trunk/src/pmc/continuation.pmc Thu Mar 5 10:31:41 2009 (r37123)
> @@ -47,6 +47,7 @@
> */
>
> pmclass Continuation need_ext {
> + ATTR struct Parrot_cont *cont; /* the continuation struct */
>
> /*
>
> @@ -59,7 +60,11 @@
> */
>
> VTABLE void init() {
> - PMC_struct_val(SELF) = new_continuation(INTERP, NULL);
> + Parrot_Continuation_attributes *attrs =
> + mem_allocate_zeroed_typed(Parrot_Continuation_attributes);
> + PMC_data(SELF) = attrs;
> +
> + PMC_cont(SELF) = new_continuation(INTERP, NULL);
> PObj_custom_mark_destroy_SETALL(SELF);
> /* PANIC("don't do that"); */
> /*
> @@ -115,8 +120,9 @@
> Parrot_free_context(interp, cc->from_ctx, 1);
>
> mem_sys_free(cc);
> - PMC_struct_val(SELF) = NULL;
> }
> + mem_sys_free(PMC_data(SELF));
> + PMC_data(SELF) = NULL;
> }
> /*
>
> @@ -131,11 +137,11 @@
> VTABLE PMC *clone() {
> Parrot_cont * const cc_self = PMC_cont(SELF);
> Parrot_cont * const cc = new_continuation(INTERP, cc_self);
> - PMC * const ret = pmc_new_noinit(INTERP, enum_class_Continuation);
> + PMC * const ret = pmc_new(INTERP, enum_class_Continuation);
>
> PObj_custom_mark_destroy_SETALL(ret);
> - cc->runloop_id = cc_self->runloop_id;
> - PMC_struct_val(ret) = cc;
> + cc->runloop_id = cc_self->runloop_id;
> + PMC_cont(ret) = cc;
>
> return ret;
> }
>
> Modified: trunk/src/pmc/exceptionhandler.pmc
> ==============================================================================
> --- trunk/src/pmc/exceptionhandler.pmc Thu Mar 5 06:01:48 2009 (r37122)
> +++ trunk/src/pmc/exceptionhandler.pmc Thu Mar 5 10:31:41 2009 (r37123)
> @@ -45,10 +45,9 @@
> mem_allocate_zeroed_typed(Parrot_ExceptionHandler_attributes);
> Parrot_cont * const cc = new_continuation(INTERP, NULL);
>
> - PMC_struct_val(SELF) = cc;
> cc->invoked = 0;
> - PMC_pmc_val(SELF) = PMCNULL;
> PMC_data(SELF) = core_struct;
> + PMC_cont(SELF) = cc;
> core_struct->min_severity = 0;
> core_struct->max_severity = 0;
> core_struct->handled_types = PMCNULL;
> @@ -90,13 +89,13 @@
> */
>
> VTABLE void destroy() {
> - Parrot_cont * const cc = PMC_cont(SELF);
> + Parrot_cont * const cc = (Parrot_cont *)PMC_cont(SELF);
> Parrot_ExceptionHandler_attributes * const core_struct =
> PARROT_EXCEPTIONHANDLER(SELF);
>
> if (cc) {
> mem_sys_free(cc);
> - PMC_struct_val(SELF) = NULL;
> + PMC_cont(SELF) = NULL;
> }
>
> if (core_struct) {
> @@ -122,7 +121,7 @@
> */
>
> VTABLE void set_integer_native(INTVAL value) {
> - Parrot_cont * const cc = PMC_cont(SELF);
> + Parrot_cont * const cc = (Parrot_cont *)PMC_cont(SELF);
> cc->invoked = value;
> }
>
> @@ -137,7 +136,7 @@
> */
>
> VTABLE INTVAL get_integer() {
> - const Parrot_cont * const cc = PMC_cont(SELF);
> + const Parrot_cont * const cc = (Parrot_cont *)PMC_cont(SELF);
> return cc->invoked;
> }
>
> @@ -152,7 +151,7 @@
> */
>
> VTABLE opcode_t *invoke(void *next) {
> - Parrot_cont * const cc = PMC_cont(SELF);
> + Parrot_cont * const cc = (Parrot_cont *)PMC_cont(SELF);
> opcode_t * const pc = cc->address;
>
> Parrot_continuation_check(interp, SELF, cc);
>
> Modified: trunk/src/pmc/retcontinuation.pmc
> ==============================================================================
> --- trunk/src/pmc/retcontinuation.pmc Thu Mar 5 06:01:48 2009 (r37122)
> +++ trunk/src/pmc/retcontinuation.pmc Thu Mar 5 10:31:41 2009 (r37123)
> @@ -38,8 +38,12 @@
> */
>
> VTABLE void init() {
> - PMC_struct_val(SELF) = new_ret_continuation(INTERP);
> - PMC_pmc_val(SELF) = NULL;
> + Parrot_RetContinuation_attributes *attrs =
> + mem_allocate_zeroed_typed(Parrot_RetContinuation_attributes);
> + PMC_data(SELF) = attrs;
> +
> + PMC_cont(SELF) = new_ret_continuation(INTERP);
> + PMC_data(SELF) = attrs;
> PObj_custom_mark_destroy_SETALL(SELF);
> }
>
> @@ -54,7 +58,7 @@
> if (cc)
> mem_sys_free(cc);
>
> - PMC_struct_val(SELF) = NULL;
> + mem_sys_free(PMC_data(SELF));
> }
> /*
>
>
> Modified: trunk/src/sub.c
> ==============================================================================
> --- trunk/src/sub.c Thu Mar 5 06:01:48 2009 (r37122)
> +++ trunk/src/sub.c Thu Mar 5 10:31:41 2009 (r37123)
> @@ -22,6 +22,7 @@
> #include "parrot/oplib/ops.h"
> #include "sub.str"
> #include "pmc/pmc_sub.h"
> +#include "pmc/pmc_continuation.h"
>
> /* HEADERIZER HFILE: include/parrot/sub.h */
>
> _______________________________________________
> http://lists.parrot.org/mailman/listinfo/parrot-commits
>
--
Reini Urban
http://phpwiki.org/ http://murbreak.at/
More information about the parrot-commits
mailing list