Skip to content

Commit

Permalink
Use mimalloc
Browse files Browse the repository at this point in the history
  • Loading branch information
blairmcg committed Dec 15, 2024
1 parent 500480b commit 19615c6
Show file tree
Hide file tree
Showing 36 changed files with 482 additions and 2,719 deletions.
14 changes: 14 additions & 0 deletions Core/DolphinVM/Compiler/Compiler.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
<ModuleDefinitionFile>.\Compiler.def</ModuleDefinitionFile>
<DataExecutionPrevention />
<ImportLibrary>.\Release/DolphinCR008.lib</ImportLibrary>
<AdditionalLibraryDirectories>$(SolutionDir)..\..\out\msvc-$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PreBuildEvent>
<Command>
Expand Down Expand Up @@ -163,6 +164,7 @@
</IgnoreSpecificDefaultLibraries>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<GenerateDebugInformation>DebugFastLink</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)..\..\out\msvc-$(Platform)\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PreBuildEvent>
<Command>
Expand Down Expand Up @@ -222,6 +224,7 @@
</IgnoreSpecificDefaultLibraries>
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
<GenerateDebugInformation>DebugFastLink</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)..\..\out\msvc-$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
<PreBuildEvent>
<Command>
Expand All @@ -241,6 +244,17 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='VM Debug|Win32'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="heap.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='VM Debug|Win32'">NotUsing</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)mimalloc\include;$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='VM Debug|Win32'">$(SolutionDir)mimalloc\include;$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)mimalloc\include;$(SolutionDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CallingConvention Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Cdecl</CallingConvention>
<CallingConvention Condition="'$(Configuration)|$(Platform)'=='VM Debug|Win32'">Cdecl</CallingConvention>
<CallingConvention Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Cdecl</CallingConvention>
</ClCompile>
<ClCompile Include="lexer.cpp" />
<ClCompile Include="LexicalScope.cpp" />
<ClCompile Include="optimizer.cpp" />
Expand Down
89 changes: 89 additions & 0 deletions Core/DolphinVM/Compiler/Compiler.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Natvis Include="Compiler.natvis" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="compiler.cpp">
<Filter>Sources</Filter>
</ClCompile>
<ClCompile Include="CompilerDLL.cpp">
<Filter>Sources</Filter>
</ClCompile>
<ClCompile Include="CompilerSupport.cpp">
<Filter>Sources</Filter>
</ClCompile>
<ClCompile Include="disasm.cpp">
<Filter>Sources</Filter>
</ClCompile>
<ClCompile Include="lexer.cpp">
<Filter>Sources</Filter>
</ClCompile>
<ClCompile Include="LexicalScope.cpp">
<Filter>Sources</Filter>
</ClCompile>
<ClCompile Include="optimizer.cpp">
<Filter>Sources</Filter>
</ClCompile>
<ClCompile Include="ParseInlinedMessages.cpp">
<Filter>Sources</Filter>
</ClCompile>
<ClCompile Include="heap.cpp">
<Filter>Sources</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="lexer.h">
<Filter>Headers</Filter>
</ClInclude>
<ClInclude Include="stdafx.h">
<Filter>Headers</Filter>
</ClInclude>
<ClInclude Include="str.h">
<Filter>Headers</Filter>
</ClInclude>
<ClInclude Include="compiler.h">
<Filter>Headers</Filter>
</ClInclude>
<ClInclude Include="bytecode.h">
<Filter>Headers</Filter>
</ClInclude>
<ClInclude Include="..\bytecdes.h">
<Filter>Headers</Filter>
</ClInclude>
<ClInclude Include="..\disassembler.h">
<Filter>Headers</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Headers</Filter>
</ClInclude>
<ClInclude Include="textrange.h">
<Filter>Headers</Filter>
</ClInclude>
<ClInclude Include="..\VMPointers.h">
<Filter>Headers</Filter>
</ClInclude>
<ClInclude Include="CompilerDLL.h">
<Filter>Headers</Filter>
</ClInclude>
<ClInclude Include="LexicalScope.h">
<Filter>Headers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="compiler.rc" />
</ItemGroup>
<ItemGroup>
<None Include="Compiler.def" />
<None Include="version.rc2" />
</ItemGroup>
<ItemGroup>
<Filter Include="Headers">
<UniqueIdentifier>{68ffeb2c-812c-4d78-b39b-2d9db2ff22be}</UniqueIdentifier>
<Extensions>*.h</Extensions>
</Filter>
<Filter Include="Sources">
<UniqueIdentifier>{446335c9-9b31-4282-8670-86d8064ff18f}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>
6 changes: 6 additions & 0 deletions Core/DolphinVM/Compiler/heap.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
///////////////////////
#include <StdAfx.h>

