Exemple #1
0
void Execution_Tracer::print_entries(Oop ents, Printer* p) {
  Object_p eo = ents.as_object();
  int n = eo->fetchWordLength()  /  e_N;
  int x;

  for (int i = 0;  i < n;  ++i) {
    int rank = eo->fetchPointer(x   =   i * e_N  +  e_rank).integerValue();
    p->printf("%3d on %2d: ", i - n, rank);

    switch (eo->fetchPointer(i * e_N  +  e_kind).integerValue()) {
        default: fatal(); break;
        case k_proc: {
          Oop process      = eo->fetchPointer(i * e_N  +  e_process); assert(process.is_mem());
          p->printf("switch to process 0x%x", process.as_untracked_object_ptr());
        }
          break;

      case k_aux: {
        int rank         = eo->fetchPointer(i * e_N  +  e_rank).integerValue();
        int aux1         = eo->fetchPointer(i * e_N  +  e_aux1).integerValue();
        //int aux2         = eo->fetchPointer(i * e_N  +  e_aux2).integerValue();
        int id           = eo->fetchPointer(i * e_N  +  e_id  ).integerValue();
        // p->printf("on %d: aux1 0x%x aux2 0x%x id %d", rank, aux1, aux2, id);
        p->printf("on %d: aux1 %s id %d", rank, aux1, id);
      }
        break;

        case k_gc:
          p->printf("gc: %d",  eo->fetchPointer(i * e_N  + e_gc).integerValue());
          break;

        case k_rcved_interp:
          p->printf("received interp");
          break;

        case k_bc: {
          Oop meth         = eo->fetchPointer(i * e_N  +  e_method); assert(meth.is_mem());
          Oop rcvr         = eo->fetchPointer(i * e_N  +  e_rcvr);
          int pc           = eo->fetchPointer(i * e_N  +  e_pc  ).integerValue();
          bool is_block    = eo->fetchPointer(i * e_N  +  e_is_block) == The_Squeak_Interpreter()->roots.trueObj;
          int aux1         = eo->fetchPointer(i * e_N  +  e_aux1).integerValue();
          int aux2         = eo->fetchPointer(i * e_N  +  e_aux2).integerValue();

          Oop klass = rcvr.fetchClass();
          Oop sel, mclass;
          bool have_sel_and_mclass = klass.as_object()->selector_and_class_of_method_in_me_or_ancestors(meth, &sel, &mclass);
          if (!have_sel_and_mclass) continue;
          if (mclass == The_Squeak_Interpreter()->roots.nilObj)
            mclass = rcvr.fetchClass();

          p->printf("rcvr: ");  rcvr.print(p);
          if (mclass != klass) {
            p->printf("(");
            bool is_meta;
            Oop mclassName = mclass.as_object()->name_of_class_or_metaclass(&is_meta);
            if (is_meta) p->printf("class ");
            mclassName.as_object()->print_bytes(p);
            p->printf(")");
          }
          p->printf("  >>  ");
          sel.as_object()->print_bytes(p);
          p->printf(is_block ? " [] " : "    ");
          p->printf(", pc: %d, ", pc);

          Object_p mo = meth.as_object();
          u_char bc = mo->first_byte_address()[pc];
          The_Squeak_Interpreter()->printBC(bc, p);

          p->printf(", bcCount %d", eo->fetchPointer(i * e_N  +  e_bcCount).integerValue());
          if (aux1)  p->printf(", aux1 = 0x%x", aux1);
          if (aux1)  p->printf(", aux1 = 0x%x", aux2);


        }
        break;
    }
    p->nl();
  }
}
Exemple #2
0
void Execution_Tracer::check_it(Oop ents) {
  Object_p eo = ents.as_object();
  int wl = eo->fetchWordLength();
  int n = wl / e_N;

  for (int i = 0;  i < n;  ++i) {
    int x = -1;
    Oop rank = eo->fetchPointer(x   =   i * e_N  +  e_rank);
    assert_always( rank.is_int());
    switch (eo->fetchPointer(i * e_N  +  e_kind).integerValue()) {
        default: fatal();
      case k_bc: {
          Oop meth         = eo->fetchPointer(x   =   i * e_N  +  e_method); assert_always(meth.is_mem());
          Oop rcvr         = eo->fetchPointer(x   =   i * e_N  +  e_rcvr);
          Oop pc           = eo->fetchPointer(x   =   i * e_N  +  e_pc  );  assert_always(pc.is_int());
          Oop is_block     = eo->fetchPointer(x   =   i * e_N  +  e_is_block); assert_always(is_block == The_Squeak_Interpreter()->roots.trueObj || is_block == The_Squeak_Interpreter()->roots.falseObj);
          break;
      }
        case k_gc: {
          Oop gc           = eo->fetchPointer(x   =   i * e_N  +  e_gc      ); assert_always(gc.is_int());
        }
          break;
        case k_proc: {
          Oop process      = eo->fetchPointer(x   =   i * e_N  +  e_process); assert_always(process.is_mem());
        }
          break;
        case k_rcved_interp:
          break;
        case k_aux: break;
    }
  }
}