提交 c2f73d1b 编写于 作者: I iveresov

7131028: Switch statement takes wrong path

Summary: Pass correct type to branch in LIRGenerator::do_SwitchRanges()
Reviewed-by: kvn, never
上级 8705c53f
...@@ -1354,9 +1354,10 @@ class LIR_OpBranch: public LIR_Op { ...@@ -1354,9 +1354,10 @@ class LIR_OpBranch: public LIR_Op {
CodeStub* _stub; // if this is a branch to a stub, this is the stub CodeStub* _stub; // if this is a branch to a stub, this is the stub
public: public:
LIR_OpBranch(LIR_Condition cond, Label* lbl) LIR_OpBranch(LIR_Condition cond, BasicType type, Label* lbl)
: LIR_Op(lir_branch, LIR_OprFact::illegalOpr, (CodeEmitInfo*) NULL) : LIR_Op(lir_branch, LIR_OprFact::illegalOpr, (CodeEmitInfo*) NULL)
, _cond(cond) , _cond(cond)
, _type(type)
, _label(lbl) , _label(lbl)
, _block(NULL) , _block(NULL)
, _ublock(NULL) , _ublock(NULL)
...@@ -2053,7 +2054,7 @@ class LIR_List: public CompilationResourceObj { ...@@ -2053,7 +2054,7 @@ class LIR_List: public CompilationResourceObj {
void jump(CodeStub* stub) { void jump(CodeStub* stub) {
append(new LIR_OpBranch(lir_cond_always, T_ILLEGAL, stub)); append(new LIR_OpBranch(lir_cond_always, T_ILLEGAL, stub));
} }
void branch(LIR_Condition cond, Label* lbl) { append(new LIR_OpBranch(cond, lbl)); } void branch(LIR_Condition cond, BasicType type, Label* lbl) { append(new LIR_OpBranch(cond, type, lbl)); }
void branch(LIR_Condition cond, BasicType type, BlockBegin* block) { void branch(LIR_Condition cond, BasicType type, BlockBegin* block) {
assert(type != T_FLOAT && type != T_DOUBLE, "no fp comparisons"); assert(type != T_FLOAT && type != T_DOUBLE, "no fp comparisons");
append(new LIR_OpBranch(cond, type, block)); append(new LIR_OpBranch(cond, type, block));
......
...@@ -2350,7 +2350,7 @@ void LIRGenerator::do_SwitchRanges(SwitchRangeArray* x, LIR_Opr value, BlockBegi ...@@ -2350,7 +2350,7 @@ void LIRGenerator::do_SwitchRanges(SwitchRangeArray* x, LIR_Opr value, BlockBegi
} else { } else {
LabelObj* L = new LabelObj(); LabelObj* L = new LabelObj();
__ cmp(lir_cond_less, value, low_key); __ cmp(lir_cond_less, value, low_key);
__ branch(lir_cond_less, L->label()); __ branch(lir_cond_less, T_INT, L->label());
__ cmp(lir_cond_lessEqual, value, high_key); __ cmp(lir_cond_lessEqual, value, high_key);
__ branch(lir_cond_lessEqual, T_INT, dest); __ branch(lir_cond_lessEqual, T_INT, dest);
__ branch_destination(L->label()); __ branch_destination(L->label());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册