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
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -28,3 +28,4 @@ wasm/*
|
|||
BeefPerf.txt
|
||||
IDE/Tests/Rando
|
||||
install/
|
||||
JEMalloc/
|
|
@ -708,7 +708,7 @@ namespace IDE
|
|||
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))
|
||||
{
|
||||
|
@ -748,6 +748,16 @@ namespace IDE
|
|||
outDbg.Append("_d");
|
||||
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)
|
||||
|
@ -775,21 +785,17 @@ namespace IDE
|
|||
|
||||
String rtName = 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 (!AddLib(rtName))
|
||||
return false;
|
||||
if (!dbgName.IsEmpty)
|
||||
if (!AddLib(dbgName))
|
||||
return false;
|
||||
switch (workspaceOptions.mAllocType)
|
||||
{
|
||||
case .JEMalloc:
|
||||
if (!AddLib("jemalloc.dll"))
|
||||
if (!allocName.IsEmpty)
|
||||
if (!AddLib(allocName))
|
||||
return false;
|
||||
default:
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -751,12 +751,12 @@ namespace IDE.Compiler
|
|||
case .CRT:
|
||||
mallocLinkName = "malloc";
|
||||
freeLinkName = "free";
|
||||
case .JEMalloc:
|
||||
case .JEMalloc, .JEMalloc_Debug:
|
||||
mallocLinkName = "je_malloc";
|
||||
freeLinkName = "je_free";
|
||||
case .TCMalloc:
|
||||
mallocLinkName = "tcmalloc";
|
||||
freeLinkName = "tcfree";
|
||||
case .TCMalloc, .TCMalloc_Debug:
|
||||
mallocLinkName = "tc_malloc";
|
||||
freeLinkName = "tc_free";
|
||||
case .Custom:
|
||||
mallocLinkName = options.mAllocMalloc;
|
||||
freeLinkName = options.mAllocFree;
|
||||
|
|
|
@ -9979,7 +9979,8 @@ namespace IDE
|
|||
let platformType = Workspace.PlatformType.GetFromName(platformName, workspaceOptions.mTargetTriple);
|
||||
String rtName = 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)
|
||||
{
|
||||
|
@ -9987,14 +9988,8 @@ namespace IDE
|
|||
newString.Append(rtName);
|
||||
if (!dbgName.IsEmpty)
|
||||
newString.Append(" ", dbgName);
|
||||
switch (workspaceOptions.mAllocType)
|
||||
{
|
||||
case .JEMalloc:
|
||||
newString.Append(" jemalloc.lib");
|
||||
case .TCMalloc:
|
||||
newString.Append(" tcmalloc.lib");
|
||||
default:
|
||||
}
|
||||
if (!allocName.IsEmpty)
|
||||
newString.Append(" ", allocName);
|
||||
case .macOS:
|
||||
newString.AppendF("./{} -Wl,-rpath -Wl,@executable_path", rtName);
|
||||
case .iOS:
|
||||
|
|
|
@ -218,7 +218,9 @@ namespace IDE
|
|||
Stomp,
|
||||
CRT,
|
||||
JEMalloc,
|
||||
JEMalloc_Debug,
|
||||
TCMalloc,
|
||||
TCMalloc_Debug,
|
||||
Custom
|
||||
}
|
||||
|
||||
|
|
|
@ -734,7 +734,7 @@ namespace IDE.ui
|
|||
AddPropertiesItem(category, "Incremental Build", "mIncrementalBuild");
|
||||
AddPropertiesItem(category, "Intermediate Type", "mIntermediateType");
|
||||
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 (freeItem, freePropEntry) = AddPropertiesItem(allocCategory, "Free", "mAllocFree");
|
||||
allocPropEntry.mOnUpdate.Add(new () =>
|
||||
|
@ -769,15 +769,15 @@ namespace IDE.ui
|
|||
mallocSubItem.Label = "malloc";
|
||||
freeSubItem.Label = "free";
|
||||
}
|
||||
else if (allocType == .JEMalloc)
|
||||
else if ((allocType == .JEMalloc) || (allocType == .JEMalloc_Debug))
|
||||
{
|
||||
mallocSubItem.Label = "je_malloc";
|
||||
freeSubItem.Label = "je_free";
|
||||
}
|
||||
else if (allocType == .TCMalloc)
|
||||
else if ((allocType == .TCMalloc) || (allocType == .TCMalloc_Debug))
|
||||
{
|
||||
mallocSubItem.Label = "tcmalloc";
|
||||
freeSubItem.Label = "tcfree";
|
||||
mallocSubItem.Label = "tc_malloc";
|
||||
freeSubItem.Label = "tc_free";
|
||||
}
|
||||
|
||||
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%
|
||||
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) ----
|
||||
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
|
||||
|
@ -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%
|
||||
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) ----
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue