mirror of
https://gitee.com/openharmony/arkcompiler_ets_runtime
synced 2024-11-27 12:10:47 +00:00
Optimize multi-byte load in interpreter for AArch64 and Amd64
Signed-off-by: steven_117f <steven.829665@huawei.com>
This commit is contained in:
parent
c50c91193d
commit
ea0284954c
@ -120,6 +120,12 @@ GateRef InterpreterStubBuilder::ReadInstSigned8_0(GateRef pc)
|
||||
|
||||
GateRef InterpreterStubBuilder::ReadInstSigned16_0(GateRef pc)
|
||||
{
|
||||
#ifdef __BISHENG__
|
||||
if (GetEnvironment()->IsAArch64() || GetEnvironment()->IsAmd64()) {
|
||||
GateRef currentInst = Load(VariableType::INT16(), pc, IntPtr(1)); // 1 : skip 1 byte of bytecode
|
||||
return GetEnvironment()->GetBuilder()->SExtInt16ToInt32(currentInst);
|
||||
}
|
||||
#endif
|
||||
/* 2 : skip 8 bits of opcode and 8 bits of low bits */
|
||||
GateRef currentInst = Load(VariableType::INT8(), pc, IntPtr(2));
|
||||
GateRef currentInst1 = GetEnvironment()->GetBuilder()->SExtInt1ToInt32(currentInst);
|
||||
@ -129,6 +135,12 @@ GateRef InterpreterStubBuilder::ReadInstSigned16_0(GateRef pc)
|
||||
|
||||
GateRef InterpreterStubBuilder::ReadInstSigned32_0(GateRef pc)
|
||||
{
|
||||
#ifdef __BISHENG__
|
||||
if (GetEnvironment()->IsAArch64() || GetEnvironment()->IsAmd64()) {
|
||||
GateRef x = Load(VariableType::INT32(), pc, IntPtr(1)); // 1 : skip 1 byte of bytecode
|
||||
return GetEnvironment()->GetBuilder()->SExtInt1ToInt32(x);
|
||||
}
|
||||
#endif
|
||||
/* 4 : skip 8 bits of opcode and 24 bits of low bits */
|
||||
GateRef x = Load(VariableType::INT8(), pc, IntPtr(4));
|
||||
GateRef currentInst = GetEnvironment()->GetBuilder()->SExtInt1ToInt32(x);
|
||||
@ -142,6 +154,11 @@ GateRef InterpreterStubBuilder::ReadInstSigned32_0(GateRef pc)
|
||||
|
||||
GateRef InterpreterStubBuilder::ReadInst16_0(GateRef pc)
|
||||
{
|
||||
#ifdef __BISHENG__
|
||||
if (GetEnvironment()->IsAArch64() || GetEnvironment()->IsAmd64()) {
|
||||
return Load(VariableType::INT16(), pc, IntPtr(1)); // 1 : skip 1 byte of bytecode
|
||||
}
|
||||
#endif
|
||||
/* 2 : skip 8 bits of opcode and 8 bits of low bits */
|
||||
GateRef currentInst1 = ZExtInt8ToInt16(ReadInst8_1(pc));
|
||||
GateRef currentInst2 = Int16LSL(currentInst1, Int16(8)); // 8 : set as high 8 bits
|
||||
@ -150,6 +167,11 @@ GateRef InterpreterStubBuilder::ReadInst16_0(GateRef pc)
|
||||
|
||||
GateRef InterpreterStubBuilder::ReadInst16_1(GateRef pc)
|
||||
{
|
||||
#ifdef __BISHENG__
|
||||
if (GetEnvironment()->IsAArch64() || GetEnvironment()->IsAmd64()) {
|
||||
return Load(VariableType::INT16(), pc, IntPtr(2)); // 2 : skip 2 bytes of bytecode
|
||||
}
|
||||
#endif
|
||||
/* 3 : skip 8 bits of opcode, 8 bits of prefix and 8 bits of low bits */
|
||||
GateRef currentInst1 = ZExtInt8ToInt16(ReadInst8_2(pc));
|
||||
GateRef currentInst2 = Int16LSL(currentInst1, Int16(8)); // 8 : set as high 8 bits
|
||||
@ -159,6 +181,11 @@ GateRef InterpreterStubBuilder::ReadInst16_1(GateRef pc)
|
||||
|
||||
GateRef InterpreterStubBuilder::ReadInst16_2(GateRef pc)
|
||||
{
|
||||
#ifdef __BISHENG__
|
||||
if (GetEnvironment()->IsAArch64() || GetEnvironment()->IsAmd64()) {
|
||||
return Load(VariableType::INT16(), pc, IntPtr(3)); // 3 : skip 3 bytes of bytecode
|
||||
}
|
||||
#endif
|
||||
/* 4 : skip 8 bits of opcode, first parameter of 16 bits and 8 bits of low bits */
|
||||
GateRef currentInst1 = ZExtInt8ToInt16(ReadInst8_3(pc));
|
||||
GateRef currentInst2 = Int16LSL(currentInst1, Int16(8)); // 8 : set as high 8 bits
|
||||
@ -168,6 +195,11 @@ GateRef InterpreterStubBuilder::ReadInst16_2(GateRef pc)
|
||||
|
||||
GateRef InterpreterStubBuilder::ReadInst16_3(GateRef pc)
|
||||
{
|
||||
#ifdef __BISHENG__
|
||||
if (GetEnvironment()->IsAArch64() || GetEnvironment()->IsAmd64()) {
|
||||
return Load(VariableType::INT16(), pc, IntPtr(4)); // 4 : skip 4 bytes of bytecode
|
||||
}
|
||||
#endif
|
||||
/* 5 : skip 8 bits of opcode, 8 bits of prefix, first parameter of 16 bits and 8 bits of low bits */
|
||||
GateRef currentInst1 = ZExtInt8ToInt16(ReadInst8_4(pc));
|
||||
GateRef currentInst2 = Int16LSL(currentInst1, Int16(8)); // 8 : set as high 8 bits
|
||||
@ -177,6 +209,11 @@ GateRef InterpreterStubBuilder::ReadInst16_3(GateRef pc)
|
||||
|
||||
GateRef InterpreterStubBuilder::ReadInst16_4(GateRef pc)
|
||||
{
|
||||
#ifdef __BISHENG__
|
||||
if (GetEnvironment()->IsAArch64() || GetEnvironment()->IsAmd64()) {
|
||||
return Load(VariableType::INT16(), pc, IntPtr(5)); // 5 : skip 5 bytes of bytecode
|
||||
}
|
||||
#endif
|
||||
/* 7 : skip 8 bits of opcode, 8 bits of prefix, first 2 parameters of 16 bits and 8 bits of low bits */
|
||||
GateRef currentInst1 = ZExtInt8ToInt16(ReadInst8_5(pc));
|
||||
GateRef currentInst2 = Int16LSL(currentInst1, Int16(8)); // 8 : set as high 8 bits
|
||||
@ -186,6 +223,11 @@ GateRef InterpreterStubBuilder::ReadInst16_4(GateRef pc)
|
||||
|
||||
GateRef InterpreterStubBuilder::ReadInst16_5(GateRef pc)
|
||||
{
|
||||
#ifdef __BISHENG__
|
||||
if (GetEnvironment()->IsAArch64() || GetEnvironment()->IsAmd64()) {
|
||||
return Load(VariableType::INT16(), pc, IntPtr(6)); // 6 : skip 6 bytes of bytecode
|
||||
}
|
||||
#endif
|
||||
/* 7 : skip 8 bits of opcode, 8 bits of prefix, first 2 parameters of 16 bits and 8 bits of low bits */
|
||||
GateRef currentInst1 = ZExtInt8ToInt16(ReadInst8_6(pc));
|
||||
GateRef currentInst2 = Int16LSL(currentInst1, Int16(8)); // 8 : set as high 8 bits
|
||||
@ -195,6 +237,11 @@ GateRef InterpreterStubBuilder::ReadInst16_5(GateRef pc)
|
||||
|
||||
GateRef InterpreterStubBuilder::ReadInst16_6(GateRef pc)
|
||||
{
|
||||
#ifdef __BISHENG__
|
||||
if (GetEnvironment()->IsAArch64() || GetEnvironment()->IsAmd64()) {
|
||||
return Load(VariableType::INT16(), pc, IntPtr(7)); // 7 : skip 7 bytes of bytecode
|
||||
}
|
||||
#endif
|
||||
/* 7 : skip 8 bits of opcode, 8 bits of prefix, first 2 parameters of 16 bits and 8 bits of low bits */
|
||||
GateRef currentInst1 = ZExtInt8ToInt16(ReadInst8_7(pc));
|
||||
GateRef currentInst2 = Int16LSL(currentInst1, Int16(8)); // 8 : set as high 8 bits
|
||||
@ -204,6 +251,11 @@ GateRef InterpreterStubBuilder::ReadInst16_6(GateRef pc)
|
||||
|
||||
GateRef InterpreterStubBuilder::ReadInst16_7(GateRef pc)
|
||||
{
|
||||
#ifdef __BISHENG__
|
||||
if (GetEnvironment()->IsAArch64() || GetEnvironment()->IsAmd64()) {
|
||||
return Load(VariableType::INT16(), pc, IntPtr(8)); // 8 : skip 8 bytes of bytecode
|
||||
}
|
||||
#endif
|
||||
/* 7 : skip 8 bits of opcode, 8 bits of prefix, first 2 parameters of 16 bits and 8 bits of low bits */
|
||||
GateRef currentInst1 = ZExtInt8ToInt16(ReadInst8_8(pc));
|
||||
GateRef currentInst2 = Int16LSL(currentInst1, Int16(8)); // 8 : set as high 8 bits
|
||||
@ -576,6 +628,11 @@ void InterpreterStubBuilder::UpdateProfileTypeInfoCellToFunction(GateRef glue, G
|
||||
|
||||
GateRef InterpreterStubBuilder::ReadInst32_0(GateRef pc)
|
||||
{
|
||||
#ifdef __BISHENG__
|
||||
if (GetEnvironment()->IsAArch64() || GetEnvironment()->IsAmd64()) {
|
||||
return Load(VariableType::INT32(), pc, IntPtr(1)); // 1 : skip 1 byte of bytecode
|
||||
}
|
||||
#endif
|
||||
GateRef currentInst = ZExtInt8ToInt32(ReadInst8_3(pc));
|
||||
GateRef currentInst1 = Int32LSL(currentInst, Int32(8)); // 8 : set as high 8 bits
|
||||
GateRef currentInst2 = Int32Add(currentInst1, ZExtInt8ToInt32(ReadInst8_2(pc)));
|
||||
@ -587,6 +644,11 @@ GateRef InterpreterStubBuilder::ReadInst32_0(GateRef pc)
|
||||
|
||||
GateRef InterpreterStubBuilder::ReadInst32_1(GateRef pc)
|
||||
{
|
||||
#ifdef __BISHENG__
|
||||
if (GetEnvironment()->IsAArch64() || GetEnvironment()->IsAmd64()) {
|
||||
return Load(VariableType::INT32(), pc, IntPtr(2)); // 2 : skip 2 bytes of bytecode
|
||||
}
|
||||
#endif
|
||||
GateRef currentInst = ZExtInt8ToInt32(ReadInst8_4(pc));
|
||||
GateRef currentInst1 = Int32LSL(currentInst, Int32(8)); // 8 : set as high 8 bits
|
||||
GateRef currentInst2 = Int32Add(currentInst1, ZExtInt8ToInt32(ReadInst8_3(pc)));
|
||||
@ -598,6 +660,11 @@ GateRef InterpreterStubBuilder::ReadInst32_1(GateRef pc)
|
||||
|
||||
GateRef InterpreterStubBuilder::ReadInst32_2(GateRef pc)
|
||||
{
|
||||
#ifdef __BISHENG__
|
||||
if (GetEnvironment()->IsAArch64() || GetEnvironment()->IsAmd64()) {
|
||||
return Load(VariableType::INT32(), pc, IntPtr(3)); // 3 : skip 3 bytes of bytecode
|
||||
}
|
||||
#endif
|
||||
GateRef currentInst = ZExtInt8ToInt32(ReadInst8_5(pc));
|
||||
GateRef currentInst1 = Int32LSL(currentInst, Int32(8)); // 8 : set as high 8 bits
|
||||
GateRef currentInst2 = Int32Add(currentInst1, ZExtInt8ToInt32(ReadInst8_4(pc)));
|
||||
@ -609,6 +676,11 @@ GateRef InterpreterStubBuilder::ReadInst32_2(GateRef pc)
|
||||
|
||||
GateRef InterpreterStubBuilder::ReadInst64_0(GateRef pc)
|
||||
{
|
||||
#ifdef __BISHENG__
|
||||
if (GetEnvironment()->IsAArch64() || GetEnvironment()->IsAmd64()) {
|
||||
return Load(VariableType::INT64(), pc, IntPtr(1)); // 1 : skip 1 byte of bytecode
|
||||
}
|
||||
#endif
|
||||
GateRef currentInst = ZExtInt8ToInt64(ReadInst8_7(pc));
|
||||
GateRef currentInst1 = Int64LSL(currentInst, Int64(8)); // 8 : set as high 8 bits
|
||||
GateRef currentInst2 = Int64Add(currentInst1, ZExtInt8ToInt64(ReadInst8_6(pc)));
|
||||
|
Loading…
Reference in New Issue
Block a user