Author: kjs
Date: Sat Dec 27 13:42:35 2008
New Revision: 34449
Modified:
trunk/NEWS
trunk/compilers/pirc/new/pircompunit.c
Log:
[pirc] generate a fixedintegerarray, not a ~pmcarray. THe problem was that you
can't resized a FIA to 0 elements, so only do the resize if size > 0. Also add
a NEWS entry for PIRC with this progress.
Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS (original)
+++ trunk/NEWS Sat Dec 27 13:42:35 2008
@@ -7,8 +7,9 @@
- removed slice syntax, e.g. $P0[1..2]
- removed .namespace <ident>/.endnamespace <ident> pair
+ PIRC
- - refactoring of data structures
+ - refactoring of various data structures
- various bug fixes and updates
+ - basic bytecode generation for calling conventions
- Languages
+ Pipp
- added support for 'elsif'
Modified: trunk/compilers/pirc/new/pircompunit.c
==============================================================================
--- trunk/compilers/pirc/new/pircompunit.c (original)
+++ trunk/compilers/pirc/new/pircompunit.c Sat Dec 27 13:42:35 2008
@@ -1812,13 +1812,9 @@
/*
=item C<static int
-generate_signature_pmc(lexer_state * const lexer)>
+generate_signature_pmc(lexer_state * const lexer, unsigned size)>
-Create a FixedPMCArray
-
-[[ XXXX sholdn't that be a FixedIntegerArray? Can't resize the
fixedintarray... ]]
-
-PMC object that encodes the types and flags
+Create a FixedIntegerArray PMC object that encodes the types and flags
of parameters and add it to the PBC constant table. The index in that
PBC constant table is returned.
@@ -1826,14 +1822,14 @@
*/
static int
-generate_signature_pmc(lexer_state * const lexer) { /* XXX add params later if
needed */
+generate_signature_pmc(lexer_state * const lexer, unsigned size) {
PMC *fixed_int_array;
int array_index;
- fixed_int_array = pmc_new(lexer->interp, enum_class_FixedPMCArray);
+ fixed_int_array = pmc_new(lexer->interp, enum_class_FixedIntegerArray);
- /* XXX set length to 0 for now. */
- VTABLE_set_integer_native(lexer->interp, fixed_int_array, 0);
+ if (size > 0) /* can't resize a fixed integer array to 0 elements. */
+ VTABLE_set_integer_native(lexer->interp, fixed_int_array, size);
array_index = add_pmc_const(lexer->bc, fixed_int_array);
@@ -1863,7 +1859,7 @@
* the number of arguments and their flags.
*/
- int array_index = generate_signature_pmc(lexer);
+ int array_index = generate_signature_pmc(lexer, 0);
push_operand(lexer, expr_from_const(lexer, new_const(lexer, INT_TYPE,
array_index)));
return; /* XXX just handle no-args calls/returns for now */
@@ -1975,7 +1971,7 @@
targets_to_operands(lexer_state * const lexer, target * const targets) {
target *iter;
- int array_index = generate_signature_pmc(lexer);
+ int array_index = generate_signature_pmc(lexer, 0);
push_operand(lexer, expr_from_const(lexer, new_const(lexer, INT_TYPE,
array_index)));
return; /* XXX just handle no-args calls/returns for now */
@@ -2401,7 +2397,7 @@
if (TEST_FLAG(lexer->subs->flags, SUB_FLAG_MAIN))
new_sub_instr(lexer, PARROT_OP_end, "end");
else {
- int array_index = generate_signature_pmc(lexer);
+ int array_index = generate_signature_pmc(lexer, 0);
new_sub_instr(lexer, PARROT_OP_set_returns_pc, "set_returns_pc");
push_operand(lexer, expr_from_const(lexer, new_const(lexer, INT_TYPE,
array_index)));