This patch replaces the existing CHUNK_BASE macro used for all the register
sets with separate (INT|NUM|STR|PMC)_CHUNK_BASE macros.  The bit masks are
already determined by Configure thanks to Dan.

-- 
Jason
Index: Configure.pl
===================================================================
RCS file: /home/perlcvs/parrot/Configure.pl,v
retrieving revision 1.28
diff -u -r1.28 Configure.pl
--- Configure.pl        2001/10/14 10:00:23     1.28
+++ Configure.pl        2001/10/16 02:03:56
@@ -85,7 +85,11 @@
        perl =>                 $^X,
        debugging =>    $opt_debugging,
        rm_f =>         'rm -f',
-       stacklow => '(~0xfff)',
+       stacklow =>     '(~0xfff)',
+       intlow =>       '(~0xfff)',
+       numlow =>       '(~0xfff)',
+       strlow =>       '(~0xfff)',
+       pmclow =>       '(~0xfff)',
 );
 
 #copy the things from --define foo=bar
Index: config_h.in
===================================================================
RCS file: /home/perlcvs/parrot/config_h.in,v
retrieving revision 1.9
diff -u -r1.9 config_h.in
--- config_h.in 2001/10/12 17:59:01     1.9
+++ config_h.in 2001/10/16 02:03:56
@@ -26,8 +26,11 @@
 #define FRAMES_PER_INT_REG_CHUNK FRAMES_PER_CHUNK
 #define FRAMES_PER_STR_REG_CHUNK FRAMES_PER_CHUNK
 
-#define MASK_CHUNK_LOW_BITS (~0xfff)
 #define MASK_STACK_CHUNK_LOW_BITS ${stacklow}
+#define MASK_INT_CHUNK_LOW_BITS ${intlow}
+#define MASK_NUM_CHUNK_LOW_BITS ${numlow}
+#define MASK_STR_CHUNK_LOW_BITS ${strlow}
+#define MASK_PMC_CHUNK_LOW_BITS ${pmclow}
 
 
 ${headers}
Index: register.c
===================================================================
RCS file: /home/perlcvs/parrot/register.c,v
retrieving revision 1.10
diff -u -r1.10 register.c
--- register.c  2001/10/02 14:01:30     1.10
+++ register.c  2001/10/16 02:03:56
@@ -19,7 +19,7 @@
 Parrot_push_i(struct Parrot_Interp *interpreter) {
     struct IRegChunk *chunk_base;
     
-    chunk_base = CHUNK_BASE(interpreter->int_reg);
+    chunk_base = INT_CHUNK_BASE(interpreter->int_reg);
     /* Do we have any slots left in the current chunk? */
     if (chunk_base->free) {
         interpreter->int_reg = &chunk_base->IReg[chunk_base->used++];
@@ -44,7 +44,7 @@
 void
 Parrot_pop_i(struct Parrot_Interp *interpreter) {
     struct IRegChunk *chunk_base;
-    chunk_base = CHUNK_BASE(interpreter->int_reg);
+    chunk_base = INT_CHUNK_BASE(interpreter->int_reg);
     /* Is there more than one register frame in use? */
     if (chunk_base->used > 1) {
         chunk_base->used--;
@@ -85,7 +85,7 @@
 Parrot_push_s(struct Parrot_Interp *interpreter) {
     struct SRegChunk *chunk_base;
     
-    chunk_base = CHUNK_BASE(interpreter->string_reg);
+    chunk_base = STR_CHUNK_BASE(interpreter->string_reg);
     /* Do we have any slots left in the current chunk? */
     if (chunk_base->free) {
         interpreter->string_reg = &chunk_base->SReg[chunk_base->used++];
@@ -113,7 +113,7 @@
 void
 Parrot_pop_s(struct Parrot_Interp *interpreter) {
     struct SRegChunk *chunk_base;
-    chunk_base = CHUNK_BASE(interpreter->string_reg);
+    chunk_base = STR_CHUNK_BASE(interpreter->string_reg);
     /* Is there more than one register frame in use? */
     if (chunk_base->used > 1) {
         chunk_base->used--;
@@ -154,7 +154,7 @@
 Parrot_push_n(struct Parrot_Interp *interpreter) {
     struct NRegChunk *chunk_base;
     
-    chunk_base = CHUNK_BASE(interpreter->num_reg);
+    chunk_base = NUM_CHUNK_BASE(interpreter->num_reg);
     /* Do we have any slots left in the current chunk? */
     if (chunk_base->free) {
         interpreter->num_reg = &chunk_base->NReg[chunk_base->used++];
@@ -179,7 +179,7 @@
 void
 Parrot_pop_n(struct Parrot_Interp *interpreter) {
     struct NRegChunk *chunk_base;
-    chunk_base = CHUNK_BASE(interpreter->num_reg);
+    chunk_base = NUM_CHUNK_BASE(interpreter->num_reg);
     /* Is there more than one register frame in use? */
     if (chunk_base->used > 1) {
         chunk_base->used--;
@@ -220,7 +220,7 @@
 Parrot_push_p(struct Parrot_Interp *interpreter) {
     struct PRegChunk *chunk_base;
     
-    chunk_base = CHUNK_BASE(interpreter->pmc_reg);
+    chunk_base = PMC_CHUNK_BASE(interpreter->pmc_reg);
     /* Do we have any slots left in the current chunk? */
     if (chunk_base->free) {
         interpreter->pmc_reg = &chunk_base->PReg[chunk_base->used++];
@@ -247,7 +247,7 @@
 void
 Parrot_pop_p(struct Parrot_Interp *interpreter) {
     struct PRegChunk *chunk_base;
-    chunk_base = CHUNK_BASE(interpreter->pmc_reg);
+    chunk_base = PMC_CHUNK_BASE(interpreter->pmc_reg);
     /* Is there more than one register frame in use? */
     if (chunk_base->used > 1) {
         chunk_base->used--;
Index: include/parrot/register.h
===================================================================
RCS file: /home/perlcvs/parrot/include/parrot/register.h,v
retrieving revision 1.6
diff -u -r1.6 register.h
--- include/parrot/register.h   2001/10/06 01:04:47     1.6
+++ include/parrot/register.h   2001/10/16 02:03:56
@@ -63,9 +63,12 @@
     struct PReg PReg[FRAMES_PER_CHUNK];
 };
 
-/* This macro masks off the low bits of a register chunk address,
+/* These macros masks off the low bits of a register chunk address,
    since we're guaranteed to be aligned */
-#define CHUNK_BASE(x) (void *)(MASK_CHUNK_LOW_BITS & (ptrcast_t)x)
+#define INT_CHUNK_BASE(x) (void *)(MASK_INT_CHUNK_LOW_BITS & (ptrcast_t)x)
+#define NUM_CHUNK_BASE(x) (void *)(MASK_NUM_CHUNK_LOW_BITS & (ptrcast_t)x)
+#define STR_CHUNK_BASE(x) (void *)(MASK_STR_CHUNK_LOW_BITS & (ptrcast_t)x)
+#define PMC_CHUNK_BASE(x) (void *)(MASK_PMC_CHUNK_LOW_BITS & (ptrcast_t)x)
 
 void Parrot_clear_i(struct Parrot_Interp *);
 void Parrot_clear_s(struct Parrot_Interp *);

Reply via email to