void InstructionPrinter::print_object(Value obj) {
  ValueType* type = obj->type();
  if (type->as_ObjectConstant() != NULL) {
    ciObject* value = type->as_ObjectConstant()->value();
    if (value->is_null_object()) {
      output()->print("null");
    } else if (!value->is_loaded()) {
output()->print("<unloaded object %p>",value);
    } else if (value->is_method()) {
      ciMethod* m = (ciMethod*)value;
      output()->print("<method %s.%s>", m->holder()->name()->as_utf8(), m->name()->as_utf8());
    } else {
output()->print("<object %p>",value->encoding());
    }
  } else if (type->as_InstanceConstant() != NULL) {
output()->print("<instance %p>",type->as_InstanceConstant()->value()->encoding());
  } else if (type->as_ArrayConstant() != NULL) {
output()->print("<array %p>",type->as_ArrayConstant()->value()->encoding());
  } else if (type->as_ClassConstant() != NULL) {
    ciInstanceKlass* klass = type->as_ClassConstant()->value();
    if (!klass->is_loaded()) {
      output()->print("<unloaded> ");
    }
    output()->print("class "); 
    print_klass(klass);
  } else {
    output()->print("???");
  }
}
void InstructionPrinter::print_object(Value obj) {
  ValueType* type = obj->type();
  if (type->as_ObjectConstant() != NULL) {
    ciObject* value = type->as_ObjectConstant()->value();
    if (value->is_null_object()) {
      tty->print("null");
    } else if (!value->is_loaded()) {
      tty->print("<unloaded object 0x%x>", value);
    } else {
      tty->print("<object 0x%x>", value->encoding());
    }
  } else if (type->as_InstanceConstant() != NULL) {
    tty->print("<instance 0x%x>", type->as_InstanceConstant()->value()->encoding());
  } else if (type->as_ArrayConstant() != NULL) {
    tty->print("<array 0x%x>", type->as_ArrayConstant()->value()->encoding());
  } else if (type->as_ClassConstant() != NULL) {
    ciInstanceKlass* klass = type->as_ClassConstant()->value();
    if (!klass->is_loaded()) {
      tty->print("<unloaded class>");
    } else {
      tty->print("<class 0x%x>", klass->encoding());
    }
  } else {
    tty->print("???");
  }
}