mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-17 15:46:05 +02:00
Added reflection category to distinct build options (wip)
This commit is contained in:
parent
5cb6570e14
commit
037b2ac1e4
15 changed files with 538 additions and 94 deletions
|
@ -9,6 +9,25 @@ namespace IDE.Compiler
|
|||
{
|
||||
public class BfSystem
|
||||
{
|
||||
enum BfOptionFlags
|
||||
{
|
||||
RuntimeChecks = 1,
|
||||
InitLocalVariables = 2,
|
||||
EmitDynamicCastCheck = 4,
|
||||
EmitObjectAccessCheck = 8,
|
||||
|
||||
ReflectAlwaysIncludeType = 0x10,
|
||||
ReflectAlwaysIncludeAll = 0x20,
|
||||
ReflectAssumeInstantiated = 0x40,
|
||||
ReflectStaticFields = 0x80,
|
||||
ReflectNonStaticFields = 0x100,
|
||||
ReflectStaticMethods = 0x200,
|
||||
ReflectNonStaticMethods = 0x400,
|
||||
ReflectConstructors = 0x800,
|
||||
|
||||
All = 0xFFF
|
||||
};
|
||||
|
||||
[CallingConvention(.Stdcall), CLink]
|
||||
static extern void BfSystem_CheckLock(void* bfSystem);
|
||||
|
||||
|
@ -37,8 +56,8 @@ namespace IDE.Compiler
|
|||
static extern void BfSystem_ClearTypeOptions(void* bfSystem);
|
||||
|
||||
[CallingConvention(.Stdcall), CLink]
|
||||
static extern void BfSystem_AddTypeOptions(void* bfSystem, char8* filter, int32 simdSetting, int32 optimizationLevel, int32 emitDebugInfo, int32 runtimeChecks,
|
||||
int32 initLocalVariables, int32 emitDynamicCastCheck, int32 emitObjectAccessCheck, int32 allocStackTraceDepth);
|
||||
static extern void BfSystem_AddTypeOptions(void* bfSystem, char8* filter, int32 simdSetting, int32 optimizationLevel, int32 emitDebugInfo, int32 andFlags, int32 orFlags,
|
||||
int32 allocStackTraceDepth, char8* reflectMethodFilter);
|
||||
|
||||
[CallingConvention(.Stdcall), CLink]
|
||||
static extern void* BfSystem_CreateParser(void* bfSystem, void* bfProject);
|
||||
|
@ -343,25 +362,52 @@ namespace IDE.Compiler
|
|||
BfSystem_ClearTypeOptions(mNativeBfSystem);
|
||||
}
|
||||
|
||||
public void AddTypeOptions(String filter, BuildOptions.SIMDSetting? simdSetting, BuildOptions.BfOptimizationLevel? optimizationLevel, BuildOptions.EmitDebugInfo? emitDebugInfo, bool? runtimeChecks,
|
||||
bool? initLocalVariables, bool? emitDynamicCastCheck, bool? emitObjectAccessCheck, int32? allocStackTraceDepth)
|
||||
public void AddTypeOptions(String filter, BuildOptions.SIMDSetting? simdSetting, BuildOptions.BfOptimizationLevel? optimizationLevel, BuildOptions.EmitDebugInfo? emitDebugInfo, BfOptionFlags andFlags, BfOptionFlags orFlags, int32? allocStackTraceDepth, String reflectMethodFilter)
|
||||
{
|
||||
int32 simdSettingInt = (simdSetting == null) ? -1 : (int32)simdSetting.Value;
|
||||
int32 optimizationLevelInt = (optimizationLevel == null) ? -1 : (int32)optimizationLevel.Value;
|
||||
int32 emitDebugInfoInt = (emitDebugInfo == null) ? -1 : (int32)emitDebugInfo.Value;
|
||||
int32 runtimeChecksInt = (runtimeChecks == null) ? -1 : runtimeChecks.Value ? 1 : 0;
|
||||
/*int32 runtimeChecksInt = (runtimeChecks == null) ? -1 : runtimeChecks.Value ? 1 : 0;
|
||||
int32 initLocalVariablesInt = (initLocalVariables == null) ? -1 : initLocalVariables.Value ? 1 : 0;
|
||||
int32 emitDynamicCastCheckInt = (emitDynamicCastCheck == null) ? -1 : emitDynamicCastCheck.Value ? 1 : 0;
|
||||
int32 emitObjectAccessCheckInt = (emitObjectAccessCheck == null) ? -1 : emitObjectAccessCheck.Value ? 1 : 0;
|
||||
int32 emitObjectAccessCheckInt = (emitObjectAccessCheck == null) ? -1 : emitObjectAccessCheck.Value ? 1 : 0;*/
|
||||
int32 allocStackTraceDepthInt = (allocStackTraceDepth == null) ? -1 : allocStackTraceDepth.Value;
|
||||
BfSystem_AddTypeOptions(mNativeBfSystem, filter, simdSettingInt, optimizationLevelInt, emitDebugInfoInt, runtimeChecksInt,
|
||||
initLocalVariablesInt, emitDynamicCastCheckInt, emitObjectAccessCheckInt, allocStackTraceDepthInt);
|
||||
BfSystem_AddTypeOptions(mNativeBfSystem, filter, simdSettingInt, optimizationLevelInt, emitDebugInfoInt, (.)andFlags, (.)orFlags, allocStackTraceDepthInt, reflectMethodFilter);
|
||||
}
|
||||
|
||||
public void AddTypeOptions(DistinctBuildOptions typeOption)
|
||||
{
|
||||
AddTypeOptions(typeOption.mFilter, typeOption.mBfSIMDSetting, typeOption.mBfOptimizationLevel, typeOption.mEmitDebugInfo, typeOption.mRuntimeChecks,
|
||||
typeOption.mInitLocalVariables, typeOption.mEmitDynamicCastCheck, typeOption.mEmitObjectAccessCheck, typeOption.mAllocStackTraceDepth);
|
||||
BfOptionFlags andFlags = .All;
|
||||
BfOptionFlags orFlags = 0;
|
||||
|
||||
void SetFlag(bool? val, BfOptionFlags flag)
|
||||
{
|
||||
if (val == false)
|
||||
andFlags &= ~flag;
|
||||
if (val == true)
|
||||
orFlags |= flag;
|
||||
}
|
||||
|
||||
switch (typeOption.mReflectAlwaysInclude)
|
||||
{
|
||||
case .NotSet:
|
||||
case .No:
|
||||
andFlags &= ~(.ReflectAlwaysIncludeType | .ReflectAlwaysIncludeAll | .ReflectAssumeInstantiated);
|
||||
case .IncludeType:
|
||||
orFlags |= .ReflectAssumeInstantiated;
|
||||
case .AssumeInstantiated:
|
||||
orFlags |= .ReflectAssumeInstantiated;
|
||||
case .IncludeAll:
|
||||
orFlags |= .ReflectAlwaysIncludeType | .ReflectAlwaysIncludeAll | .ReflectAssumeInstantiated;
|
||||
}
|
||||
|
||||
SetFlag(typeOption.mReflectStaticFields, .ReflectStaticFields);
|
||||
SetFlag(typeOption.mReflectNonStaticFields, .ReflectNonStaticFields);
|
||||
SetFlag(typeOption.mReflectStaticMethods, .ReflectStaticMethods);
|
||||
SetFlag(typeOption.mReflectNonStaticMethods, .ReflectNonStaticMethods);
|
||||
SetFlag(typeOption.mReflectConstructors, .ReflectConstructors);
|
||||
|
||||
AddTypeOptions(typeOption.mFilter, typeOption.mBfSIMDSetting, typeOption.mBfOptimizationLevel, typeOption.mEmitDebugInfo, andFlags, orFlags, typeOption.mAllocStackTraceDepth, typeOption.mReflectMethodFilter);
|
||||
}
|
||||
|
||||
public void Log(String str)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue