Skip to content

Commit

Permalink
[opt] 优化AOT泛型实例化函数缺失时抛出的异常信息。
Browse files Browse the repository at this point in the history
  • Loading branch information
pirunxi committed May 21, 2022
1 parent 324a148 commit e651f24
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions huatuo/CommonDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ namespace huatuo
return name;
}

inline void RaiseMethodPointerNotImplementException(const MethodInfo* method)
inline void RaiseAOTGenericMethodNotInstantiatedException(const MethodInfo* method)
{
std::string methodName = GetMethodNameWithSignature(method);
TEMP_FORMAT(errMsg, "MethodPointerNotImplement %s", methodName.c_str());
TEMP_FORMAT(errMsg, "AOT generic method isn't instantiated in aot module. %s", methodName.c_str());
il2cpp::vm::Exception::Raise(il2cpp::vm::Exception::GetMissingMethodException(errMsg));
}

Expand Down
6 changes: 3 additions & 3 deletions huatuo/interpreter/Interpreter_Execute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4976,7 +4976,7 @@ else \
{
if (_actualMethod->methodPointer == nullptr)
{
RaiseMethodPointerNotImplementException(_actualMethod);
RaiseAOTGenericMethodNotInstantiatedException(_actualMethod);
}
((Managed2NativeCallMethod)imi->resolveDatas[__managed2NativeMethod])(_actualMethod, _argIdxData, localVarBase, nullptr);
ip += 14;
Expand Down Expand Up @@ -5013,7 +5013,7 @@ else \
{
if (_actualMethod->methodPointer == nullptr)
{
RaiseMethodPointerNotImplementException(_actualMethod);
RaiseAOTGenericMethodNotInstantiatedException(_actualMethod);
}
((Managed2NativeCallMethod)imi->resolveDatas[__managed2NativeMethod])(_actualMethod, _argIdxData, localVarBase, _ret);
ip += 16;
Expand Down Expand Up @@ -5052,7 +5052,7 @@ else \
{
if (_actualMethod->methodPointer == nullptr)
{
RaiseMethodPointerNotImplementException(_actualMethod);
RaiseAOTGenericMethodNotInstantiatedException(_actualMethod);
}
((Managed2NativeCallMethod)imi->resolveDatas[__managed2NativeMethod])(_actualMethod, _argIdxData, localVarBase, _ret);
ExpandLocationData2StackDataByType(_ret, (LocationDataType)__retLocationType);
Expand Down
4 changes: 2 additions & 2 deletions huatuo/transform/Transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2737,7 +2737,7 @@ ip++;

if (!shareMethod->invoker_method || !shareMethod->methodPointer)
{
RaiseMethodPointerNotImplementException(shareMethod);
RaiseAOTGenericMethodNotInstantiatedException(shareMethod);
}

uint32_t methodDataIndex = GetOrAddResolveDataIndex(ptr2DataIdxs, resolveDatas, shareMethod);
Expand Down Expand Up @@ -4111,7 +4111,7 @@ ip++;

if (!shareMethod->methodPointer)
{
RaiseMethodPointerNotImplementException(shareMethod);
RaiseAOTGenericMethodNotInstantiatedException(shareMethod);
}
int32_t callArgEvalStackIdxBase = evalStackTop - shareMethod->parameters_count;
IL2CPP_ASSERT(callArgEvalStackIdxBase >= 0);
Expand Down

0 comments on commit e651f24

Please sign in to comment.