[refactor] 重构methodPointer,微小调整了桥接函数生成

main
walon 2022-10-14 11:44:30 +08:00
parent 2899d13d60
commit 823877275c
8 changed files with 9 additions and 12 deletions

View File

@ -1,4 +1,4 @@
#include "MethodBridge.h"
#include "MethodBridge.h"
#include <codegen/il2cpp-codegen-metadata.h>
#include "vm/ClassInlines.h"
@ -13,7 +13,6 @@
#include "InstrinctDef.h"
using namespace hybridclr::interpreter;
using hybridclr::GetInterpreterDirectlyCallMethodPointer;
#if HYBRIDCLR_ABI_ARM_64
//!!!{{INVOKE_STUB

View File

@ -1,4 +1,4 @@
#include "MethodBridge.h"
#include "MethodBridge.h"
#include <codegen/il2cpp-codegen-metadata.h>
#include "vm/ClassInlines.h"
@ -13,7 +13,6 @@
#include "InstrinctDef.h"
using namespace hybridclr::interpreter;
using hybridclr::GetInterpreterDirectlyCallMethodPointer;
#if HYBRIDCLR_ABI_UNIVERSAL_32
//!!!{{INVOKE_STUB

View File

@ -1,4 +1,4 @@
#include "MethodBridge.h"
#include "MethodBridge.h"
#include <codegen/il2cpp-codegen-metadata.h>
#include "vm/ClassInlines.h"
@ -13,7 +13,6 @@
#include "InstrinctDef.h"
using namespace hybridclr::interpreter;
using hybridclr::GetInterpreterDirectlyCallMethodPointer;
#if HYBRIDCLR_ABI_UNIVERSAL_64
//!!!{{INVOKE_STUB

View File

@ -58,7 +58,7 @@ namespace HybridCLR.Editor.MethodBridge
static void __M2N_{method.CreateCallSigName()}(const MethodInfo* method, uint16_t* argVarIndexs, StackObject* localVarBase, void* ret)
{{
typedef {method.ReturnInfo.Type.GetTypeName()} (*NativeMethod)({paramListStr});
{(!method.ReturnInfo.IsVoid ? $"*({method.ReturnInfo.Type.GetTypeName()}*)ret = " : "")}((NativeMethod)(GetInterpreterDirectlyCallMethodPointer(method)))({paramNameListStr});
{(!method.ReturnInfo.IsVoid ? $"*({method.ReturnInfo.Type.GetTypeName()}*)ret = " : "")}((NativeMethod)(method->methodPointerCallByInterp))({paramNameListStr});
}}
");
}

View File

@ -41,7 +41,7 @@ namespace HybridCLR.Editor.MethodBridge
static void __M2N_{method.CreateCallSigName()}(const MethodInfo* method, uint16_t* argVarIndexs, StackObject* localVarBase, void* ret)
{{
typedef {method.ReturnInfo.Type.GetTypeName()} (*NativeMethod)({paramListStr});
{(!method.ReturnInfo.IsVoid ? $"*({method.ReturnInfo.Type.GetTypeName()}*)ret = " : "")}((NativeMethod)(GetInterpreterDirectlyCallMethodPointer(method)))({paramNameListStr});
{(!method.ReturnInfo.IsVoid ? $"*({method.ReturnInfo.Type.GetTypeName()}*)ret = " : "")}((NativeMethod)(method->methodPointerCallByInterp))({paramNameListStr});
}}
");
}

View File

@ -39,7 +39,7 @@ namespace HybridCLR.Editor.MethodBridge
static void __M2N_{method.CreateCallSigName()}(const MethodInfo* method, uint16_t* argVarIndexs, StackObject* localVarBase, void* ret)
{{
typedef {method.ReturnInfo.Type.GetTypeName()} (*NativeMethod)({paramListStr});
{(!method.ReturnInfo.IsVoid ? $"*({method.ReturnInfo.Type.GetTypeName()}*)ret = " : "")}((NativeMethod)(GetInterpreterDirectlyCallMethodPointer(method)))({paramNameListStr});
{(!method.ReturnInfo.IsVoid ? $"*({method.ReturnInfo.Type.GetTypeName()}*)ret = " : "")}((NativeMethod)(method->methodPointerCallByInterp))({paramNameListStr});
}}
");
}

View File

@ -27,12 +27,12 @@ namespace HybridCLR.Editor
public string outputAOTGenericReferenceFile = "HybridCLRData/Generated/AOTGenericReferences.cs";
[Header("AOT泛型实例化搜索迭代次数")]
public int maxGenericReferenceIteration = 4;
public int maxGenericReferenceIteration = 10;
[Header("预留MonoPInvokeCallbackAttribute函数个数")]
public int ReversePInvokeWrapperCount = 10;
[Header("MethodBridge泛型搜索迭代次数")]
public int maxMethodBridgeGenericIteration = 4;
public int maxMethodBridgeGenericIteration = 10;
}
}

View File

@ -1,6 +1,6 @@
{
"name": "com.focus-creative-games.hybridclr_unity",
"version": "0.3.9",
"version": "0.4.0",
"displayName": "HybridCLR",
"description": "Unity package for HybridCLR. It includes editor and runtime scripts and assets for HybridCLR",
"category": "Runtime",