Ejemplo n.º 1
0
  static void noim() {

    int i;
    wr('n');
    wr('i');
    wr(' ');
    i = Native.getSP(); // sp of noim();
    int sp = Native.rdIntMem(i - 4); // sp of calling function
    int pc = Native.rdIntMem(sp - 3) - 1; // one to high
    i = Native.rdIntMem(sp); // mp
    wrSmall(i);
    wr(' ');
    int start = Native.rdMem(i) >>> 10;
    wrSmall(start);
    wr(' ');
    wrByte(pc);
    wr(' ');

    int val = Native.rdMem(start + (pc >> 2));
    for (i = (pc & 0x03); i < 3; ++i) val >>= 8;
    val &= 0xff;
    wrByte(val);

    Object o = new Object();
    synchronized (o) {
      System.out.println();
      System.out.print("JOP: bytecode ");
      System.out.print(val);
      System.out.println(" not implemented");

      trace(sp);

      for (; ; ) ;
    }
  }
Ejemplo n.º 2
0
  static void trace(int sp) {

    int fp, mp, vp, pc, addr, loc, args;
    int val;

    //		for (int i=0; i<1024; ++i) {
    //			wrSmall(i);
    //			wrSmall(Native.rdIntMem(i));
    //			wr('\n');
    //		}
    wr("saved sp=");
    wrSmall(sp);
    wr('\n');

    fp = sp - 4; // first frame point is easy, since last sp points to the end of the frame

    wr("  mp     pc     fp");
    wr('\n');

    while (fp > Const.STACK_OFF + 5) {
      mp = Native.rdIntMem(fp + 4);
      vp = Native.rdIntMem(fp + 2);
      pc = Native.rdIntMem(fp + 1);
      val = Native.rdMem(mp);
      addr = val >>> 10; // address of callee

      wrSmall(mp);
      //			wrSmall(addr);
      wrSmall(pc);
      wrSmall(fp);
      wr('\n');

      val = Native.rdMem(mp + 1); // cp, locals, args
      args = val & 0x1f;
      loc = (val >>> 5) & 0x1f;
      fp = vp + args + loc; // new fp can be calc. with vp and count of local vars
    }
    wr('\n');
  }