8.2版本上传

This commit is contained in:
2025-06-12 18:00:06 +08:00
parent a10df85379
commit 6a881f2e8a
263 changed files with 9063 additions and 1338 deletions

View File

@@ -3,8 +3,8 @@ namespace HybridCLR
{
public enum HomologousImageMode
{
Consistent, // AOT dll需要跟主工程精确一致即为裁剪后的AO dll
SuperSet, // AOT dll不需要跟主工程精确一致但必须包含裁剪后的AOT dll的所有元数据即为裁剪后dll的超集。推荐使用原始aot dll
Consistent,
SuperSet,
}
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: bfb72a4a8e158ab4f9dd2552f7d662a1
guid: 0f0351553ad90e74aa586746b5965ded
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 006be2ba6588a8b4989d3724bb01d8b7
guid: 13ba8ce62aa80c74598530029cb2d649
AssemblyDefinitionImporter:
externalObjects: {}
userData:

View File

@@ -4,12 +4,13 @@ namespace HybridCLR
public enum LoadImageErrorCode
{
OK = 0,
BAD_IMAGE, // dll 不合法
NOT_IMPLEMENT, // 不支持的元数据特性
AOT_ASSEMBLY_NOT_FIND, // 对应的AOT assembly未找到
HOMOLOGOUS_ONLY_SUPPORT_AOT_ASSEMBLY, // 不能给解释器assembly补充元数据
HOMOLOGOUS_ASSEMBLY_HAS_LOADED, // 已经补充过了,不能再次补充
INVALID_HOMOLOGOUS_MODE, // 非法HomologousImageMode
};
BAD_IMAGE, // invalid dll file
NOT_IMPLEMENT, // not implement feature
AOT_ASSEMBLY_NOT_FIND, // AOT assembly not found
HOMOLOGOUS_ONLY_SUPPORT_AOT_ASSEMBLY, // can not load supplementary metadata assembly for non-AOT assembly
HOMOLOGOUS_ASSEMBLY_HAS_LOADED, // can not load supplementary metadata assembly for the same assembly
INVALID_HOMOLOGOUS_MODE, // invalid homologous image mode
PDB_BAD_FILE, // invalid pdb file
};
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 6982c52ba05eada40bd1f38a1b719daa
guid: 2c7d5b71981fba643b4c21ed01bcb675
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: a9ad08231091388419452f4b3318e4f3
guid: f99dd22d9d81b2540b4663b3bcdf0a79
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -6,13 +6,16 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using UnityEditor;
using UnityEngine.Scripting;
namespace HybridCLR
{
[Preserve]
public static class RuntimeApi
{
/// <summary>
/// 加载补充元数据assembly
/// load supplementary metadata assembly
/// </summary>
/// <param name="dllBytes"></param>
/// <returns></returns>
@@ -28,7 +31,38 @@ namespace HybridCLR
#endif
/// <summary>
/// 获取解释器线程栈的最大StackObject个数(size*8 为最终占用的内存大小)
/// prejit method to avoid the jit cost of first time running
/// </summary>
/// <param name="method"></param>
/// <returns>return true if method is jited, return false if method can't be jited </returns>
///
#if UNITY_EDITOR
public static bool PreJitMethod(MethodInfo method)
{
return false;
}
#else
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern bool PreJitMethod(MethodInfo method);
#endif
/// <summary>
/// prejit all methods of class to avoid the jit cost of first time running
/// </summary>
/// <param name="type"></param>
/// <returns>return true if class is jited, return false if class can't be jited </returns>
#if UNITY_EDITOR
public static bool PreJitClass(Type type)
{
return false;
}
#else
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern bool PreJitClass(Type type);
#endif
/// <summary>
/// get the maximum number of StackObjects in the interpreter thread stack (size*8 represents the final memory size occupied
/// </summary>
/// <returns></returns>
public static int GetInterpreterThreadObjectStackSize()
@@ -37,17 +71,17 @@ namespace HybridCLR
}
/// <summary>
/// 设置解释器线程栈的最大StackObject个数(size*8 为最终占用的内存大小)
/// set the maximum number of StackObjects for the interpreter thread stack (size*8 represents the final memory size occupied)
/// </summary>
/// <param name="size"></param>
public static void SetInterpreterThreadObjectStackSize(int size)
{
SetRuntimeOption(RuntimeOptionId.InterpreterThreadObjectStackSize, size);
}
/// <summary>
/// 获取解释器线程函数帧数量(sizeof(InterpreterFrame)*size 为最终占用的内存大小)
/// get the number of interpreter thread function frames (sizeof(InterpreterFrame)*size represents the final memory size occupied)
/// </summary>
/// <returns></returns>
public static int GetInterpreterThreadFrameStackSize()
@@ -56,7 +90,7 @@ namespace HybridCLR
}
/// <summary>
/// 设置解释器线程函数帧数量(sizeof(InterpreterFrame)*size 为最终占用的内存大小)
/// set the number of interpreter thread function frames (sizeof(InterpreterFrame)*size represents the final memory size occupied)
/// </summary>
/// <param name="size"></param>
public static void SetInterpreterThreadFrameStackSize(int size)
@@ -69,6 +103,11 @@ namespace HybridCLR
private static readonly Dictionary<RuntimeOptionId, int> s_runtimeOptions = new Dictionary<RuntimeOptionId, int>();
/// <summary>
/// set runtime option value
/// </summary>
/// <param name="optionId"></param>
/// <param name="value"></param>
public static void SetRuntimeOption(RuntimeOptionId optionId, int value)
{
s_runtimeOptions[optionId] = value;
@@ -78,6 +117,11 @@ namespace HybridCLR
public static extern void SetRuntimeOption(RuntimeOptionId optionId, int value);
#endif
/// <summary>
/// get runtime option value
/// </summary>
/// <param name="optionId"></param>
/// <returns></returns>
#if UNITY_EDITOR
public static int GetRuntimeOption(RuntimeOptionId optionId)
{

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: a6b8a4a760dd0a14e92007d5e5aab70a
guid: 0d58bdc22b6d6b54ab6791baf16a0a3d
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@@ -5,5 +5,8 @@
InterpreterThreadObjectStackSize = 1,
InterpreterThreadFrameStackSize = 2,
ThreadExceptionFlowSize = 3,
MaxMethodBodyCacheSize = 4,
MaxMethodInlineDepth = 5,
MaxInlineableMethodBodySize = 6,
}
}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 926f1f78d8ea7d24c91951ad5bbf0208
guid: 64be598b47302644a96013c74d945653
MonoImporter:
externalObjects: {}
serializedVersion: 2