#include "mimalloc.h"
#include "mimalloc-new-delete.h"
#pragma comment(lib, "mimalloc-static.lib")
3 changes: 1 addition & 2 deletions Core/DolphinVM/Compiler/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#endif

// Turn off iterator debugging as it makes the compiler very slow on large methods in debug builds
#define _HAS_ITERATOR_DEBUGGING 0
//#define _HAS_ITERATOR_DEBUGGING 0

// Enable templated overloads for secure version of old-style CRT functions that manipulate buffers but take no size arguments
#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
Expand All @@ -30,7 +30,6 @@
#include "..\DolphinSmalltalk_i.h"

#include <limits.h>
#include <malloc.h>
#include <stdlib.h>
#include <stdarg.h>
#include <locale.h>
Expand Down
58 changes: 0 additions & 58 deletions Core/DolphinVM/ConsoleToGo/ConsoleToGo.def
Original file line number Diff line number Diff line change
Expand Up @@ -23,64 +23,6 @@ CompileForEval=_PrimCompileForEval@32

compress2
uncompress

; CRT functions imported by the image

_chsize_s
_clearfp
_close
_control87
_dup
_dup2
_errno
_fdopen
_filelengthi64
_fileno
_fseeki64
_ftelli64
_get_invalid_parameter_handler
_get_osfhandle
_isatty
_makepath_s
_open_osfhandle
_setmode
_splitpath_s
_statusfp
_wcserror_s
_wcsicmp
_wfsopen
atoi
fclose
feof
fflush
fgetc
fgets
fgetwc
fgetws
fputc
fputs
fputwc
fputws
fread_s
free
fwrite
memcmp
memcpy_s
rand
setlocale
srand
strcat_s
strcmp
strcspn
strlen
strncmp
strncpy_s
ungetc
ungetwc
wcslen
wcscspn
wcsncpy_s

; VMLibrary

