Ejemplo n.º 1
0
void ppxv(int x) {
  bool oldVerbose = Verbose;
  Verbose = true;
  Oop o = (OopDesc*)x;
  o.print();
  Verbose = oldVerbose;
}
Ejemplo n.º 2
0
void find(int x) {
  OopDesc** p = (OopDesc**) x;
  if (ObjectHeap::contains_live(p)) {
    Oop o = ObjectHeap::slow_object_start(p);
    tty->print_cr("0x%p in object 0x%p", x, o.obj());
    o.print();
  } else if (ObjectHeap::contains(p)) {
    tty->print_cr("0x%p inside dead region of ObjectHeap", x);
  } else {
    tty->print_cr("0x%p unknown location", x);
  }
}
Ejemplo n.º 3
0
void Profiling_Tracer::record_for_profile(Oop meth, Oop rcvr, bool is_block) {
  if (Logical_Core::num_cores > 1)
    return;

  static std::string lastSignature;
  std::map<std::string, int>* profile;
#warning Stefan: warning, not threadsafe
  get_profile(&profile);

  static char buff[2024];
  StringPrinter p(buff, 2023);

  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) return;
  if (mclass == The_Squeak_Interpreter()->roots.nilObj)
    mclass = rcvr.fetchClass();

  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);
  if (is_block) p.printf("[]");

  buff[2023] = 0;
  std::string signature(buff);

  if (lastSignature != signature) {
    lastSignature = signature;
    ++(*profile)[lastSignature];
  }


  // STEFAN: a little hack to be able to get the printout during debugging, any better ways to do so?
  static bool print_profile = false;
  if (print_profile) {
    this->print_profile(debug_printer);
  }
}
Ejemplo n.º 4
0
void ppx(int x) {
  Oop o = (OopDesc*)x;
  o.print();
}
Ejemplo n.º 5
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();
  }
}