提交 d7df102a 编写于 作者: I iveresov

6946892: c1 shouldn't sign-extend to upper 32bits on x64

Summary: c1 does sign-extension when it loads ints and shorts from memory to 64-bit registers. This causes problems for c2 because it relies on the fact the int passed in a 64-bit register is zero-extended.
Reviewed-by: never
上级 3d784467
...@@ -1244,8 +1244,7 @@ void LIR_Assembler::mem2reg(LIR_Opr src, LIR_Opr dest, BasicType type, LIR_Patch ...@@ -1244,8 +1244,7 @@ void LIR_Assembler::mem2reg(LIR_Opr src, LIR_Opr dest, BasicType type, LIR_Patch
break; break;
#endif // _L64 #endif // _L64
case T_INT: case T_INT:
// %%% could this be a movl? this is safer but longer instruction __ movl(dest->as_register(), from_addr);
__ movl2ptr(dest->as_register(), from_addr);
break; break;
case T_LONG: { case T_LONG: {
...@@ -1303,7 +1302,6 @@ void LIR_Assembler::mem2reg(LIR_Opr src, LIR_Opr dest, BasicType type, LIR_Patch ...@@ -1303,7 +1302,6 @@ void LIR_Assembler::mem2reg(LIR_Opr src, LIR_Opr dest, BasicType type, LIR_Patch
__ shll(dest_reg, 24); __ shll(dest_reg, 24);
__ sarl(dest_reg, 24); __ sarl(dest_reg, 24);
} }
// These are unsigned so the zero extension on 64bit is just what we need
break; break;
} }
...@@ -1315,8 +1313,6 @@ void LIR_Assembler::mem2reg(LIR_Opr src, LIR_Opr dest, BasicType type, LIR_Patch ...@@ -1315,8 +1313,6 @@ void LIR_Assembler::mem2reg(LIR_Opr src, LIR_Opr dest, BasicType type, LIR_Patch
} else { } else {
__ movw(dest_reg, from_addr); __ movw(dest_reg, from_addr);
} }
// This is unsigned so the zero extension on 64bit is just what we need
// __ movl2ptr(dest_reg, dest_reg);
break; break;
} }
...@@ -1329,8 +1325,6 @@ void LIR_Assembler::mem2reg(LIR_Opr src, LIR_Opr dest, BasicType type, LIR_Patch ...@@ -1329,8 +1325,6 @@ void LIR_Assembler::mem2reg(LIR_Opr src, LIR_Opr dest, BasicType type, LIR_Patch
__ shll(dest_reg, 16); __ shll(dest_reg, 16);
__ sarl(dest_reg, 16); __ sarl(dest_reg, 16);
} }
// Might not be needed in 64bit but certainly doesn't hurt (except for code size)
__ movl2ptr(dest_reg, dest_reg);
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册