Skip to content

Commit

Permalink
Remove the old implementations and add posix/win32 allocator
Browse files Browse the repository at this point in the history
  • Loading branch information
Golle committed Sep 11, 2022
1 parent 4c56d90 commit 882a7c1
Show file tree
Hide file tree
Showing 19 changed files with 365 additions and 579 deletions.
26 changes: 0 additions & 26 deletions Titan.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Titan.CodeGeneration", "src
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tools.Core", "src\Tools.Core\Tools.Core.csproj", "{0C0ABB2C-BD95-406F-A6BB-82370E3820F7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tools.ModelBuilder", "src\Tools.ModelBuilder\Tools.ModelBuilder.csproj", "{BB5CE964-F58E-496F-A833-B9DD29802E8C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Titan.ECS", "src\Titan.ECS\Titan.ECS.csproj", "{972296BE-2FC7-4AB7-8242-8B88E3CA970C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{2E5F74ED-A362-46AD-81EF-3D06CC61DF7C}"
Expand Down Expand Up @@ -218,29 +216,6 @@ Global
{0C0ABB2C-BD95-406F-A6BB-82370E3820F7}.Shipping|x64.Build.0 = Shipping|Any CPU
{0C0ABB2C-BD95-406F-A6BB-82370E3820F7}.Shipping|x86.ActiveCfg = Shipping|Any CPU
{0C0ABB2C-BD95-406F-A6BB-82370E3820F7}.Shipping|x86.Build.0 = Shipping|Any CPU
{BB5CE964-F58E-496F-A833-B9DD29802E8C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BB5CE964-F58E-496F-A833-B9DD29802E8C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BB5CE964-F58E-496F-A833-B9DD29802E8C}.Debug|arm64.ActiveCfg = Debug|Any CPU
{BB5CE964-F58E-496F-A833-B9DD29802E8C}.Debug|arm64.Build.0 = Debug|Any CPU
{BB5CE964-F58E-496F-A833-B9DD29802E8C}.Debug|x64.ActiveCfg = Debug|Any CPU
{BB5CE964-F58E-496F-A833-B9DD29802E8C}.Debug|x64.Build.0 = Debug|Any CPU
{BB5CE964-F58E-496F-A833-B9DD29802E8C}.Debug|x86.ActiveCfg = Debug|Any CPU
{BB5CE964-F58E-496F-A833-B9DD29802E8C}.Debug|x86.Build.0 = Debug|Any CPU
{BB5CE964-F58E-496F-A833-B9DD29802E8C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BB5CE964-F58E-496F-A833-B9DD29802E8C}.Release|Any CPU.Build.0 = Release|Any CPU
{BB5CE964-F58E-496F-A833-B9DD29802E8C}.Release|arm64.ActiveCfg = Release|Any CPU
{BB5CE964-F58E-496F-A833-B9DD29802E8C}.Release|arm64.Build.0 = Release|Any CPU
{BB5CE964-F58E-496F-A833-B9DD29802E8C}.Release|x64.ActiveCfg = Release|Any CPU
{BB5CE964-F58E-496F-A833-B9DD29802E8C}.Release|x64.Build.0 = Release|Any CPU
{BB5CE964-F58E-496F-A833-B9DD29802E8C}.Release|x86.ActiveCfg = Release|Any CPU
{BB5CE964-F58E-496F-A833-B9DD29802E8C}.Release|x86.Build.0 = Release|Any CPU
{BB5CE964-F58E-496F-A833-B9DD29802E8C}.Shipping|Any CPU.ActiveCfg = Debug|Any CPU
{BB5CE964-F58E-496F-A833-B9DD29802E8C}.Shipping|arm64.ActiveCfg = Release|Any CPU
{BB5CE964-F58E-496F-A833-B9DD29802E8C}.Shipping|arm64.Build.0 = Release|Any CPU
{BB5CE964-F58E-496F-A833-B9DD29802E8C}.Shipping|x64.ActiveCfg = Release|Any CPU
{BB5CE964-F58E-496F-A833-B9DD29802E8C}.Shipping|x64.Build.0 = Release|Any CPU
{BB5CE964-F58E-496F-A833-B9DD29802E8C}.Shipping|x86.ActiveCfg = Release|Any CPU
{BB5CE964-F58E-496F-A833-B9DD29802E8C}.Shipping|x86.Build.0 = Release|Any CPU
{972296BE-2FC7-4AB7-8242-8B88E3CA970C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{972296BE-2FC7-4AB7-8242-8B88E3CA970C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{972296BE-2FC7-4AB7-8242-8B88E3CA970C}.Debug|arm64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -657,7 +632,6 @@ Global
{09AE8312-C593-4D53-9895-8556CACCFB11} = {74127627-7DB8-4DB4-B491-454C750DB930}
{458692E9-0A02-48D2-9DD5-D326478313A2} = {74127627-7DB8-4DB4-B491-454C750DB930}
{0C0ABB2C-BD95-406F-A6BB-82370E3820F7} = {D078C8E6-5D88-4DF0-9425-84E84CB7A6CD}
{BB5CE964-F58E-496F-A833-B9DD29802E8C} = {D078C8E6-5D88-4DF0-9425-84E84CB7A6CD}
{972296BE-2FC7-4AB7-8242-8B88E3CA970C} = {74127627-7DB8-4DB4-B491-454C750DB930}
{60783C89-5057-4D0C-A1FE-642D761AED75} = {2E5F74ED-A362-46AD-81EF-3D06CC61DF7C}
{27B06914-7F39-414F-A4B5-427EB8680E86} = {9DCCF95F-43AF-4B38-AAB8-4C07AC075E10}
Expand Down
75 changes: 0 additions & 75 deletions src/Titan.Memory/Allocator.cs

This file was deleted.

18 changes: 0 additions & 18 deletions src/Titan.Memory/Allocators/NativeMemoryAllocator.cs

This file was deleted.

23 changes: 0 additions & 23 deletions src/Titan.Memory/Allocators/Win32VirtualAllocAllocator.cs

This file was deleted.

50 changes: 0 additions & 50 deletions src/Titan.Memory/Allocators/Win32VirtualAllocFixedSizeAllocator.cs

This file was deleted.

50 changes: 25 additions & 25 deletions src/Titan.Memory/Arenas/BestFitFixedArena.cs
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
using Titan.Core.Logging;
//using Titan.Core.Logging;

namespace Titan.Memory.Arenas;
//namespace Titan.Memory.Arenas;

public unsafe struct BestFitFixedArena
{
public PlatformAllocator _allocator;
public uint _maxSize;
//public unsafe struct BestFitFixedArena
//{
// public PlatformAllocator _allocator;
// public uint _maxSize;

public static bool Create(uint minBlockSize, uint maxSizeInBytes, out BestFitFixedArena arena)
{
Logger.Warning<BestFitFixedArena>($"The {nameof(BestFitFixedArena)} has not been implemented yet, it uses VirtualAlloc/NativeLibrary.");
// public static bool Create(uint minBlockSize, uint maxSizeInBytes, out BestFitFixedArena arena)
// {
// Logger.Warning<BestFitFixedArena>($"The {nameof(BestFitFixedArena)} has not been implemented yet, it uses VirtualAlloc/NativeLibrary.");

arena = new BestFitFixedArena
{
_allocator = PlatformAllocator.Create(),
_maxSize = maxSizeInBytes
};
// arena = new BestFitFixedArena
// {
// _allocator = PlatformAllocator.Create(),
// _maxSize = maxSizeInBytes
// };

return true;
}
// return true;
// }

public void* Allocate(nuint size, bool initialize = false)
=> _allocator.Allocate(size, initialize);
// public void* Allocate(nuint size, bool initialize = false)
// => _allocator.Allocate(size, initialize);


public void Free(void* ptr)
=> _allocator.Free(ptr);
// public void Free(void* ptr)
// => _allocator.Free(ptr);

public void Release()
{
Logger.Warning<BestFitFixedArena>($"Not implemented yet");
}
}
// public void Release()
// {
// Logger.Warning<BestFitFixedArena>($"Not implemented yet");
// }
//}
Loading

0 comments on commit 882a7c1

Please sign in to comment.