Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
runtime
提交
44ed52a8
R
runtime
项目概览
dotNET Platform
/
runtime
10 个月 前同步成功
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
runtime
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
44ed52a8
编写于
4月 18, 2020
作者:
A
Andrew Au
提交者:
GitHub
4月 18, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make GCToEEInterface::Get*ConfigValue check the runtimeconfig.json (#34797)
上级
cf66f084
变更
12
展开全部
隐藏空白更改
内联
并排
Showing
12 changed file
with
182 addition
and
177 deletion
+182
-177
src/coreclr/src/gc/env/gcenv.ee.h
src/coreclr/src/gc/env/gcenv.ee.h
+3
-3
src/coreclr/src/gc/gcconfig.cpp
src/coreclr/src/gc/gcconfig.cpp
+16
-15
src/coreclr/src/gc/gcconfig.h
src/coreclr/src/gc/gcconfig.h
+64
-86
src/coreclr/src/gc/gcenv.ee.standalone.inl
src/coreclr/src/gc/gcenv.ee.standalone.inl
+6
-6
src/coreclr/src/gc/gcinterface.ee.h
src/coreclr/src/gc/gcinterface.ee.h
+3
-3
src/coreclr/src/gc/sample/gcenv.ee.cpp
src/coreclr/src/gc/sample/gcenv.ee.cpp
+3
-3
src/coreclr/src/inc/configuration.h
src/coreclr/src/inc/configuration.h
+1
-1
src/coreclr/src/utilcode/configuration.cpp
src/coreclr/src/utilcode/configuration.cpp
+2
-2
src/coreclr/src/vm/eeconfig.cpp
src/coreclr/src/vm/eeconfig.cpp
+2
-8
src/coreclr/src/vm/eeconfig.h
src/coreclr/src/vm/eeconfig.h
+8
-14
src/coreclr/src/vm/gcenv.ee.cpp
src/coreclr/src/vm/gcenv.ee.cpp
+71
-33
src/coreclr/src/vm/gcenv.ee.h
src/coreclr/src/vm/gcenv.ee.h
+3
-3
未找到文件。
src/coreclr/src/gc/env/gcenv.ee.h
浏览文件 @
44ed52a8
...
...
@@ -73,9 +73,9 @@ public:
static
void
HandleFatalError
(
unsigned
int
exitCode
);
static
bool
EagerFinalized
(
Object
*
obj
);
static
MethodTable
*
GetFreeObjectMethodTable
();
static
bool
GetBooleanConfigValue
(
const
char
*
k
ey
,
bool
*
value
);
static
bool
GetIntConfigValue
(
const
char
*
k
ey
,
int64_t
*
value
);
static
bool
GetStringConfigValue
(
const
char
*
k
ey
,
const
char
**
value
);
static
bool
GetBooleanConfigValue
(
const
char
*
privateKey
,
const
char
*
publicK
ey
,
bool
*
value
);
static
bool
GetIntConfigValue
(
const
char
*
privateKey
,
const
char
*
publicK
ey
,
int64_t
*
value
);
static
bool
GetStringConfigValue
(
const
char
*
privateKey
,
const
char
*
publicK
ey
,
const
char
**
value
);
static
void
FreeStringConfigValue
(
const
char
*
key
);
static
bool
IsGCThread
();
static
bool
WasCurrentThreadCreatedByGC
();
...
...
src/coreclr/src/gc/gcconfig.cpp
浏览文件 @
44ed52a8
...
...
@@ -6,23 +6,23 @@
#include "gcenv.h"
#include "gc.h"
#define BOOL_CONFIG(name,
key, default, unused_doc)
\
bool GCConfig::Get##name() { return s_##name; } \
#define BOOL_CONFIG(name,
unused_private_key, unused_public_key, default, unused_doc)
\
bool GCConfig::Get##name() { return s_##name; }
\
bool GCConfig::s_##name = default;
#define INT_CONFIG(name,
key, default, unused_doc)
\
int64_t GCConfig::Get##name() { return s_##name; } \
#define INT_CONFIG(name,
unused_private_key, unused_public_key, default, unused_doc)
\
int64_t GCConfig::Get##name() { return s_##name; }
\
int64_t GCConfig::s_##name = default;
// String configs are not cached because 1) they are rare and
// not on hot paths and 2) they involve transfers of ownership
// of EE-allocated strings, which is potentially complicated.
#define STRING_CONFIG(name, key, unused_doc) \
GCConfigStringHolder GCConfig::Get##name() \
{ \
const char* resultStr = nullptr; \
GCToEEInterface::GetStringConfigValue(key, &resultStr); \
return GCConfigStringHolder(resultStr); \
#define STRING_CONFIG(name,
private_key, public_
key, unused_doc) \
GCConfigStringHolder GCConfig::Get##name()
\
{
\
const char* resultStr = nullptr;
\
GCToEEInterface::GetStringConfigValue(
private_key, public_
key, &resultStr); \
return GCConfigStringHolder(resultStr);
\
}
GC_CONFIGURATION_KEYS
...
...
@@ -33,18 +33,19 @@ GC_CONFIGURATION_KEYS
void
GCConfig
::
Initialize
()
{
#define BOOL_CONFIG(name, key, default, unused_doc) \
GCToEEInterface::GetBooleanConfigValue(key, &s_##name);
#define BOOL_CONFIG(name,
private_key, public_
key, default, unused_doc) \
GCToEEInterface::GetBooleanConfigValue(
private_key, public_
key, &s_##name);
#define INT_CONFIG(name, key, default, unused_doc) \
GCToEEInterface::GetIntConfigValue(key, &s_##name);
#define INT_CONFIG(name,
private_key, public_
key, default, unused_doc) \
GCToEEInterface::GetIntConfigValue(
private_key, public_
key, &s_##name);
#define STRING_CONFIG(unused_name, unused_key, unused_doc)
#define STRING_CONFIG(unused_name, unused_
private_key, unused_public_
key, unused_doc)
GC_CONFIGURATION_KEYS
#undef BOOL_CONFIG
#undef INT_CONFIG
#undef STRING_CONFIG
}
// Parse an integer index or range of two indices separated by '-'.
...
...
src/coreclr/src/gc/gcconfig.h
浏览文件 @
44ed52a8
此差异已折叠。
点击以展开。
src/coreclr/src/gc/gcenv.ee.standalone.inl
浏览文件 @
44ed52a8
...
...
@@ -203,22 +203,22 @@ inline MethodTable* GCToEEInterface::GetFreeObjectMethodTable()
return g_theGCToCLR->GetFreeObjectMethodTable();
}
inline bool GCToEEInterface::GetBooleanConfigValue(const char*
k
ey, bool* value)
inline bool GCToEEInterface::GetBooleanConfigValue(const char*
privateKey, const char* publicK
ey, bool* value)
{
assert(g_theGCToCLR != nullptr);
return g_theGCToCLR->GetBooleanConfigValue(
k
ey, value);
return g_theGCToCLR->GetBooleanConfigValue(
privateKey, publicK
ey, value);
}
inline bool GCToEEInterface::GetIntConfigValue(const char*
k
ey, int64_t* value)
inline bool GCToEEInterface::GetIntConfigValue(const char*
privateKey, const char* publicK
ey, int64_t* value)
{
assert(g_theGCToCLR != nullptr);
return g_theGCToCLR->GetIntConfigValue(
k
ey, value);
return g_theGCToCLR->GetIntConfigValue(
privateKey, publicK
ey, value);
}
inline bool GCToEEInterface::GetStringConfigValue(const char*
k
ey, const char** value)
inline bool GCToEEInterface::GetStringConfigValue(const char*
privateKey, const char* publicK
ey, const char** value)
{
assert(g_theGCToCLR != nullptr);
return g_theGCToCLR->GetStringConfigValue(
k
ey, value);
return g_theGCToCLR->GetStringConfigValue(
privateKey, publicK
ey, value);
}
inline void GCToEEInterface::FreeStringConfigValue(const char* value)
...
...
src/coreclr/src/gc/gcinterface.ee.h
浏览文件 @
44ed52a8
...
...
@@ -348,13 +348,13 @@ public:
// pointer is undefined. Otherwise, true is returned and the config key's value is written to
// the passed-in pointer.
virtual
bool
GetBooleanConfigValue
(
const
char
*
k
ey
,
bool
*
value
)
=
0
;
bool
GetBooleanConfigValue
(
const
char
*
privateKey
,
const
char
*
publicK
ey
,
bool
*
value
)
=
0
;
virtual
bool
GetIntConfigValue
(
const
char
*
k
ey
,
int64_t
*
value
)
=
0
;
bool
GetIntConfigValue
(
const
char
*
privateKey
,
const
char
*
publicK
ey
,
int64_t
*
value
)
=
0
;
virtual
bool
GetStringConfigValue
(
const
char
*
k
ey
,
const
char
**
value
)
=
0
;
bool
GetStringConfigValue
(
const
char
*
privateKey
,
const
char
*
publicK
ey
,
const
char
**
value
)
=
0
;
virtual
void
FreeStringConfigValue
(
const
char
*
value
)
=
0
;
...
...
src/coreclr/src/gc/sample/gcenv.ee.cpp
浏览文件 @
44ed52a8
...
...
@@ -275,17 +275,17 @@ bool GCToEEInterface::EagerFinalized(Object* obj)
return
false
;
}
bool
GCToEEInterface
::
GetBooleanConfigValue
(
const
char
*
k
ey
,
bool
*
value
)
bool
GCToEEInterface
::
GetBooleanConfigValue
(
const
char
*
privateKey
,
const
char
*
publicK
ey
,
bool
*
value
)
{
return
false
;
}
bool
GCToEEInterface
::
GetIntConfigValue
(
const
char
*
k
ey
,
int64_t
*
value
)
bool
GCToEEInterface
::
GetIntConfigValue
(
const
char
*
privateKey
,
const
char
*
publicK
ey
,
int64_t
*
value
)
{
return
false
;
}
bool
GCToEEInterface
::
GetStringConfigValue
(
const
char
*
k
ey
,
const
char
**
value
)
bool
GCToEEInterface
::
GetStringConfigValue
(
const
char
*
privateKey
,
const
char
*
publicK
ey
,
const
char
**
value
)
{
return
false
;
}
...
...
src/coreclr/src/inc/configuration.h
浏览文件 @
44ed52a8
...
...
@@ -35,7 +35,7 @@ public:
// in the traditional way separately if you need to.
//
// Returns value for name if found in config.
static
ULONGLONG
GetKnobULONGLONGValue
(
LPCWSTR
name
);
static
ULONGLONG
GetKnobULONGLONGValue
(
LPCWSTR
name
,
ULONGLONG
defaultValue
);
// Returns (in priority order):
// - The value of the ConfigStringInfo if it's set
...
...
src/coreclr/src/utilcode/configuration.cpp
浏览文件 @
44ed52a8
...
...
@@ -79,7 +79,7 @@ DWORD Configuration::GetKnobDWORDValue(LPCWSTR name, DWORD defaultValue)
return
defaultValue
;
}
ULONGLONG
Configuration
::
GetKnobULONGLONGValue
(
LPCWSTR
name
)
ULONGLONG
Configuration
::
GetKnobULONGLONGValue
(
LPCWSTR
name
,
ULONGLONG
defaultValue
)
{
LPCWSTR
knobValue
=
GetConfigurationValue
(
name
);
if
(
knobValue
!=
nullptr
)
...
...
@@ -87,7 +87,7 @@ ULONGLONG Configuration::GetKnobULONGLONGValue(LPCWSTR name)
return
_wcstoui64
(
knobValue
,
nullptr
,
0
);
}
return
0
;
return
defaultValue
;
}
LPCWSTR
Configuration
::
GetKnobStringValue
(
LPCWSTR
name
,
const
CLRConfig
::
ConfigStringInfo
&
stringInfo
)
...
...
src/coreclr/src/vm/eeconfig.cpp
浏览文件 @
44ed52a8
...
...
@@ -114,8 +114,6 @@ HRESULT EEConfig::Init()
iGCHoardVM
=
0
;
iGCLOHCompactionMode
=
0
;
iGCLOHThreshold
=
0
;
iGCHeapCount
=
0
;
iGCNoAffinitize
=
0
;
iGCAffinityMask
=
0
;
#ifdef GCTRIMCOMMIT
...
...
@@ -564,7 +562,7 @@ fTrackDynamicMethodDebugInfo = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_
#ifdef HOST_64BIT
iGCAffinityMask
=
GetConfigULONGLONG_DontUse_
(
CLRConfig
::
EXTERNAL_GCHeapAffinitizeMask
,
iGCAffinityMask
);
if
(
!
iGCAffinityMask
)
iGCAffinityMask
=
Configuration
::
GetKnobULONGLONGValue
(
W
(
"System.GC.HeapAffinitizeMask"
));
if
(
!
iGCAffinityMask
)
iGCAffinityMask
=
Configuration
::
GetKnobULONGLONGValue
(
W
(
"System.GC.HeapAffinitizeMask"
)
,
0
);
if
(
!
iGCSegmentSize
)
iGCSegmentSize
=
GetConfigULONGLONG_DontUse_
(
CLRConfig
::
UNSUPPORTED_GCSegmentSize
,
iGCSegmentSize
);
if
(
!
iGCgen0size
)
iGCgen0size
=
GetConfigULONGLONG_DontUse_
(
CLRConfig
::
UNSUPPORTED_GCgen0size
,
iGCgen0size
);
#else
...
...
@@ -574,11 +572,10 @@ fTrackDynamicMethodDebugInfo = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_
if
(
!
iGCgen0size
)
iGCgen0size
=
GetConfigDWORD_DontUse_
(
CLRConfig
::
UNSUPPORTED_GCgen0size
,
iGCgen0size
);
#endif //HOST_64BIT
const
ULONGLONG
ullHeapHardLimit
=
Configuration
::
GetKnobULONGLONGValue
(
W
(
"System.GC.HeapHardLimit"
));
const
ULONGLONG
ullHeapHardLimit
=
Configuration
::
GetKnobULONGLONGValue
(
W
(
"System.GC.HeapHardLimit"
)
,
0
);
iGCHeapHardLimit
=
FitsIn
<
size_t
,
ULONGLONG
>
(
ullHeapHardLimit
)
?
static_cast
<
size_t
>
(
ullHeapHardLimit
)
:
ClrSafeInt
<
size_t
>::
MaxInt
();
iGCHeapHardLimitPercent
=
Configuration
::
GetKnobDWORDValue
(
W
(
"System.GC.HeapHardLimitPercent"
),
0
);
if
(
g_IGCHoardVM
)
iGCHoardVM
=
g_IGCHoardVM
;
...
...
@@ -639,9 +636,6 @@ fTrackDynamicMethodDebugInfo = CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_
#endif
iGCForceCompact
=
GetConfigDWORD_DontUse_
(
CLRConfig
::
UNSUPPORTED_gcForceCompact
,
iGCForceCompact
);
iGCNoAffinitize
=
Configuration
::
GetKnobBooleanValue
(
W
(
"System.GC.NoAffinitize"
),
CLRConfig
::
EXTERNAL_GCNoAffinitize
);
iGCHeapCount
=
Configuration
::
GetKnobDWORDValue
(
W
(
"System.GC.HeapCount"
),
CLRConfig
::
EXTERNAL_GCHeapCount
);
fStressLog
=
GetConfigDWORD_DontUse_
(
CLRConfig
::
UNSUPPORTED_StressLog
,
fStressLog
)
!=
0
;
fForceEnc
=
GetConfigDWORD_DontUse_
(
CLRConfig
::
UNSUPPORTED_ForceEnc
,
fForceEnc
)
!=
0
;
...
...
src/coreclr/src/vm/eeconfig.h
浏览文件 @
44ed52a8
...
...
@@ -399,27 +399,24 @@ public:
GCStressFlags
GetGCStressLevel
()
const
{
WRAPPER_NO_CONTRACT
;
SUPPORTS_DAC
;
return
GCStressFlags
(
iGCStress
);
}
#endif
bool
IsGCBreakOnOOMEnabled
()
const
{
LIMITED_METHOD_CONTRACT
;
return
fGCBreakOnOOM
;
}
bool
IsGCBreakOnOOMEnabled
()
const
{
LIMITED_METHOD_CONTRACT
;
return
fGCBreakOnOOM
;
}
size_t
GetGCgen0size
()
const
{
LIMITED_METHOD_CONTRACT
;
return
iGCgen0size
;
}
void
SetGCgen0size
(
size_t
iSize
)
{
LIMITED_METHOD_CONTRACT
;
iGCgen0size
=
iSize
;
}
size_t
GetSegmentSize
()
const
{
LIMITED_METHOD_CONTRACT
;
return
iGCSegmentSize
;
}
void
SetSegmentSize
(
size_t
iSize
)
{
LIMITED_METHOD_CONTRACT
;
iGCSegmentSize
=
iSize
;
}
size_t
GetGCgen0size
()
const
{
LIMITED_METHOD_CONTRACT
;
return
iGCgen0size
;
}
void
SetGCgen0size
(
size_t
iSize
)
{
LIMITED_METHOD_CONTRACT
;
iGCgen0size
=
iSize
;
}
size_t
GetSegmentSize
()
const
{
LIMITED_METHOD_CONTRACT
;
return
iGCSegmentSize
;
}
void
SetSegmentSize
(
size_t
iSize
)
{
LIMITED_METHOD_CONTRACT
;
iGCSegmentSize
=
iSize
;
}
int
GetGCconcurrent
()
const
{
LIMITED_METHOD_CONTRACT
;
return
iGCconcurrent
;
}
void
SetGCconcurrent
(
int
val
)
{
LIMITED_METHOD_CONTRACT
;
iGCconcurrent
=
val
;
}
int
GetGCconcurrent
()
const
{
LIMITED_METHOD_CONTRACT
;
return
iGCconcurrent
;
}
void
SetGCconcurrent
(
int
val
)
{
LIMITED_METHOD_CONTRACT
;
iGCconcurrent
=
val
;
}
#ifdef _DEBUG
int
GetGCLatencyMode
()
const
{
LIMITED_METHOD_CONTRACT
;
return
iGCLatencyMode
;
}
int
GetGCLatencyMode
()
const
{
LIMITED_METHOD_CONTRACT
;
return
iGCLatencyMode
;
}
#endif //_DEBUG
int
GetGCForceCompact
()
const
{
LIMITED_METHOD_CONTRACT
;
return
iGCForceCompact
;
}
int
GetGCRetainVM
()
const
{
LIMITED_METHOD_CONTRACT
;
return
iGCHoardVM
;}
DWORD
GetGCLOHThreshold
()
const
{
LIMITED_METHOD_CONTRACT
;
return
iGCLOHThreshold
;}
int
GetGCLOHCompactionMode
()
const
{
LIMITED_METHOD_CONTRACT
;
return
iGCLOHCompactionMode
;}
int
GetGCHeapCount
()
const
{
LIMITED_METHOD_CONTRACT
;
return
iGCHeapCount
;}
int
GetGCNoAffinitize
()
const
{
LIMITED_METHOD_CONTRACT
;
return
iGCNoAffinitize
;}
size_t
GetGCAffinityMask
()
const
{
LIMITED_METHOD_CONTRACT
;
return
iGCAffinityMask
;}
size_t
GetGCHeapHardLimit
()
const
{
LIMITED_METHOD_CONTRACT
;
return
iGCHeapHardLimit
;}
int
GetGCHeapHardLimitPercent
()
const
{
LIMITED_METHOD_CONTRACT
;
return
iGCHeapHardLimitPercent
;}
#ifdef GCTRIMCOMMIT
...
...
@@ -698,11 +695,8 @@ private: //----------------------------------------------------------------
int
iGCHoardVM
;
int
iGCLOHCompactionMode
;
DWORD
iGCLOHThreshold
;
int
iGCHeapCount
;
int
iGCNoAffinitize
;
size_t
iGCAffinityMask
;
size_t
iGCHeapHardLimit
;
int
iGCHeapHardLimitPercent
;
#ifdef GCTRIMCOMMIT
...
...
src/coreclr/src/vm/gcenv.ee.cpp
浏览文件 @
44ed52a8
...
...
@@ -1023,7 +1023,7 @@ MethodTable* GCToEEInterface::GetFreeObjectMethodTable()
// longer than these lengths.
const
size_t
MaxConfigKeyLength
=
255
;
bool
GCToEEInterface
::
GetBooleanConfigValue
(
const
char
*
k
ey
,
bool
*
value
)
bool
GCToEEInterface
::
GetBooleanConfigValue
(
const
char
*
privateKey
,
const
char
*
publicK
ey
,
bool
*
value
)
{
CONTRACTL
{
NOTHROW
;
...
...
@@ -1031,32 +1031,26 @@ bool GCToEEInterface::GetBooleanConfigValue(const char* key, bool* value)
}
CONTRACTL_END
;
// these configuration values are given to us via startup flags.
if
(
strcmp
(
k
ey
,
"gcServer"
)
==
0
)
if
(
strcmp
(
privateK
ey
,
"gcServer"
)
==
0
)
{
*
value
=
g_heap_type
==
GC_HEAP_SVR
;
return
true
;
}
if
(
strcmp
(
k
ey
,
"gcConcurrent"
)
==
0
)
if
(
strcmp
(
privateK
ey
,
"gcConcurrent"
)
==
0
)
{
*
value
=
!!
g_pConfig
->
GetGCconcurrent
();
return
true
;
}
if
(
strcmp
(
k
ey
,
"GCRetainVM"
)
==
0
)
if
(
strcmp
(
privateK
ey
,
"GCRetainVM"
)
==
0
)
{
*
value
=
!!
g_pConfig
->
GetGCRetainVM
();
return
true
;
}
if
(
strcmp
(
key
,
"GCLargePages"
)
==
0
)
{
*
value
=
Configuration
::
GetKnobBooleanValue
(
W
(
"System.GC.LargePages"
),
CLRConfig
::
GetConfigValue
(
CLRConfig
::
EXTERNAL_GCLargePages
));
return
true
;
}
WCHAR
configKey
[
MaxConfigKeyLength
];
if
(
MultiByteToWideChar
(
CP_ACP
,
0
,
k
ey
,
-
1
/* key is null-terminated */
,
configKey
,
MaxConfigKeyLength
)
==
0
)
if
(
MultiByteToWideChar
(
CP_ACP
,
0
,
privateK
ey
,
-
1
/* key is null-terminated */
,
configKey
,
MaxConfigKeyLength
)
==
0
)
{
// whatever this is... it's not something we care about. (It was too long, wasn't unicode, etc.)
return
false
;
...
...
@@ -1069,49 +1063,56 @@ bool GCToEEInterface::GetBooleanConfigValue(const char* key, bool* value)
*
value
=
CLRConfig
::
GetConfigValue
(
info
)
!=
0
;
return
true
;
}
else
if
(
publicKey
!=
NULL
)
{
if
(
MultiByteToWideChar
(
CP_ACP
,
0
,
publicKey
,
-
1
/* key is null-terminated */
,
configKey
,
MaxConfigKeyLength
)
==
0
)
{
// whatever this is... it's not something we care about. (It was too long, wasn't unicode, etc.)
return
false
;
}
if
(
Configuration
::
GetKnobStringValue
(
configKey
)
!=
NULL
)
{
*
value
=
Configuration
::
GetKnobBooleanValue
(
configKey
,
false
);
return
true
;
}
}
return
false
;
}
bool
GCToEEInterface
::
GetIntConfigValue
(
const
char
*
k
ey
,
int64_t
*
value
)
bool
GCToEEInterface
::
GetIntConfigValue
(
const
char
*
privateKey
,
const
char
*
publicK
ey
,
int64_t
*
value
)
{
CONTRACTL
{
NOTHROW
;
GC_NOTRIGGER
;
}
CONTRACTL_END
;
if
(
strcmp
(
k
ey
,
"GCSegmentSize"
)
==
0
)
if
(
strcmp
(
privateK
ey
,
"GCSegmentSize"
)
==
0
)
{
*
value
=
g_pConfig
->
GetSegmentSize
();
return
true
;
}
if
(
strcmp
(
k
ey
,
"GCgen0size"
)
==
0
)
if
(
strcmp
(
privateK
ey
,
"GCgen0size"
)
==
0
)
{
*
value
=
g_pConfig
->
GetGCgen0size
();
return
true
;
}
if
(
strcmp
(
k
ey
,
"GCHeapHardLimit"
)
==
0
)
if
(
strcmp
(
privateK
ey
,
"GCHeapHardLimit"
)
==
0
)
{
*
value
=
g_pConfig
->
GetGCHeapHardLimit
();
return
true
;
}
if
(
strcmp
(
key
,
"GCHeapHardLimitPercent"
)
==
0
)
{
*
value
=
g_pConfig
->
GetGCHeapHardLimitPercent
();
return
true
;
}
if
(
strcmp
(
key
,
"GCLOHThreshold"
)
==
0
)
if
(
strcmp
(
privateKey
,
"GCLOHThreshold"
)
==
0
)
{
*
value
=
g_pConfig
->
GetGCLOHThreshold
();
return
true
;
}
WCHAR
configKey
[
MaxConfigKeyLength
];
if
(
MultiByteToWideChar
(
CP_ACP
,
0
,
k
ey
,
-
1
/* key is null-terminated */
,
configKey
,
MaxConfigKeyLength
)
==
0
)
if
(
MultiByteToWideChar
(
CP_ACP
,
0
,
privateK
ey
,
-
1
/* key is null-terminated */
,
configKey
,
MaxConfigKeyLength
)
==
0
)
{
// whatever this is... it's not something we care about. (It was too long, wasn't unicode, etc.)
return
false
;
...
...
@@ -1146,11 +1147,24 @@ bool GCToEEInterface::GetIntConfigValue(const char* key, int64_t* value)
CLRConfig
::
FreeConfigString
(
out
);
return
true
;
}
else
if
(
publicKey
!=
NULL
)
{
if
(
MultiByteToWideChar
(
CP_ACP
,
0
,
publicKey
,
-
1
/* key is null-terminated */
,
configKey
,
MaxConfigKeyLength
)
==
0
)
{
// whatever this is... it's not something we care about. (It was too long, wasn't unicode, etc.)
return
false
;
}
if
(
Configuration
::
GetKnobStringValue
(
configKey
)
!=
NULL
)
{
*
value
=
Configuration
::
GetKnobULONGLONGValue
(
configKey
,
0
);
return
true
;
}
}
return
false
;
}
bool
GCToEEInterface
::
GetStringConfigValue
(
const
char
*
k
ey
,
const
char
**
value
)
bool
GCToEEInterface
::
GetStringConfigValue
(
const
char
*
privateKey
,
const
char
*
publicK
ey
,
const
char
**
value
)
{
CONTRACTL
{
NOTHROW
;
...
...
@@ -1158,18 +1172,30 @@ bool GCToEEInterface::GetStringConfigValue(const char* key, const char** value)
}
CONTRACTL_END
;
WCHAR
configKey
[
MaxConfigKeyLength
];
if
(
MultiByteToWideChar
(
CP_ACP
,
0
,
k
ey
,
-
1
/* key is null-terminated */
,
configKey
,
MaxConfigKeyLength
)
==
0
)
if
(
MultiByteToWideChar
(
CP_ACP
,
0
,
privateK
ey
,
-
1
/* key is null-terminated */
,
configKey
,
MaxConfigKeyLength
)
==
0
)
{
// whatever this is... it's not something we care about. (It was too long, wasn't unicode, etc.)
return
false
;
}
CLRConfig
::
ConfigStringInfo
info
{
configKey
,
CLRConfig
::
EEConfig_default
};
LPWSTR
out
=
CLRConfig
::
GetConfigValue
(
info
);
if
(
!
out
)
LPWSTR
fromClrConfig
=
CLRConfig
::
GetConfigValue
(
info
);
LPCWSTR
out
=
fromClrConfig
;
if
(
out
==
NULL
)
{
// config not found
return
false
;
if
(
publicKey
!=
NULL
)
{
if
(
MultiByteToWideChar
(
CP_ACP
,
0
,
publicKey
,
-
1
/* key is null-terminated */
,
configKey
,
MaxConfigKeyLength
)
==
0
)
{
// whatever this is... it's not something we care about. (It was too long, wasn't unicode, etc.)
return
false
;
}
out
=
Configuration
::
GetKnobStringValue
(
configKey
);
if
(
out
==
NULL
)
{
return
false
;
}
}
}
int
charCount
=
WideCharToMultiByte
(
CP_ACP
,
0
,
out
,
-
1
/* out is null-terminated */
,
NULL
,
0
,
nullptr
,
nullptr
);
...
...
@@ -1177,7 +1203,10 @@ bool GCToEEInterface::GetStringConfigValue(const char* key, const char** value)
{
// this should only happen if the config subsystem gives us a string that's not valid
// unicode.
CLRConfig
::
FreeConfigString
(
out
);
if
(
fromClrConfig
)
{
CLRConfig
::
FreeConfigString
(
fromClrConfig
);
}
return
false
;
}
...
...
@@ -1185,7 +1214,10 @@ bool GCToEEInterface::GetStringConfigValue(const char* key, const char** value)
AStringHolder
configResult
=
new
(
nothrow
)
char
[
charCount
];
if
(
!
configResult
)
{
CLRConfig
::
FreeConfigString
(
out
);
if
(
fromClrConfig
)
{
CLRConfig
::
FreeConfigString
(
fromClrConfig
);
}
return
false
;
}
...
...
@@ -1195,12 +1227,18 @@ bool GCToEEInterface::GetStringConfigValue(const char* key, const char** value)
// this should never happen, the previous call to WideCharToMultiByte that computed the charCount should
// have caught all issues.
assert
(
false
);
CLRConfig
::
FreeConfigString
(
out
);
if
(
fromClrConfig
)
{
CLRConfig
::
FreeConfigString
(
fromClrConfig
);
}
return
false
;
}
*
value
=
configResult
.
Extract
();
CLRConfig
::
FreeConfigString
(
out
);
if
(
fromClrConfig
)
{
CLRConfig
::
FreeConfigString
(
fromClrConfig
);
}
return
true
;
}
...
...
src/coreclr/src/vm/gcenv.ee.h
浏览文件 @
44ed52a8
...
...
@@ -64,9 +64,9 @@ public:
void
HandleFatalError
(
unsigned
int
exitCode
);
bool
EagerFinalized
(
Object
*
obj
);
MethodTable
*
GetFreeObjectMethodTable
();
bool
GetBooleanConfigValue
(
const
char
*
k
ey
,
bool
*
value
);
bool
GetIntConfigValue
(
const
char
*
k
ey
,
int64_t
*
value
);
bool
GetStringConfigValue
(
const
char
*
k
ey
,
const
char
**
value
);
bool
GetBooleanConfigValue
(
const
char
*
privateKey
,
const
char
*
publicK
ey
,
bool
*
value
);
bool
GetIntConfigValue
(
const
char
*
privateKey
,
const
char
*
publicK
ey
,
int64_t
*
value
);
bool
GetStringConfigValue
(
const
char
*
privateKey
,
const
char
*
publicK
ey
,
const
char
**
value
);
void
FreeStringConfigValue
(
const
char
*
value
);
bool
IsGCThread
();
bool
WasCurrentThreadCreatedByGC
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录