[svn:parrot] r43375 - in trunk: compilers/imcc compilers/pirc/src include/parrot src src/call src/pmc

bacek at svn.parrot.org bacek at svn.parrot.org
Sat Jan 2 22:28:14 UTC 2010


Author: bacek
Date: Sat Jan  2 22:28:13 2010
New Revision: 43375
URL: https://trac.parrot.org/parrot/changeset/43375

Log:
Use UINTVAL to store/pass CallContext n_regs_used. jimmy++ for TT#1397.

Modified:
   trunk/compilers/imcc/parser_util.c
   trunk/compilers/pirc/src/bcgen.h
   trunk/include/parrot/call.h
   trunk/src/call/context.c
   trunk/src/call/pcc.c
   trunk/src/dynext.c
   trunk/src/packfile.c
   trunk/src/pmc/sub.pmc

Modified: trunk/compilers/imcc/parser_util.c
==============================================================================
--- trunk/compilers/imcc/parser_util.c	Sat Jan  2 21:06:33 2010	(r43374)
+++ trunk/compilers/imcc/parser_util.c	Sat Jan  2 22:28:13 2010	(r43375)
@@ -628,7 +628,7 @@
     struct parser_state_t *next;
     void                  *yyscanner;
     PMC                   *ignored;
-    INTVAL regs_used[4] = {3, 3, 3, 3};
+    UINTVAL regs_used[4] = {3, 3, 3, 3};
     INTVAL eval_number;
 
     do_yylex_init(interp, &yyscanner);
@@ -912,7 +912,7 @@
 
     /* need at least 3 regs for compilation of constant math e.g.
      * add_i_ic_ic - see also IMCC_subst_constants() */
-    INTVAL regs_used[4] = {3, 3, 3, 3};
+    UINTVAL regs_used[4] = {3, 3, 3, 3};
 
     if (IMCC_INFO(interp)->last_unit) {
         /* a reentrant compile */

Modified: trunk/compilers/pirc/src/bcgen.h
==============================================================================
--- trunk/compilers/pirc/src/bcgen.h	Sat Jan  2 21:06:33 2010	(r43374)
+++ trunk/compilers/pirc/src/bcgen.h	Sat Jan  2 22:28:13 2010	(r43375)
@@ -162,6 +162,10 @@
 emit_opcode(ARGIN(bytecode * const bc), opcode_t op)
         __attribute__nonnull__(1);
 
+int emit_pbc_key(ARGIN(bytecode * const bc), ARGIN(key * const k))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
+
 FLOATVAL get_num_const(ARGIN(bytecode * const bc), unsigned index)
         __attribute__nonnull__(1);
 

Modified: trunk/include/parrot/call.h
==============================================================================
--- trunk/include/parrot/call.h	Sat Jan  2 21:06:33 2010	(r43374)
+++ trunk/include/parrot/call.h	Sat Jan  2 22:28:13 2010	(r43375)
@@ -449,7 +449,7 @@
 PARROT_EXPORT
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
-PMC * Parrot_push_context(PARROT_INTERP, ARGIN(const INTVAL *n_regs_used))
+PMC * Parrot_push_context(PARROT_INTERP, ARGIN(const UINTVAL *n_regs_used))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
@@ -459,7 +459,7 @@
 PARROT_CANNOT_RETURN_NULL
 PARROT_WARN_UNUSED_RESULT
 PMC * Parrot_alloc_context(PARROT_INTERP,
-    ARGIN(const INTVAL *number_regs_used),
+    ARGIN(const UINTVAL *number_regs_used),
     ARGIN_NULLOK(PMC *old))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
@@ -472,7 +472,7 @@
 
 void Parrot_pcc_allocate_registers(PARROT_INTERP,
     ARGIN(PMC *pmcctx),
-    ARGIN(const INTVAL *number_regs_used))
+    ARGIN(const UINTVAL *number_regs_used))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         __attribute__nonnull__(3);
@@ -491,7 +491,7 @@
 PARROT_CANNOT_RETURN_NULL
 PARROT_WARN_UNUSED_RESULT
 PMC * Parrot_set_new_context(PARROT_INTERP,
-    ARGIN(const INTVAL *number_regs_used))
+    ARGIN(const UINTVAL *number_regs_used))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 

