Front page | perl.cvs.parrot |
Postings from January 2009
[svn:parrot] r34753 - trunk/compilers/pirc/new
From:
kjs
Date:
January 1, 2009 10:15
Subject:
[svn:parrot] r34753 - trunk/compilers/pirc/new
Message ID:
20090101181543.1DED4CB9FA@x12.develooper.com
Author: kjs
Date: Thu Jan 1 10:15:42 2009
New Revision: 34753
Modified:
trunk/compilers/pirc/new/bcgen.c
trunk/compilers/pirc/new/bcgen.h
trunk/compilers/pirc/new/pircompiler.c
trunk/compilers/pirc/new/pircompunit.c
trunk/compilers/pirc/new/pircompunit.h
Log:
[pirc] fix :immediate (it seems so...). Do some trickery with sub flags.
Modified: trunk/compilers/pirc/new/bcgen.c
==============================================================================
--- trunk/compilers/pirc/new/bcgen.c (original)
+++ trunk/compilers/pirc/new/bcgen.c Thu Jan 1 10:15:42 2009
@@ -602,7 +602,7 @@
*/
int
-add_sub_pmc(bytecode * const bc, sub_info * const info, int needlex) {
+add_sub_pmc(bytecode * const bc, sub_info * const info, int needlex, int subpragmas) {
PMC * sub_pmc;
Parrot_sub * sub;
int subconst_index;
@@ -638,6 +638,11 @@
sub->multi_signature = generate_multi_signature(bc, info->multi_types, info->num_multi_types);
+ /* copy sub pragma flags such as :immediate etc. */
+ PObj_get_FLAGS(sub_pmc) |= subpragmas & SUB_FLAG_PF_MASK;
+ Sub_comp_get_FLAGS(sub_pmc) |= subpragmas & SUB_COMP_FLAG_MASK;
+
+
/* store register usage of this sub. */
for (i = 0; i < 4; ++i)
sub->n_regs_used[i] = info->regs_used[i];
Modified: trunk/compilers/pirc/new/bcgen.h
==============================================================================
--- trunk/compilers/pirc/new/bcgen.h (original)
+++ trunk/compilers/pirc/new/bcgen.h Thu Jan 1 10:15:42 2009
@@ -121,7 +121,7 @@
*/
-int add_sub_pmc(bytecode * const bc, sub_info * const info, int needlex);
+int add_sub_pmc(bytecode * const bc, sub_info * const info, int needlex, int subpragmas);
#endif /* PARROT_BCGEN_H_GUARD */
Modified: trunk/compilers/pirc/new/pircompiler.c
==============================================================================
--- trunk/compilers/pirc/new/pircompiler.c (original)
+++ trunk/compilers/pirc/new/pircompiler.c Thu Jan 1 10:15:42 2009
@@ -183,7 +183,7 @@
/* create a hashtable for storing .const declarations */
init_hashtable(lexer, &lexer->constants, HASHTABLE_SIZE_INIT);
- /* create a new symbol table for macros XXX why not a hashtable? XXX */
+ /* create a new symbol table for macros. */
lexer->macros = new_macro_table(NULL);
lexer->macro_size = INIT_MACRO_SIZE;
Modified: trunk/compilers/pirc/new/pircompunit.c
==============================================================================
--- trunk/compilers/pirc/new/pircompunit.c (original)
+++ trunk/compilers/pirc/new/pircompunit.c Thu Jan 1 10:15:42 2009
@@ -2219,8 +2219,8 @@
*/
void
close_sub(lexer_state * const lexer) {
- int need_epilogue = 1;
- int sub_const_table_index;
+ int need_epilogue = 1;
+ int sub_const_table_index;
global_label *glob;
/* don't generate the sub epilogue if the last instruction was already
@@ -2258,7 +2258,10 @@
/* store the subroutine in the bytecode constant table. */
sub_const_table_index = add_sub_pmc(lexer->bc, &CURRENT_SUB(lexer)->info,
- TEST_FLAG(CURRENT_SUB(lexer)->flags, PIRC_SUB_FLAG_LEX));
+ TEST_FLAG(CURRENT_SUB(lexer)->flags, PIRC_SUB_FLAG_LEX),
+ CURRENT_SUB(lexer)->flags);
+
+
/* store the sub PMC index in the constant table with the global label,
* so that invoking ops can find this index.
Modified: trunk/compilers/pirc/new/pircompunit.h
==============================================================================
--- trunk/compilers/pirc/new/pircompunit.h (original)
+++ trunk/compilers/pirc/new/pircompunit.h Thu Jan 1 10:15:42 2009
@@ -1,6 +1,6 @@
/*
* $Id$
- * Copyright (C) 2007-2008, The Perl Foundation.
+ * Copyright (C) 2007-2009, The Perl Foundation.
*/
/*
@@ -72,21 +72,21 @@
/* sub flags */
typedef enum sub_flags {
- PIRC_SUB_FLAG_METHOD = 1 << 0, /* the sub is a method */
- PIRC_SUB_FLAG_INIT = 1 << 1, /* the sub is run before :main when starting up */
- PIRC_SUB_FLAG_LOAD = 1 << 2, /* the sub is run when the bytecode is loaded */
- PIRC_SUB_FLAG_HAS_OUTER = 1 << 3, /* the sub is lexically nested */
- PIRC_SUB_FLAG_IS_OUTER = 1 << 4, /* the sub contains lexically nested subs. */
- PIRC_SUB_FLAG_MAIN = 1 << 5, /* execution of the program will start at this sub */
- PIRC_SUB_FLAG_ANON = 1 << 6, /* this sub is shy and will not be stored in the global
- namespace */
- PIRC_SUB_FLAG_POSTCOMP = 1 << 7, /* this sub will be executed after compilation */
- PIRC_SUB_FLAG_IMMEDIATE = 1 << 8, /* similar to POSTCOMP above; check PDD19 for difference */
- PIRC_SUB_FLAG_VTABLE = 1 << 9, /* this sub overrides a vtable method */
- PIRC_SUB_FLAG_LEX = 1 << 10, /* this sub needs a LexPad */
- PIRC_SUB_FLAG_MULTI = 1 << 11, /* this sub is a multi method/sub */
- PIRC_SUB_FLAG_SUBID = 1 << 12, /* this sub has a namespace-unaware identifier */
- PIRC_SUB_FLAG_INSTANCEOF = 1 << 13 /* this sub has an :instanceof flag. XXX document this */
+ PIRC_SUB_FLAG_INIT = SUB_COMP_FLAG_PF_INIT, /* run before :main when starting up */
+ PIRC_SUB_FLAG_LOAD = SUB_FLAG_PF_LOAD, /* run when the bytecode is loaded */
+ PIRC_SUB_FLAG_MAIN = SUB_FLAG_PF_MAIN, /* start at this sub */
+ PIRC_SUB_FLAG_ANON = SUB_FLAG_PF_ANON, /* sub is not stored in the global namespace */
+ PIRC_SUB_FLAG_POSTCOMP = SUB_FLAG_PF_POSTCOMP, /* executed after compilation */
+ PIRC_SUB_FLAG_IMMEDIATE = SUB_FLAG_PF_IMMEDIATE, /* similar to POSTCOMP above; check PDD19 */
+
+ PIRC_SUB_FLAG_METHOD = 1 << 10, /* the sub is a method */
+ PIRC_SUB_FLAG_HAS_OUTER = 1 << 11, /* the sub is lexically nested */
+ PIRC_SUB_FLAG_IS_OUTER = 1 << 12, /* the sub contains lexically nested subs. */
+ PIRC_SUB_FLAG_VTABLE = 1 << 13, /* this sub overrides a vtable method */
+ PIRC_SUB_FLAG_LEX = 1 << 14, /* this sub needs a LexPad */
+ PIRC_SUB_FLAG_MULTI = 1 << 15, /* this sub is a multi method/sub */
+ PIRC_SUB_FLAG_SUBID = 1 << 16, /* this sub has a namespace-unaware identifier */
+ PIRC_SUB_FLAG_INSTANCEOF = 1 << 17 /* this sub has an :instanceof flag. XXX document this */
} sub_flag;
-
[svn:parrot] r34753 - trunk/compilers/pirc/new
by kjs