Beispiel #1
0
void InstructionPrinter::do_Constant(Constant* x) {
    ValueType* t = x->type();
    switch (t->tag()) {
    case intTag    :
        output()->print("%d"  , t->as_IntConstant   ()->value());
        break;
    case longTag   :
        output()->print(os::jlong_format_specifier(), t->as_LongConstant()->value());
        output()->print("L");
        break;
    case floatTag  :
        output()->print("%g"  , t->as_FloatConstant ()->value());
        break;
    case doubleTag :
        output()->print("%gD" , t->as_DoubleConstant()->value());
        break;
    case objectTag :
        print_object(x);
        break;
    case addressTag:
        output()->print("bci:%d", t->as_AddressConstant()->value());
        break;
    default        :
        output()->print("???");
        break;
    }
}
Beispiel #2
0
void Canonicalizer::do_NegateOp(NegateOp* x) {
  ValueType* t = x->x()->type();
  if (t->is_constant()) {
    switch (t->tag()) {
      case intTag   : set_constant(-t->as_IntConstant   ()->value()); return;
      case longTag  : set_constant(-t->as_LongConstant  ()->value()); return;
      case floatTag : set_constant(-t->as_FloatConstant ()->value()); return;
      case doubleTag: set_constant(-t->as_DoubleConstant()->value()); return;
      default       : ShouldNotReachHere();
    }
  }
}