Modified: trunk/src/call/context.c
==============================================================================
--- trunk/src/call/context.c	Sat Jan  2 21:06:33 2010	(r43374)
+++ trunk/src/call/context.c	Sat Jan  2 22:28:13 2010	(r43375)
@@ -70,7 +70,7 @@
 
 static void allocate_registers(PARROT_INTERP,
     ARGIN(PMC *pmcctx),
-    ARGIN(const INTVAL *number_regs_used))
+    ARGIN(const UINTVAL *number_regs_used))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         __attribute__nonnull__(3);
@@ -201,7 +201,7 @@
 create_initial_context(PARROT_INTERP)
 {
     ASSERT_ARGS(create_initial_context)
-    static INTVAL   num_regs[] = {32, 32, 32, 32};
+    static UINTVAL   num_regs[] = {32, 32, 32, 32};
     PMC *ignored;
 
     /* Create some initial free_list slots. */
@@ -358,7 +358,7 @@
 
 /*
 
-=item C<PMC * Parrot_push_context(PARROT_INTERP, const INTVAL *n_regs_used)>
+=item C<PMC * Parrot_push_context(PARROT_INTERP, const UINTVAL *n_regs_used)>
 
 Creates and sets the current context to a new context, remembering the old
 context in C<caller_ctx>.  Suitable to use with C<Parrot_pop_context>.
@@ -371,7 +371,7 @@
 PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 PMC *
-Parrot_push_context(PARROT_INTERP, ARGIN(const INTVAL *n_regs_used))
+Parrot_push_context(PARROT_INTERP, ARGIN(const UINTVAL *n_regs_used))
 {
     ASSERT_ARGS(Parrot_push_context)
     PMC * const old = CURRENT_CONTEXT(interp);
@@ -451,7 +451,7 @@
 
 /*
 
-=item C<static void allocate_registers(PARROT_INTERP, PMC *pmcctx, const INTVAL
+=item C<static void allocate_registers(PARROT_INTERP, PMC *pmcctx, const UINTVAL
 *number_regs_used)>
 
 Allocate registers inside Context.
@@ -460,7 +460,7 @@
 
 */
 static void
-allocate_registers(PARROT_INTERP, ARGIN(PMC *pmcctx), ARGIN(const INTVAL *number_regs_used))
+allocate_registers(PARROT_INTERP, ARGIN(PMC *pmcctx), ARGIN(const UINTVAL *number_regs_used))
 {
     ASSERT_ARGS(allocate_registers)
     Parrot_CallContext_attributes *ctx = PARROT_CALLCONTEXT(pmcctx);
@@ -497,7 +497,7 @@
 /*
 
 =item C<void Parrot_pcc_allocate_registers(PARROT_INTERP, PMC *pmcctx, const
-INTVAL *number_regs_used)>
+UINTVAL *number_regs_used)>
 
 Allocate registers in Context.
 
@@ -507,7 +507,7 @@
 
 void
 Parrot_pcc_allocate_registers(PARROT_INTERP, ARGIN(PMC *pmcctx),
-        ARGIN(const INTVAL *number_regs_used))
+        ARGIN(const UINTVAL *number_regs_used))
 {
     ASSERT_ARGS(Parrot_pcc_allocate_registers)
     allocate_registers(interp, pmcctx, number_regs_used);
@@ -546,7 +546,7 @@
 
 /*
 
-=item C<PMC * Parrot_alloc_context(PARROT_INTERP, const INTVAL
+=item C<PMC * Parrot_alloc_context(PARROT_INTERP, const UINTVAL
 *number_regs_used, PMC *old)>
 
 Allocates and returns a new context.  Does not set this new context as the
@@ -563,7 +563,7 @@
 PARROT_CANNOT_RETURN_NULL
 PARROT_WARN_UNUSED_RESULT
 PMC *
-Parrot_alloc_context(PARROT_INTERP, ARGIN(const INTVAL *number_regs_used),
+Parrot_alloc_context(PARROT_INTERP, ARGIN(const UINTVAL *number_regs_used),
     ARGIN_NULLOK(PMC *old))
 {
     ASSERT_ARGS(Parrot_alloc_context)
@@ -623,7 +623,7 @@
 
 /*
 
-=item C<PMC * Parrot_set_new_context(PARROT_INTERP, const INTVAL
+=item C<PMC * Parrot_set_new_context(PARROT_INTERP, const UINTVAL
 *number_regs_used)>
 
 Allocates and returns a new context as the current context.  Note that the
@@ -636,7 +636,7 @@
 PARROT_CANNOT_RETURN_NULL
 PARROT_WARN_UNUSED_RESULT
 PMC *
-Parrot_set_new_context(PARROT_INTERP, ARGIN(const INTVAL *number_regs_used))
+Parrot_set_new_context(PARROT_INTERP, ARGIN(const UINTVAL *number_regs_used))
 {
     ASSERT_ARGS(Parrot_set_new_context)
     PMC *old = CURRENT_CONTEXT(interp);

Modified: trunk/src/call/pcc.c
==============================================================================
--- trunk/src/call/pcc.c	Sat Jan  2 21:06:33 2010	(r43374)
+++ trunk/src/call/pcc.c	Sat Jan  2 22:28:13 2010	(r43375)
@@ -272,7 +272,7 @@
     ASSERT_ARGS(Parrot_pcc_invoke_from_sig_object)
 
     opcode_t    *dest;
-    INTVAL       n_regs_used[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+    UINTVAL      n_regs_used[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
     PMC         *ctx  = Parrot_push_context(interp, n_regs_used);
     PMC * const  ret_cont = new_ret_continuation_pmc(interp, NULL);
 

Modified: trunk/src/dynext.c
==============================================================================
--- trunk/src/dynext.c	Sat Jan  2 21:06:33 2010	(r43374)
+++ trunk/src/dynext.c	Sat Jan  2 22:28:13 2010	(r43375)
@@ -429,7 +429,7 @@
     void (*init_func)(PARROT_INTERP, PMC *);
     PMC *lib_pmc;
 
-    INTVAL regs_used[] = { 2, 2, 2, 2 }; /* Arbitrary values */
+    UINTVAL regs_used[]     = { 2, 2, 2, 2 }; /* Arbitrary values */
     const int parrot_hll_id = 0;
     PMC * context = Parrot_push_context(interp, regs_used);
     Parrot_pcc_set_HLL(interp, context, parrot_hll_id);

Modified: trunk/src/packfile.c
==============================================================================
--- trunk/src/packfile.c	Sat Jan  2 21:06:33 2010	(r43374)
+++ trunk/src/packfile.c	Sat Jan  2 22:28:13 2010	(r43375)
@@ -4669,7 +4669,7 @@
     ASSERT_ARGS(compile_or_load_file)
     char * const filename = Parrot_str_to_cstring(interp, path);
 
-    INTVAL regs_used[] = { 2, 2, 2, 2 }; /* Arbitrary values */
+    UINTVAL regs_used[]     = { 2, 2, 2, 2 }; /* Arbitrary values */
     const int parrot_hll_id = 0;
     PMC * context = Parrot_push_context(interp, regs_used);
     Parrot_pcc_set_HLL(interp, context, parrot_hll_id);

Modified: trunk/src/pmc/sub.pmc
==============================================================================
--- trunk/src/pmc/sub.pmc	Sat Jan  2 21:06:33 2010	(r43374)
+++ trunk/src/pmc/sub.pmc	Sat Jan  2 22:28:13 2010	(r43375)
@@ -36,33 +36,32 @@
 }
 
 pmclass Sub auto_attrs {
-    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 PMC      *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. */
+    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 UINTVAL            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 PMC               *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 PMC      *outer_ctx;         /* outer context, if a closure */
+    ATTR PMC               *outer_ctx;       /* outer context, if a closure */
 
 /*
 


More information about the parrot-commits mailing list