aoqi@0: /* aoqi@0: * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. aoqi@0: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. aoqi@0: * aoqi@0: * This code is free software; you can redistribute it and/or modify it aoqi@0: * under the terms of the GNU General Public License version 2 only, as aoqi@0: * published by the Free Software Foundation. aoqi@0: * aoqi@0: * This code is distributed in the hope that it will be useful, but WITHOUT aoqi@0: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or aoqi@0: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License aoqi@0: * version 2 for more details (a copy is included in the LICENSE file that aoqi@0: * accompanied this code). aoqi@0: * aoqi@0: * You should have received a copy of the GNU General Public License version aoqi@0: * 2 along with this work; if not, write to the Free Software Foundation, aoqi@0: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. aoqi@0: * aoqi@0: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA aoqi@0: * or visit www.oracle.com if you need additional information or have any aoqi@0: * questions. aoqi@0: * aoqi@0: */ aoqi@0: aoqi@0: #include "precompiled.hpp" aoqi@0: #include "c1/c1_Canonicalizer.hpp" aoqi@0: #include "c1/c1_InstructionPrinter.hpp" aoqi@0: #include "c1/c1_ValueStack.hpp" aoqi@0: #include "ci/ciArray.hpp" aoqi@0: #include "runtime/sharedRuntime.hpp" aoqi@0: aoqi@0: aoqi@0: class PrintValueVisitor: public ValueVisitor { aoqi@0: void visit(Value* vp) { aoqi@0: (*vp)->print_line(); aoqi@0: } aoqi@0: }; aoqi@0: aoqi@0: void Canonicalizer::set_canonical(Value x) { aoqi@0: assert(x != NULL, "value must exist"); aoqi@0: // Note: we can not currently substitute root nodes which show up in aoqi@0: // the instruction stream (because the instruction list is embedded aoqi@0: // in the instructions). aoqi@0: if (canonical() != x) { aoqi@0: #ifndef PRODUCT aoqi@0: if (!x->has_printable_bci()) { aoqi@0: x->set_printable_bci(bci()); aoqi@0: } aoqi@0: #endif aoqi@0: if (PrintCanonicalization) { aoqi@0: PrintValueVisitor do_print_value; aoqi@0: canonical()->input_values_do(&do_print_value); aoqi@0: canonical()->print_line(); aoqi@0: tty->print_cr("canonicalized to:"); aoqi@0: x->input_values_do(&do_print_value); aoqi@0: x->print_line(); aoqi@0: tty->cr(); aoqi@0: } aoqi@0: assert(_canonical->type()->tag() == x->type()->tag(), "types must match"); aoqi@0: _canonical = x; aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: aoqi@0: void Canonicalizer::move_const_to_right(Op2* x) { aoqi@0: if (x->x()->type()->is_constant() && x->is_commutative()) x->swap_operands(); aoqi@0: } aoqi@0: aoqi@0: aoqi@0: void Canonicalizer::do_Op2(Op2* x) { aoqi@0: if (x->x() == x->y()) { aoqi@0: switch (x->op()) { aoqi@0: case Bytecodes::_isub: set_constant(0); return; aoqi@0: case Bytecodes::_lsub: set_constant(jlong_cast(0)); return; aoqi@0: case Bytecodes::_iand: // fall through aoqi@0: case Bytecodes::_land: // fall through aoqi@0: case Bytecodes::_ior: // fall through aoqi@0: case Bytecodes::_lor : set_canonical(x->x()); return; aoqi@0: case Bytecodes::_ixor: set_constant(0); return; aoqi@0: case Bytecodes::_lxor: set_constant(jlong_cast(0)); return; aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: if (x->x()->type()->is_constant() && x->y()->type()->is_constant()) { aoqi@0: // do constant folding for selected operations aoqi@0: switch (x->type()->tag()) { aoqi@0: case intTag: aoqi@0: { jint a = x->x()->type()->as_IntConstant()->value(); aoqi@0: jint b = x->y()->type()->as_IntConstant()->value(); aoqi@0: switch (x->op()) { aoqi@0: case Bytecodes::_iadd: set_constant(a + b); return; aoqi@0: case Bytecodes::_isub: set_constant(a - b); return; aoqi@0: case Bytecodes::_imul: set_constant(a * b); return; aoqi@0: case Bytecodes::_idiv: aoqi@0: if (b != 0) { aoqi@0: if (a == min_jint && b == -1) { aoqi@0: set_constant(min_jint); aoqi@0: } else { aoqi@0: set_constant(a / b); aoqi@0: } aoqi@0: return; aoqi@0: } aoqi@0: break; aoqi@0: case Bytecodes::_irem: aoqi@0: if (b != 0) { aoqi@0: if (a == min_jint && b == -1) { aoqi@0: set_constant(0); aoqi@0: } else { aoqi@0: set_constant(a % b); aoqi@0: } aoqi@0: return; aoqi@0: } aoqi@0: break; aoqi@0: case Bytecodes::_iand: set_constant(a & b); return; aoqi@0: case Bytecodes::_ior : set_constant(a | b); return; aoqi@0: case Bytecodes::_ixor: set_constant(a ^ b); return; aoqi@0: } aoqi@0: } aoqi@0: break; aoqi@0: case longTag: aoqi@0: { jlong a = x->x()->type()->as_LongConstant()->value(); aoqi@0: jlong b = x->y()->type()->as_LongConstant()->value(); aoqi@0: switch (x->op()) { aoqi@0: case Bytecodes::_ladd: set_constant(a + b); return; aoqi@0: case Bytecodes::_lsub: set_constant(a - b); return; aoqi@0: case Bytecodes::_lmul: set_constant(a * b); return; aoqi@0: case Bytecodes::_ldiv: aoqi@0: if (b != 0) { aoqi@0: set_constant(SharedRuntime::ldiv(b, a)); aoqi@0: return; aoqi@0: } aoqi@0: break; aoqi@0: case Bytecodes::_lrem: aoqi@0: if (b != 0) { aoqi@0: set_constant(SharedRuntime::lrem(b, a)); aoqi@0: return; aoqi@0: } aoqi@0: break; aoqi@0: case Bytecodes::_land: set_constant(a & b); return; aoqi@0: case Bytecodes::_lor : set_constant(a | b); return; aoqi@0: case Bytecodes::_lxor: set_constant(a ^ b); return; aoqi@0: } aoqi@0: } aoqi@0: break; aoqi@0: // other cases not implemented (must be extremely careful with floats & doubles!) aoqi@0: } aoqi@0: } aoqi@0: // make sure constant is on the right side, if any aoqi@0: move_const_to_right(x); aoqi@0: aoqi@0: if (x->y()->type()->is_constant()) { aoqi@0: // do constant folding for selected operations aoqi@0: switch (x->type()->tag()) { aoqi@0: case intTag: aoqi@0: if (x->y()->type()->as_IntConstant()->value() == 0) { aoqi@0: switch (x->op()) { aoqi@0: case Bytecodes::_iadd: set_canonical(x->x()); return; aoqi@0: case Bytecodes::_isub: set_canonical(x->x()); return; aoqi@0: case Bytecodes::_imul: set_constant(0); return; aoqi@0: // Note: for div and rem, make sure that C semantics aoqi@0: // corresponds to Java semantics! aoqi@0: case Bytecodes::_iand: set_constant(0); return; aoqi@0: case Bytecodes::_ior : set_canonical(x->x()); return; aoqi@0: } aoqi@0: } aoqi@0: break; aoqi@0: case longTag: aoqi@0: if (x->y()->type()->as_LongConstant()->value() == (jlong)0) { aoqi@0: switch (x->op()) { aoqi@0: case Bytecodes::_ladd: set_canonical(x->x()); return; aoqi@0: case Bytecodes::_lsub: set_canonical(x->x()); return; aoqi@0: case Bytecodes::_lmul: set_constant((jlong)0); return; aoqi@0: // Note: for div and rem, make sure that C semantics aoqi@0: // corresponds to Java semantics! aoqi@0: case Bytecodes::_land: set_constant((jlong)0); return; aoqi@0: case Bytecodes::_lor : set_canonical(x->x()); return; aoqi@0: } aoqi@0: } aoqi@0: break; aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: aoqi@0: void Canonicalizer::do_Phi (Phi* x) {} aoqi@0: void Canonicalizer::do_Constant (Constant* x) {} aoqi@0: void Canonicalizer::do_Local (Local* x) {} aoqi@0: void Canonicalizer::do_LoadField (LoadField* x) {} aoqi@0: aoqi@0: // checks if v is in the block that is currently processed by aoqi@0: // GraphBuilder. This is the only block that has not BlockEnd yet. aoqi@0: static bool in_current_block(Value v) { aoqi@0: int max_distance = 4; aoqi@0: while (max_distance > 0 && v != NULL && v->as_BlockEnd() == NULL) { aoqi@0: v = v->next(); aoqi@0: max_distance--; aoqi@0: } aoqi@0: return v == NULL; aoqi@0: } aoqi@0: aoqi@0: void Canonicalizer::do_StoreField (StoreField* x) { aoqi@0: // If a value is going to be stored into a field or array some of aoqi@0: // the conversions emitted by javac are unneeded because the fields aoqi@0: // are packed to their natural size. aoqi@0: Convert* conv = x->value()->as_Convert(); aoqi@0: if (conv) { aoqi@0: Value value = NULL; aoqi@0: BasicType type = x->field()->type()->basic_type(); aoqi@0: switch (conv->op()) { aoqi@0: case Bytecodes::_i2b: if (type == T_BYTE) value = conv->value(); break; aoqi@0: case Bytecodes::_i2s: if (type == T_SHORT || type == T_BYTE) value = conv->value(); break; aoqi@0: case Bytecodes::_i2c: if (type == T_CHAR || type == T_BYTE) value = conv->value(); break; aoqi@0: } aoqi@0: // limit this optimization to current block aoqi@0: if (value != NULL && in_current_block(conv)) { aoqi@0: set_canonical(new StoreField(x->obj(), x->offset(), x->field(), value, x->is_static(), aoqi@0: x->state_before(), x->needs_patching())); aoqi@0: return; aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: } aoqi@0: aoqi@0: void Canonicalizer::do_ArrayLength (ArrayLength* x) { aoqi@0: NewArray* array = x->array()->as_NewArray(); aoqi@0: if (array != NULL && array->length() != NULL) { aoqi@0: Constant* length = array->length()->as_Constant(); aoqi@0: if (length != NULL) { aoqi@0: // do not use the Constant itself, but create a new Constant aoqi@0: // with same value Otherwise a Constant is live over multiple aoqi@0: // blocks without being registered in a state array. aoqi@0: assert(length->type()->as_IntConstant() != NULL, "array length must be integer"); aoqi@0: set_constant(length->type()->as_IntConstant()->value()); aoqi@0: } aoqi@0: } else { aoqi@0: LoadField* lf = x->array()->as_LoadField(); aoqi@0: if (lf != NULL) { aoqi@0: ciField* field = lf->field(); aoqi@0: if (field->is_constant() && field->is_static()) { aoqi@0: // final static field aoqi@0: ciObject* c = field->constant_value().as_object(); aoqi@0: if (c->is_array()) { aoqi@0: ciArray* array = (ciArray*) c; aoqi@0: set_constant(array->length()); aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: void Canonicalizer::do_LoadIndexed (LoadIndexed* x) {} aoqi@0: void Canonicalizer::do_StoreIndexed (StoreIndexed* x) { aoqi@0: // If a value is going to be stored into a field or array some of aoqi@0: // the conversions emitted by javac are unneeded because the fields aoqi@0: // are packed to their natural size. aoqi@0: Convert* conv = x->value()->as_Convert(); aoqi@0: if (conv) { aoqi@0: Value value = NULL; aoqi@0: BasicType type = x->elt_type(); aoqi@0: switch (conv->op()) { aoqi@0: case Bytecodes::_i2b: if (type == T_BYTE) value = conv->value(); break; aoqi@0: case Bytecodes::_i2s: if (type == T_SHORT || type == T_BYTE) value = conv->value(); break; aoqi@0: case Bytecodes::_i2c: if (type == T_CHAR || type == T_BYTE) value = conv->value(); break; aoqi@0: } aoqi@0: // limit this optimization to current block aoqi@0: if (value != NULL && in_current_block(conv)) { aoqi@0: set_canonical(new StoreIndexed(x->array(), x->index(), x->length(), aoqi@0: x->elt_type(), value, x->state_before())); aoqi@0: return; aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: aoqi@0: } aoqi@0: aoqi@0: aoqi@0: void Canonicalizer::do_NegateOp(NegateOp* x) { aoqi@0: ValueType* t = x->x()->type(); aoqi@0: if (t->is_constant()) { aoqi@0: switch (t->tag()) { aoqi@0: case intTag : set_constant(-t->as_IntConstant ()->value()); return; aoqi@0: case longTag : set_constant(-t->as_LongConstant ()->value()); return; aoqi@0: case floatTag : set_constant(-t->as_FloatConstant ()->value()); return; aoqi@0: case doubleTag: set_constant(-t->as_DoubleConstant()->value()); return; aoqi@0: default : ShouldNotReachHere(); aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: aoqi@0: void Canonicalizer::do_ArithmeticOp (ArithmeticOp* x) { do_Op2(x); } aoqi@0: aoqi@0: aoqi@0: void Canonicalizer::do_ShiftOp (ShiftOp* x) { aoqi@0: ValueType* t = x->x()->type(); aoqi@0: ValueType* t2 = x->y()->type(); aoqi@0: if (t->is_constant()) { aoqi@0: switch (t->tag()) { aoqi@0: case intTag : if (t->as_IntConstant()->value() == 0) { set_constant(0); return; } break; aoqi@0: case longTag : if (t->as_LongConstant()->value() == (jlong)0) { set_constant(jlong_cast(0)); return; } break; aoqi@0: default : ShouldNotReachHere(); aoqi@0: } aoqi@0: if (t2->is_constant()) { aoqi@0: if (t->tag() == intTag) { aoqi@0: int value = t->as_IntConstant()->value(); aoqi@0: int shift = t2->as_IntConstant()->value() & 31; aoqi@0: jint mask = ~(~0 << (32 - shift)); aoqi@0: if (shift == 0) mask = ~0; aoqi@0: switch (x->op()) { aoqi@0: case Bytecodes::_ishl: set_constant(value << shift); return; aoqi@0: case Bytecodes::_ishr: set_constant(value >> shift); return; aoqi@0: case Bytecodes::_iushr: set_constant((value >> shift) & mask); return; aoqi@0: } aoqi@0: } else if (t->tag() == longTag) { aoqi@0: jlong value = t->as_LongConstant()->value(); aoqi@0: int shift = t2->as_IntConstant()->value() & 63; aoqi@0: jlong mask = ~(~jlong_cast(0) << (64 - shift)); aoqi@0: if (shift == 0) mask = ~jlong_cast(0); aoqi@0: switch (x->op()) { aoqi@0: case Bytecodes::_lshl: set_constant(value << shift); return; aoqi@0: case Bytecodes::_lshr: set_constant(value >> shift); return; aoqi@0: case Bytecodes::_lushr: set_constant((value >> shift) & mask); return; aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: if (t2->is_constant()) { aoqi@0: switch (t2->tag()) { aoqi@0: case intTag : if (t2->as_IntConstant()->value() == 0) set_canonical(x->x()); return; aoqi@0: case longTag : if (t2->as_IntConstant()->value() == 0) set_canonical(x->x()); return; aoqi@0: default : ShouldNotReachHere(); aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: aoqi@0: void Canonicalizer::do_LogicOp (LogicOp* x) { do_Op2(x); } aoqi@0: void Canonicalizer::do_CompareOp (CompareOp* x) { aoqi@0: if (x->x() == x->y()) { aoqi@0: switch (x->x()->type()->tag()) { aoqi@0: case longTag: set_constant(0); break; aoqi@0: case floatTag: { aoqi@0: FloatConstant* fc = x->x()->type()->as_FloatConstant(); aoqi@0: if (fc) { aoqi@0: if (g_isnan(fc->value())) { aoqi@0: set_constant(x->op() == Bytecodes::_fcmpl ? -1 : 1); aoqi@0: } else { aoqi@0: set_constant(0); aoqi@0: } aoqi@0: } aoqi@0: break; aoqi@0: } aoqi@0: case doubleTag: { aoqi@0: DoubleConstant* dc = x->x()->type()->as_DoubleConstant(); aoqi@0: if (dc) { aoqi@0: if (g_isnan(dc->value())) { aoqi@0: set_constant(x->op() == Bytecodes::_dcmpl ? -1 : 1); aoqi@0: } else { aoqi@0: set_constant(0); aoqi@0: } aoqi@0: } aoqi@0: break; aoqi@0: } aoqi@0: } aoqi@0: } else if (x->x()->type()->is_constant() && x->y()->type()->is_constant()) { aoqi@0: switch (x->x()->type()->tag()) { aoqi@0: case longTag: { aoqi@0: jlong vx = x->x()->type()->as_LongConstant()->value(); aoqi@0: jlong vy = x->y()->type()->as_LongConstant()->value(); aoqi@0: if (vx == vy) aoqi@0: set_constant(0); aoqi@0: else if (vx < vy) aoqi@0: set_constant(-1); aoqi@0: else aoqi@0: set_constant(1); aoqi@0: break; aoqi@0: } aoqi@0: aoqi@0: case floatTag: { aoqi@0: float vx = x->x()->type()->as_FloatConstant()->value(); aoqi@0: float vy = x->y()->type()->as_FloatConstant()->value(); aoqi@0: if (g_isnan(vx) || g_isnan(vy)) aoqi@0: set_constant(x->op() == Bytecodes::_fcmpl ? -1 : 1); aoqi@0: else if (vx == vy) aoqi@0: set_constant(0); aoqi@0: else if (vx < vy) aoqi@0: set_constant(-1); aoqi@0: else aoqi@0: set_constant(1); aoqi@0: break; aoqi@0: } aoqi@0: aoqi@0: case doubleTag: { aoqi@0: double vx = x->x()->type()->as_DoubleConstant()->value(); aoqi@0: double vy = x->y()->type()->as_DoubleConstant()->value(); aoqi@0: if (g_isnan(vx) || g_isnan(vy)) aoqi@0: set_constant(x->op() == Bytecodes::_dcmpl ? -1 : 1); aoqi@0: else if (vx == vy) aoqi@0: set_constant(0); aoqi@0: else if (vx < vy) aoqi@0: set_constant(-1); aoqi@0: else aoqi@0: set_constant(1); aoqi@0: break; aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: aoqi@0: void Canonicalizer::do_IfInstanceOf(IfInstanceOf* x) {} aoqi@0: aoqi@0: void Canonicalizer::do_IfOp(IfOp* x) { aoqi@0: // Caution: do not use do_Op2(x) here for now since aoqi@0: // we map the condition to the op for now! aoqi@0: move_const_to_right(x); aoqi@0: } aoqi@0: aoqi@0: aoqi@0: void Canonicalizer::do_Intrinsic (Intrinsic* x) { aoqi@0: switch (x->id()) { aoqi@0: case vmIntrinsics::_floatToRawIntBits : { aoqi@0: FloatConstant* c = x->argument_at(0)->type()->as_FloatConstant(); aoqi@0: if (c != NULL) { aoqi@0: JavaValue v; aoqi@0: v.set_jfloat(c->value()); aoqi@0: set_constant(v.get_jint()); aoqi@0: } aoqi@0: break; aoqi@0: } aoqi@0: case vmIntrinsics::_intBitsToFloat : { aoqi@0: IntConstant* c = x->argument_at(0)->type()->as_IntConstant(); aoqi@0: if (c != NULL) { aoqi@0: JavaValue v; aoqi@0: v.set_jint(c->value()); aoqi@0: set_constant(v.get_jfloat()); aoqi@0: } aoqi@0: break; aoqi@0: } aoqi@0: case vmIntrinsics::_doubleToRawLongBits : { aoqi@0: DoubleConstant* c = x->argument_at(0)->type()->as_DoubleConstant(); aoqi@0: if (c != NULL) { aoqi@0: JavaValue v; aoqi@0: v.set_jdouble(c->value()); aoqi@0: set_constant(v.get_jlong()); aoqi@0: } aoqi@0: break; aoqi@0: } aoqi@0: case vmIntrinsics::_longBitsToDouble : { aoqi@0: LongConstant* c = x->argument_at(0)->type()->as_LongConstant(); aoqi@0: if (c != NULL) { aoqi@0: JavaValue v; aoqi@0: v.set_jlong(c->value()); aoqi@0: set_constant(v.get_jdouble()); aoqi@0: } aoqi@0: break; aoqi@0: } aoqi@0: case vmIntrinsics::_isInstance : { aoqi@0: assert(x->number_of_arguments() == 2, "wrong type"); aoqi@0: aoqi@0: InstanceConstant* c = x->argument_at(0)->type()->as_InstanceConstant(); aoqi@0: if (c != NULL && !c->value()->is_null_object()) { aoqi@0: // ciInstance::java_mirror_type() returns non-NULL only for Java mirrors aoqi@0: ciType* t = c->value()->as_instance()->java_mirror_type(); aoqi@0: if (t->is_klass()) { aoqi@0: // substitute cls.isInstance(obj) of a constant Class into aoqi@0: // an InstantOf instruction aoqi@0: InstanceOf* i = new InstanceOf(t->as_klass(), x->argument_at(1), x->state_before()); aoqi@0: set_canonical(i); aoqi@0: // and try to canonicalize even further aoqi@0: do_InstanceOf(i); aoqi@0: } else { aoqi@0: assert(t->is_primitive_type(), "should be a primitive type"); aoqi@0: // cls.isInstance(obj) always returns false for primitive classes aoqi@0: set_constant(0); aoqi@0: } aoqi@0: } aoqi@0: break; aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: void Canonicalizer::do_Convert (Convert* x) { aoqi@0: if (x->value()->type()->is_constant()) { aoqi@0: switch (x->op()) { aoqi@0: case Bytecodes::_i2b: set_constant((int)((x->value()->type()->as_IntConstant()->value() << 24) >> 24)); break; aoqi@0: case Bytecodes::_i2s: set_constant((int)((x->value()->type()->as_IntConstant()->value() << 16) >> 16)); break; aoqi@0: case Bytecodes::_i2c: set_constant((int)(x->value()->type()->as_IntConstant()->value() & ((1<<16)-1))); break; aoqi@0: case Bytecodes::_i2l: set_constant((jlong)(x->value()->type()->as_IntConstant()->value())); break; aoqi@0: case Bytecodes::_i2f: set_constant((float)(x->value()->type()->as_IntConstant()->value())); break; aoqi@0: case Bytecodes::_i2d: set_constant((double)(x->value()->type()->as_IntConstant()->value())); break; aoqi@0: case Bytecodes::_l2i: set_constant((int)(x->value()->type()->as_LongConstant()->value())); break; aoqi@0: case Bytecodes::_l2f: set_constant(SharedRuntime::l2f(x->value()->type()->as_LongConstant()->value())); break; aoqi@0: case Bytecodes::_l2d: set_constant(SharedRuntime::l2d(x->value()->type()->as_LongConstant()->value())); break; aoqi@0: case Bytecodes::_f2d: set_constant((double)(x->value()->type()->as_FloatConstant()->value())); break; aoqi@0: case Bytecodes::_f2i: set_constant(SharedRuntime::f2i(x->value()->type()->as_FloatConstant()->value())); break; aoqi@0: case Bytecodes::_f2l: set_constant(SharedRuntime::f2l(x->value()->type()->as_FloatConstant()->value())); break; aoqi@0: case Bytecodes::_d2f: set_constant((float)(x->value()->type()->as_DoubleConstant()->value())); break; aoqi@0: case Bytecodes::_d2i: set_constant(SharedRuntime::d2i(x->value()->type()->as_DoubleConstant()->value())); break; aoqi@0: case Bytecodes::_d2l: set_constant(SharedRuntime::d2l(x->value()->type()->as_DoubleConstant()->value())); break; aoqi@0: default: aoqi@0: ShouldNotReachHere(); aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: Value value = x->value(); aoqi@0: BasicType type = T_ILLEGAL; aoqi@0: LoadField* lf = value->as_LoadField(); aoqi@0: if (lf) { aoqi@0: type = lf->field_type(); aoqi@0: } else { aoqi@0: LoadIndexed* li = value->as_LoadIndexed(); aoqi@0: if (li) { aoqi@0: type = li->elt_type(); aoqi@0: } else { aoqi@0: Convert* conv = value->as_Convert(); aoqi@0: if (conv) { aoqi@0: switch (conv->op()) { aoqi@0: case Bytecodes::_i2b: type = T_BYTE; break; aoqi@0: case Bytecodes::_i2s: type = T_SHORT; break; aoqi@0: case Bytecodes::_i2c: type = T_CHAR; break; aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: if (type != T_ILLEGAL) { aoqi@0: switch (x->op()) { aoqi@0: case Bytecodes::_i2b: if (type == T_BYTE) set_canonical(x->value()); break; aoqi@0: case Bytecodes::_i2s: if (type == T_SHORT || type == T_BYTE) set_canonical(x->value()); break; aoqi@0: case Bytecodes::_i2c: if (type == T_CHAR) set_canonical(x->value()); break; aoqi@0: } aoqi@0: } else { aoqi@0: Op2* op2 = x->value()->as_Op2(); aoqi@0: if (op2 && op2->op() == Bytecodes::_iand && op2->y()->type()->is_constant()) { aoqi@0: jint safebits = 0; aoqi@0: jint mask = op2->y()->type()->as_IntConstant()->value(); aoqi@0: switch (x->op()) { aoqi@0: case Bytecodes::_i2b: safebits = 0x7f; break; aoqi@0: case Bytecodes::_i2s: safebits = 0x7fff; break; aoqi@0: case Bytecodes::_i2c: safebits = 0xffff; break; aoqi@0: } aoqi@0: // When casting a masked integer to a smaller signed type, if aoqi@0: // the mask doesn't include the sign bit the cast isn't needed. aoqi@0: if (safebits && (mask & ~safebits) == 0) { aoqi@0: set_canonical(x->value()); aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: } aoqi@0: aoqi@0: void Canonicalizer::do_NullCheck (NullCheck* x) { aoqi@0: if (x->obj()->as_NewArray() != NULL || x->obj()->as_NewInstance() != NULL) { aoqi@0: set_canonical(x->obj()); aoqi@0: } else { aoqi@0: Constant* con = x->obj()->as_Constant(); aoqi@0: if (con) { aoqi@0: ObjectType* c = con->type()->as_ObjectType(); aoqi@0: if (c && c->is_loaded()) { aoqi@0: ObjectConstant* oc = c->as_ObjectConstant(); aoqi@0: if (!oc || !oc->value()->is_null_object()) { aoqi@0: set_canonical(con); aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: void Canonicalizer::do_TypeCast (TypeCast* x) {} aoqi@0: void Canonicalizer::do_Invoke (Invoke* x) {} aoqi@0: void Canonicalizer::do_NewInstance (NewInstance* x) {} aoqi@0: void Canonicalizer::do_NewTypeArray (NewTypeArray* x) {} aoqi@0: void Canonicalizer::do_NewObjectArray (NewObjectArray* x) {} aoqi@0: void Canonicalizer::do_NewMultiArray (NewMultiArray* x) {} aoqi@0: void Canonicalizer::do_CheckCast (CheckCast* x) { aoqi@0: if (x->klass()->is_loaded()) { aoqi@0: Value obj = x->obj(); aoqi@0: ciType* klass = obj->exact_type(); aoqi@0: if (klass == NULL) klass = obj->declared_type(); aoqi@0: if (klass != NULL && klass->is_loaded() && klass->is_subtype_of(x->klass())) { aoqi@0: set_canonical(obj); aoqi@0: return; aoqi@0: } aoqi@0: // checkcast of null returns null aoqi@0: if (obj->as_Constant() && obj->type()->as_ObjectType()->constant_value()->is_null_object()) { aoqi@0: set_canonical(obj); aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: void Canonicalizer::do_InstanceOf (InstanceOf* x) { aoqi@0: if (x->klass()->is_loaded()) { aoqi@0: Value obj = x->obj(); aoqi@0: ciType* exact = obj->exact_type(); aoqi@0: if (exact != NULL && exact->is_loaded() && (obj->as_NewInstance() || obj->as_NewArray())) { aoqi@0: set_constant(exact->is_subtype_of(x->klass()) ? 1 : 0); aoqi@0: return; aoqi@0: } aoqi@0: // instanceof null returns false aoqi@0: if (obj->as_Constant() && obj->type()->as_ObjectType()->constant_value()->is_null_object()) { aoqi@0: set_constant(0); aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: } aoqi@0: void Canonicalizer::do_MonitorEnter (MonitorEnter* x) {} aoqi@0: void Canonicalizer::do_MonitorExit (MonitorExit* x) {} aoqi@0: void Canonicalizer::do_BlockBegin (BlockBegin* x) {} aoqi@0: void Canonicalizer::do_Goto (Goto* x) {} aoqi@0: aoqi@0: aoqi@0: static bool is_true(jlong x, If::Condition cond, jlong y) { aoqi@0: switch (cond) { aoqi@0: case If::eql: return x == y; aoqi@0: case If::neq: return x != y; aoqi@0: case If::lss: return x < y; aoqi@0: case If::leq: return x <= y; aoqi@0: case If::gtr: return x > y; aoqi@0: case If::geq: return x >= y; aoqi@0: } aoqi@0: ShouldNotReachHere(); aoqi@0: return false; aoqi@0: } aoqi@0: aoqi@0: static bool is_safepoint(BlockEnd* x, BlockBegin* sux) { aoqi@0: // An Instruction with multiple successors, x, is replaced by a Goto aoqi@0: // to a single successor, sux. Is a safepoint check needed = was the aoqi@0: // instruction being replaced a safepoint and the single remaining aoqi@0: // successor a back branch? aoqi@0: return x->is_safepoint() && (sux->bci() < x->state_before()->bci()); aoqi@0: } aoqi@0: aoqi@0: void Canonicalizer::do_If(If* x) { aoqi@0: // move const to right aoqi@0: if (x->x()->type()->is_constant()) x->swap_operands(); aoqi@0: // simplify aoqi@0: const Value l = x->x(); ValueType* lt = l->type(); aoqi@0: const Value r = x->y(); ValueType* rt = r->type(); aoqi@0: aoqi@0: if (l == r && !lt->is_float_kind()) { aoqi@0: // pattern: If (a cond a) => simplify to Goto aoqi@0: BlockBegin* sux; aoqi@0: switch (x->cond()) { aoqi@0: case If::eql: sux = x->sux_for(true); break; aoqi@0: case If::neq: sux = x->sux_for(false); break; aoqi@0: case If::lss: sux = x->sux_for(false); break; aoqi@0: case If::leq: sux = x->sux_for(true); break; aoqi@0: case If::gtr: sux = x->sux_for(false); break; aoqi@0: case If::geq: sux = x->sux_for(true); break; aoqi@0: } aoqi@0: // If is a safepoint then the debug information should come from the state_before of the If. aoqi@0: set_canonical(new Goto(sux, x->state_before(), is_safepoint(x, sux))); aoqi@0: return; aoqi@0: } aoqi@0: aoqi@0: if (lt->is_constant() && rt->is_constant()) { aoqi@0: if (x->x()->as_Constant() != NULL) { aoqi@0: // pattern: If (lc cond rc) => simplify to: Goto aoqi@0: BlockBegin* sux = x->x()->as_Constant()->compare(x->cond(), x->y(), aoqi@0: x->sux_for(true), aoqi@0: x->sux_for(false)); aoqi@0: if (sux != NULL) { aoqi@0: // If is a safepoint then the debug information should come from the state_before of the If. aoqi@0: set_canonical(new Goto(sux, x->state_before(), is_safepoint(x, sux))); aoqi@0: } aoqi@0: } aoqi@0: } else if (rt->as_IntConstant() != NULL) { aoqi@0: // pattern: If (l cond rc) => investigate further aoqi@0: const jint rc = rt->as_IntConstant()->value(); aoqi@0: if (l->as_CompareOp() != NULL) { aoqi@0: // pattern: If ((a cmp b) cond rc) => simplify to: If (x cond y) or: Goto aoqi@0: CompareOp* cmp = l->as_CompareOp(); aoqi@0: bool unordered_is_less = cmp->op() == Bytecodes::_fcmpl || cmp->op() == Bytecodes::_dcmpl; aoqi@0: BlockBegin* lss_sux = x->sux_for(is_true(-1, x->cond(), rc)); // successor for a < b aoqi@0: BlockBegin* eql_sux = x->sux_for(is_true( 0, x->cond(), rc)); // successor for a = b aoqi@0: BlockBegin* gtr_sux = x->sux_for(is_true(+1, x->cond(), rc)); // successor for a > b aoqi@0: BlockBegin* nan_sux = unordered_is_less ? lss_sux : gtr_sux ; // successor for unordered aoqi@0: // Note: At this point all successors (lss_sux, eql_sux, gtr_sux, nan_sux) are aoqi@0: // equal to x->tsux() or x->fsux(). Furthermore, nan_sux equals either aoqi@0: // lss_sux or gtr_sux. aoqi@0: if (lss_sux == eql_sux && eql_sux == gtr_sux) { aoqi@0: // all successors identical => simplify to: Goto aoqi@0: set_canonical(new Goto(lss_sux, x->state_before(), x->is_safepoint())); aoqi@0: } else { aoqi@0: // two successors differ and two successors are the same => simplify to: If (x cmp y) aoqi@0: // determine new condition & successors aoqi@0: If::Condition cond; aoqi@0: BlockBegin* tsux = NULL; aoqi@0: BlockBegin* fsux = NULL; aoqi@0: if (lss_sux == eql_sux) { cond = If::leq; tsux = lss_sux; fsux = gtr_sux; } aoqi@0: else if (lss_sux == gtr_sux) { cond = If::neq; tsux = lss_sux; fsux = eql_sux; } aoqi@0: else if (eql_sux == gtr_sux) { cond = If::geq; tsux = eql_sux; fsux = lss_sux; } aoqi@0: else { ShouldNotReachHere(); } aoqi@0: If* canon = new If(cmp->x(), cond, nan_sux == tsux, cmp->y(), tsux, fsux, cmp->state_before(), x->is_safepoint()); aoqi@0: if (cmp->x() == cmp->y()) { aoqi@0: do_If(canon); aoqi@0: } else { aoqi@0: if (compilation()->profile_branches()) { aoqi@0: // TODO: If profiling, leave floating point comparisons unoptimized. aoqi@0: // We currently do not support profiling of the unordered case. aoqi@0: switch(cmp->op()) { aoqi@0: case Bytecodes::_fcmpl: case Bytecodes::_fcmpg: aoqi@0: case Bytecodes::_dcmpl: case Bytecodes::_dcmpg: aoqi@0: set_canonical(x); aoqi@0: return; aoqi@0: } aoqi@0: } aoqi@0: set_bci(cmp->state_before()->bci()); aoqi@0: set_canonical(canon); aoqi@0: } aoqi@0: } aoqi@0: } else if (l->as_InstanceOf() != NULL) { aoqi@0: // NOTE: Code permanently disabled for now since it leaves the old InstanceOf aoqi@0: // instruction in the graph (it is pinned). Need to fix this at some point. aoqi@0: // It should also be left in the graph when generating a profiled method version or Goto aoqi@0: // has to know that it was an InstanceOf. aoqi@0: return; aoqi@0: // pattern: If ((obj instanceof klass) cond rc) => simplify to: IfInstanceOf or: Goto aoqi@0: InstanceOf* inst = l->as_InstanceOf(); aoqi@0: BlockBegin* is_inst_sux = x->sux_for(is_true(1, x->cond(), rc)); // successor for instanceof == 1 aoqi@0: BlockBegin* no_inst_sux = x->sux_for(is_true(0, x->cond(), rc)); // successor for instanceof == 0 aoqi@0: if (is_inst_sux == no_inst_sux && inst->is_loaded()) { aoqi@0: // both successors identical and klass is loaded => simplify to: Goto aoqi@0: set_canonical(new Goto(is_inst_sux, x->state_before(), x->is_safepoint())); aoqi@0: } else { aoqi@0: // successors differ => simplify to: IfInstanceOf aoqi@0: set_canonical(new IfInstanceOf(inst->klass(), inst->obj(), true, inst->state_before()->bci(), is_inst_sux, no_inst_sux)); aoqi@0: } aoqi@0: } aoqi@0: } else if (rt == objectNull && (l->as_NewInstance() || l->as_NewArray())) { aoqi@0: if (x->cond() == Instruction::eql) { aoqi@0: BlockBegin* sux = x->fsux(); aoqi@0: set_canonical(new Goto(sux, x->state_before(), is_safepoint(x, sux))); aoqi@0: } else { aoqi@0: assert(x->cond() == Instruction::neq, "only other valid case"); aoqi@0: BlockBegin* sux = x->tsux(); aoqi@0: set_canonical(new Goto(sux, x->state_before(), is_safepoint(x, sux))); aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: aoqi@0: void Canonicalizer::do_TableSwitch(TableSwitch* x) { aoqi@0: if (x->tag()->type()->is_constant()) { aoqi@0: int v = x->tag()->type()->as_IntConstant()->value(); aoqi@0: BlockBegin* sux = x->default_sux(); aoqi@0: if (v >= x->lo_key() && v <= x->hi_key()) { aoqi@0: sux = x->sux_at(v - x->lo_key()); aoqi@0: } aoqi@0: set_canonical(new Goto(sux, x->state_before(), is_safepoint(x, sux))); aoqi@0: } else if (x->number_of_sux() == 1) { aoqi@0: // NOTE: Code permanently disabled for now since the switch statement's aoqi@0: // tag expression may produce side-effects in which case it must aoqi@0: // be executed. aoqi@0: return; aoqi@0: // simplify to Goto aoqi@0: set_canonical(new Goto(x->default_sux(), x->state_before(), x->is_safepoint())); aoqi@0: } else if (x->number_of_sux() == 2) { aoqi@0: // NOTE: Code permanently disabled for now since it produces two new nodes aoqi@0: // (Constant & If) and the Canonicalizer cannot return them correctly aoqi@0: // yet. For now we copied the corresponding code directly into the aoqi@0: // GraphBuilder (i.e., we should never reach here). aoqi@0: return; aoqi@0: // simplify to If aoqi@0: assert(x->lo_key() == x->hi_key(), "keys must be the same"); aoqi@0: Constant* key = new Constant(new IntConstant(x->lo_key())); aoqi@0: set_canonical(new If(x->tag(), If::eql, true, key, x->sux_at(0), x->default_sux(), x->state_before(), x->is_safepoint())); aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: aoqi@0: void Canonicalizer::do_LookupSwitch(LookupSwitch* x) { aoqi@0: if (x->tag()->type()->is_constant()) { aoqi@0: int v = x->tag()->type()->as_IntConstant()->value(); aoqi@0: BlockBegin* sux = x->default_sux(); aoqi@0: for (int i = 0; i < x->length(); i++) { aoqi@0: if (v == x->key_at(i)) { aoqi@0: sux = x->sux_at(i); aoqi@0: } aoqi@0: } aoqi@0: set_canonical(new Goto(sux, x->state_before(), is_safepoint(x, sux))); aoqi@0: } else if (x->number_of_sux() == 1) { aoqi@0: // NOTE: Code permanently disabled for now since the switch statement's aoqi@0: // tag expression may produce side-effects in which case it must aoqi@0: // be executed. aoqi@0: return; aoqi@0: // simplify to Goto aoqi@0: set_canonical(new Goto(x->default_sux(), x->state_before(), x->is_safepoint())); aoqi@0: } else if (x->number_of_sux() == 2) { aoqi@0: // NOTE: Code permanently disabled for now since it produces two new nodes aoqi@0: // (Constant & If) and the Canonicalizer cannot return them correctly aoqi@0: // yet. For now we copied the corresponding code directly into the aoqi@0: // GraphBuilder (i.e., we should never reach here). aoqi@0: return; aoqi@0: // simplify to If aoqi@0: assert(x->length() == 1, "length must be the same"); aoqi@0: Constant* key = new Constant(new IntConstant(x->key_at(0))); aoqi@0: set_canonical(new If(x->tag(), If::eql, true, key, x->sux_at(0), x->default_sux(), x->state_before(), x->is_safepoint())); aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: aoqi@0: void Canonicalizer::do_Return (Return* x) {} aoqi@0: void Canonicalizer::do_Throw (Throw* x) {} aoqi@0: void Canonicalizer::do_Base (Base* x) {} aoqi@0: void Canonicalizer::do_OsrEntry (OsrEntry* x) {} aoqi@0: void Canonicalizer::do_ExceptionObject(ExceptionObject* x) {} aoqi@0: aoqi@0: static bool match_index_and_scale(Instruction* instr, aoqi@0: Instruction** index, aoqi@0: int* log2_scale, aoqi@0: Instruction** instr_to_unpin) { aoqi@0: *instr_to_unpin = NULL; aoqi@0: aoqi@0: // Skip conversion ops aoqi@0: Convert* convert = instr->as_Convert(); aoqi@0: if (convert != NULL) { aoqi@0: instr = convert->value(); aoqi@0: } aoqi@0: aoqi@0: ShiftOp* shift = instr->as_ShiftOp(); aoqi@0: if (shift != NULL) { aoqi@0: if (shift->is_pinned()) { aoqi@0: *instr_to_unpin = shift; aoqi@0: } aoqi@0: // Constant shift value? aoqi@0: Constant* con = shift->y()->as_Constant(); aoqi@0: if (con == NULL) return false; aoqi@0: // Well-known type and value? aoqi@0: IntConstant* val = con->type()->as_IntConstant(); aoqi@0: if (val == NULL) return false; aoqi@0: if (shift->x()->type() != intType) return false; aoqi@0: *index = shift->x(); aoqi@0: int tmp_scale = val->value(); aoqi@0: if (tmp_scale >= 0 && tmp_scale < 4) { aoqi@0: *log2_scale = tmp_scale; aoqi@0: return true; aoqi@0: } else { aoqi@0: return false; aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: ArithmeticOp* arith = instr->as_ArithmeticOp(); aoqi@0: if (arith != NULL) { aoqi@0: if (arith->is_pinned()) { aoqi@0: *instr_to_unpin = arith; aoqi@0: } aoqi@0: // Check for integer multiply aoqi@0: if (arith->op() == Bytecodes::_imul) { aoqi@0: // See if either arg is a known constant aoqi@0: Constant* con = arith->x()->as_Constant(); aoqi@0: if (con != NULL) { aoqi@0: *index = arith->y(); aoqi@0: } else { aoqi@0: con = arith->y()->as_Constant(); aoqi@0: if (con == NULL) return false; aoqi@0: *index = arith->x(); aoqi@0: } aoqi@0: if ((*index)->type() != intType) return false; aoqi@0: // Well-known type and value? aoqi@0: IntConstant* val = con->type()->as_IntConstant(); aoqi@0: if (val == NULL) return false; aoqi@0: switch (val->value()) { aoqi@0: case 1: *log2_scale = 0; return true; aoqi@0: case 2: *log2_scale = 1; return true; aoqi@0: case 4: *log2_scale = 2; return true; aoqi@0: case 8: *log2_scale = 3; return true; aoqi@0: default: return false; aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: // Unknown instruction sequence; don't touch it aoqi@0: return false; aoqi@0: } aoqi@0: aoqi@0: aoqi@0: static bool match(UnsafeRawOp* x, aoqi@0: Instruction** base, aoqi@0: Instruction** index, aoqi@0: int* log2_scale) { aoqi@0: Instruction* instr_to_unpin = NULL; aoqi@0: ArithmeticOp* root = x->base()->as_ArithmeticOp(); aoqi@0: if (root == NULL) return false; aoqi@0: // Limit ourselves to addition for now aoqi@0: if (root->op() != Bytecodes::_ladd) return false; aoqi@0: // Try to find shift or scale op aoqi@0: if (match_index_and_scale(root->y(), index, log2_scale, &instr_to_unpin)) { aoqi@0: *base = root->x(); aoqi@0: } else if (match_index_and_scale(root->x(), index, log2_scale, &instr_to_unpin)) { aoqi@0: *base = root->y(); aoqi@0: } else if (root->y()->as_Convert() != NULL) { aoqi@0: Convert* convert = root->y()->as_Convert(); aoqi@0: if (convert->op() == Bytecodes::_i2l && convert->value()->type() == intType) { aoqi@0: // pick base and index, setting scale at 1 aoqi@0: *base = root->x(); aoqi@0: *index = convert->value(); aoqi@0: *log2_scale = 0; aoqi@0: } else { aoqi@0: return false; aoqi@0: } aoqi@0: } else { aoqi@0: // doesn't match any expected sequences aoqi@0: return false; aoqi@0: } aoqi@0: aoqi@0: // If the value is pinned then it will be always be computed so aoqi@0: // there's no profit to reshaping the expression. aoqi@0: return !root->is_pinned(); aoqi@0: } aoqi@0: aoqi@0: aoqi@0: void Canonicalizer::do_UnsafeRawOp(UnsafeRawOp* x) { aoqi@0: Instruction* base = NULL; aoqi@0: Instruction* index = NULL; aoqi@0: int log2_scale; aoqi@0: aoqi@0: if (match(x, &base, &index, &log2_scale)) { aoqi@0: x->set_base(base); aoqi@0: x->set_index(index); aoqi@0: x->set_log2_scale(log2_scale); aoqi@0: if (PrintUnsafeOptimization) { aoqi@0: tty->print_cr("Canonicalizer: UnsafeRawOp id %d: base = id %d, index = id %d, log2_scale = %d", aoqi@0: x->id(), x->base()->id(), x->index()->id(), x->log2_scale()); aoqi@0: } aoqi@0: } aoqi@0: } aoqi@0: aoqi@0: void Canonicalizer::do_RoundFP(RoundFP* x) {} aoqi@0: void Canonicalizer::do_UnsafeGetRaw(UnsafeGetRaw* x) { if (OptimizeUnsafes) do_UnsafeRawOp(x); } aoqi@0: void Canonicalizer::do_UnsafePutRaw(UnsafePutRaw* x) { if (OptimizeUnsafes) do_UnsafeRawOp(x); } aoqi@0: void Canonicalizer::do_UnsafeGetObject(UnsafeGetObject* x) {} aoqi@0: void Canonicalizer::do_UnsafePutObject(UnsafePutObject* x) {} aoqi@0: void Canonicalizer::do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x) {} aoqi@0: void Canonicalizer::do_UnsafePrefetchRead (UnsafePrefetchRead* x) {} aoqi@0: void Canonicalizer::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) {} aoqi@0: void Canonicalizer::do_ProfileCall(ProfileCall* x) {} aoqi@0: void Canonicalizer::do_ProfileReturnType(ProfileReturnType* x) {} aoqi@0: void Canonicalizer::do_ProfileInvoke(ProfileInvoke* x) {} aoqi@0: void Canonicalizer::do_RuntimeCall(RuntimeCall* x) {} aoqi@0: void Canonicalizer::do_RangeCheckPredicate(RangeCheckPredicate* x) {} aoqi@0: #ifdef ASSERT aoqi@0: void Canonicalizer::do_Assert(Assert* x) {} aoqi@0: #endif aoqi@0: void Canonicalizer::do_MemBar(MemBar* x) {}