_snprintf_s
9 changes: 6 additions & 3 deletions Core/DolphinVM/ConsoleToGo/ConsoleToGo.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
<ClCompile>
<PreprocessorDefinitions>_CONSOLE;STRICT;TO_GO;_CTYPE_DISABLE_MACROS;WIN32;_WINDOWS;WIN32_LEAN_AND_MEAN;WIN32_EXTRA_LEAN;ZEXPORT=__stdcall;ZEXPORTVA=__cdecl;_HAS_EXCEPTIONS=0;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>false</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>ist.h</PrecompiledHeaderFile>
</ClCompile>
Expand All @@ -115,6 +115,7 @@
<SubSystem>Console</SubSystem>
<DataExecutionPrevention />
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
<AdditionalLibraryDirectories>$(SolutionDir)..\..\out\msvc-$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VM Debug|Win32'">
Expand All @@ -137,7 +138,7 @@
<StringPooling>true</StringPooling>
<ExceptionHandling>
</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>ist.h</PrecompiledHeaderFile>
Expand Down Expand Up @@ -170,6 +171,7 @@
</IgnoreSpecificDefaultLibraries>
<GenerateMapFile>true</GenerateMapFile>
<MapExports>true</MapExports>
<AdditionalLibraryDirectories>$(SolutionDir)..\..\out\msvc-$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
Expand All @@ -193,7 +195,7 @@
<StringPooling>true</StringPooling>
<ExceptionHandling>
</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>ist.h</PrecompiledHeaderFile>
Expand Down Expand Up @@ -226,6 +228,7 @@
</IgnoreSpecificDefaultLibraries>
<GenerateMapFile>true</GenerateMapFile>
<MapExports>true</MapExports>
<AdditionalLibraryDirectories>$(SolutionDir)..\..\out\msvc-$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
Expand Down
49 changes: 35 additions & 14 deletions Core/DolphinVM/DolphinVM.sln
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2027
# Visual Studio Version 17
VisualStudioVersion = 17.12.35527.113 d17.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VM", "dll.vcxproj", "{382ABBF3-B32D-4D77-B303-346AA146921C}"
ProjectSection(ProjectDependencies) = postProject
{ABB5EAE7-B3E6-432E-B636-333449892EA6} = {ABB5EAE7-B3E6-432E-B636-333449892EA6}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Launcher", "Launcher\Dull.vcxproj", "{A8454911-DE25-451D-AC38-1B6B058C050D}"
ProjectSection(ProjectDependencies) = postProject
{35EB6247-4F53-4605-AA04-A9310AB3235B} = {35EB6247-4F53-4605-AA04-A9310AB3235B}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Compiler", "Compiler\Compiler.vcxproj", "{35EB6247-4F53-4605-AA04-A9310AB3235B}"
ProjectSection(ProjectDependencies) = postProject
{ABB5EAE7-B3E6-432E-B636-333449892EA6} = {ABB5EAE7-B3E6-432E-B636-333449892EA6}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DolphinLib", "DolphinLib.vcxproj", "{241D4E3E-44C0-40B7-BE1B-5249916FE631}"
EndProject
Expand All @@ -21,13 +27,19 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InProcStub", "InProcStub\In
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InProcToGo", "InProcToGo\InProcToGo.vcxproj", "{90C32F90-C0B1-46FE-BACE-FB6566EB6F3C}"
ProjectSection(ProjectDependencies) = postProject
{ABB5EAE7-B3E6-432E-B636-333449892EA6} = {ABB5EAE7-B3E6-432E-B636-333449892EA6}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GUIStub", "GUIStub\Stub.vcxproj", "{47007458-C534-493F-9A4C-936E5E0C91C8}"
ProjectSection(ProjectDependencies) = postProject
{241D4E3E-44C0-40B7-BE1B-5249916FE631} = {241D4E3E-44C0-40B7-BE1B-5249916FE631}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ConsoleToGo", "ConsoleToGo\ConsoleToGo.vcxproj", "{714480A5-0779-4C59-8A08-856E5C34AC37}"
ProjectSection(ProjectDependencies) = postProject
{ABB5EAE7-B3E6-432E-B636-333449892EA6} = {ABB5EAE7-B3E6-432E-B636-333449892EA6}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Console", "ConsoleStub\Console.vcxproj", "{F6BBF41C-E4E0-4514-BA19-E248DE206820}"
ProjectSection(ProjectDependencies) = postProject
Expand All @@ -37,6 +49,7 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GUIToGo", "ToGoStub\GuiToGo.vcxproj", "{12B536BA-143E-4F38-BD96-77B35467DB13}"
ProjectSection(ProjectDependencies) = postProject
{241D4E3E-44C0-40B7-BE1B-5249916FE631} = {241D4E3E-44C0-40B7-BE1B-5249916FE631}
{ABB5EAE7-B3E6-432E-B636-333449892EA6} = {ABB5EAE7-B3E6-432E-B636-333449892EA6}
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Stubs", "Stubs", "{F6CB1D3C-CC39-4BCA-AC1A-DF0D1CA27580}"
Expand All @@ -51,19 +64,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VMLib", "VMLib\VMLib.vcxite
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "zlib\zlib.vcxitems", "{1F161730-1E11-4FBD-A4DF-F6E9B5577F5E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mimalloc", "mimalloc\ide\vs2022\mimalloc.vcxproj", "{ABB5EAE7-B3E6-432E-B636-333449892EA6}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
VMLib\VMLib.vcxitems*{12b536ba-143e-4f38-bd96-77b35467db13}*SharedItemsImports = 4
zlib\zlib.vcxitems*{12b536ba-143e-4f38-bd96-77b35467db13}*SharedItemsImports = 4
zlib\zlib.vcxitems*{1f161730-1e11-4fbd-a4df-f6e9b5577f5e}*SharedItemsImports = 9
VMLib\VMLib.vcxitems*{382abbf3-b32d-4d77-b303-346aa146921c}*SharedItemsImports = 4
zlib\zlib.vcxitems*{382abbf3-b32d-4d77-b303-346aa146921c}*SharedItemsImports = 4
VMLib\VMLib.vcxitems*{714480a5-0779-4c59-8a08-856e5c34ac37}*SharedItemsImports = 4
zlib\zlib.vcxitems*{714480a5-0779-4c59-8a08-856e5c34ac37}*SharedItemsImports = 4
VMLib\VMLib.vcxitems*{90c32f90-c0b1-46fe-bace-fb6566eb6f3c}*SharedItemsImports = 4
zlib\zlib.vcxitems*{90c32f90-c0b1-46fe-bace-fb6566eb6f3c}*SharedItemsImports = 4
VMLib\VMLib.vcxitems*{bc5d162d-46bc-42cf-85db-cb715ee8517e}*SharedItemsImports = 9
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
Expand Down Expand Up @@ -130,6 +133,12 @@ Global
{12B536BA-143E-4F38-BD96-77B35467DB13}.Release|Win32.ActiveCfg = Release|Win32
{12B536BA-143E-4F38-BD96-77B35467DB13}.Release|Win32.Build.0 = Release|Win32
{12B536BA-143E-4F38-BD96-77B35467DB13}.VM Debug|Win32.ActiveCfg = VM Debug|Win32
{ABB5EAE7-B3E6-432E-B636-333449892EA6}.Debug|Win32.ActiveCfg = Debug|Win32
{ABB5EAE7-B3E6-432E-B636-333449892EA6}.Debug|Win32.Build.0 = Debug|Win32
{ABB5EAE7-B3E6-432E-B636-333449892EA6}.Release|Win32.ActiveCfg = Release|Win32
{ABB5EAE7-B3E6-432E-B636-333449892EA6}.Release|Win32.Build.0 = Release|Win32
{ABB5EAE7-B3E6-432E-B636-333449892EA6}.VM Debug|Win32.ActiveCfg = Debug|Win32
{ABB5EAE7-B3E6-432E-B636-333449892EA6}.VM Debug|Win32.Build.0 = Debug|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -145,4 +154,16 @@ Global
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {808FD94F-FA41-4A9A-B2BC-2010D373F582}
EndGlobalSection
GlobalSection(SharedMSBuildProjectFiles) = preSolution
VMLib\VMLib.vcxitems*{12b536ba-143e-4f38-bd96-77b35467db13}*SharedItemsImports = 4
zlib\zlib.vcxitems*{12b536ba-143e-4f38-bd96-77b35467db13}*SharedItemsImports = 4
zlib\zlib.vcxitems*{1f161730-1e11-4fbd-a4df-f6e9b5577f5e}*SharedItemsImports = 9
VMLib\VMLib.vcxitems*{382abbf3-b32d-4d77-b303-346aa146921c}*SharedItemsImports = 4
zlib\zlib.vcxitems*{382abbf3-b32d-4d77-b303-346aa146921c}*SharedItemsImports = 4
VMLib\VMLib.vcxitems*{714480a5-0779-4c59-8a08-856e5c34ac37}*SharedItemsImports = 4
zlib\zlib.vcxitems*{714480a5-0779-4c59-8a08-856e5c34ac37}*SharedItemsImports = 4
VMLib\VMLib.vcxitems*{90c32f90-c0b1-46fe-bace-fb6566eb6f3c}*SharedItemsImports = 4
zlib\zlib.vcxitems*{90c32f90-c0b1-46fe-bace-fb6566eb6f3c}*SharedItemsImports = 4
VMLib\VMLib.vcxitems*{bc5d162d-46bc-42cf-85db-cb715ee8517e}*SharedItemsImports = 9
EndGlobalSection
EndGlobal
Loading

0 comments on commit 19615c6

Please sign in to comment.