cvsuser 04/06/17 05:04:53
Modified: imcc pbc.c symreg.h
include/parrot key.h
src packfile.c
Log:
slices 3 - packfile stuff
Revision Changes Path
1.81 +3 -3 parrot/imcc/pbc.c
Index: pbc.c
===================================================================
RCS file: /cvs/public/parrot/imcc/pbc.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -w -r1.80 -r1.81
--- pbc.c 17 Jun 2004 08:59:27 -0000 1.80
+++ pbc.c 17 Jun 2004 12:04:42 -0000 1.81
@@ -678,7 +678,7 @@
case VTPASM: /* P[S0] */
case VTREG: /* P[S0] */
if (r->set == 'I')
- *pc++ = PARROT_ARG_I; /* register type */
+ *pc++ = PARROT_ARG_I | slice_bits; /* register type */
else if (r->set == 'S')
*pc++ = PARROT_ARG_S;
else
@@ -697,7 +697,7 @@
case VTCONST:
switch (r->set) {
case 'S': /* P["key"] */
- *pc++ = PARROT_ARG_SC; /* str constant */
+ *pc++ = PARROT_ARG_SC | slice_bits; /* str constant */
*pc++ = r->color; /* constant idx */
debug(interpreter, DEBUG_PBC_CONST,
" keypart SC %s #%d slice %s\n",
@@ -705,7 +705,7 @@
slice_deb(slice_bits));
break;
case 'I': /* P[;42;..] */
- *pc++ = PARROT_ARG_IC; /* int constant */
+ *pc++ = PARROT_ARG_IC | slice_bits; /* int constant */
*pc++ = r->color = atol(r->name); /* value */
debug(interpreter, DEBUG_PBC_CONST,
" keypart IC %s #%d slice %s\n",
1.50 +1 -0 parrot/imcc/symreg.h
Index: symreg.h
===================================================================
RCS file: /cvs/public/parrot/imcc/symreg.h,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -w -r1.49 -r1.50
--- symreg.h 17 Jun 2004 08:59:28 -0000 1.49
+++ symreg.h 17 Jun 2004 12:04:42 -0000 1.50
@@ -19,6 +19,7 @@
VT_CONSTP = 1 << 7, /* pointer to constant value */
VT_PCC_SUB = 1 << 8, /* PCC subroutine call */
VT_FLATTEN = 1 << 9, /* .flatten_arg IDENT | VTIDENT ... */
+ /* XXX s. src/packfile.c */
VT_START_SLICE = 1 << 10, /* x .. y slice range */
VT_END_SLICE = 1 << 11,
VT_START_ZERO = 1 << 12, /* .. y 0..start */
1.22 +10 -2 parrot/include/parrot/key.h
Index: key.h
===================================================================
RCS file: /cvs/public/parrot/include/parrot/key.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -w -r1.21 -r1.22
--- key.h 22 Apr 2004 08:55:05 -0000 1.21
+++ key.h 17 Jun 2004 12:04:46 -0000 1.22
@@ -1,7 +1,7 @@
/* key.h
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: key.h,v 1.21 2004/04/22 08:55:05 leo Exp $
+ * $Id: key.h,v 1.22 2004/06/17 12:04:46 leo Exp $
* Overview:
* This is the api header for the pmc subsystem
* Data Structure and Algorithms:
@@ -22,11 +22,19 @@
KEY_pmc_FLAG = PObj_private3_FLAG,
KEY_register_FLAG = PObj_private4_FLAG,
+ KEY_start_slice_FLAG = PObj_private5_FLAG,
+ KEY_end_slice_FLAG = PObj_private6_FLAG,
+ KEY_inf_slice_FLAG = PObj_private7_FLAG,
+
KEY_type_FLAGS = KEY_integer_FLAG |
KEY_number_FLAG |
KEY_string_FLAG |
KEY_pmc_FLAG |
- KEY_register_FLAG
+ KEY_register_FLAG |
+ KEY_start_slice_FLAG |
+ KEY_end_slice_FLAG |
+ KEY_inf_slice_FLAG
+
} KEY_flags;
PMC *key_new(struct Parrot_Interp *interpreter);
1.164 +28 -3 parrot/src/packfile.c
Index: packfile.c
===================================================================
RCS file: /cvs/public/parrot/src/packfile.c,v
retrieving revision 1.163
retrieving revision 1.164
diff -u -w -r1.163 -r1.164
--- packfile.c 26 May 2004 19:14:34 -0000 1.163
+++ packfile.c 17 Jun 2004 12:04:52 -0000 1.164
@@ -2,7 +2,7 @@
Copyright (C) 2001-2002 Gregor N. Purdy. All rights reserved.
This program is free software. It is subject to the same license as
Parrot itself.
-$Id: packfile.c,v 1.163 2004/05/26 19:14:34 jrieks Exp $
+$Id: packfile.c,v 1.164 2004/06/17 12:04:52 leo Exp $
=head1 NAME
@@ -27,6 +27,18 @@
#include "parrot/parrot.h"
#include "parrot/embed.h"
#include "parrot/packfile.h"
+
+/*
+ * XXX copy from imcc/symreg.h
+ */
+enum VARTYPE { /* variable type can be */
+ VT_START_SLICE = 1 << 10, /* x .. y slice range */
+ VT_END_SLICE = 1 << 11,
+ VT_START_ZERO = 1 << 12, /* .. y 0..start */
+ VT_END_INF = 1 << 13, /* x.. start..inf */
+ VT_SLICE_BITS = VT_START_SLICE | VT_END_SLICE | VT_START_ZERO | VT_END_INF
+};
+
#include <assert.h>
#define TRACE_PACKFILE 0
@@ -2968,13 +2980,19 @@
INTVAL components;
PMC *head;
PMC *tail;
- opcode_t type, op;
+ opcode_t type, op, slice_bits;
struct PackFile *pf = constt->base.pf;
components = (INTVAL)PF_fetch_opcode(pf, &cursor);
head = tail = NULL;
while (components-- > 0) {
+ type = PF_fetch_opcode(pf, &cursor);
+ slice_bits = type & VT_SLICE_BITS;
+ type &= ~VT_SLICE_BITS;
+ if (!head && slice_bits) {
+ head = tail = constant_pmc_new(interpreter, enum_class_Slice);
+ }
if (tail) {
PMC_data(tail)
= constant_pmc_new_noinit(interpreter, enum_class_Key);
@@ -2986,7 +3004,6 @@
VTABLE_init(interpreter, tail);
- type = PF_fetch_opcode(pf, &cursor);
op = PF_fetch_opcode(pf, &cursor);
switch (type) {
case PARROT_ARG_IC:
@@ -3013,6 +3030,14 @@
default:
return 0;
}
+ if (slice_bits) {
+ if (slice_bits & VT_START_SLICE)
+ PObj_get_FLAGS(tail) |= KEY_start_slice_FLAG;
+ if (slice_bits & VT_END_SLICE)
+ PObj_get_FLAGS(tail) |= KEY_end_slice_FLAG;
+ if (slice_bits & (VT_START_ZERO | VT_END_INF))
+ PObj_get_FLAGS(tail) |= KEY_inf_slice_FLAG;
+ }
}
self->type = PFC_KEY;