Browse files

Keep the PC in a register.

  • Loading branch information...
1 parent b9985e0 commit 451597ebbdc2a8286939becd88d7f794d21b66fe @kr committed Mar 31, 2009
Showing with 7 additions and 2 deletions.
  1. +2 −0 mem.c
  2. +3 −1 vm.c
  3. +2 −1 vm.h
View
2 mem.c
@@ -235,12 +235,14 @@ gc(datum *x1, datum *x2)
relocate((datum) x2);
for (i = 0; i < REG_COUNT; ++i) {
if (i == R_FREE) continue; /* this register doesn't hold a datum */
+ if (i == R_PC) continue; /* this register doesn't hold a datum */
relocate((datum) &regs[i]);
}
relocate((datum) &saved_stack);
for (i = 0; i < REG_COUNT; ++i) {
if (i == R_FREE) continue; /* this register doesn't hold a datum */
+ if (i == R_PC) continue; /* this register doesn't hold a datum */
relocate((datum) saved_regs + i);
}
relocate((datum) &saved_x1);
View
4 vm.c
@@ -336,10 +336,12 @@ closure_method2(datum d, datum name1, datum name2)
#define sign_ext_imm(x) (((ssize_t) (I_RRI(x) << 15)) >> 15)
+#define pc (regs[R_PC])
+
void
start_body(uint *start_addr)
{
- register uint *pc, *tmp;
+ register uint *tmp;
uint ra, rb, rc, rd, di, level;
int index;
ssize_t imm;
View
3 vm.h
@@ -6,7 +6,7 @@
#include "mem.h"
#include "nil.h"
-#define REG_COUNT 12
+#define REG_COUNT 13
/*#define REG_COUNT 32*/
#define R_NIL 0
#define R_GLOBAL 1
@@ -20,6 +20,7 @@
#define R_VM0 9
#define R_VOID 10
#define R_FREE 11
+#define R_PC 12
int imep(datum x);

0 comments on commit 451597e

Please sign in to comment.