mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 03:28:20 +02:00
Added JEMalloc/TCMalloc options
This commit is contained in:
parent
652142e189
commit
8c16454006
7 changed files with 89 additions and 28 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -27,4 +27,5 @@ builds/*
|
||||||
wasm/*
|
wasm/*
|
||||||
BeefPerf.txt
|
BeefPerf.txt
|
||||||
IDE/Tests/Rando
|
IDE/Tests/Rando
|
||||||
install/
|
install/
|
||||||
|
JEMalloc/
|
|
@ -708,7 +708,7 @@ namespace IDE
|
||||||
outPdbPath.Append(".pdb");
|
outPdbPath.Append(".pdb");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void GetRtLibNames(Workspace.PlatformType platformType, Workspace.Options workspaceOptions, Project.Options options, bool dynName, String outRt, String outDbg)
|
public static void GetRtLibNames(Workspace.PlatformType platformType, Workspace.Options workspaceOptions, Project.Options options, bool dynName, String outRt, String outDbg, String outAlloc)
|
||||||
{
|
{
|
||||||
if ((platformType == .Linux) || (platformType == .macOS) || (platformType == .iOS))
|
if ((platformType == .Linux) || (platformType == .macOS) || (platformType == .iOS))
|
||||||
{
|
{
|
||||||
|
@ -748,6 +748,16 @@ namespace IDE
|
||||||
outDbg.Append("_d");
|
outDbg.Append("_d");
|
||||||
outDbg.Append(dynName ? ".dll" : ".lib");
|
outDbg.Append(dynName ? ".dll" : ".lib");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((workspaceOptions.mAllocType == .TCMalloc) || (workspaceOptions.mAllocType == .TCMalloc_Debug) ||
|
||||||
|
(workspaceOptions.mAllocType == .JEMalloc) || (workspaceOptions.mAllocType == .JEMalloc_Debug))
|
||||||
|
{
|
||||||
|
outAlloc.Append(((workspaceOptions.mAllocType == .TCMalloc) || (workspaceOptions.mAllocType == .TCMalloc_Debug)) ? "TCMalloc" : "JEMalloc");
|
||||||
|
outAlloc.Append((Workspace.PlatformType.GetPtrSizeByName(gApp.mPlatformName) == 4) ? "32" : "64");
|
||||||
|
if ((workspaceOptions.mAllocType == .TCMalloc_Debug) || (workspaceOptions.mAllocType == .JEMalloc_Debug))
|
||||||
|
outAlloc.Append("_d");
|
||||||
|
outAlloc.Append(dynName ? ".dll" : ".lib");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CopyLibFiles(String targetPath, Workspace.Options workspaceOptions, Project.Options options)
|
bool CopyLibFiles(String targetPath, Workspace.Options workspaceOptions, Project.Options options)
|
||||||
|
@ -775,21 +785,17 @@ namespace IDE
|
||||||
|
|
||||||
String rtName = scope String();
|
String rtName = scope String();
|
||||||
String dbgName = scope String();
|
String dbgName = scope String();
|
||||||
GetRtLibNames(mPlatformType, workspaceOptions, options, true, rtName, dbgName);
|
String allocName = scope String();
|
||||||
|
GetRtLibNames(mPlatformType, workspaceOptions, options, true, rtName, dbgName, allocName);
|
||||||
if (!rtName.IsEmpty)
|
if (!rtName.IsEmpty)
|
||||||
if (!AddLib(rtName))
|
if (!AddLib(rtName))
|
||||||
return false;
|
return false;
|
||||||
if (!dbgName.IsEmpty)
|
if (!dbgName.IsEmpty)
|
||||||
if (!AddLib(dbgName))
|
if (!AddLib(dbgName))
|
||||||
return false;
|
return false;
|
||||||
switch (workspaceOptions.mAllocType)
|
if (!allocName.IsEmpty)
|
||||||
{
|
if (!AddLib(allocName))
|
||||||
case .JEMalloc:
|
|
||||||
if (!AddLib("jemalloc.dll"))
|
|
||||||
return false;
|
return false;
|
||||||
default:
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -751,12 +751,12 @@ namespace IDE.Compiler
|
||||||
case .CRT:
|
case .CRT:
|
||||||
mallocLinkName = "malloc";
|
mallocLinkName = "malloc";
|
||||||
freeLinkName = "free";
|
freeLinkName = "free";
|
||||||
case .JEMalloc:
|
case .JEMalloc, .JEMalloc_Debug:
|
||||||
mallocLinkName = "je_malloc";
|
mallocLinkName = "je_malloc";
|
||||||
freeLinkName = "je_free";
|
freeLinkName = "je_free";
|
||||||
case .TCMalloc:
|
case .TCMalloc, .TCMalloc_Debug:
|
||||||
mallocLinkName = "tcmalloc";
|
mallocLinkName = "tc_malloc";
|
||||||
freeLinkName = "tcfree";
|
freeLinkName = "tc_free";
|
||||||
case .Custom:
|
case .Custom:
|
||||||
mallocLinkName = options.mAllocMalloc;
|
mallocLinkName = options.mAllocMalloc;
|
||||||
freeLinkName = options.mAllocFree;
|
freeLinkName = options.mAllocFree;
|
||||||
|
|
|
@ -9979,7 +9979,8 @@ namespace IDE
|
||||||
let platformType = Workspace.PlatformType.GetFromName(platformName, workspaceOptions.mTargetTriple);
|
let platformType = Workspace.PlatformType.GetFromName(platformName, workspaceOptions.mTargetTriple);
|
||||||
String rtName = scope String();
|
String rtName = scope String();
|
||||||
String dbgName = scope String();
|
String dbgName = scope String();
|
||||||
BuildContext.GetRtLibNames(platformType, workspaceOptions, options, false, rtName, dbgName);
|
String allocName = scope String();
|
||||||
|
BuildContext.GetRtLibNames(platformType, workspaceOptions, options, false, rtName, dbgName, allocName);
|
||||||
|
|
||||||
switch (platformType)
|
switch (platformType)
|
||||||
{
|
{
|
||||||
|
@ -9987,14 +9988,8 @@ namespace IDE
|
||||||
newString.Append(rtName);
|
newString.Append(rtName);
|
||||||
if (!dbgName.IsEmpty)
|
if (!dbgName.IsEmpty)
|
||||||
newString.Append(" ", dbgName);
|
newString.Append(" ", dbgName);
|
||||||
switch (workspaceOptions.mAllocType)
|
if (!allocName.IsEmpty)
|
||||||
{
|
newString.Append(" ", allocName);
|
||||||
case .JEMalloc:
|
|
||||||
newString.Append(" jemalloc.lib");
|
|
||||||
case .TCMalloc:
|
|
||||||
newString.Append(" tcmalloc.lib");
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
case .macOS:
|
case .macOS:
|
||||||
newString.AppendF("./{} -Wl,-rpath -Wl,@executable_path", rtName);
|
newString.AppendF("./{} -Wl,-rpath -Wl,@executable_path", rtName);
|
||||||
case .iOS:
|
case .iOS:
|
||||||
|
|
|
@ -218,7 +218,9 @@ namespace IDE
|
||||||
Stomp,
|
Stomp,
|
||||||
CRT,
|
CRT,
|
||||||
JEMalloc,
|
JEMalloc,
|
||||||
|
JEMalloc_Debug,
|
||||||
TCMalloc,
|
TCMalloc,
|
||||||
|
TCMalloc_Debug,
|
||||||
Custom
|
Custom
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -734,7 +734,7 @@ namespace IDE.ui
|
||||||
AddPropertiesItem(category, "Incremental Build", "mIncrementalBuild");
|
AddPropertiesItem(category, "Incremental Build", "mIncrementalBuild");
|
||||||
AddPropertiesItem(category, "Intermediate Type", "mIntermediateType");
|
AddPropertiesItem(category, "Intermediate Type", "mIntermediateType");
|
||||||
var (allocCategory, allocPropEntry) = AddPropertiesItem(category, "Memory Allocator", "mAllocType",
|
var (allocCategory, allocPropEntry) = AddPropertiesItem(category, "Memory Allocator", "mAllocType",
|
||||||
scope String[] ("Debug", "Stomp (Debug)", "CRT", "JEMalloc", "TCMalloc"));
|
scope String[] ("Debug", "Stomp (Debug)", "CRT", "JEMalloc", "JEMalloc Debug", "TCMalloc", "TCMalloc Debug"));
|
||||||
var (mallocItem, mallocPropEntry) = AddPropertiesItem(allocCategory, "Malloc", "mAllocMalloc");
|
var (mallocItem, mallocPropEntry) = AddPropertiesItem(allocCategory, "Malloc", "mAllocMalloc");
|
||||||
var (freeItem, freePropEntry) = AddPropertiesItem(allocCategory, "Free", "mAllocFree");
|
var (freeItem, freePropEntry) = AddPropertiesItem(allocCategory, "Free", "mAllocFree");
|
||||||
allocPropEntry.mOnUpdate.Add(new () =>
|
allocPropEntry.mOnUpdate.Add(new () =>
|
||||||
|
@ -769,15 +769,15 @@ namespace IDE.ui
|
||||||
mallocSubItem.Label = "malloc";
|
mallocSubItem.Label = "malloc";
|
||||||
freeSubItem.Label = "free";
|
freeSubItem.Label = "free";
|
||||||
}
|
}
|
||||||
else if (allocType == .JEMalloc)
|
else if ((allocType == .JEMalloc) || (allocType == .JEMalloc_Debug))
|
||||||
{
|
{
|
||||||
mallocSubItem.Label = "je_malloc";
|
mallocSubItem.Label = "je_malloc";
|
||||||
freeSubItem.Label = "je_free";
|
freeSubItem.Label = "je_free";
|
||||||
}
|
}
|
||||||
else if (allocType == .TCMalloc)
|
else if ((allocType == .TCMalloc) || (allocType == .TCMalloc_Debug))
|
||||||
{
|
{
|
||||||
mallocSubItem.Label = "tcmalloc";
|
mallocSubItem.Label = "tc_malloc";
|
||||||
freeSubItem.Label = "tcfree";
|
freeSubItem.Label = "tc_free";
|
||||||
}
|
}
|
||||||
|
|
||||||
mallocSubItem.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, 0xFFC0C0C0);
|
mallocSubItem.mTextColor = Color.Mult(DarkTheme.COLOR_TEXT, 0xFFC0C0C0);
|
||||||
|
|
|
@ -46,6 +46,44 @@ IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
||||||
CALL bin\msbuild.bat BeefRT\BeefDbg\BeefDbg.vcxproj /p:Configuration="Release Static CStatic" /p:Platform=x64 /p:SolutionDir=%cd%\ /v:m %MSBUILD_FLAGS%
|
CALL bin\msbuild.bat BeefRT\BeefDbg\BeefDbg.vcxproj /p:Configuration="Release Static CStatic" /p:Platform=x64 /p:SolutionDir=%cd%\ /v:m %MSBUILD_FLAGS%
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
||||||
|
|
||||||
|
@ECHO ---- Building TCMalloc64 (Debug) ----
|
||||||
|
CALL bin\msbuild.bat BeefRT\TCMalloc\TCMalloc.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:SolutionDir=%cd%\ /v:m %MSBUILD_FLAGS%
|
||||||
|
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
||||||
|
@ECHO ---- Building TCMalloc64 (Debug Static) ----
|
||||||
|
CALL bin\msbuild.bat BeefRT\TCMalloc\TCMalloc.vcxproj /p:Configuration="Debug Static" /p:Platform=x64 /p:SolutionDir=%cd%\ /v:m %MSBUILD_FLAGS%
|
||||||
|
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
||||||
|
@ECHO ---- Building TCMalloc64 (Debug Static CStatic) ----
|
||||||
|
CALL bin\msbuild.bat BeefRT\TCMalloc\TCMalloc.vcxproj /p:Configuration="Debug Static CStatic" /p:Platform=x64 /p:SolutionDir=%cd%\ /v:m %MSBUILD_FLAGS%
|
||||||
|
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
||||||
|
@ECHO ---- Building TCMalloc64 (Release) ----
|
||||||
|
CALL bin\msbuild.bat BeefRT\TCMalloc\TCMalloc.vcxproj /p:Configuration=Release /p:Platform=x64 /p:SolutionDir=%cd%\ /v:m %MSBUILD_FLAGS%
|
||||||
|
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
||||||
|
@ECHO ---- Building TCMalloc64 (Release Static) ----
|
||||||
|
CALL bin\msbuild.bat BeefRT\TCMalloc\TCMalloc.vcxproj /p:Configuration="Release Static" /p:Platform=x64 /p:SolutionDir=%cd%\ /v:m %MSBUILD_FLAGS%
|
||||||
|
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
||||||
|
@ECHO ---- Building TCMalloc64 (Release Static CStatic) ----
|
||||||
|
CALL bin\msbuild.bat BeefRT\TCMalloc\TCMalloc.vcxproj /p:Configuration="Release Static CStatic" /p:Platform=x64 /p:SolutionDir=%cd%\ /v:m %MSBUILD_FLAGS%
|
||||||
|
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
||||||
|
|
||||||
|
@ECHO ---- Building JEMalloc64 (Debug) ----
|
||||||
|
CALL bin\msbuild.bat BeefRT\JEMalloc\JEMalloc.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:SolutionDir=%cd%\BeefRT\JEMalloc\ /v:m %MSBUILD_FLAGS%
|
||||||
|
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
||||||
|
@ECHO ---- Building JEMalloc64 (Debug Static) ----
|
||||||
|
CALL bin\msbuild.bat BeefRT\JEMalloc\JEMalloc.vcxproj /p:Configuration="Debug Static" /p:Platform=x64 /p:SolutionDir=%cd%\BeefRT\JEMalloc\ /v:m %MSBUILD_FLAGS%
|
||||||
|
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
||||||
|
@ECHO ---- Building JEMalloc64 (Debug Static CStatic) ----
|
||||||
|
CALL bin\msbuild.bat BeefRT\JEMalloc\JEMalloc.vcxproj /p:Configuration="Debug Static CStatic" /p:Platform=x64 /p:SolutionDir=%cd%\BeefRT\JEMalloc\ /v:m %MSBUILD_FLAGS%
|
||||||
|
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
||||||
|
@ECHO ---- Building JEMalloc64 (Release) ----
|
||||||
|
CALL bin\msbuild.bat BeefRT\JEMalloc\JEMalloc.vcxproj /p:Configuration=Release /p:Platform=x64 /p:SolutionDir=%cd%\BeefRT\JEMalloc\ /v:m %MSBUILD_FLAGS%
|
||||||
|
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
||||||
|
@ECHO ---- Building JEMalloc64 (Release Static) ----
|
||||||
|
CALL bin\msbuild.bat BeefRT\JEMalloc\JEMalloc.vcxproj /p:Configuration="Release Static" /p:Platform=x64 /p:SolutionDir=%cd%\BeefRT\JEMalloc\ /v:m %MSBUILD_FLAGS%
|
||||||
|
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
||||||
|
@ECHO ---- Building JEMalloc64 (Release Static CStatic) ----
|
||||||
|
CALL bin\msbuild.bat BeefRT\JEMalloc\JEMalloc.vcxproj /p:Configuration="Release Static CStatic" /p:Platform=x64 /p:SolutionDir=%cd%\BeefRT\JEMalloc\ /v:m %MSBUILD_FLAGS%
|
||||||
|
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
||||||
|
|
||||||
@ECHO ---- Building MinRT (Debug) ----
|
@ECHO ---- Building MinRT (Debug) ----
|
||||||
CALL bin\msbuild.bat BeefRT\MinRT\MinRT.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:SolutionDir=%cd%\ /v:m %MSBUILD_FLAGS%
|
CALL bin\msbuild.bat BeefRT\MinRT\MinRT.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:SolutionDir=%cd%\ /v:m %MSBUILD_FLAGS%
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
||||||
|
@ -99,6 +137,25 @@ IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
||||||
CALL bin\msbuild.bat BeefRT\BeefDbg\BeefDbg.vcxproj /p:Configuration="Release Static CStatic" /p:Platform=Win32 /p:SolutionDir=%cd%\ /v:m %MSBUILD_FLAGS%
|
CALL bin\msbuild.bat BeefRT\BeefDbg\BeefDbg.vcxproj /p:Configuration="Release Static CStatic" /p:Platform=Win32 /p:SolutionDir=%cd%\ /v:m %MSBUILD_FLAGS%
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
||||||
|
|
||||||
|
@ECHO ---- Building TCMalloc32 (Debug) ----
|
||||||
|
CALL bin\msbuild.bat BeefRT\TCMalloc\TCMalloc.vcxproj /p:Configuration=Debug /p:Platform=Win32 /p:SolutionDir=%cd%\ /v:m %MSBUILD_FLAGS%
|
||||||
|
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
||||||
|
@ECHO ---- Building TCMalloc32 (Debug Static) ----
|
||||||
|
CALL bin\msbuild.bat BeefRT\TCMalloc\TCMalloc.vcxproj /p:Configuration="Debug Static" /p:Platform=Win32 /p:SolutionDir=%cd%\ /v:m %MSBUILD_FLAGS%
|
||||||
|
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
||||||
|
@ECHO ---- Building TCMalloc32 (Debug Static CStatic) ----
|
||||||
|
CALL bin\msbuild.bat BeefRT\TCMalloc\TCMalloc.vcxproj /p:Configuration="Debug Static CStatic" /p:Platform=Win32 /p:SolutionDir=%cd%\ /v:m %MSBUILD_FLAGS%
|
||||||
|
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
||||||
|
@ECHO ---- Building TCMalloc32 (Release) ----
|
||||||
|
CALL bin\msbuild.bat BeefRT\TCMalloc\TCMalloc.vcxproj /p:Configuration=Release /p:Platform=Win32 /p:SolutionDir=%cd%\ /v:m %MSBUILD_FLAGS%
|
||||||
|
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
||||||
|
@ECHO ---- Building TCMalloc32 (Release Static) ----
|
||||||
|
CALL bin\msbuild.bat BeefRT\TCMalloc\TCMalloc.vcxproj /p:Configuration="Release Static" /p:Platform=Win32 /p:SolutionDir=%cd%\ /v:m %MSBUILD_FLAGS%
|
||||||
|
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
||||||
|
@ECHO ---- Building TCMalloc32 (Release Static CStatic) ----
|
||||||
|
CALL bin\msbuild.bat BeefRT\TCMalloc\TCMalloc.vcxproj /p:Configuration="Release Static CStatic" /p:Platform=Win32 /p:SolutionDir=%cd%\ /v:m %MSBUILD_FLAGS%
|
||||||
|
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
||||||
|
|
||||||
@ECHO ---- Building MinRT (Debug) ----
|
@ECHO ---- Building MinRT (Debug) ----
|
||||||
CALL bin\msbuild.bat BeefRT\MinRT\MinRT.vcxproj /p:Configuration=Debug /p:Platform=Win32 /p:SolutionDir=%cd%\ /v:m %MSBUILD_FLAGS%
|
CALL bin\msbuild.bat BeefRT\MinRT\MinRT.vcxproj /p:Configuration=Debug /p:Platform=Win32 /p:SolutionDir=%cd%\ /v:m %MSBUILD_FLAGS%
|
||||||
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
IF %ERRORLEVEL% NEQ 0 GOTO FAILED
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue