689 }
690
691
692 static bool positive_constant(Instruction* inst) {
693 IntConstant* c = inst->type()->as_IntConstant();
694 if (c) {
695 return (c->value() >= 0);
696 }
697 return false;
698 }
699
700
701 static ciArrayKlass* as_array_klass(ciType* type) {
702 if (type != NULL && type->is_array_klass() && type->is_loaded()) {
703 return (ciArrayKlass*)type;
704 } else {
705 return NULL;
706 }
707 }
708
709 static Value maxvalue(IfOp* ifop) {
710 switch (ifop->cond()) {
711 case If::eql: return NULL;
712 case If::neq: return NULL;
713 case If::lss: // x < y ? x : y
714 case If::leq: // x <= y ? x : y
715 if (ifop->x() == ifop->tval() &&
716 ifop->y() == ifop->fval()) return ifop->y();
717 return NULL;
718
719 case If::gtr: // x > y ? y : x
720 case If::geq: // x >= y ? y : x
721 if (ifop->x() == ifop->tval() &&
722 ifop->y() == ifop->fval()) return ifop->y();
723 return NULL;
724
725 }
726 }
727
728 static ciType* phi_declared_type(Phi* phi) {
729 ciType* t = phi->operand_at(0)->declared_type();
730 if (t == NULL) {
731 return NULL;
732 }
733 for(int i = 1; i < phi->operand_count(); i++) {
734 if (t != phi->operand_at(i)->declared_type()) {
735 return NULL;
736 }
737 }
738 return t;
739 }
740
741 void LIRGenerator::arraycopy_helper(Intrinsic* x, int* flagsp, ciArrayKlass** expected_typep) {
742 Instruction* src = x->argument_at(0);
743 Instruction* src_pos = x->argument_at(1);
744 Instruction* dst = x->argument_at(2);
745 Instruction* dst_pos = x->argument_at(3);
746 Instruction* length = x->argument_at(4);
747
|
689 }
690
691
692 static bool positive_constant(Instruction* inst) {
693 IntConstant* c = inst->type()->as_IntConstant();
694 if (c) {
695 return (c->value() >= 0);
696 }
697 return false;
698 }
699
700
701 static ciArrayKlass* as_array_klass(ciType* type) {
702 if (type != NULL && type->is_array_klass() && type->is_loaded()) {
703 return (ciArrayKlass*)type;
704 } else {
705 return NULL;
706 }
707 }
708
709 static ciType* phi_declared_type(Phi* phi) {
710 ciType* t = phi->operand_at(0)->declared_type();
711 if (t == NULL) {
712 return NULL;
713 }
714 for(int i = 1; i < phi->operand_count(); i++) {
715 if (t != phi->operand_at(i)->declared_type()) {
716 return NULL;
717 }
718 }
719 return t;
720 }
721
722 void LIRGenerator::arraycopy_helper(Intrinsic* x, int* flagsp, ciArrayKlass** expected_typep) {
723 Instruction* src = x->argument_at(0);
724 Instruction* src_pos = x->argument_at(1);
725 Instruction* dst = x->argument_at(2);
726 Instruction* dst_pos = x->argument_at(3);
727 Instruction* length = x->argument_at(4);
728
|