mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Expose AllocStackCount
to corlib
This commit is contained in:
parent
b0aa27c82c
commit
111b785081
6 changed files with 19 additions and 3 deletions
|
@ -18,6 +18,12 @@ namespace System
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class Options
|
||||||
|
{
|
||||||
|
[LinkName("#AllocStackCount")]
|
||||||
|
public static extern int32 AllocStackCount;
|
||||||
|
}
|
||||||
|
|
||||||
[LinkName("#CallerLineNum")]
|
[LinkName("#CallerLineNum")]
|
||||||
public static extern int CallerLineNum;
|
public static extern int CallerLineNum;
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@ namespace System.Reflection
|
||||||
let objType = typeof(Object) as TypeInstance;
|
let objType = typeof(Object) as TypeInstance;
|
||||||
|
|
||||||
#if BF_ENABLE_OBJECT_DEBUG_FLAGS
|
#if BF_ENABLE_OBJECT_DEBUG_FLAGS
|
||||||
obj = Internal.Dbg_ObjectAlloc(mTypeClassVData, mInstSize, mInstAlign, 1);
|
obj = Internal.Dbg_ObjectAlloc(mTypeClassVData, mInstSize, mInstAlign, Compiler.Options.AllocStackCount);
|
||||||
#else
|
#else
|
||||||
void* mem = new [Align(16)] uint8[mInstSize]* (?);
|
void* mem = new [Align(16)] uint8[mInstSize]* (?);
|
||||||
obj = Internal.UnsafeCastToObject(mem);
|
obj = Internal.UnsafeCastToObject(mem);
|
||||||
|
|
|
@ -1187,7 +1187,7 @@ namespace System.Reflection
|
||||||
let genericType = GetGenericArg(0);
|
let genericType = GetGenericArg(0);
|
||||||
let arraySize = [Friend]mInstSize - genericType.Size + genericType.Stride * count;
|
let arraySize = [Friend]mInstSize - genericType.Size + genericType.Stride * count;
|
||||||
#if BF_ENABLE_OBJECT_DEBUG_FLAGS
|
#if BF_ENABLE_OBJECT_DEBUG_FLAGS
|
||||||
obj = Internal.Dbg_ObjectAlloc([Friend]mTypeClassVData, arraySize, [Friend]mInstAlign, 1);
|
obj = Internal.Dbg_ObjectAlloc([Friend]mTypeClassVData, arraySize, [Friend]mInstAlign, Compiler.Options.AllocStackCount);
|
||||||
#else
|
#else
|
||||||
void* mem = new [Align(16)] uint8[arraySize]* (?);
|
void* mem = new [Align(16)] uint8[arraySize]* (?);
|
||||||
obj = Internal.UnsafeCastToObject(mem);
|
obj = Internal.UnsafeCastToObject(mem);
|
||||||
|
|
|
@ -2,6 +2,12 @@ namespace System
|
||||||
{
|
{
|
||||||
class Compiler
|
class Compiler
|
||||||
{
|
{
|
||||||
|
public static class Options
|
||||||
|
{
|
||||||
|
[LinkName("#AllocStackCount")]
|
||||||
|
public static extern int32 AllocStackCount;
|
||||||
|
}
|
||||||
|
|
||||||
[LinkName("#CallerLineNum")]
|
[LinkName("#CallerLineNum")]
|
||||||
public static extern int CallerLineNum;
|
public static extern int CallerLineNum;
|
||||||
|
|
||||||
|
|
|
@ -1117,7 +1117,7 @@ namespace System.Reflection
|
||||||
let genericType = GetGenericArg(0);
|
let genericType = GetGenericArg(0);
|
||||||
let arraySize = [Friend]mInstSize - genericType.Size + genericType.Stride * count;
|
let arraySize = [Friend]mInstSize - genericType.Size + genericType.Stride * count;
|
||||||
#if BF_ENABLE_OBJECT_DEBUG_FLAGS
|
#if BF_ENABLE_OBJECT_DEBUG_FLAGS
|
||||||
obj = Internal.Dbg_ObjectAlloc([Friend]mTypeClassVData, arraySize, [Friend]mInstAlign, 1);
|
obj = Internal.Dbg_ObjectAlloc([Friend]mTypeClassVData, arraySize, [Friend]mInstAlign, Compiler.Options.AllocStackCount);
|
||||||
#else
|
#else
|
||||||
void* mem = new [Align(16)] uint8[arraySize]* (?);
|
void* mem = new [Align(16)] uint8[arraySize]* (?);
|
||||||
obj = Internal.UnsafeCastToObject(mem);
|
obj = Internal.UnsafeCastToObject(mem);
|
||||||
|
|
|
@ -13876,6 +13876,10 @@ BfTypedValue BfModule::GetCompilerFieldValue(const StringImpl& str)
|
||||||
if (mProject != NULL)
|
if (mProject != NULL)
|
||||||
return BfTypedValue(GetStringObjectValue(mProject->mName), ResolveTypeDef(mCompiler->mStringTypeDef));
|
return BfTypedValue(GetStringObjectValue(mProject->mName), ResolveTypeDef(mCompiler->mStringTypeDef));
|
||||||
}
|
}
|
||||||
|
if (str == "#AllocStackCount")
|
||||||
|
{
|
||||||
|
return BfTypedValue(mBfIRBuilder->CreateConst(BfTypeCode_Int32, mCompiler->mOptions.mAllocStackCount), GetPrimitiveType(BfTypeCode_Int32));
|
||||||
|
}
|
||||||
|
|
||||||
if (mCurMethodState->mMixinState != NULL)
|
if (mCurMethodState->mMixinState != NULL)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue