diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c6cb323 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/huatuo/test diff --git a/huatuo/interpreter/Instruction.h b/huatuo/interpreter/Instruction.h index 97fa13f..6a5a1a2 100644 --- a/huatuo/interpreter/Instruction.h +++ b/huatuo/interpreter/Instruction.h @@ -3515,7 +3515,7 @@ namespace interpreter uint32_t methodInfo; uint32_t argIdxs; uint16_t ret; - uint8_t retLocaltionType; + uint8_t retLocationType; uint8_t __pad__; }; @@ -3558,7 +3558,7 @@ namespace interpreter uint32_t methodInfo; uint32_t argIdxs; uint16_t ret; - uint8_t retLocaltionType; + uint8_t retLocationType; uint8_t __pad__; }; @@ -3601,7 +3601,7 @@ namespace interpreter uint32_t methodInfo; uint32_t argIdxs; uint16_t ret; - uint8_t retLocaltionType; + uint8_t retLocationType; uint8_t __pad__; }; @@ -3632,7 +3632,7 @@ namespace interpreter uint32_t argIdxs; uint16_t ret; uint16_t invokeParamCount; - uint8_t retLocaltionType; + uint8_t retLocationType; uint8_t __pad__; }; @@ -5582,7 +5582,7 @@ namespace interpreter struct IRInterlockedCompareExchangeVarVarVarVar_i4 : IRCommon { uint16_t ret; - uint16_t localtion; + uint16_t location; uint16_t value; uint16_t comparand; }; @@ -5591,7 +5591,7 @@ namespace interpreter struct IRInterlockedCompareExchangeVarVarVarVar_i8 : IRCommon { uint16_t ret; - uint16_t localtion; + uint16_t location; uint16_t value; uint16_t comparand; }; @@ -5600,7 +5600,7 @@ namespace interpreter struct IRInterlockedCompareExchangeVarVarVarVar_pointer : IRCommon { uint16_t ret; - uint16_t localtion; + uint16_t location; uint16_t value; uint16_t comparand; }; @@ -5609,7 +5609,7 @@ namespace interpreter struct IRInterlockedExchangeVarVarVar_i4 : IRCommon { uint16_t ret; - uint16_t localtion; + uint16_t location; uint16_t value; }; @@ -5617,7 +5617,7 @@ namespace interpreter struct IRInterlockedExchangeVarVarVar_i8 : IRCommon { uint16_t ret; - uint16_t localtion; + uint16_t location; uint16_t value; }; @@ -5625,7 +5625,7 @@ namespace interpreter struct IRInterlockedExchangeVarVarVar_pointer : IRCommon { uint16_t ret; - uint16_t localtion; + uint16_t location; uint16_t value; }; diff --git a/huatuo/interpreter/InterpreterDefs.h b/huatuo/interpreter/InterpreterDefs.h index d5f96a5..d0fccbf 100644 --- a/huatuo/interpreter/InterpreterDefs.h +++ b/huatuo/interpreter/InterpreterDefs.h @@ -126,7 +126,7 @@ namespace huatuo return GetTypeArgDesc(type).type; } - inline void ExpandLocaltionData2StackDataByType(void* retValue, LocationDataType type) + inline void ExpandLocationData2StackDataByType(void* retValue, LocationDataType type) { switch (type) { diff --git a/huatuo/interpreter/Interpreter_Execute.cpp b/huatuo/interpreter/Interpreter_Execute.cpp index 33ace71..9c6389c 100644 --- a/huatuo/interpreter/Interpreter_Execute.cpp +++ b/huatuo/interpreter/Interpreter_Execute.cpp @@ -1790,7 +1790,7 @@ else \ { uint16_t __dst = *(uint16_t*)(ip + 2); uint16_t __src = *(uint16_t*)(ip + 4); - (*(int32_t*)(localVarBase + __dst)) = (int8_t)((*(float*)(localVarBase + __src))); + (*(int32_t*)(localVarBase + __dst)) = il2cpp_codegen_cast_double_to_int((*(float*)(localVarBase + __src))); ip += 6; continue; } @@ -1798,7 +1798,7 @@ else \ { uint16_t __dst = *(uint16_t*)(ip + 2); uint16_t __src = *(uint16_t*)(ip + 4); - (*(int32_t*)(localVarBase + __dst)) = (uint8_t)((*(float*)(localVarBase + __src))); + (*(int32_t*)(localVarBase + __dst)) = il2cpp_codegen_cast_floating_point((*(float*)(localVarBase + __src))); ip += 6; continue; } @@ -1806,7 +1806,7 @@ else \ { uint16_t __dst = *(uint16_t*)(ip + 2); uint16_t __src = *(uint16_t*)(ip + 4); - (*(int32_t*)(localVarBase + __dst)) = (int16_t)((*(float*)(localVarBase + __src))); + (*(int32_t*)(localVarBase + __dst)) = il2cpp_codegen_cast_double_to_int((*(float*)(localVarBase + __src))); ip += 6; continue; } @@ -1814,7 +1814,7 @@ else \ { uint16_t __dst = *(uint16_t*)(ip + 2); uint16_t __src = *(uint16_t*)(ip + 4); - (*(int32_t*)(localVarBase + __dst)) = (uint16_t)((*(float*)(localVarBase + __src))); + (*(int32_t*)(localVarBase + __dst)) = il2cpp_codegen_cast_floating_point((*(float*)(localVarBase + __src))); ip += 6; continue; } @@ -1822,7 +1822,7 @@ else \ { uint16_t __dst = *(uint16_t*)(ip + 2); uint16_t __src = *(uint16_t*)(ip + 4); - (*(int32_t*)(localVarBase + __dst)) = (int32_t)((*(float*)(localVarBase + __src))); + (*(int32_t*)(localVarBase + __dst)) = il2cpp_codegen_cast_double_to_int((*(float*)(localVarBase + __src))); ip += 6; continue; } @@ -1830,7 +1830,7 @@ else \ { uint16_t __dst = *(uint16_t*)(ip + 2); uint16_t __src = *(uint16_t*)(ip + 4); - (*(int32_t*)(localVarBase + __dst)) = (uint32_t)((*(float*)(localVarBase + __src))); + (*(int32_t*)(localVarBase + __dst)) = il2cpp_codegen_cast_floating_point((*(float*)(localVarBase + __src))); ip += 6; continue; } @@ -1838,7 +1838,7 @@ else \ { uint16_t __dst = *(uint16_t*)(ip + 2); uint16_t __src = *(uint16_t*)(ip + 4); - (*(int64_t*)(localVarBase + __dst)) = (int64_t)((*(float*)(localVarBase + __src))); + (*(int64_t*)(localVarBase + __dst)) = il2cpp_codegen_cast_double_to_int((*(float*)(localVarBase + __src))); ip += 6; continue; } @@ -1846,7 +1846,7 @@ else \ { uint16_t __dst = *(uint16_t*)(ip + 2); uint16_t __src = *(uint16_t*)(ip + 4); - (*(int64_t*)(localVarBase + __dst)) = (uint64_t)((*(float*)(localVarBase + __src))); + (*(int64_t*)(localVarBase + __dst)) = il2cpp_codegen_cast_floating_point((*(float*)(localVarBase + __src))); ip += 6; continue; } @@ -1870,7 +1870,7 @@ else \ { uint16_t __dst = *(uint16_t*)(ip + 2); uint16_t __src = *(uint16_t*)(ip + 4); - (*(int32_t*)(localVarBase + __dst)) = (int8_t)((*(double*)(localVarBase + __src))); + (*(int32_t*)(localVarBase + __dst)) = il2cpp_codegen_cast_double_to_int((*(double*)(localVarBase + __src))); ip += 6; continue; } @@ -1878,7 +1878,7 @@ else \ { uint16_t __dst = *(uint16_t*)(ip + 2); uint16_t __src = *(uint16_t*)(ip + 4); - (*(int32_t*)(localVarBase + __dst)) = (uint8_t)((*(double*)(localVarBase + __src))); + (*(int32_t*)(localVarBase + __dst)) = il2cpp_codegen_cast_floating_point((*(double*)(localVarBase + __src))); ip += 6; continue; } @@ -1886,7 +1886,7 @@ else \ { uint16_t __dst = *(uint16_t*)(ip + 2); uint16_t __src = *(uint16_t*)(ip + 4); - (*(int32_t*)(localVarBase + __dst)) = (int16_t)((*(double*)(localVarBase + __src))); + (*(int32_t*)(localVarBase + __dst)) = il2cpp_codegen_cast_double_to_int((*(double*)(localVarBase + __src))); ip += 6; continue; } @@ -1894,7 +1894,7 @@ else \ { uint16_t __dst = *(uint16_t*)(ip + 2); uint16_t __src = *(uint16_t*)(ip + 4); - (*(int32_t*)(localVarBase + __dst)) = (uint16_t)((*(double*)(localVarBase + __src))); + (*(int32_t*)(localVarBase + __dst)) = il2cpp_codegen_cast_floating_point((*(double*)(localVarBase + __src))); ip += 6; continue; } @@ -1902,7 +1902,7 @@ else \ { uint16_t __dst = *(uint16_t*)(ip + 2); uint16_t __src = *(uint16_t*)(ip + 4); - (*(int32_t*)(localVarBase + __dst)) = (int32_t)((*(double*)(localVarBase + __src))); + (*(int32_t*)(localVarBase + __dst)) = il2cpp_codegen_cast_double_to_int((*(double*)(localVarBase + __src))); ip += 6; continue; } @@ -1910,7 +1910,7 @@ else \ { uint16_t __dst = *(uint16_t*)(ip + 2); uint16_t __src = *(uint16_t*)(ip + 4); - (*(int32_t*)(localVarBase + __dst)) = (uint32_t)((*(double*)(localVarBase + __src))); + (*(int32_t*)(localVarBase + __dst)) = il2cpp_codegen_cast_floating_point((*(double*)(localVarBase + __src))); ip += 6; continue; } @@ -1918,7 +1918,7 @@ else \ { uint16_t __dst = *(uint16_t*)(ip + 2); uint16_t __src = *(uint16_t*)(ip + 4); - (*(int64_t*)(localVarBase + __dst)) = (int64_t)((*(double*)(localVarBase + __src))); + (*(int64_t*)(localVarBase + __dst)) = il2cpp_codegen_cast_double_to_int((*(double*)(localVarBase + __src))); ip += 6; continue; } @@ -1926,7 +1926,7 @@ else \ { uint16_t __dst = *(uint16_t*)(ip + 2); uint16_t __src = *(uint16_t*)(ip + 4); - (*(int64_t*)(localVarBase + __dst)) = (uint64_t)((*(double*)(localVarBase + __src))); + (*(int64_t*)(localVarBase + __dst)) = il2cpp_codegen_cast_floating_point((*(double*)(localVarBase + __src))); ip += 6; continue; } @@ -4938,11 +4938,11 @@ else \ uint32_t __methodInfo = *(uint32_t*)(ip + 6); uint32_t __argIdxs = *(uint32_t*)(ip + 10); uint16_t __ret = *(uint16_t*)(ip + 14); - uint8_t __retLocaltionType = *(uint8_t*)(ip + 16); + uint8_t __retLocationType = *(uint8_t*)(ip + 16); uint8_t ____pad__ = *(uint8_t*)(ip + 0); void* _ret = (void*)(localVarBase + __ret); ((Managed2NativeCallMethod)imi->resolveDatas[__managed2NativeMethod])(((MethodInfo*)imi->resolveDatas[__methodInfo]), ((uint16_t*)&imi->resolveDatas[__argIdxs]), localVarBase, _ret); - ExpandLocaltionData2StackDataByType(_ret, (LocationDataType)__retLocaltionType); + ExpandLocationData2StackDataByType(_ret, (LocationDataType)__retLocationType); ip += 18; continue; } @@ -5031,7 +5031,7 @@ else \ uint32_t __methodInfo = *(uint32_t*)(ip + 6); uint32_t __argIdxs = *(uint32_t*)(ip + 10); uint16_t __ret = *(uint16_t*)(ip + 14); - uint8_t __retLocaltionType = *(uint8_t*)(ip + 16); + uint8_t __retLocationType = *(uint8_t*)(ip + 16); uint8_t ____pad__ = *(uint8_t*)(ip + 0); uint16_t* _argIdxData = ((uint16_t*)&imi->resolveDatas[__argIdxs]); StackObject* _objPtr = localVarBase + _argIdxData[0]; @@ -5056,7 +5056,7 @@ else \ else { ((Managed2NativeCallMethod)imi->resolveDatas[__managed2NativeMethod])(_actualMethod, _argIdxData, localVarBase, _ret); - ExpandLocaltionData2StackDataByType(_ret, (LocationDataType)__retLocaltionType); + ExpandLocationData2StackDataByType(_ret, (LocationDataType)__retLocationType); ip += 18; } continue; @@ -5114,11 +5114,11 @@ else \ uint32_t __methodInfo = *(uint32_t*)(ip + 6); uint32_t __argIdxs = *(uint32_t*)(ip + 10); uint16_t __ret = *(uint16_t*)(ip + 14); - uint8_t __retLocaltionType = *(uint8_t*)(ip + 16); + uint8_t __retLocationType = *(uint8_t*)(ip + 16); uint8_t ____pad__ = *(uint8_t*)(ip + 0); void* _ret = (void*)(localVarBase + __ret); ((Managed2NativeCallMethod)imi->resolveDatas[__managed2NativeMethod])(((MethodInfo*)imi->resolveDatas[__methodInfo]), ((uint16_t*)&imi->resolveDatas[__argIdxs]), localVarBase, _ret); - ExpandLocaltionData2StackDataByType(_ret, (LocationDataType)__retLocaltionType); + ExpandLocationData2StackDataByType(_ret, (LocationDataType)__retLocationType); ip += 18; continue; } @@ -5155,13 +5155,13 @@ else \ uint32_t __argIdxs = *(uint32_t*)(ip + 10); uint16_t __ret = *(uint16_t*)(ip + 14); uint16_t __invokeParamCount = *(uint16_t*)(ip + 16); - uint8_t __retLocaltionType = *(uint8_t*)(ip + 18); + uint8_t __retLocationType = *(uint8_t*)(ip + 18); uint8_t ____pad__ = *(uint8_t*)(ip + 0); uint16_t* _resolvedArgIdxs = ((uint16_t*)&imi->resolveDatas[__argIdxs]); Il2CppObject* __obj = localVarBase[_resolvedArgIdxs[0]].obj; void* _ret = (void*)(localVarBase + __ret); HiCallDelegate((Il2CppMulticastDelegate*)__obj, __invokeParamCount, ((Managed2NativeCallMethod)imi->resolveDatas[__managed2NativeStaticMethod]), ((Managed2NativeCallMethod)imi->resolveDatas[__managed2NativeInstanceMethod]), _resolvedArgIdxs, localVarBase, _ret); - ExpandLocaltionData2StackDataByType(_ret, (LocationDataType)__retLocaltionType); + ExpandLocationData2StackDataByType(_ret, (LocationDataType)__retLocationType); ip += 20; continue; } @@ -7578,57 +7578,57 @@ else \ case HiOpcodeEnum::InterlockedCompareExchangeVarVarVarVar_i4: { uint16_t __ret = *(uint16_t*)(ip + 2); - uint16_t __localtion = *(uint16_t*)(ip + 4); + uint16_t __location = *(uint16_t*)(ip + 4); uint16_t __value = *(uint16_t*)(ip + 6); uint16_t __comparand = *(uint16_t*)(ip + 8); - (*(int32_t*)(localVarBase + __ret)) = HiInterlockedCompareExchange((int32_t*)(*(void**)(localVarBase + __localtion)), (*(int32_t*)(localVarBase + __value)), (*(int32_t*)(localVarBase + __comparand))); + (*(int32_t*)(localVarBase + __ret)) = HiInterlockedCompareExchange((int32_t*)(*(void**)(localVarBase + __location)), (*(int32_t*)(localVarBase + __value)), (*(int32_t*)(localVarBase + __comparand))); ip += 10; continue; } case HiOpcodeEnum::InterlockedCompareExchangeVarVarVarVar_i8: { uint16_t __ret = *(uint16_t*)(ip + 2); - uint16_t __localtion = *(uint16_t*)(ip + 4); + uint16_t __location = *(uint16_t*)(ip + 4); uint16_t __value = *(uint16_t*)(ip + 6); uint16_t __comparand = *(uint16_t*)(ip + 8); - (*(int64_t*)(localVarBase + __ret)) = HiInterlockedCompareExchange((int64_t*)(*(void**)(localVarBase + __localtion)), (*(int64_t*)(localVarBase + __value)), (*(int64_t*)(localVarBase + __comparand))); + (*(int64_t*)(localVarBase + __ret)) = HiInterlockedCompareExchange((int64_t*)(*(void**)(localVarBase + __location)), (*(int64_t*)(localVarBase + __value)), (*(int64_t*)(localVarBase + __comparand))); ip += 10; continue; } case HiOpcodeEnum::InterlockedCompareExchangeVarVarVarVar_pointer: { uint16_t __ret = *(uint16_t*)(ip + 2); - uint16_t __localtion = *(uint16_t*)(ip + 4); + uint16_t __location = *(uint16_t*)(ip + 4); uint16_t __value = *(uint16_t*)(ip + 6); uint16_t __comparand = *(uint16_t*)(ip + 8); - (*(void**)(localVarBase + __ret)) = HiInterlockedCompareExchange((void**)(*(void**)(localVarBase + __localtion)), (*(void**)(localVarBase + __value)), (*(void**)(localVarBase + __comparand))); + (*(void**)(localVarBase + __ret)) = HiInterlockedCompareExchange((void**)(*(void**)(localVarBase + __location)), (*(void**)(localVarBase + __value)), (*(void**)(localVarBase + __comparand))); ip += 10; continue; } case HiOpcodeEnum::InterlockedExchangeVarVarVar_i4: { uint16_t __ret = *(uint16_t*)(ip + 2); - uint16_t __localtion = *(uint16_t*)(ip + 4); + uint16_t __location = *(uint16_t*)(ip + 4); uint16_t __value = *(uint16_t*)(ip + 6); - (*(int32_t*)(localVarBase + __ret)) = HiInterlockedExchange((int32_t*)(*(void**)(localVarBase + __localtion)), (*(int32_t*)(localVarBase + __value))); + (*(int32_t*)(localVarBase + __ret)) = HiInterlockedExchange((int32_t*)(*(void**)(localVarBase + __location)), (*(int32_t*)(localVarBase + __value))); ip += 8; continue; } case HiOpcodeEnum::InterlockedExchangeVarVarVar_i8: { uint16_t __ret = *(uint16_t*)(ip + 2); - uint16_t __localtion = *(uint16_t*)(ip + 4); + uint16_t __location = *(uint16_t*)(ip + 4); uint16_t __value = *(uint16_t*)(ip + 6); - (*(int64_t*)(localVarBase + __ret)) = HiInterlockedExchange((int64_t*)(*(void**)(localVarBase + __localtion)), (*(int64_t*)(localVarBase + __value))); + (*(int64_t*)(localVarBase + __ret)) = HiInterlockedExchange((int64_t*)(*(void**)(localVarBase + __location)), (*(int64_t*)(localVarBase + __value))); ip += 8; continue; } case HiOpcodeEnum::InterlockedExchangeVarVarVar_pointer: { uint16_t __ret = *(uint16_t*)(ip + 2); - uint16_t __localtion = *(uint16_t*)(ip + 4); + uint16_t __location = *(uint16_t*)(ip + 4); uint16_t __value = *(uint16_t*)(ip + 6); - (*(void**)(localVarBase + __ret)) = HiInterlockedExchange((void**)(*(void**)(localVarBase + __localtion)), (*(void**)(localVarBase + __value))); + (*(void**)(localVarBase + __ret)) = HiInterlockedExchange((void**)(*(void**)(localVarBase + __location)), (*(void**)(localVarBase + __value))); ip += 8; continue; } diff --git a/huatuo/transform/Transform.cpp b/huatuo/transform/Transform.cpp index 275d93d..3fc9afc 100644 --- a/huatuo/transform/Transform.cpp +++ b/huatuo/transform/Transform.cpp @@ -2508,7 +2508,7 @@ ip++; CreateAddIR(ir, InterlockedCompareExchangeVarVarVarVar_pointer); ir->ret = retIdx; - ir->localtion = locationIdx; + ir->location = locationIdx; ir->value = valueIdx; ir->comparand = comparandIdx; @@ -2547,7 +2547,7 @@ ip++; CreateAddIR(ir, InterlockedExchangeVarVarVar_pointer); ir->ret = retIdx; - ir->localtion = locationIdx; + ir->location = locationIdx; ir->value = valueIdx; const Il2CppType* paramType = GET_METHOD_PARAMETER_TYPE(shareMethod->parameters[1]); @@ -2798,7 +2798,7 @@ ip++; ir->methodInfo = methodDataIndex; ir->argIdxs = argIdxDataIndex; ir->ret = GetEvalStackTopOffset(); - ir->retLocaltionType = (uint8_t)locDataType; + ir->retLocationType = (uint8_t)locDataType; } else { @@ -2928,7 +2928,7 @@ ip++; ir->methodInfo = methodDataIndex; ir->argIdxs = argIdxDataIndex; ir->ret = retIdx; - ir->retLocaltionType = (uint8_t)locDataType; + ir->retLocationType = (uint8_t)locDataType; } else { @@ -2965,7 +2965,7 @@ ip++; ir->argIdxs = argIdxDataIndex; ir->ret = retIdx; ir->invokeParamCount = shareMethod->parameters_count; - ir->retLocaltionType = (uint8_t)locDataType; + ir->retLocationType = (uint8_t)locDataType; } else { @@ -3042,7 +3042,7 @@ ip++; ir->methodInfo = methodIdx; ir->argIdxs = argIdxDataIndex; ir->ret = GetEvalStackTopOffset(); - ir->retLocaltionType = (uint8_t)locDataType; + ir->retLocationType = (uint8_t)locDataType; } else {