cvsuser 03/06/12 16:50:52
Modified: . MANIFEST interpreter.c register.c
Log:
Added an enums.h and started moving things into it. Trying to use the same
enum in multiple headers was getting to be a big ordering pain.
Also unified the register stacks with the general stacks, so they can
be made COW as well.
Revision Changes Path
1.352 +1 -0 parrot/MANIFEST
Index: MANIFEST
===================================================================
RCS file: /cvs/public/parrot/MANIFEST,v
retrieving revision 1.351
retrieving revision 1.352
diff -u -w -r1.351 -r1.352
--- MANIFEST 12 Jun 2003 20:05:32 -0000 1.351
+++ MANIFEST 12 Jun 2003 23:50:52 -0000 1.352
@@ -1259,6 +1259,7 @@
include/parrot/dod.h
include/parrot/embed.h
include/parrot/encoding.h
+include/parrot/enums.h
include/parrot/events.h
include/parrot/exceptions.h
include/parrot/exit.h
1.156 +5 -5 parrot/interpreter.c
Index: interpreter.c
===================================================================
RCS file: /cvs/public/parrot/interpreter.c,v
retrieving revision 1.155
retrieving revision 1.156
diff -u -w -r1.155 -r1.156
--- interpreter.c 6 Jun 2003 10:05:45 -0000 1.155
+++ interpreter.c 12 Jun 2003 23:50:52 -0000 1.156
@@ -1,7 +1,7 @@
/* interpreter.c
* Copyright: (When this is determined...it will go here)
* CVS Info
- * $Id: interpreter.c,v 1.155 2003/06/06 10:05:45 leo Exp $
+ * $Id: interpreter.c,v 1.156 2003/06/12 23:50:52 dan Exp $
* Overview:
* The interpreter api handles running the operations
* Data Structure and Algorithms:
@@ -531,10 +531,10 @@
interpreter->ctx.pmc_reg_top = interpreter->ctx.pmc_reg_base;
/* Initialize the register chunks */
- interpreter->ctx.int_reg_base->free = FRAMES_PER_INT_REG_CHUNK;
- interpreter->ctx.num_reg_base->free = FRAMES_PER_NUM_REG_CHUNK;
- interpreter->ctx.string_reg_base->free = FRAMES_PER_STR_REG_CHUNK;
- interpreter->ctx.pmc_reg_base->free = FRAMES_PER_PMC_REG_CHUNK;
+ // interpreter->ctx.int_reg_base->used = 0;
+ //interpreter->ctx.num_reg_base->used = 0;
+ //interpreter->ctx.string_reg_base->used = 0;
+ //interpreter->ctx.pmc_reg_base->used = 0;
/* the SET_NULL macros are only for systems where a NULL pointer
* isn't represented by zeroes, so don't use these for resetting
* non-null pointers
1.27 +5 -21 parrot/register.c
Index: register.c
===================================================================
RCS file: /cvs/public/parrot/register.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -w -r1.26 -r1.27
--- register.c 22 May 2003 00:51:29 -0000 1.26
+++ register.c 12 Jun 2003 23:50:52 -0000 1.27
@@ -1,7 +1,7 @@
/* register.c
* Copyright: (When this is determined...it will go here)
* CVS Info
- * $Id: register.c,v 1.26 2003/05/22 00:51:29 scog Exp $
+ * $Id: register.c,v 1.27 2003/06/12 23:50:52 dan Exp $
* Overview:
* Register handling routines
* Data Structure and Algorithms:
@@ -20,11 +20,10 @@
{
/* Do we have any space in the current savestack? If so, memcpy
* down */
- if (interpreter->ctx.int_reg_top->free) {
+ if (interpreter->ctx.int_reg_top->used < FRAMES_PER_CHUNK) {
memcpy(&interpreter->ctx.int_reg_top->
IReg[interpreter->ctx.int_reg_top->used],
&interpreter->ctx.int_reg, sizeof(struct IReg));
- interpreter->ctx.int_reg_top->free--;
interpreter->ctx.int_reg_top->used++;
}
/* Nope, so either move to next stack chunk or grow the stack */
@@ -39,7 +38,6 @@
interpreter->ctx.int_reg_top->next = next_chunk;
}
next_chunk->used = 1;
- next_chunk->free = FRAMES_PER_INT_REG_CHUNK - 1;
interpreter->ctx.int_reg_top = next_chunk;
memcpy(&next_chunk->IReg[0],
&interpreter->ctx.int_reg, sizeof(struct IReg));
@@ -58,7 +56,6 @@
top->used--;
memcpy(&interpreter->ctx.int_reg,
&top->IReg[top->used], sizeof(struct IReg));
- top->free++;
/* Empty? */
if (!top->used) {
/* Yep, drop down a frame. Maybe */
@@ -92,7 +89,6 @@
memcpy(&interpreter->ctx.int_reg.registers[NUM_REGISTERS/2],
&top->IReg[top->used].registers[NUM_REGISTERS/2],
sizeof(struct IReg)/2);
- top->free++;
/* Empty? */
if (!top->used) {
/* Yep, drop down a frame. Maybe */
@@ -132,11 +128,10 @@
{
/* Do we have any space in the current savestack? If so, memcpy
* down */
- if (interpreter->ctx.string_reg_top->free) {
+ if (interpreter->ctx.string_reg_top->used < FRAMES_PER_CHUNK) {
memcpy(&interpreter->ctx.string_reg_top->
SReg[interpreter->ctx.string_reg_top->used],
&interpreter->ctx.string_reg, sizeof(struct SReg));
- interpreter->ctx.string_reg_top->free--;
interpreter->ctx.string_reg_top->used++;
}
/* Nope, so either move to next stack chunk or grow the stack */
@@ -151,7 +146,6 @@
interpreter->ctx.string_reg_top->next = next_chunk;
}
next_chunk->used = 1;
- next_chunk->free = FRAMES_PER_STR_REG_CHUNK - 1;
interpreter->ctx.string_reg_top = next_chunk;
memcpy(&next_chunk->SReg[0],
&interpreter->ctx.string_reg, sizeof(struct SReg));
@@ -170,7 +164,6 @@
top->used--;
memcpy(&interpreter->ctx.string_reg,
&top->SReg[top->used], sizeof(struct SReg));
- top->free++;
/* Empty? */
if (!top->used) {
/* Yep, drop down a frame. Maybe */
@@ -204,7 +197,6 @@
memcpy(&interpreter->ctx.string_reg.registers[NUM_REGISTERS/2],
&top->SReg[top->used].registers[NUM_REGISTERS/2],
sizeof(struct SReg)/2);
- top->free++;
/* Empty? */
if (!top->used) {
/* Yep, drop down a frame. Maybe */
@@ -244,11 +236,10 @@
{
/* Do we have any space in the current savestack? If so, memcpy
* down */
- if (interpreter->ctx.num_reg_top->free) {
+ if (interpreter->ctx.num_reg_top->used < FRAMES_PER_CHUNK) {
memcpy(&interpreter->ctx.num_reg_top->
NReg[interpreter->ctx.num_reg_top->used],
&interpreter->ctx.num_reg, sizeof(struct NReg));
- interpreter->ctx.num_reg_top->free--;
interpreter->ctx.num_reg_top->used++;
}
/* Nope, so either move to next stack chunk or grow the stack */
@@ -263,7 +254,6 @@
interpreter->ctx.num_reg_top->next = next_chunk;
}
next_chunk->used = 1;
- next_chunk->free = FRAMES_PER_NUM_REG_CHUNK - 1;
interpreter->ctx.num_reg_top = next_chunk;
memcpy(&next_chunk->NReg[0],
&interpreter->ctx.num_reg, sizeof(struct NReg));
@@ -282,7 +272,6 @@
top->used--;
memcpy(&interpreter->ctx.num_reg,
&top->NReg[top->used], sizeof(struct NReg));
- top->free++;
/* Empty? */
if (!top->used) {
/* Yep, drop down a frame. Maybe */
@@ -316,7 +305,6 @@
memcpy(&interpreter->ctx.num_reg.registers[NUM_REGISTERS/2],
&top->NReg[top->used].registers[NUM_REGISTERS/2],
sizeof(struct NReg)/2);
- top->free++;
/* Empty? */
if (!top->used) {
/* Yep, drop down a frame. Maybe */
@@ -356,11 +344,10 @@
{
/* Do we have any space in the current savestack? If so, memcpy
* down */
- if (interpreter->ctx.pmc_reg_top->free) {
+ if (interpreter->ctx.pmc_reg_top->used < FRAMES_PER_CHUNK) {
memcpy(&interpreter->ctx.pmc_reg_top->
PReg[interpreter->ctx.pmc_reg_top->used],
&interpreter->ctx.pmc_reg, sizeof(struct PReg));
- interpreter->ctx.pmc_reg_top->free--;
interpreter->ctx.pmc_reg_top->used++;
}
/* Nope, so either move to next stack chunk or grow the stack */
@@ -375,7 +362,6 @@
interpreter->ctx.pmc_reg_top->next = next_chunk;
}
next_chunk->used = 1;
- next_chunk->free = FRAMES_PER_PMC_REG_CHUNK - 1;
interpreter->ctx.pmc_reg_top = next_chunk;
memcpy(&next_chunk->PReg[0],
&interpreter->ctx.pmc_reg, sizeof(struct PReg));
@@ -394,7 +380,6 @@
top->used--;
memcpy(&interpreter->ctx.pmc_reg,
&top->PReg[top->used], sizeof(struct PReg));
- top->free++;
/* Empty? */
if (!top->used) {
/* Yep, drop down a frame. Maybe */
@@ -428,7 +413,6 @@
memcpy(&interpreter->ctx.pmc_reg.registers[NUM_REGISTERS/2],
&top->PReg[top->used].registers[NUM_REGISTERS/2],
sizeof(struct PReg)/2);
- top->free++;
/* Empty? */
if (!top->used) {
/* Yep, drop down a frame. Maybe */