diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/13A699ACF94FF1BC2244331357343A42 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/13A699ACF94FF1BC2244331357343A42 deleted file mode 100644 index 5f282702..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/13A699ACF94FF1BC2244331357343A42 +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/17B72F29C1CC21C3FDE7DDD63EF7F9FD b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/17B72F29C1CC21C3FDE7DDD63EF7F9FD deleted file mode 100644 index 1bf9924b..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/17B72F29C1CC21C3FDE7DDD63EF7F9FD +++ /dev/null @@ -1,21 +0,0 @@ -#include "glfw_function_table.h" -#include - -void LoadGLFWFunctions(GLFWFunctionTable* table) { - memset(table, 0, sizeof(GLFWFunctionTable)); - table->glfwInit = (int (*)(void))glfwGetProcAddress("glfwInit"); - table->glfwTerminate = (void (*)(void))glfwGetProcAddress("glfwTerminate"); - table->glfwInitHint = (void (*)(int, int))glfwGetProcAddress("glfwInitHint"); - table->glfwGetVersionString = (const char* (*)(void))glfwGetProcAddress("glfwGetVersionString"); - table->glfwGetError = (int (*)(const char**))glfwGetProcAddress("glfwGetError"); - table->glfwGetMonitors = (GLFWmonitor** (*)(int*))glfwGetProcAddress("glfwGetMonitors"); - table->glfwGetPrimaryMonitor = (GLFWmonitor* (*)(void))glfwGetProcAddress("glfwGetPrimaryMonitor"); - table->glfwGetMonitorPos = (void (*)(GLFWmonitor*, int*, int*))glfwGetProcAddress("glfwGetMonitorPos"); - table->glfwCreateWindow = (GLFWwindow* (*)(int, int, const char*, GLFWmonitor*, GLFWwindow*))glfwGetProcAddress("glfwCreateWindow"); - table->glfwDestroyWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwDestroyWindow"); - table->glfwWindowShouldClose = (int (*)(GLFWwindow*))glfwGetProcAddress("glfwWindowShouldClose"); - table->glfwSetWindowShouldClose = (void (*)(GLFWwindow*, int))glfwGetProcAddress("glfwSetWindowShouldClose"); - table->glfwPollEvents = (void (*)(void))glfwGetProcAddress("glfwPollEvents"); - table->glfwSwapBuffers = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwSwapBuffers"); - table->glfwGetProcAddress = (GLFWglproc (*)(const char*))glfwGetProcAddress("glfwGetProcAddress"); -} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/516E4750BFA070C15018A44BF13AD02C b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/516E4750BFA070C15018A44BF13AD02C deleted file mode 100644 index 5f282702..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/516E4750BFA070C15018A44BF13AD02C +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/85640CC1F60032566B378A1E4081FD35 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/85640CC1F60032566B378A1E4081FD35 deleted file mode 100644 index d6228b3a..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/85640CC1F60032566B378A1E4081FD35 +++ /dev/null @@ -1,3 +0,0 @@ -#include "StgSharpNative.h" -#include "glfw_function_table.h" -#include diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/885C0127350D5D9423F07D688925FD75 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/885C0127350D5D9423F07D688925FD75 deleted file mode 100644 index 5f282702..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/885C0127350D5D9423F07D688925FD75 +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/88B037775D1540415FF0DE3440228241 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/88B037775D1540415FF0DE3440228241 deleted file mode 100644 index 5f282702..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/88B037775D1540415FF0DE3440228241 +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA deleted file mode 100644 index dae34e16..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA +++ /dev/null @@ -1,123 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="InternalIO.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; -using StgSharp.Graphics.OpenGL; - -using System; -using System.Collections.Generic; -using System.IO; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -using System.Text; -using System.Threading; - -namespace StgSharp.Internal -{ - internal static unsafe partial class InternalIO - { - - internal const string SS_errorLog = - "SS_errorlog.log"; - - internal const string NativeLibName = - "StgSharp.C"; - - internal static Dictionary GLtype = []; - - internal static readonly GCHandle ssc_logHandle = - GCHandle.Alloc(new byte[512], GCHandleType.Pinned); - - internal static IntPtr _nativeLibPtr = IntPtr.Zero; - - internal static SemaphoreSlim logSyncSemaphore = new SemaphoreSlim(1, 1); - - static InternalIO() - { - GLtype.Add(TypeCode.Single, glConst.FLOAT); - GLtype.Add(TypeCode.Int32, glConst.INT); - GLtype.Add(TypeCode.UInt32, glConst.UNSIGNED_INT); - GLtype.Add(TypeCode.Int16, glConst.SHORT); - GLtype.Add(TypeCode.UInt16, glConst.UNSIGNED_SHORT); - GLtype.Add(TypeCode.SByte, glConst.BYTE); - GLtype.Add(TypeCode.Byte, glConst.UNSIGNED_BYTE); - } - - internal static void InternalAppendLog(string log) - { - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) { - logStream.WriteLine(log); - } - } - - internal static void InternalWriteLog(string logLine, LogType logType) - { - logSyncSemaphore.Wait(); - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) - { - logStream.WriteLine($"{logType}\t{DateTime.Now.ToString("o")}"); - logStream.WriteLine(logLine); - } - _ = logSyncSemaphore.Release(); - } - - internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType) - { - logSyncSemaphore.Wait(); - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) - { - logStream.WriteLine(beforeTime); - logStream.WriteLine($"{logType}\t@\t{DateTime.Now.ToString("o")}"); - logStream.WriteLine(logLine); - } - _ = logSyncSemaphore.Release(1); - } - - } -} diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/A3919CCA57C33ABF0FE7102A8A97A697 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/A3919CCA57C33ABF0FE7102A8A97A697 deleted file mode 100644 index 5f282702..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/A3919CCA57C33ABF0FE7102A8A97A697 +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/BF682B06259E1DAC71F7644A79308571 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/BF682B06259E1DAC71F7644A79308571 deleted file mode 100644 index 15eb20da..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/BF682B06259E1DAC71F7644A79308571 +++ /dev/null @@ -1,486 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; - -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; - -namespace StgSharp.Internal -{ - internal unsafe partial class InternalIO - { - - private static GLFWFunction _glfw; - - [LibraryImport(NativeLibName, EntryPoint = "load_glfw_functions")] - internal static unsafe partial void glfwLoadLibrary(GLFWFunction* context); - - internal static unsafe void LoadGlfw() - { - _glfw = new GLFWFunction(); - fixed (GLFWFunction* func = &_glfw) { } - } - - #region api call - - [LibraryImport(NativeLibName, EntryPoint = "glfwInit")] - internal static unsafe partial int glfwInit(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwTerminate")] - internal static unsafe partial void glfwTerminate(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwInitHint")] - internal static unsafe partial void glfwInitHint(int hint, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetVersion")] - internal static unsafe partial void glfwGetVersion(int* major, int* minor, int* rev); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetVersionString")] - internal static unsafe partial byte* glfwGetVersionString(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetError")] - internal static unsafe partial int glfwGetError(byte** description); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetErrorCallback")] - internal static unsafe partial delegate* glfwSetErrorCallback( - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitors")] - internal static unsafe partial IntPtr* glfwGetMonitors(int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetPrimaryMonitor")] - internal static unsafe partial IntPtr glfwGetPrimaryMonitor(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorPos")] - internal static unsafe partial void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorWorkarea")] - internal static unsafe partial void glfwGetMonitorWorkarea( - IntPtr monitor, - int* xpos, - int* ypos, - int* width, - int* height); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorPhysicalSize")] - internal static unsafe partial void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorContentScale")] - internal static unsafe partial void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorName")] - internal static unsafe partial byte* glfwGetMonitorName(IntPtr monitor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetMonitorUserPointer")] - internal static unsafe partial void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorUserPointer")] - internal static unsafe partial void* glfwGetMonitorUserPointer(IntPtr monitor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetMonitorCallback")] - internal static unsafe partial delegate* glfwSetMonitorCallback( - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetVideoModes")] - internal static unsafe partial glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetVideoMode")] - internal static unsafe partial glfwVideomode* glfwGetVideoMode(IntPtr monitor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetGamma")] - internal static unsafe partial void glfwSetGamma(IntPtr monitor, float gamma); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetGammaRamp")] - internal static unsafe partial glfwGammaramp* glfwGetGammaRamp(IntPtr monitor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetGammaRamp")] - internal static unsafe partial void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp); - - [LibraryImport(NativeLibName, EntryPoint = "glfwDefaultWindowHints")] - internal static unsafe partial void glfwDefaultWindowHints(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWindowHint")] - internal static unsafe partial void glfwWindowHint(int hint, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWindowHintString")] - internal static unsafe partial void glfwWindowHintString(int hint, byte* value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindow")] - internal static unsafe partial IntPtr glfwCreateWindow( - int width, - int height, - byte[] title, - IntPtr monitor, - IntPtr share); - - [LibraryImport(NativeLibName, EntryPoint = "glfwDestroyWindow")] - internal static unsafe partial void glfwDestroyWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWindowShouldClose")] - internal static unsafe partial int glfwWindowShouldClose(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowShouldClose")] - internal static unsafe partial void glfwSetWindowShouldClose(IntPtr window, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowTitle")] - internal static unsafe partial void glfwSetWindowTitle(IntPtr window, byte* title); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowIcon")] - internal static unsafe partial void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowPos")] - internal static unsafe partial void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowPos")] - internal static unsafe partial void glfwSetWindowPos(IntPtr window, int xpos, int ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowSize")] - internal static unsafe partial void glfwGetWindowSize(IntPtr window, int* width, int* height); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSizeLimits")] - internal static unsafe partial void glfwSetWindowSizeLimits( - IntPtr window, - int minwidth, - int minheight, - int maxwidth, - int maxheight); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowAspectRatio")] - internal static unsafe partial void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSize")] - internal static unsafe partial void glfwSetWindowSize(IntPtr window, int width, int height); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetFramebufferSize")] - internal static unsafe partial void glfwGetFramebufferSize(IntPtr window, int* width, int* height); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowFrameSize")] - internal static unsafe partial void glfwGetWindowFrameSize( - IntPtr window, - int* left, - int* top, - int* right, - int* bottom); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowContentScale")] - internal static unsafe partial void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowOpacity")] - internal static unsafe partial float glfwGetWindowOpacity(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowOpacity")] - internal static unsafe partial void glfwSetWindowOpacity(IntPtr window, float opacity); - - [LibraryImport(NativeLibName, EntryPoint = "glfwIconifyWindow")] - internal static unsafe partial void glfwIconifyWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwRestoreWindow")] - internal static unsafe partial void glfwRestoreWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwMaximizeWindow")] - internal static unsafe partial void glfwMaximizeWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwShowWindow")] - internal static unsafe partial void glfwShowWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwHideWindow")] - internal static unsafe partial void glfwHideWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwFocusWindow")] - internal static unsafe partial void glfwFocusWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwRequestWindowAttention")] - internal static unsafe partial void glfwRequestWindowAttention(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowMonitor")] - internal static unsafe partial IntPtr glfwGetWindowMonitor(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowMonitor")] - internal static unsafe partial void glfwSetWindowMonitor( - IntPtr window, - IntPtr monitor, - int xpos, - int ypos, - int width, - int height, - int refreshRate); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowAttrib")] - internal static unsafe partial int glfwGetWindowAttrib(IntPtr window, int attrib); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowAttrib")] - internal static unsafe partial void glfwSetWindowAttrib(IntPtr window, int attrib, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowUserPointer")] - internal static unsafe partial void glfwSetWindowUserPointer(IntPtr window, void* pointer); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowUserPointer")] - internal static unsafe partial void* glfwGetWindowUserPointer(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowPosCallback")] - internal static unsafe partial delegate* glfwSetWindowPosCallback( - IntPtr window, - IntPtr callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSizeCallback")] - internal static unsafe partial delegate* glfwSetWindowSizeCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowCloseCallback")] - internal static unsafe partial delegate* glfwSetWindowCloseCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowRefreshCallback")] - internal static unsafe partial delegate* glfwSetWindowRefreshCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowFocusCallback")] - internal static unsafe partial delegate* glfwSetWindowFocusCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowIconifyCallback")] - internal static unsafe partial delegate* glfwSetWindowIconifyCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowMaximizeCallback")] - internal static unsafe partial delegate* glfwSetWindowMaximizeCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetFramebufferSizeCallback")] - internal static unsafe partial FrameBufferSizeHandler glfwSetFramebufferSizeCallback( - IntPtr window, - IntPtr callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowContentScaleCallback")] - internal static unsafe partial delegate* glfwSetWindowContentScaleCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwPollEvents")] - internal static unsafe partial void glfwPollEvents(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWaitEvents")] - internal static unsafe partial void glfwWaitEvents(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWaitEventsTimeout")] - internal static unsafe partial void glfwWaitEventsTimeout(double timeout); - - [LibraryImport(NativeLibName, EntryPoint = "glfwPostEmptyEvent")] - internal static unsafe partial void glfwPostEmptyEvent(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetInputMode")] - internal static unsafe partial int glfwGetInputMode(IntPtr window, int mode); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetInputMode")] - internal static unsafe partial void glfwSetInputMode(IntPtr window, int mode, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwRawMouseMotionSupported")] - internal static unsafe partial int glfwRawMouseMotionSupported(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetKeyName")] - internal static unsafe partial byte* glfwGetKeyName(int key, int scancode); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetKeyScancode")] - internal static unsafe partial int glfwGetKeyScancode(int key); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetKey")] - internal static unsafe partial KeyStatus glfwGetKey(IntPtr window, int key); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMouseButton")] - internal static unsafe partial int glfwGetMouseButton(IntPtr window, int button); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetCursorPos")] - internal static unsafe partial void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorPos")] - internal static unsafe partial void glfwSetCursorPos(IntPtr window, double xpos, double ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateCursor")] - internal static unsafe partial GLFWcursor* glfwCreateCursor(GLFWimage* image, int xhot, int yhot); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateStandardCursor")] - internal static unsafe partial GLFWcursor* glfwCreateStandardCursor(int shape); - - [LibraryImport(NativeLibName, EntryPoint = "glfwDestroyCursor")] - internal static unsafe partial void glfwDestroyCursor(GLFWcursor* cursor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCursor")] - internal static unsafe partial void glfwSetCursor(IntPtr window, GLFWcursor* cursor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetKeyCallback")] - internal static unsafe partial delegate* glfwSetKeyCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCharCallback")] - internal static unsafe partial delegate* glfwSetCharCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCharModsCallback")] - internal static unsafe partial delegate* glfwSetCharModsCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetMouseButtonCallback")] - internal static unsafe partial delegate* glfwSetMouseButtonCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorPosCallback")] - internal static unsafe partial delegate* glfwSetCursorPosCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorEnterCallback")] - internal static unsafe partial delegate* glfwSetCursorEnterCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetScrollCallback")] - internal static unsafe partial delegate* glfwSetScrollCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetDropCallback")] - internal static unsafe partial delegate* glfwSetDropCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwJoystickPresent")] - internal static unsafe partial int glfwJoystickPresent(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickAxes")] - internal static unsafe partial float* glfwGetJoystickAxes(int jid, int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickButtons")] - internal static unsafe partial byte* glfwGetJoystickButtons(int jid, int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickHats")] - internal static unsafe partial byte* glfwGetJoystickHats(int jid, int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickName")] - internal static unsafe partial byte* glfwGetJoystickName(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickGUID")] - internal static unsafe partial byte* glfwGetJoystickGUID(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetJoystickUserPointer")] - internal static unsafe partial void glfwSetJoystickUserPointer(int jid, void* pointer); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickUserPointer")] - internal static unsafe partial void* glfwGetJoystickUserPointer(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwJoystickIsGamepad")] - internal static unsafe partial int glfwJoystickIsGamepad(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetJoystickCallback")] - internal static unsafe partial delegate* glfwSetJoystickCallback(delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwUpdateGamepadMappings")] - internal static unsafe partial int glfwUpdateGamepadMappings(byte* str); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetGamepadName")] - internal static unsafe partial byte* glfwGetGamepadName(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetGamepadState")] - internal static unsafe partial int glfwGetGamepadState(int jid, GLFWgamepadstate* state); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetClipboardString")] - internal static unsafe partial void glfwSetClipboardString(IntPtr window, byte* str); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetClipboardString")] - internal static unsafe partial byte* glfwGetClipboardString(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetTime")] - internal static unsafe partial double glfwGetTime(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetTime")] - internal static unsafe partial void glfwSetTime(double time); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetTimerValue")] - internal static unsafe partial ulong* glfwGetTimerValue(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetTimerFrequency")] - internal static unsafe partial ulong* glfwGetTimerFrequency(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwMakeContextCurrent")] - internal static unsafe partial void glfwMakeContextCurrent(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetCurrentContext")] - internal static unsafe partial IntPtr glfwGetCurrentContext(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSwapBuffers")] - internal static unsafe partial void glfwSwapBuffers(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSwapInterval")] - internal static unsafe partial void glfwSwapInterval(int interval); - - [LibraryImport(NativeLibName, EntryPoint = "glfwExtensionSupported")] - internal static unsafe partial int glfwExtensionSupported(byte* extension); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetProcAddress", StringMarshalling = StringMarshalling.Utf8)] - internal static unsafe partial IntPtr glfwGetProcAddress(string procname); - - [LibraryImport(NativeLibName, EntryPoint = "glfwVulkanSupported")] - internal static unsafe partial int glfwVulkanSupported(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetRequiredInstanceExtensions")] - internal static unsafe partial byte** glfwGetRequiredInstanceExtensions(uint* count); - - /* - [LibraryImport(NativeLibName, EntryPoint = "glfwGetInstanceProcAddress")] internal static unsafe partial delegate* glfwGetInstanceProcAddress( - VkInstance instance, - byte* procname); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetPhysicalDevicePresentationSupport")] internal static unsafe partial int glfwGetPhysicalDevicePresentationSupport( - VkInstance instance, - VkPhysicalDevice device, - uint* queuefamily); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindowSurface")] internal static unsafe partial VkResult glfwCreateWindowSurface( - VkInstance instance, - glfwWindow* window, - VkAllocationCallbacks* _allocator, - VkSurfaceKHR* surface); - /**/ - - #endregion api call - } -} diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/E85AA11F74CAA82F5E384A85CDBE0B61 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/E85AA11F74CAA82F5E384A85CDBE0B61 deleted file mode 100644 index 48081bd3..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/E85AA11F74CAA82F5E384A85CDBE0B61 +++ /dev/null @@ -1,156 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw_function_table.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.InteropServices; - -namespace StgSharp.Internal -{ - [StructLayout(LayoutKind.Sequential)] - internal unsafe struct GLFWFunction - { - - public delegate* unmanaged[Cdecl] glfwCreateCursor; - public delegate* unmanaged[Cdecl] glfwCreateStandardCursor; - public delegate* unmanaged[Cdecl] glfwCreateWindow; - public delegate* unmanaged[Cdecl] glfwDefaultWindowHints; - public delegate* unmanaged[Cdecl] glfwDestroyCursor; - public delegate* unmanaged[Cdecl] glfwDestroyWindow; - public delegate* unmanaged[Cdecl] glfwExtensionSupported; - public delegate* unmanaged[Cdecl] glfwFocusWindow; - public delegate* unmanaged[Cdecl] glfwGetClipboardString; - public delegate* unmanaged[Cdecl] glfwGetCurrentContext; - public delegate* unmanaged[Cdecl] glfwGetCursorPos; - public delegate* unmanaged[Cdecl] glfwGetError; - public delegate* unmanaged[Cdecl] glfwGetFramebufferSize; - public delegate* unmanaged[Cdecl] glfwGetGamepadName; - public delegate* unmanaged[Cdecl] glfwGetGamepadState; - public delegate* unmanaged[Cdecl] glfwGetGammaRamp; - public delegate* unmanaged[Cdecl] glfwGetInputMode; - public delegate* unmanaged[Cdecl] glfwGetJoystickAxes; - public delegate* unmanaged[Cdecl] glfwGetJoystickButtons; - public delegate* unmanaged[Cdecl] glfwGetJoystickGUID; - public delegate* unmanaged[Cdecl] glfwGetJoystickHats; - public delegate* unmanaged[Cdecl] glfwGetJoystickName; - public delegate* unmanaged[Cdecl] glfwGetJoystickUserPointer; - public delegate* unmanaged[Cdecl] glfwGetKey; - public delegate* unmanaged[Cdecl] glfwGetKeyName; - public delegate* unmanaged[Cdecl] glfwGetKeyScancode; - public delegate* unmanaged[Cdecl] glfwGetMonitorContentScale; - public delegate* unmanaged[Cdecl] glfwGetMonitorName; - public delegate* unmanaged[Cdecl] glfwGetMonitorPhysicalSize; - public delegate* unmanaged[Cdecl] glfwGetMonitorPos; - public delegate* unmanaged[Cdecl] glfwGetMonitors; - public delegate* unmanaged[Cdecl] glfwGetMonitorUserPointer; - public delegate* unmanaged[Cdecl] glfwGetMonitorWorkarea; - public delegate* unmanaged[Cdecl] glfwGetMouseButton; - public delegate* unmanaged[Cdecl] glfwGetPrimaryMonitor; - public delegate* unmanaged[Cdecl] glfwGetProcAddress; - public delegate* unmanaged[Cdecl] glfwGetRequiredInstanceExtensions; - public delegate* unmanaged[Cdecl] glfwGetTime; - public delegate* unmanaged[Cdecl] glfwGetTimerFrequency; - public delegate* unmanaged[Cdecl] glfwGetTimerValue; - public delegate* unmanaged[Cdecl] glfwGetVersionString; - public delegate* unmanaged[Cdecl] glfwGetVideoMode; - public delegate* unmanaged[Cdecl] glfwGetVideoModes; - public delegate* unmanaged[Cdecl] glfwGetWindowAttrib; - public delegate* unmanaged[Cdecl] glfwGetWindowContentScale; - public delegate* unmanaged[Cdecl] glfwGetWindowFrameSize; - public delegate* unmanaged[Cdecl] glfwGetWindowMonitor; - public delegate* unmanaged[Cdecl] glfwGetWindowOpacity; - public delegate* unmanaged[Cdecl] glfwGetWindowPos; - public delegate* unmanaged[Cdecl] glfwGetWindowSize; - public delegate* unmanaged[Cdecl] glfwGetWindowUserPointer; - public delegate* unmanaged[Cdecl] glfwHideWindow; - public delegate* unmanaged[Cdecl] glfwIconifyWindow; - public delegate* unmanaged[Cdecl] glfwInit; - public delegate* unmanaged[Cdecl] glfwInitHint; - public delegate* unmanaged[Cdecl] glfwJoystickIsGamepad; - public delegate* unmanaged[Cdecl] glfwJoystickPresent; - public delegate* unmanaged[Cdecl] glfwMakeContextCurrent; - public delegate* unmanaged[Cdecl] glfwMaximizeWindow; - public delegate* unmanaged[Cdecl] glfwPollEvents; - public delegate* unmanaged[Cdecl] glfwPostEmptyEvent; - public delegate* unmanaged[Cdecl] glfwRawMouseMotionSupported; - public delegate* unmanaged[Cdecl] glfwRequestWindowAttention; - public delegate* unmanaged[Cdecl] glfwRestoreWindow; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCharCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCharModsCallback; - public delegate* unmanaged[Cdecl] glfwSetClipboardString; - public delegate* unmanaged[Cdecl] glfwSetCursor; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCursorEnterCallback; - public delegate* unmanaged[Cdecl] glfwSetCursorPos; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCursorPosCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged [Cdecl]> glfwSetDropCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetFramebufferSizeCallback; - public delegate* unmanaged[Cdecl] glfwSetGamma; - public delegate* unmanaged[Cdecl] glfwSetGammaRamp; - public delegate* unmanaged[Cdecl] glfwSetInputMode; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetJoystickCallback; - public delegate* unmanaged[Cdecl] glfwSetJoystickUserPointer; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetKeyCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetMonitorCallback; - public delegate* unmanaged[Cdecl] glfwSetMonitorUserPointer; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetMouseButtonCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetScrollCallback; - public delegate* unmanaged[Cdecl] glfwSetTime; - public delegate* unmanaged[Cdecl] glfwSetWindowAspectRatio; - public delegate* unmanaged[Cdecl] glfwSetWindowAttrib; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowCloseCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowContentScaleCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowFocusCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowIcon; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowIconifyCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowMaximizeCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowMonitor; - public delegate* unmanaged[Cdecl] glfwSetWindowOpacity; - public delegate* unmanaged[Cdecl] glfwSetWindowPos; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowPosCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowRefreshCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowShouldClose; - public delegate* unmanaged[Cdecl] glfwSetWindowSize; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowSizeCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowSizeLimits; - public delegate* unmanaged[Cdecl] glfwSetWindowTitle; - public delegate* unmanaged[Cdecl] glfwSetWindowUserPointer; - public delegate* unmanaged[Cdecl] glfwShowWindow; - public delegate* unmanaged[Cdecl] glfwSwapBuffers; - public delegate* unmanaged[Cdecl] glfwSwapInterval; - public delegate* unmanaged[Cdecl] glfwTerminate; - public delegate* unmanaged[Cdecl] glfwUpdateGamepadMappings; - public delegate* unmanaged[Cdecl] glfwVulkanSupported; - public delegate* unmanaged[Cdecl] glfwWaitEvents; - public delegate* unmanaged[Cdecl] glfwWaitEventsTimeout; - public delegate* unmanaged[Cdecl] glfwWindowHint; - public delegate* unmanaged[Cdecl] glfwWindowHintString; - public delegate* unmanaged[Cdecl] glfwWindowShouldClose; - - } -} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/F1E7BCC96B693FC67D483F12B936DDA5 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/F1E7BCC96B693FC67D483F12B936DDA5 deleted file mode 100644 index 9b7fc4d0..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/020E8EDCB484644083135806C6E36CA6/F1E7BCC96B693FC67D483F12B936DDA5 +++ /dev/null @@ -1,57 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw_function_table.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.InteropServices; - -namespace StgSharp.Internal -{ - [StructLayout(LayoutKind.Sequential)] - internal unsafe struct GLFWFunctionTable - { - - public delegate* unmanaged[Cdecl] glfwCreateWindow; - public delegate* unmanaged[Cdecl] glfwDestroyWindow; - public delegate* unmanaged[Cdecl] glfwGetError; - public delegate* unmanaged[Cdecl] glfwGetMonitorPos; - public delegate* unmanaged[Cdecl] glfwGetMonitors; - public delegate* unmanaged[Cdecl] glfwGetPrimaryMonitor; - public delegate* unmanaged[Cdecl] glfwGetProcAddress; - public delegate* unmanaged[Cdecl] glfwGetVersionString; - public delegate* unmanaged[Cdecl] glfwInit; - public delegate* unmanaged[Cdecl] glfwInitHint; - public delegate* unmanaged[Cdecl] glfwPollEvents; - public delegate* unmanaged[Cdecl] glfwSetWindowShouldClose; - public delegate* unmanaged[Cdecl] glfwSwapBuffers; - public delegate* unmanaged[Cdecl] glfwTerminate; - public delegate* unmanaged[Cdecl] glfwWindowShouldClose; - - } -} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/10F3465F37E69FBE73BF8D12C0E30EE1 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/10F3465F37E69FBE73BF8D12C0E30EE1 deleted file mode 100644 index fbb2ea09..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/10F3465F37E69FBE73BF8D12C0E30EE1 +++ /dev/null @@ -1,692 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; - -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; - -namespace StgSharp.Internal -{ - internal unsafe partial class InternalIO - { - - private static GLFWFunction _glfw; - - [LibraryImport(NativeLibName, EntryPoint = "load_glfw_functions")] - internal static unsafe partial void glfwLoadLibrary(GLFWFunction* context); - - internal static unsafe void LoadGlfw() - { - _glfw = new GLFWFunction(); - fixed (GLFWFunction* func = &_glfw) { } - } - - #region api call - - internal static unsafe int glfwInit() - { - return _glfw.glfwInit(); - } - - internal static unsafe void glfwTerminate() - { - _glfw.glfwTerminate(); - } - - internal static unsafe void glfwInitHint(int hint, int value) - { - _glfw.glfwInitHint(hint, value); - } - - internal static unsafe void glfwGetVersion(int* major, int* minor, int* rev) - { - _glfw.glfwGetVersion(major, minor, rev); - } - - internal static unsafe byte* glfwGetVersionString() - { - return _glfw.glfwGetVersionString(); - } - - internal static unsafe int glfwGetError(byte** description) - { - return _glfw.glfwGetError(description); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetErrorCallback( - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetErrorCallback(callback); - } - - internal static unsafe IntPtr* glfwGetMonitors(int* count) - { - return _glfw.glfwGetMonitors(count); - } - - internal static unsafe IntPtr glfwGetPrimaryMonitor() - { - return _glfw.glfwGetPrimaryMonitor(); - } - - internal static unsafe void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos) - { - _glfw.glfwGetMonitorPos(monitor, xpos, ypos); - } - - internal static unsafe void glfwGetMonitorWorkarea( - IntPtr monitor, - int* xpos, - int* ypos, - int* width, - int* height) - { - _glfw.glfwGetMonitorWorkarea(monitor, xpos, ypos, width, height); - } - - internal static unsafe void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM) - { - _glfw.glfwGetMonitorPhysicalSize(monitor, widthMM, heightMM); - } - - internal static unsafe void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale) - { - _glfw.glfwGetMonitorContentScale(monitor, xscale, yscale); - } - - internal static unsafe byte* glfwGetMonitorName(IntPtr monitor) - { - return _glfw.glfwGetMonitorName(monitor); - } - - internal static unsafe void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer) - { - _glfw.glfwSetMonitorUserPointer(monitor, pointer); - } - - internal static unsafe void* glfwGetMonitorUserPointer(IntPtr monitor) - { - return _glfw.glfwGetMonitorUserPointer(monitor); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetMonitorCallback( - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetMonitorCallback(callback); - } - - internal static unsafe glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count) - { - return (glfwVideomode*)_glfw.glfwGetVideoModes(monitor, count); - } - - internal static unsafe glfwVideomode* glfwGetVideoMode(IntPtr monitor) - { - return (glfwVideomode*)_glfw.glfwGetVideoMode(monitor); - } - - internal static unsafe void glfwSetGamma(IntPtr monitor, float gamma) - { - _glfw.glfwSetGamma(monitor, gamma); - } - - internal static unsafe glfwGammaramp* glfwGetGammaRamp(IntPtr monitor) - { - return (glfwGammaramp*)_glfw.glfwGetGammaRamp(monitor); - } - - internal static unsafe void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp) - { - _glfw.glfwSetGammaRamp(monitor, (IntPtr)ramp); - } - - internal static unsafe void glfwDefaultWindowHints() - { - _glfw.glfwDefaultWindowHints(); - } - - internal static unsafe void glfwWindowHint(int hint, int value) - { - _glfw.glfwWindowHint(hint, value); - } - - internal static unsafe void glfwWindowHintString(int hint, byte* value) - { - _glfw.glfwWindowHintString(hint, value); - } - - internal static unsafe IntPtr glfwCreateWindow(int width, int height, byte* title, IntPtr monitor, IntPtr share) - { - return _glfw.glfwCreateWindow(width, height, title, monitor, share); - } - - internal static unsafe void glfwDestroyWindow(IntPtr window) - { - _glfw.glfwDestroyWindow(window); - } - - internal static unsafe int glfwWindowShouldClose(IntPtr window) - { - return _glfw.glfwWindowShouldClose(window); - } - - internal static unsafe void glfwSetWindowShouldClose(IntPtr window, int value) - { - _glfw.glfwSetWindowShouldClose(window, value); - } - - internal static unsafe void glfwSetWindowTitle(IntPtr window, byte* title) - { - _glfw.glfwSetWindowTitle(window, title); - } - - internal static unsafe void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images) - { - _glfw.glfwSetWindowIcon(window, count, (IntPtr)images); - } - - internal static unsafe void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos) - { - _glfw.glfwGetWindowPos(window, xpos, ypos); - } - - internal static unsafe void glfwSetWindowPos(IntPtr window, int xpos, int ypos) - { - _glfw.glfwSetWindowPos(window, xpos, ypos); - } - - internal static unsafe void glfwGetWindowSize(IntPtr window, int* width, int* height) - { - _glfw.glfwGetWindowSize(window, width, height); - } - - internal static unsafe void glfwSetWindowSizeLimits( - IntPtr window, - int minwidth, - int minheight, - int maxwidth, - int maxheight) - { - _glfw.glfwSetWindowSizeLimits(window, minwidth, minheight, maxwidth, maxheight); - } - - internal static unsafe void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom) - { - _glfw.glfwSetWindowAspectRatio(window, numer, denom); - } - - internal static unsafe void glfwSetWindowSize(IntPtr window, int width, int height) - { - _glfw.glfwSetWindowSize(window, width, height); - } - - internal static unsafe void glfwGetFramebufferSize(IntPtr window, int* width, int* height) - { - _glfw.glfwGetFramebufferSize(window, width, height); - } - - internal static unsafe void glfwGetWindowFrameSize(IntPtr window, int* left, int* top, int* right, int* bottom) - { - _glfw.glfwGetWindowFrameSize(window, left, top, right, bottom); - } - - internal static unsafe void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale) - { - _glfw.glfwGetWindowContentScale(window, xscale, yscale); - } - - internal static unsafe float glfwGetWindowOpacity(IntPtr window) - { - return _glfw.glfwGetWindowOpacity(window); - } - - internal static unsafe void glfwSetWindowOpacity(IntPtr window, float opacity) - { - _glfw.glfwSetWindowOpacity(window, opacity); - } - - internal static unsafe void glfwIconifyWindow(IntPtr window) - { - _glfw.glfwIconifyWindow(window); - } - - internal static unsafe void glfwRestoreWindow(IntPtr window) - { - _glfw.glfwRestoreWindow(window); - } - - internal static unsafe void glfwMaximizeWindow(IntPtr window) - { - _glfw.glfwMaximizeWindow(window); - } - - internal static unsafe void glfwShowWindow(IntPtr window) - { - _glfw.glfwShowWindow(window); - } - - internal static unsafe void glfwHideWindow(IntPtr window) - { - _glfw.glfwHideWindow(window); - } - - internal static unsafe void glfwFocusWindow(IntPtr window) - { - _glfw.glfwFocusWindow(window); - } - - internal static unsafe void glfwRequestWindowAttention(IntPtr window) - { - _glfw.glfwRequestWindowAttention(window); - } - - internal static unsafe IntPtr glfwGetWindowMonitor(IntPtr window) - { - return _glfw.glfwGetWindowMonitor(window); - } - - internal static unsafe void glfwSetWindowMonitor( - IntPtr window, - IntPtr monitor, - int xpos, - int ypos, - int width, - int height, - int refreshRate) - { - _glfw.glfwSetWindowMonitor(window, monitor, xpos, ypos, width, height, refreshRate); - } - - internal static unsafe int glfwGetWindowAttrib(IntPtr window, int attrib) - { - return _glfw.glfwGetWindowAttrib(window, attrib); - } - - internal static unsafe void glfwSetWindowAttrib(IntPtr window, int attrib, int value) - { - _glfw.glfwSetWindowAttrib(window, attrib, value); - } - - internal static unsafe void glfwSetWindowUserPointer(IntPtr window, void* pointer) - { - _glfw.glfwSetWindowUserPointer(window, pointer); - } - - internal static unsafe void* glfwGetWindowUserPointer(IntPtr window) - { - return _glfw.glfwGetWindowUserPointer(window); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowPosCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowPosCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowSizeCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowSizeCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowCloseCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowCloseCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowRefreshCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowRefreshCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowFocusCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowFocusCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowIconifyCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowIconifyCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowMaximizeCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowMaximizeCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetFramebufferSizeCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetFramebufferSizeCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowContentScaleCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowContentScaleCallback(window, callback); - } - - internal static unsafe void glfwPollEvents() - { - _glfw.glfwPollEvents(); - } - - internal static unsafe void glfwWaitEvents() - { - _glfw.glfwWaitEvents(); - } - - internal static unsafe void glfwWaitEventsTimeout(double timeout) - { - _glfw.glfwWaitEventsTimeout(timeout); - } - - internal static unsafe void glfwPostEmptyEvent() - { - _glfw.glfwPostEmptyEvent(); - } - - internal static unsafe int glfwGetInputMode(IntPtr window, int mode) - { - return _glfw.glfwGetInputMode(window, mode); - } - - internal static unsafe void glfwSetInputMode(IntPtr window, int mode, int value) - { - _glfw.glfwSetInputMode(window, mode, value); - } - - internal static unsafe int glfwRawMouseMotionSupported() - { - return _glfw.glfwRawMouseMotionSupported(); - } - - internal static unsafe byte* glfwGetKeyName(int key, int scancode) - { - return _glfw.glfwGetKeyName(key, scancode); - } - - internal static unsafe int glfwGetKeyScancode(int key) - { - return _glfw.glfwGetKeyScancode(key); - } - - internal static unsafe int glfwGetKey(IntPtr window, int key) - { - return _glfw.glfwGetKey(window, key); - } - - internal static unsafe int glfwGetMouseButton(IntPtr window, int button) - { - return _glfw.glfwGetMouseButton(window, button); - } - - internal static unsafe void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos) - { - _glfw.glfwGetCursorPos(window, xpos, ypos); - } - - internal static unsafe void glfwSetCursorPos(IntPtr window, double xpos, double ypos) - { - _glfw.glfwSetCursorPos(window, xpos, ypos); - } - - internal static unsafe IntPtr glfwCreateCursor(GLFWimage* image, int xhot, int yhot) - { - return _glfw.glfwCreateCursor((IntPtr)image, xhot, yhot); - } - - internal static unsafe IntPtr glfwCreateStandardCursor(int shape) - { - return _glfw.glfwCreateStandardCursor(shape); - } - - internal static unsafe void glfwDestroyCursor(IntPtr cursor) - { - _glfw.glfwDestroyCursor(cursor); - } - - internal static unsafe void glfwSetCursor(IntPtr window, IntPtr cursor) - { - _glfw.glfwSetCursor(window, cursor); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetKeyCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetKeyCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetCharCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetCharCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetCharModsCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetCharModsCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetMouseButtonCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetMouseButtonCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetCursorPosCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetCursorPosCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetCursorEnterCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetCursorEnterCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetScrollCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetScrollCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetDropCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetDropCallback(window, callback); - } - - internal static unsafe int glfwJoystickPresent(int jid) - { - return _glfw.glfwJoystickPresent(jid); - } - - internal static unsafe float* glfwGetJoystickAxes(int jid, int* count) - { - return _glfw.glfwGetJoystickAxes(jid, count); - } - - internal static unsafe byte* glfwGetJoystickButtons(int jid, int* count) - { - return _glfw.glfwGetJoystickButtons(jid, count); - } - - internal static unsafe byte* glfwGetJoystickHats(int jid, int* count) - { - return _glfw.glfwGetJoystickHats(jid, count); - } - - internal static unsafe byte* glfwGetJoystickName(int jid) - { - return _glfw.glfwGetJoystickName(jid); - } - - internal static unsafe byte* glfwGetJoystickGUID(int jid) - { - return _glfw.glfwGetJoystickGUID(jid); - } - - internal static unsafe void glfwSetJoystickUserPointer(int jid, void* pointer) - { - _glfw.glfwSetJoystickUserPointer(jid, pointer); - } - - internal static unsafe void* glfwGetJoystickUserPointer(int jid) - { - return _glfw.glfwGetJoystickUserPointer(jid); - } - - internal static unsafe int glfwJoystickIsGamepad(int jid) - { - return _glfw.glfwJoystickIsGamepad(jid); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetJoystickCallback( - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetJoystickCallback(callback); - } - - internal static unsafe int glfwUpdateGamepadMappings(byte* str) - { - return _glfw.glfwUpdateGamepadMappings(str); - } - - internal static unsafe byte* glfwGetGamepadName(int jid) - { - return _glfw.glfwGetGamepadName(jid); - } - - internal static unsafe int glfwGetGamepadState(int jid, GLFWgamepadstate* state) - { - return _glfw.glfwGetGamepadState(jid, (IntPtr)state); - } - - internal static unsafe void glfwSetClipboardString(IntPtr window, byte* str) - { - _glfw.glfwSetClipboardString(window, str); - } - - internal static unsafe byte* glfwGetClipboardString(IntPtr window) - { - return _glfw.glfwGetClipboardString(window); - } - - internal static unsafe double glfwGetTime() - { - return _glfw.glfwGetTime(); - } - - internal static unsafe void glfwSetTime(double time) - { - _glfw.glfwSetTime(time); - } - - internal static unsafe ulong glfwGetTimerValue() - { - return _glfw.glfwGetTimerValue(); - } - - internal static unsafe ulong glfwGetTimerFrequency() - { - return _glfw.glfwGetTimerFrequency(); - } - - internal static unsafe void glfwMakeContextCurrent(IntPtr window) - { - _glfw.glfwMakeContextCurrent(window); - } - - internal static unsafe IntPtr glfwGetCurrentContext() - { - return _glfw.glfwGetCurrentContext(); - } - - internal static unsafe void glfwSwapBuffers(IntPtr window) - { - _glfw.glfwSwapBuffers(window); - } - - internal static unsafe void glfwSwapInterval(int interval) - { - _glfw.glfwSwapInterval(interval); - } - - internal static unsafe int glfwExtensionSupported(byte* extension) - { - return _glfw.glfwExtensionSupported(extension); - } - - internal static unsafe IntPtr glfwGetProcAddress(byte* procname) - { - return _glfw.glfwGetProcAddress(procname); - } - - internal static unsafe int glfwVulkanSupported() - { - return _glfw.glfwVulkanSupported(); - } - - internal static unsafe byte** glfwGetRequiredInstanceExtensions(uint* count) - { - return _glfw.glfwGetRequiredInstanceExtensions(count); - } - - -#endregion - diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/135CAC7AC95DE0AD555F714073273E3F b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/135CAC7AC95DE0AD555F714073273E3F deleted file mode 100644 index 9729337d..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/135CAC7AC95DE0AD555F714073273E3F +++ /dev/null @@ -1,122 +0,0 @@ -#include "StgSharpNative.h" -#include "glfw_function_table.h" -#include - -void LoadGLFWFunctions(GLFWFunctionTable* table) { - memset(table, 0, sizeof(GLFWFunctionTable)); - table->glfwInit = glfwInit; - table->glfwTerminate = glfwTerminate; - table->glfwInitHint = glfwInitHint; - table->glfwGetVersion = glfwGetVersion; - table->glfwGetVersionString = glfwGetVersionString; - table->glfwGetError = glfwGetError; - table->glfwSetErrorCallback = glfwSetErrorCallback; - table->glfwGetMonitors = glfwGetMonitors; - table->glfwGetPrimaryMonitor = glfwGetPrimaryMonitor; - table->glfwGetMonitorPos = glfwGetMonitorPos; - table->glfwGetMonitorWorkarea = glfwGetMonitorWorkarea; - table->glfwGetMonitorPhysicalSize = glfwGetMonitorPhysicalSize; - table->glfwGetMonitorContentScale = glfwGetMonitorContentScale; - table->glfwGetMonitorName = glfwGetMonitorName; - table->glfwSetMonitorUserPointer = glfwSetMonitorUserPointer; - table->glfwGetMonitorUserPointer = glfwGetMonitorUserPointer; - table->glfwSetMonitorCallback = glfwSetMonitorCallback; - table->glfwGetVideoModes = glfwGetVideoModes; - table->glfwGetVideoMode = glfwGetVideoMode; - table->glfwSetGamma = glfwSetGamma; - table->glfwGetGammaRamp = glfwGetGammaRamp; - table->glfwSetGammaRamp = glfwSetGammaRamp; - table->glfwDefaultWindowHints = glfwDefaultWindowHints; - table->glfwWindowHint = glfwWindowHint; - table->glfwWindowHintString = glfwWindowHintString; - table->glfwCreateWindow = glfwCreateWindow; - table->glfwDestroyWindow = glfwDestroyWindow; - table->glfwWindowShouldClose = glfwWindowShouldClose; - table->glfwSetWindowShouldClose = glfwSetWindowShouldClose; - table->glfwSetWindowTitle = glfwSetWindowTitle; - table->glfwSetWindowIcon = glfwSetWindowIcon; - table->glfwGetWindowPos = glfwGetWindowPos; - table->glfwSetWindowPos = glfwSetWindowPos; - table->glfwGetWindowSize = glfwGetWindowSize; - table->glfwSetWindowSizeLimits = glfwSetWindowSizeLimits; - table->glfwSetWindowAspectRatio = glfwSetWindowAspectRatio; - table->glfwSetWindowSize = glfwSetWindowSize; - table->glfwGetFramebufferSize = glfwGetFramebufferSize; - table->glfwGetWindowFrameSize = glfwGetWindowFrameSize; - table->glfwGetWindowContentScale = glfwGetWindowContentScale; - table->glfwGetWindowOpacity = glfwGetWindowOpacity; - table->glfwSetWindowOpacity = glfwSetWindowOpacity; - table->glfwIconifyWindow = glfwIconifyWindow; - table->glfwRestoreWindow = glfwRestoreWindow; - table->glfwMaximizeWindow = glfwMaximizeWindow; - table->glfwShowWindow = glfwShowWindow; - table->glfwHideWindow = glfwHideWindow; - table->glfwFocusWindow = glfwFocusWindow; - table->glfwRequestWindowAttention = glfwRequestWindowAttention; - table->glfwGetWindowMonitor = glfwGetWindowMonitor; - table->glfwSetWindowMonitor = glfwSetWindowMonitor; - table->glfwGetWindowAttrib = glfwGetWindowAttrib; - table->glfwSetWindowAttrib = glfwSetWindowAttrib; - table->glfwSetWindowUserPointer = glfwSetWindowUserPointer; - table->glfwGetWindowUserPointer = glfwGetWindowUserPointer; - table->glfwSetWindowPosCallback = glfwSetWindowPosCallback; - table->glfwSetWindowSizeCallback = glfwSetWindowSizeCallback; - table->glfwSetWindowCloseCallback = glfwSetWindowCloseCallback; - table->glfwSetWindowRefreshCallback = glfwSetWindowRefreshCallback; - table->glfwSetWindowFocusCallback = glfwSetWindowFocusCallback; - table->glfwSetWindowIconifyCallback = glfwSetWindowIconifyCallback; - table->glfwSetWindowMaximizeCallback = glfwSetWindowMaximizeCallback; - table->glfwSetFramebufferSizeCallback = glfwSetFramebufferSizeCallback; - table->glfwSetWindowContentScaleCallback = glfwSetWindowContentScaleCallback; - table->glfwPollEvents = glfwPollEvents; - table->glfwWaitEvents = glfwWaitEvents; - table->glfwWaitEventsTimeout = glfwWaitEventsTimeout; - table->glfwPostEmptyEvent = glfwPostEmptyEvent; - table->glfwGetInputMode = glfwGetInputMode; - table->glfwSetInputMode = glfwSetInputMode; - table->glfwRawMouseMotionSupported = glfwRawMouseMotionSupported; - table->glfwGetKeyName = glfwGetKeyName; - table->glfwGetKeyScancode = glfwGetKeyScancode; - table->glfwGetKey = glfwGetKey; - table->glfwGetMouseButton = glfwGetMouseButton; - table->glfwGetCursorPos = glfwGetCursorPos; - table->glfwSetCursorPos = glfwSetCursorPos; - table->glfwCreateCursor = glfwCreateCursor; - table->glfwCreateStandardCursor = glfwCreateStandardCursor; - table->glfwDestroyCursor = glfwDestroyCursor; - table->glfwSetCursor = glfwSetCursor; - table->glfwSetKeyCallback = glfwSetKeyCallback; - table->glfwSetCharCallback = glfwSetCharCallback; - table->glfwSetCharModsCallback = glfwSetCharModsCallback; - table->glfwSetMouseButtonCallback = glfwSetMouseButtonCallback; - table->glfwSetCursorPosCallback = glfwSetCursorPosCallback; - table->glfwSetCursorEnterCallback = glfwSetCursorEnterCallback; - table->glfwSetScrollCallback = glfwSetScrollCallback; - table->glfwSetDropCallback = glfwSetDropCallback; - table->glfwJoystickPresent = glfwJoystickPresent; - table->glfwGetJoystickAxes = glfwGetJoystickAxes; - table->glfwGetJoystickButtons = glfwGetJoystickButtons; - table->glfwGetJoystickGUID = glfwGetJoystickGUID; - table->glfwGetJoystickHats = glfwGetJoystickHats; - table->glfwGetJoystickName = glfwGetJoystickName; - table->glfwGetJoystickUserPointer = glfwGetJoystickUserPointer; - table->glfwJoystickIsGamepad = glfwJoystickIsGamepad; - table->glfwSetJoystickCallback = glfwSetJoystickCallback; - table->glfwUpdateGamepadMappings = glfwUpdateGamepadMappings; - table->glfwGetGamepadName = glfwGetGamepadName; - table->glfwGetGamepadState = glfwGetGamepadState; - table->glfwSetClipboardString = glfwSetClipboardString; - table->glfwGetClipboardString = glfwGetClipboardString; - table->glfwGetTime = glfwGetTime; - table->glfwSetTime = glfwSetTime; - table->glfwGetTimerValue = glfwGetTimerValue; - table->glfwGetTimerFrequency = glfwGetTimerFrequency; - table->glfwMakeContextCurrent = glfwMakeContextCurrent; - table->glfwGetCurrentContext = glfwGetCurrentContext; - table->glfwSwapBuffers = glfwSwapBuffers; - table->glfwSwapInterval = glfwSwapInterval; - table->glfwExtensionSupported = glfwExtensionSupported; - table->glfwGetProcAddress = glfwGetProcAddress; - table->glfwVulkanSupported = glfwVulkanSupported; - table->glfwGetRequiredInstanceExtensions = glfwGetRequiredInstanceExtensions; -} diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/166A1ECCDB30BD0CE586285AF8DCC76D b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/166A1ECCDB30BD0CE586285AF8DCC76D deleted file mode 100644 index 39895862..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/166A1ECCDB30BD0CE586285AF8DCC76D +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef GLFW_FUNCTION_TABLE_H -#define GLFW_FUNCTION_TABLE_H - -#include "../glfw/glfw3.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct GLFWFunctionTable { - int (*glfwInit)(void); - void (*glfwTerminate)(void); - void (*glfwInitHint)(int hint, int value); - void (*glfwGetVersion)(int* major, int* minor, int* rev); - const char* (*glfwGetVersionString)(void); - int (*glfwGetError)(const char** description); - void* (*glfwSetErrorCallback)(void* callback); - GLFWmonitor** (*glfwGetMonitors)(int* count); - GLFWmonitor* (*glfwGetPrimaryMonitor)(void); - void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos); - void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height); - void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM); - void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale); - const char* (*glfwGetMonitorName)(GLFWmonitor* monitor); - void glfwSetMonitorUserPointer(GLFWmonitor* monitor, void* pointer); - void* glfwGetMonitorUserPointer(GLFWmonitor* monitor); - void* (*glfwSetMonitorCallback)(void* callback); - const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count); - const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor); - void (*glfwSetGamma)(GLFWmonitor* monitor, float gamma); - const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor); - void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp); - void (*glfwDefaultWindowHints)(void); - void (*glfwWindowHint)(int hint, int value); - void (*glfwWindowHintString)(int hint, const char* value); - GLFWwindow* (*glfwCreateWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share); - void (*glfwDestroyWindow)(GLFWwindow* window); - int (*glfwWindowShouldClose)(GLFWwindow* window); - void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value); - void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title); - void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images); - void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos); - void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos); - void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height); - void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); - void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom); - void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height); - void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height); - void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom); - void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale); - float (*glfwGetWindowOpacity)(GLFWwindow* window); - void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity); - void (*glfwIconifyWindow)(GLFWwindow* window); - void (*glfwRestoreWindow)(GLFWwindow* window); - void (*glfwMaximizeWindow)(GLFWwindow* window); - void (*glfwShowWindow)(GLFWwindow* window); - void (*glfwHideWindow)(GLFWwindow* window); - void (*glfwFocusWindow)(GLFWwindow* window); - void (*glfwRequestWindowAttention)(GLFWwindow* window); - GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window); - void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); - int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib); - void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value); - void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer); - void* (*glfwGetWindowUserPointer)(GLFWwindow* window); - void* (*glfwSetWindowPosCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetWindowSizeCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetWindowCloseCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetWindowRefreshCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetWindowFocusCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetWindowIconifyCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, void* callback); - void (*glfwPollEvents)(void); - void (*glfwWaitEvents)(void); - void (*glfwWaitEventsTimeout)(double timeout); - void (*glfwPostEmptyEvent)(void); - int (*glfwGetInputMode)(GLFWwindow* window, int mode); - void (*glfwSetInputMode)(GLFWwindow* window, int mode, int value); - int (*glfwRawMouseMotionSupported)(void); - const char* (*glfwGetKeyName)(int key, int scancode); - int (*glfwGetKeyScancode)(int key); - int (*glfwGetKey)(GLFWwindow* window, int key); - int (*glfwGetMouseButton)(GLFWwindow* window, int button); - void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos); - void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos); - GLFWcursor* (*glfwCreateCursor)(const GLFWimage* image, int xhot, int yhot); - GLFWcursor* (*glfwCreateStandardCursor)(int shape); - void (*glfwDestroyCursor)(GLFWcursor* cursor); - void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor); - void* (*glfwSetKeyCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetCharCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetCharModsCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetMouseButtonCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetCursorPosCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetCursorEnterCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetScrollCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetDropCallback)(GLFWwindow* window, void* callback); - int (*glfwJoystickPresent)(int jid); - const float* (*glfwGetJoystickAxes)(int jid, int* count); - const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count); - const char* (*glfwGetJoystickGUID)(int jid); - const unsigned char* (*glfwGetJoystickHats)(int jid, int* count); - const char* (*glfwGetJoystickName)(int jid); - void* (*glfwGetJoystickUserPointer)(int jid); - int (*glfwJoystickIsGamepad)(int jid); - void* (*glfwSetJoystickCallback)(void* callback); - int (*glfwUpdateGamepadMappings)(const char* str); - const char* (*glfwGetGamepadName)(int jid); - int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state); - void (*glfwSetClipboardString)(GLFWwindow* window, const char* str); - const char* (*glfwGetClipboardString)(GLFWwindow* window); - double (*glfwGetTime)(void); - void (*glfwSetTime)(double time); - unsigned long long (*glfwGetTimerValue)(void); - unsigned long long (*glfwGetTimerFrequency)(void); - void (*glfwMakeContextCurrent)(GLFWwindow* window); - GLFWwindow* (*glfwGetCurrentContext)(void); - void (*glfwSwapBuffers)(GLFWwindow* window); - void (*glfwSwapInterval)(int interval); - int (*glfwExtensionSupported)(const char* extension); - void* (*glfwGetProcAddress)(const char* procname); - int (*glfwVulkanSupported)(void); - const char** (*glfwGetRequiredInstanceExtensions)(unsigned int* count); -} GLFWFunctionTable; - -#ifdef __cplusplus -} -#endif - -#endif \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/2F706754A973706759ED5DC4DF8941BB b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/2F706754A973706759ED5DC4DF8941BB deleted file mode 100644 index 7fb941f2..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/2F706754A973706759ED5DC4DF8941BB +++ /dev/null @@ -1,366 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; - -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; - -namespace StgSharp.Internal -{ - internal unsafe partial class InternalIO - { - - private static GLFWFunction _glfw; - - [LibraryImport(NativeLibName, EntryPoint = "load_glfw_functions")] - internal static unsafe partial void glfwLoadLibrary(GLFWFunction* context); - - internal static unsafe void LoadGlfw() - { - _glfw = new GLFWFunction(); - fixed (GLFWFunction* func = &_glfw) { } - } - - #region api call - - internal static unsafe int glfwInit() => _glfw.glfwInit(); - - internal static unsafe void glfwTerminate() => _glfw.glfwTerminate(); - - internal static unsafe void glfwInitHint(int hint, int value) => _glfw.glfwInitHint(hint, value); - - internal static unsafe void glfwGetVersion(int* major, int* minor, int* rev) => _glfw.glfwGetVersion(major, minor, rev); - - internal static unsafe byte* glfwGetVersionString() => _glfw.glfwGetVersionString(); - - internal static unsafe int glfwGetError(byte** description) => _glfw.glfwGetError(description); - - internal static unsafe delegate* glfwSetErrorCallback(delegate* callback) => _glfw.glfwSetErrorCallback(callback); - - internal static unsafe IntPtr* glfwGetMonitors(int* count) => _glfw.glfwGetMonitors(count); - - internal static unsafe IntPtr glfwGetPrimaryMonitor() => _glfw.glfwGetPrimaryMonitor(); - - internal static unsafe void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos) => _glfw.glfwGetMonitorPos(monitor, xpos, ypos); - - internal static unsafe void glfwGetMonitorWorkarea( - IntPtr monitor, - int* xpos, - int* ypos, - int* width, - int* height) - { - _glfw.glfwGetMonitorWorkarea(monitor, xpos, ypos, width, height); - } - - internal static unsafe void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM) => _glfw.glfwGetMonitorPhysicalSize(monitor, widthMM, heightMM); - - internal static unsafe void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale) => _glfw.glfwGetMonitorContentScale(monitor, xscale, yscale); - - internal static unsafe byte* glfwGetMonitorName(IntPtr monitor) => _glfw.glfwGetMonitorName(monitor); - - internal static unsafe void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer) => _glfw.glfwSetMonitorUserPointer(monitor, pointer); - - internal static unsafe void* glfwGetMonitorUserPointer(IntPtr monitor) => _glfw.glfwGetMonitorUserPointer(monitor); - - internal static unsafe delegate* glfwSetMonitorCallback( - delegate* callback) => _glfw.glfwSetMonitorCallback(callback); - - internal static unsafe glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count) => _glfw.glfwGetVideoModes(monitor, count); - - internal static unsafe glfwVideomode* glfwGetVideoMode(IntPtr monitor) => _glfw.glfwGetVideoMode(monitor); - - internal static unsafe void glfwSetGamma(IntPtr monitor, float gamma) => _glfw.glfwSetGamma(monitor, gamma); - - internal static unsafe glfwGammaramp* glfwGetGammaRamp(IntPtr monitor) => _glfw.glfwGetGammaRamp(monitor); - - internal static unsafe void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp) => _glfw.glfwSetGammaRamp(monitor, ramp); - - internal static unsafe void glfwDefaultWindowHints() => _glfw.glfwDefaultWindowHints(); - - internal static unsafe void glfwWindowHint(int hint, int value) => _glfw.glfwWindowHint(hint, value); - - internal static unsafe void glfwWindowHintString(int hint, byte* value) => _glfw.glfwWindowHintString(hint, value); - - internal static unsafe IntPtr glfwCreateWindow( - int width, - int height, - byte[] title, - IntPtr monitor, - IntPtr share) => _glfw.glfwCreateWindow(width, height, title, monitor, share); - - internal static unsafe void glfwDestroyWindow(IntPtr window) => _glfw.glfwDestroyWindow(window); - - internal static unsafe int glfwWindowShouldClose(IntPtr window) => _glfw.glfwWindowShouldClose(window); - - internal static unsafe void glfwSetWindowShouldClose(IntPtr window, int value) => _glfw.glfwSetWindowShouldClose(window, value); - - internal static unsafe void glfwSetWindowTitle(IntPtr window, byte* title) => _glfw.glfwSetWindowTitle(window, title); - - internal static unsafe void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images) => _glfw.glfwSetWindowIcon(window, count, images); - - internal static unsafe void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos) => _glfw.glfwGetWindowPos(window, xpos, ypos); - - internal static unsafe void glfwSetWindowPos(IntPtr window, int xpos, int ypos) => _glfw.glfwSetWindowPos(window, xpos, ypos); - - internal static unsafe void glfwGetWindowSize(IntPtr window, int* width, int* height) => _glfw.glfwGetWindowSize(window, width, height); - - internal static unsafe void glfwSetWindowSizeLimits( - IntPtr window, - int minwidth, - int minheight, - int maxwidth, - int maxheight) => _glfw.glfwSetWindowSizeLimits(window, minwidth, minheight, maxwidth, maxheight); - - internal static unsafe void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom) => _glfw.glfwSetWindowAspectRatio(window, numer, denom); - - internal static unsafe void glfwSetWindowSize(IntPtr window, int width, int height) => _glfw.glfwSetWindowSize(window, width, height); - - internal static unsafe void glfwGetFramebufferSize(IntPtr window, int* width, int* height) => _glfw.glfwGetFramebufferSize(window, width, height); - - internal static unsafe void glfwGetWindowFrameSize(IntPtr window, int* left, int* top, int* right, int* bottom) => _glfw.glfwGetWindowFrameSize(window, left, top, right, bottom); - - internal static unsafe void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale) => _glfw.glfwGetWindowContentScale(window, xscale, yscale); - - internal static unsafe float glfwGetWindowOpacity(IntPtr window) => _glfw.glfwGetWindowOpacity(window); - - internal static unsafe void glfwSetWindowOpacity(IntPtr window, float opacity) => _glfw.glfwSetWindowOpacity(window, opacity); - - internal static unsafe void glfwIconifyWindow(IntPtr window) => _glfw.glfwIconifyWindow(window); - - internal static unsafe void glfwRestoreWindow(IntPtr window) => _glfw.glfwRestoreWindow(window); - - internal static unsafe void glfwMaximizeWindow(IntPtr window) => _glfw.glfwMaximizeWindow(window); - - internal static unsafe void glfwShowWindow(IntPtr window) => _glfw.glfwShowWindow(window); - - internal static unsafe void glfwHideWindow(IntPtr window) => _glfw.glfwHideWindow(window); - - internal static unsafe void glfwFocusWindow(IntPtr window) => _glfw.glfwFocusWindow(window); - - internal static unsafe void glfwRequestWindowAttention(IntPtr window) => _glfw.glfwRequestWindowAttention(window); - - internal static unsafe IntPtr glfwGetWindowMonitor(IntPtr window) => _glfw.glfwGetWindowMonitor(window); - - internal static unsafe void glfwSetWindowMonitor( - IntPtr window, - IntPtr monitor, - int xpos, - int ypos, - int width, - int height, - int refreshRate) => _glfw.glfwSetWindowMonitor( - window, monitor, xpos, ypos, width, height, refreshRate); - - internal static unsafe int glfwGetWindowAttrib(IntPtr window, int attrib) => _glfw.glfwGetWindowAttrib(window, attrib); - - internal static unsafe void glfwSetWindowAttrib(IntPtr window, int attrib, int value) => _glfw.glfwSetWindowAttrib(window, attrib, value); - - internal static unsafe void glfwSetWindowUserPointer(IntPtr window, void* pointer) => _glfw.glfwSetWindowUserPointer(window, pointer); - - internal static unsafe void* glfwGetWindowUserPointer(IntPtr window) => _glfw.glfwGetWindowUserPointer(window); - - internal static unsafe delegate* glfwSetWindowPosCallback( - IntPtr window, - IntPtr callback) => _glfw.glfwSetWindowPosCallback(window, callback); - - internal static unsafe delegate* glfwSetWindowSizeCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetWindowSizeCallback(window, callback); - - internal static unsafe delegate* glfwSetWindowCloseCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetWindowCloseCallback(window, callback); - - internal static unsafe delegate* glfwSetWindowRefreshCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetWindowRefreshCallback(window, callback); - - internal static unsafe delegate* glfwSetWindowFocusCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetWindowFocusCallback(window, callback); - - internal static unsafe delegate* glfwSetWindowIconifyCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetWindowIconifyCallback(window, callback); - - internal static unsafe delegate* glfwSetWindowMaximizeCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetWindowMaximizeCallback(window, callback); - - internal static unsafe FrameBufferSizeHandler glfwSetFramebufferSizeCallback(IntPtr window, IntPtr callback) => _glfw.glfwSetFramebufferSizeCallback(window, callback); - - internal static unsafe delegate* glfwSetWindowContentScaleCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetWindowContentScaleCallback(window, callback); - - internal static unsafe void glfwPollEvents() => _glfw.glfwPollEvents(); - - internal static unsafe void glfwWaitEvents() => _glfw.glfwWaitEvents(); - - internal static unsafe void glfwWaitEventsTimeout(double timeout) => _glfw.glfwWaitEventsTimeout(timeout); - - internal static unsafe void glfwPostEmptyEvent() => _glfw.glfwPostEmptyEvent(); - - internal static unsafe int glfwGetInputMode(IntPtr window, int mode) => _glfw.glfwGetInputMode(window, mode); - - internal static unsafe void glfwSetInputMode(IntPtr window, int mode, int value) => _glfw.glfwSetInputMode(window, mode, value); - - internal static unsafe int glfwRawMouseMotionSupported() => _glfw.glfwRawMouseMotionSupported(); - - internal static unsafe byte* glfwGetKeyName(int key, int scancode) => _glfw.glfwGetKeyName(key, scancode); - - internal static unsafe int glfwGetKeyScancode(int key) => _glfw.glfwGetKeyScancode(key); - - internal static unsafe KeyStatus glfwGetKey(IntPtr window, int key) => _glfw.glfwGetKey(window, key); - - internal static unsafe int glfwGetMouseButton(IntPtr window, int button) => _glfw.glfwGetMouseButton(window, button); - - internal static unsafe void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos) => _glfw.glfwGetCursorPos(window, xpos, ypos); - - internal static unsafe void glfwSetCursorPos(IntPtr window, double xpos, double ypos) => _glfw.glfwSetCursorPos(window, xpos, ypos); - - internal static unsafe GLFWcursor* glfwCreateCursor(GLFWimage* image, int xhot, int yhot) => _glfw.glfwCreateCursor(image, xhot, yhot); - - internal static unsafe GLFWcursor* glfwCreateStandardCursor(int shape) => _glfw.glfwCreateStandardCursor(shape); - - internal static unsafe void glfwDestroyCursor(GLFWcursor* cursor) => _glfw.glfwDestroyCursor(cursor); - - internal static unsafe void glfwSetCursor(IntPtr window, GLFWcursor* cursor) => _glfw.glfwSetCursor(window, cursor); - - internal static unsafe delegate* glfwSetKeyCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetKeyCallback(window, callback); - - internal static unsafe delegate* glfwSetCharCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetCharCallback(window, callback); - - internal static unsafe delegate* glfwSetCharModsCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetCharModsCallback(window, callback); - - internal static unsafe delegate* glfwSetMouseButtonCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetMouseButtonCallback(window, callback); - - internal static unsafe delegate* glfwSetCursorPosCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetCursorPosCallback(window, callback); - - internal static unsafe delegate* glfwSetCursorEnterCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetCursorEnterCallback(window, callback); - - internal static unsafe delegate* glfwSetScrollCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetScrollCallback(window, callback); - - internal static unsafe delegate* glfwSetDropCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetDropCallback(window, callback); - - internal static unsafe int glfwJoystickPresent(int jid) => _glfw.glfwJoystickPresent(jid); - - internal static unsafe float* glfwGetJoystickAxes(int jid, int* count) => _glfw.glfwGetJoystickAxes(jid, count); - - internal static unsafe byte* glfwGetJoystickButtons(int jid, int* count) => _glfw.glfwGetJoystickButtons(jid, count); - - internal static unsafe byte* glfwGetJoystickHats(int jid, int* count) => _glfw.glfwGetJoystickHats(jid, count); - - internal static unsafe byte* glfwGetJoystickName(int jid) => _glfw.glfwGetJoystickName(jid); - - internal static unsafe byte* glfwGetJoystickGUID(int jid) => _glfw.glfwGetJoystickGUID(jid); - - internal static unsafe void glfwSetJoystickUserPointer(int jid, void* pointer) => _glfw.glfwSetJoystickUserPointer(jid, pointer); - - internal static unsafe void* glfwGetJoystickUserPointer(int jid) => _glfw.glfwGetJoystickUserPointer(jid); - - internal static unsafe int glfwJoystickIsGamepad(int jid) => _glfw.glfwJoystickIsGamepad(jid); - - internal static unsafe delegate* glfwSetJoystickCallback(delegate* callback) => _glfw.glfwSetJoystickCallback(callback); - - internal static unsafe int glfwUpdateGamepadMappings(byte* str) => _glfw.glfwUpdateGamepadMappings(str); - - internal static unsafe byte* glfwGetGamepadName(int jid) => _glfw.glfwGetGamepadName(jid); - - internal static unsafe int glfwGetGamepadState(int jid, GLFWgamepadstate* state) => _glfw.glfwGetGamepadState(jid, state); - - internal static unsafe void glfwSetClipboardString(IntPtr window, byte* str) => _glfw.glfwSetClipboardString(window, str); - - internal static unsafe byte* glfwGetClipboardString(IntPtr window) => _glfw.glfwGetClipboardString(window); - - internal static unsafe double glfwGetTime() => _glfw.glfwGetTime(); - - internal static unsafe void glfwSetTime(double time) => _glfw.glfwSetTime(time); - - internal static unsafe ulong* glfwGetTimerValue() => _glfw.glfwGetTimerValue(); - - internal static unsafe ulong* glfwGetTimerFrequency() => _glfw.glfwGetTimerFrequency(); - - internal static unsafe void glfwMakeContextCurrent(IntPtr window) => _glfw.glfwMakeContextCurrent(window); - - internal static unsafe IntPtr glfwGetCurrentContext() => _glfw.glfwGetCurrentContext(); - - internal static unsafe void glfwSwapBuffers(IntPtr window) => _glfw.glfwSwapBuffers(window); - - internal static unsafe void glfwSwapInterval(int interval) => _glfw.glfwSwapInterval(interval); - - internal static unsafe int glfwExtensionSupported(byte* extension) => _glfw.glfwExtensionSupported(extension); - - internal static unsafe IntPtr glfwGetProcAddress(string procname) => _glfw.glfwGetProcAddress(procname); - - internal static unsafe int glfwVulkanSupported() => _glfw.glfwVulkanSupported(); - - internal static unsafe byte** glfwGetRequiredInstanceExtensions(uint* count) => _glfw.glfwGetRequiredInstanceExtensions(count); - - /* - [LibraryImport(NativeLibName, EntryPoint = "glfwGetInstanceProcAddress")] internal static unsafe partial delegate* glfwGetInstanceProcAddress( - VkInstance instance, - byte* procname); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetPhysicalDevicePresentationSupport")] internal static unsafe partial int glfwGetPhysicalDevicePresentationSupport( - VkInstance instance, - VkPhysicalDevice device, - uint* queuefamily); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindowSurface")] internal static unsafe partial VkResult glfwCreateWindowSurface( - VkInstance instance, - glfwWindow* window, - VkAllocationCallbacks* _allocator, - VkSurfaceKHR* surface); - /**/ - - #endregion api call - } -} diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/3D40D8052D36F2E6DA41032D46BCCFFA b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/3D40D8052D36F2E6DA41032D46BCCFFA deleted file mode 100644 index 889c5296..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/3D40D8052D36F2E6DA41032D46BCCFFA +++ /dev/null @@ -1,157 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfwFunction.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.InteropServices; - -namespace StgSharp.Internal -{ - [StructLayout(LayoutKind.Sequential)] - internal unsafe struct GLFWFunction - { - - public delegate* unmanaged[Cdecl] glfwCreateCursor; - public delegate* unmanaged[Cdecl] glfwCreateStandardCursor; - public delegate* unmanaged[Cdecl] glfwCreateWindow; - public delegate* unmanaged[Cdecl] glfwDefaultWindowHints; - public delegate* unmanaged[Cdecl] glfwDestroyCursor; - public delegate* unmanaged[Cdecl] glfwDestroyWindow; - public delegate* unmanaged[Cdecl] glfwExtensionSupported; - public delegate* unmanaged[Cdecl] glfwFocusWindow; - public delegate* unmanaged[Cdecl] glfwGetClipboardString; - public delegate* unmanaged[Cdecl] glfwGetCurrentContext; - public delegate* unmanaged[Cdecl] glfwGetCursorPos; - public delegate* unmanaged[Cdecl] glfwGetError; - public delegate* unmanaged[Cdecl] glfwGetFramebufferSize; - public delegate* unmanaged[Cdecl] glfwGetGamepadName; - public delegate* unmanaged[Cdecl] glfwGetGamepadState; - public delegate* unmanaged[Cdecl] glfwGetGammaRamp; - public delegate* unmanaged[Cdecl] glfwGetInputMode; - public delegate* unmanaged[Cdecl] glfwGetJoystickAxes; - public delegate* unmanaged[Cdecl] glfwGetJoystickButtons; - public delegate* unmanaged[Cdecl] glfwGetJoystickGUID; - public delegate* unmanaged[Cdecl] glfwGetJoystickHats; - public delegate* unmanaged[Cdecl] glfwGetJoystickName; - public delegate* unmanaged[Cdecl] glfwGetJoystickUserPointer; - public delegate* unmanaged[Cdecl] glfwGetKey; - public delegate* unmanaged[Cdecl] glfwGetKeyName; - public delegate* unmanaged[Cdecl] glfwGetKeyScancode; - public delegate* unmanaged[Cdecl] glfwGetMonitorContentScale; - public delegate* unmanaged[Cdecl] glfwGetMonitorName; - public delegate* unmanaged[Cdecl] glfwGetMonitorPhysicalSize; - public delegate* unmanaged[Cdecl] glfwGetMonitorPos; - public delegate* unmanaged[Cdecl] glfwGetMonitors; - public delegate* unmanaged[Cdecl] glfwGetMonitorUserPointer; - public delegate* unmanaged[Cdecl] glfwGetMonitorWorkarea; - public delegate* unmanaged[Cdecl] glfwGetMouseButton; - public delegate* unmanaged[Cdecl] glfwGetPrimaryMonitor; - public delegate* unmanaged[Cdecl] glfwGetProcAddress; - public delegate* unmanaged[Cdecl] glfwGetRequiredInstanceExtensions; - public delegate* unmanaged[Cdecl] glfwGetTime; - public delegate* unmanaged[Cdecl] glfwGetTimerFrequency; - public delegate* unmanaged[Cdecl] glfwGetTimerValue; - public delegate* unmanaged[Cdecl] glfwGetVersion; - public delegate* unmanaged[Cdecl] glfwGetVersionString; - public delegate* unmanaged[Cdecl] glfwGetVideoMode; - public delegate* unmanaged[Cdecl] glfwGetVideoModes; - public delegate* unmanaged[Cdecl] glfwGetWindowAttrib; - public delegate* unmanaged[Cdecl] glfwGetWindowContentScale; - public delegate* unmanaged[Cdecl] glfwGetWindowFrameSize; - public delegate* unmanaged[Cdecl] glfwGetWindowMonitor; - public delegate* unmanaged[Cdecl] glfwGetWindowOpacity; - public delegate* unmanaged[Cdecl] glfwGetWindowPos; - public delegate* unmanaged[Cdecl] glfwGetWindowSize; - public delegate* unmanaged[Cdecl] glfwGetWindowUserPointer; - public delegate* unmanaged[Cdecl] glfwHideWindow; - public delegate* unmanaged[Cdecl] glfwIconifyWindow; - public delegate* unmanaged[Cdecl] glfwInit; - public delegate* unmanaged[Cdecl] glfwInitHint; - public delegate* unmanaged[Cdecl] glfwJoystickIsGamepad; - public delegate* unmanaged[Cdecl] glfwJoystickPresent; - public delegate* unmanaged[Cdecl] glfwMakeContextCurrent; - public delegate* unmanaged[Cdecl] glfwMaximizeWindow; - public delegate* unmanaged[Cdecl] glfwPollEvents; - public delegate* unmanaged[Cdecl] glfwPostEmptyEvent; - public delegate* unmanaged[Cdecl] glfwRawMouseMotionSupported; - public delegate* unmanaged[Cdecl] glfwRequestWindowAttention; - public delegate* unmanaged[Cdecl] glfwRestoreWindow; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCharCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCharModsCallback; - public delegate* unmanaged[Cdecl] glfwSetClipboardString; - public delegate* unmanaged[Cdecl] glfwSetCursor; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCursorEnterCallback; - public delegate* unmanaged[Cdecl] glfwSetCursorPos; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCursorPosCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetDropCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetErrorCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetFramebufferSizeCallback; - public delegate* unmanaged[Cdecl] glfwSetGamma; - public delegate* unmanaged[Cdecl] glfwSetGammaRamp; - public delegate* unmanaged[Cdecl] glfwSetInputMode; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetJoystickCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetKeyCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetMonitorCallback; - public delegate* unmanaged[Cdecl] glfwSetMonitorUserPointer; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetMouseButtonCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetScrollCallback; - public delegate* unmanaged[Cdecl] glfwSetTime; - public delegate* unmanaged[Cdecl] glfwSetWindowAspectRatio; - public delegate* unmanaged[Cdecl] glfwSetWindowAttrib; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowCloseCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowContentScaleCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowFocusCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowIcon; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowIconifyCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowMaximizeCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowMonitor; - public delegate* unmanaged[Cdecl] glfwSetWindowOpacity; - public delegate* unmanaged[Cdecl] glfwSetWindowPos; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowPosCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowRefreshCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowShouldClose; - public delegate* unmanaged[Cdecl] glfwSetWindowSize; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowSizeCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowSizeLimits; - public delegate* unmanaged[Cdecl] glfwSetWindowTitle; - public delegate* unmanaged[Cdecl] glfwSetWindowUserPointer; - public delegate* unmanaged[Cdecl] glfwShowWindow; - public delegate* unmanaged[Cdecl] glfwSwapBuffers; - public delegate* unmanaged[Cdecl] glfwSwapInterval; - public delegate* unmanaged[Cdecl] glfwTerminate; - public delegate* unmanaged[Cdecl] glfwUpdateGamepadMappings; - public delegate* unmanaged[Cdecl] glfwVulkanSupported; - public delegate* unmanaged[Cdecl] glfwWaitEvents; - public delegate* unmanaged[Cdecl] glfwWaitEventsTimeout; - public delegate* unmanaged[Cdecl] glfwWindowHint; - public delegate* unmanaged[Cdecl] glfwWindowHintString; - public delegate* unmanaged[Cdecl] glfwWindowShouldClose; - - } -}} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/4F1D8C005951704097607C7179658E45 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/4F1D8C005951704097607C7179658E45 deleted file mode 100644 index 39895862..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/4F1D8C005951704097607C7179658E45 +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef GLFW_FUNCTION_TABLE_H -#define GLFW_FUNCTION_TABLE_H - -#include "../glfw/glfw3.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct GLFWFunctionTable { - int (*glfwInit)(void); - void (*glfwTerminate)(void); - void (*glfwInitHint)(int hint, int value); - void (*glfwGetVersion)(int* major, int* minor, int* rev); - const char* (*glfwGetVersionString)(void); - int (*glfwGetError)(const char** description); - void* (*glfwSetErrorCallback)(void* callback); - GLFWmonitor** (*glfwGetMonitors)(int* count); - GLFWmonitor* (*glfwGetPrimaryMonitor)(void); - void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos); - void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height); - void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM); - void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale); - const char* (*glfwGetMonitorName)(GLFWmonitor* monitor); - void glfwSetMonitorUserPointer(GLFWmonitor* monitor, void* pointer); - void* glfwGetMonitorUserPointer(GLFWmonitor* monitor); - void* (*glfwSetMonitorCallback)(void* callback); - const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count); - const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor); - void (*glfwSetGamma)(GLFWmonitor* monitor, float gamma); - const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor); - void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp); - void (*glfwDefaultWindowHints)(void); - void (*glfwWindowHint)(int hint, int value); - void (*glfwWindowHintString)(int hint, const char* value); - GLFWwindow* (*glfwCreateWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share); - void (*glfwDestroyWindow)(GLFWwindow* window); - int (*glfwWindowShouldClose)(GLFWwindow* window); - void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value); - void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title); - void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images); - void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos); - void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos); - void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height); - void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); - void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom); - void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height); - void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height); - void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom); - void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale); - float (*glfwGetWindowOpacity)(GLFWwindow* window); - void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity); - void (*glfwIconifyWindow)(GLFWwindow* window); - void (*glfwRestoreWindow)(GLFWwindow* window); - void (*glfwMaximizeWindow)(GLFWwindow* window); - void (*glfwShowWindow)(GLFWwindow* window); - void (*glfwHideWindow)(GLFWwindow* window); - void (*glfwFocusWindow)(GLFWwindow* window); - void (*glfwRequestWindowAttention)(GLFWwindow* window); - GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window); - void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); - int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib); - void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value); - void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer); - void* (*glfwGetWindowUserPointer)(GLFWwindow* window); - void* (*glfwSetWindowPosCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetWindowSizeCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetWindowCloseCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetWindowRefreshCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetWindowFocusCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetWindowIconifyCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, void* callback); - void (*glfwPollEvents)(void); - void (*glfwWaitEvents)(void); - void (*glfwWaitEventsTimeout)(double timeout); - void (*glfwPostEmptyEvent)(void); - int (*glfwGetInputMode)(GLFWwindow* window, int mode); - void (*glfwSetInputMode)(GLFWwindow* window, int mode, int value); - int (*glfwRawMouseMotionSupported)(void); - const char* (*glfwGetKeyName)(int key, int scancode); - int (*glfwGetKeyScancode)(int key); - int (*glfwGetKey)(GLFWwindow* window, int key); - int (*glfwGetMouseButton)(GLFWwindow* window, int button); - void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos); - void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos); - GLFWcursor* (*glfwCreateCursor)(const GLFWimage* image, int xhot, int yhot); - GLFWcursor* (*glfwCreateStandardCursor)(int shape); - void (*glfwDestroyCursor)(GLFWcursor* cursor); - void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor); - void* (*glfwSetKeyCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetCharCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetCharModsCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetMouseButtonCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetCursorPosCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetCursorEnterCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetScrollCallback)(GLFWwindow* window, void* callback); - void* (*glfwSetDropCallback)(GLFWwindow* window, void* callback); - int (*glfwJoystickPresent)(int jid); - const float* (*glfwGetJoystickAxes)(int jid, int* count); - const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count); - const char* (*glfwGetJoystickGUID)(int jid); - const unsigned char* (*glfwGetJoystickHats)(int jid, int* count); - const char* (*glfwGetJoystickName)(int jid); - void* (*glfwGetJoystickUserPointer)(int jid); - int (*glfwJoystickIsGamepad)(int jid); - void* (*glfwSetJoystickCallback)(void* callback); - int (*glfwUpdateGamepadMappings)(const char* str); - const char* (*glfwGetGamepadName)(int jid); - int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state); - void (*glfwSetClipboardString)(GLFWwindow* window, const char* str); - const char* (*glfwGetClipboardString)(GLFWwindow* window); - double (*glfwGetTime)(void); - void (*glfwSetTime)(double time); - unsigned long long (*glfwGetTimerValue)(void); - unsigned long long (*glfwGetTimerFrequency)(void); - void (*glfwMakeContextCurrent)(GLFWwindow* window); - GLFWwindow* (*glfwGetCurrentContext)(void); - void (*glfwSwapBuffers)(GLFWwindow* window); - void (*glfwSwapInterval)(int interval); - int (*glfwExtensionSupported)(const char* extension); - void* (*glfwGetProcAddress)(const char* procname); - int (*glfwVulkanSupported)(void); - const char** (*glfwGetRequiredInstanceExtensions)(unsigned int* count); -} GLFWFunctionTable; - -#ifdef __cplusplus -} -#endif - -#endif \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/516E4750BFA070C15018A44BF13AD02C b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/516E4750BFA070C15018A44BF13AD02C deleted file mode 100644 index f3f91a8e..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/516E4750BFA070C15018A44BF13AD02C +++ /dev/null @@ -1,123 +0,0 @@ -#ifndef GLFW_FUNCTION_TABLE_H -#define GLFW_FUNCTION_TABLE_H - -#include "../glfw/glfw3.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct GLFWFunctionTable { - void (*glfwCreateCursor)(GLFWimage* image, int xhot, int yhot); - GLFWcursor* (*glfwCreateStandardCursor)(int shape); - GLFWwindow* (*glfwCreateWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share); - void (*glfwDefaultWindowHints)(void); - void (*glfwDestroyCursor)(GLFWcursor* cursor); - void (*glfwDestroyWindow)(GLFWwindow* window); - void (*glfwFocusWindow)(GLFWwindow* window); - const char* (*glfwGetClipboardString)(GLFWwindow* window); - GLFWwindow* (*glfwGetCurrentContext)(void); - void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos); - int (*glfwGetError)(const char** description); - void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height); - const char* (*glfwGetGamepadName)(int jid); - int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state); - const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor); - int (*glfwGetInputMode)(GLFWwindow* window, int mode); - const float* (*glfwGetJoystickAxes)(int jid, int* count); - const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count); - const char* (*glfwGetJoystickGUID)(int jid); - const unsigned char* (*glfwGetJoystickHats)(int jid, int* count); - const char* (*glfwGetJoystickName)(int jid); - void* (*glfwGetJoystickUserPointer)(int jid); - int (*glfwGetKey)(GLFWwindow* window, int key); - const char* (*glfwGetKeyName)(int key, int scancode); - int (*glfwGetKeyScancode)(int key); - void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale); - const char* (*glfwGetMonitorName)(GLFWmonitor* monitor); - void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM); - void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos); - GLFWmonitor** (*glfwGetMonitors)(int* count); - void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor); - void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height); - int (*glfwGetMouseButton)(GLFWwindow* window, int button); - GLFWmonitor* (*glfwGetPrimaryMonitor)(void); - double (*glfwGetTime)(void); - uint64_t (*glfwGetTimerFrequency)(void); - uint64_t (*glfwGetTimerValue)(void); - const char* (*glfwGetVersionString)(void); - const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor); - const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count); - int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib); - void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale); - void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom); - GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window); - float (*glfwGetWindowOpacity)(GLFWwindow* window); - void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos); - void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height); - void* (*glfwGetWindowUserPointer)(GLFWwindow* window); - void (*glfwHideWindow)(GLFWwindow* window); - void (*glfwIconifyWindow)(GLFWwindow* window); - int (*glfwInit)(void); - void (*glfwInitHint)(int hint, int value); - void (*glfwMakeContextCurrent)(GLFWwindow* window); - void (*glfwMaximizeWindow)(GLFWwindow* window); - void (*glfwPollEvents)(void); - void (*glfwPostEmptyEvent)(void); - void (*glfwRequestWindowAttention)(GLFWwindow* window); - int (*glfwRawMouseMotionSupported)(void); - void (*glfwRestoreWindow)(GLFWwindow* window); - void (*glfwSetClipboardString)(GLFWwindow* window, const char* string); - GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback); - GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback); - void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor); - GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback); - void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos); - GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback); - GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback); - void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp); - GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback); - void (*glfwSetJoystickUserPointer)(int jid, void* pointer); - GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback); - void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer); - GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback); - void (*glfwSetTime)(double time); - void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom); - void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value); - GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback); - void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images); - GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback); - GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback); - GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback); - GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback); - void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); - GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback); - void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity); - GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback); - void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos); - GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback); - void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value); - void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); - GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback); - void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height); - void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title); - void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer); - GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback); - GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback); - void (*glfwSwapBuffers)(GLFWwindow* window); - void (*glfwSwapInterval)(int interval); - void (*glfwTerminate)(void); - int (*glfwUpdateGamepadMappings)(const char* string); - void (*glfwWaitEvents)(void); - void (*glfwWaitEventsTimeout)(double timeout); - int (*glfwVulkanSupported)(void); - int (*glfwWindowShouldClose)(GLFWwindow* window); -} GLFWFunctionTable; - -void LoadGLFWFunctions(GLFWFunctionTable* table); - -#ifdef __cplusplus -} -#endif - -#endif \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/524702B030C2D2424860FAC921D37497 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/524702B030C2D2424860FAC921D37497 deleted file mode 100644 index f3f91a8e..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/524702B030C2D2424860FAC921D37497 +++ /dev/null @@ -1,123 +0,0 @@ -#ifndef GLFW_FUNCTION_TABLE_H -#define GLFW_FUNCTION_TABLE_H - -#include "../glfw/glfw3.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct GLFWFunctionTable { - void (*glfwCreateCursor)(GLFWimage* image, int xhot, int yhot); - GLFWcursor* (*glfwCreateStandardCursor)(int shape); - GLFWwindow* (*glfwCreateWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share); - void (*glfwDefaultWindowHints)(void); - void (*glfwDestroyCursor)(GLFWcursor* cursor); - void (*glfwDestroyWindow)(GLFWwindow* window); - void (*glfwFocusWindow)(GLFWwindow* window); - const char* (*glfwGetClipboardString)(GLFWwindow* window); - GLFWwindow* (*glfwGetCurrentContext)(void); - void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos); - int (*glfwGetError)(const char** description); - void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height); - const char* (*glfwGetGamepadName)(int jid); - int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state); - const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor); - int (*glfwGetInputMode)(GLFWwindow* window, int mode); - const float* (*glfwGetJoystickAxes)(int jid, int* count); - const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count); - const char* (*glfwGetJoystickGUID)(int jid); - const unsigned char* (*glfwGetJoystickHats)(int jid, int* count); - const char* (*glfwGetJoystickName)(int jid); - void* (*glfwGetJoystickUserPointer)(int jid); - int (*glfwGetKey)(GLFWwindow* window, int key); - const char* (*glfwGetKeyName)(int key, int scancode); - int (*glfwGetKeyScancode)(int key); - void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale); - const char* (*glfwGetMonitorName)(GLFWmonitor* monitor); - void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM); - void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos); - GLFWmonitor** (*glfwGetMonitors)(int* count); - void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor); - void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height); - int (*glfwGetMouseButton)(GLFWwindow* window, int button); - GLFWmonitor* (*glfwGetPrimaryMonitor)(void); - double (*glfwGetTime)(void); - uint64_t (*glfwGetTimerFrequency)(void); - uint64_t (*glfwGetTimerValue)(void); - const char* (*glfwGetVersionString)(void); - const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor); - const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count); - int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib); - void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale); - void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom); - GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window); - float (*glfwGetWindowOpacity)(GLFWwindow* window); - void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos); - void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height); - void* (*glfwGetWindowUserPointer)(GLFWwindow* window); - void (*glfwHideWindow)(GLFWwindow* window); - void (*glfwIconifyWindow)(GLFWwindow* window); - int (*glfwInit)(void); - void (*glfwInitHint)(int hint, int value); - void (*glfwMakeContextCurrent)(GLFWwindow* window); - void (*glfwMaximizeWindow)(GLFWwindow* window); - void (*glfwPollEvents)(void); - void (*glfwPostEmptyEvent)(void); - void (*glfwRequestWindowAttention)(GLFWwindow* window); - int (*glfwRawMouseMotionSupported)(void); - void (*glfwRestoreWindow)(GLFWwindow* window); - void (*glfwSetClipboardString)(GLFWwindow* window, const char* string); - GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback); - GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback); - void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor); - GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback); - void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos); - GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback); - GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback); - void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp); - GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback); - void (*glfwSetJoystickUserPointer)(int jid, void* pointer); - GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback); - void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer); - GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback); - void (*glfwSetTime)(double time); - void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom); - void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value); - GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback); - void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images); - GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback); - GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback); - GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback); - GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback); - void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); - GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback); - void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity); - GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback); - void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos); - GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback); - void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value); - void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); - GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback); - void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height); - void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title); - void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer); - GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback); - GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback); - void (*glfwSwapBuffers)(GLFWwindow* window); - void (*glfwSwapInterval)(int interval); - void (*glfwTerminate)(void); - int (*glfwUpdateGamepadMappings)(const char* string); - void (*glfwWaitEvents)(void); - void (*glfwWaitEventsTimeout)(double timeout); - int (*glfwVulkanSupported)(void); - int (*glfwWindowShouldClose)(GLFWwindow* window); -} GLFWFunctionTable; - -void LoadGLFWFunctions(GLFWFunctionTable* table); - -#ifdef __cplusplus -} -#endif - -#endif \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/85640CC1F60032566B378A1E4081FD35 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/85640CC1F60032566B378A1E4081FD35 deleted file mode 100644 index d6228b3a..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/85640CC1F60032566B378A1E4081FD35 +++ /dev/null @@ -1,3 +0,0 @@ -#include "StgSharpNative.h" -#include "glfw_function_table.h" -#include diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/8D40139AB64C449627A5C6C270E0A97D b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/8D40139AB64C449627A5C6C270E0A97D deleted file mode 100644 index 48081bd3..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/8D40139AB64C449627A5C6C270E0A97D +++ /dev/null @@ -1,156 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw_function_table.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.InteropServices; - -namespace StgSharp.Internal -{ - [StructLayout(LayoutKind.Sequential)] - internal unsafe struct GLFWFunction - { - - public delegate* unmanaged[Cdecl] glfwCreateCursor; - public delegate* unmanaged[Cdecl] glfwCreateStandardCursor; - public delegate* unmanaged[Cdecl] glfwCreateWindow; - public delegate* unmanaged[Cdecl] glfwDefaultWindowHints; - public delegate* unmanaged[Cdecl] glfwDestroyCursor; - public delegate* unmanaged[Cdecl] glfwDestroyWindow; - public delegate* unmanaged[Cdecl] glfwExtensionSupported; - public delegate* unmanaged[Cdecl] glfwFocusWindow; - public delegate* unmanaged[Cdecl] glfwGetClipboardString; - public delegate* unmanaged[Cdecl] glfwGetCurrentContext; - public delegate* unmanaged[Cdecl] glfwGetCursorPos; - public delegate* unmanaged[Cdecl] glfwGetError; - public delegate* unmanaged[Cdecl] glfwGetFramebufferSize; - public delegate* unmanaged[Cdecl] glfwGetGamepadName; - public delegate* unmanaged[Cdecl] glfwGetGamepadState; - public delegate* unmanaged[Cdecl] glfwGetGammaRamp; - public delegate* unmanaged[Cdecl] glfwGetInputMode; - public delegate* unmanaged[Cdecl] glfwGetJoystickAxes; - public delegate* unmanaged[Cdecl] glfwGetJoystickButtons; - public delegate* unmanaged[Cdecl] glfwGetJoystickGUID; - public delegate* unmanaged[Cdecl] glfwGetJoystickHats; - public delegate* unmanaged[Cdecl] glfwGetJoystickName; - public delegate* unmanaged[Cdecl] glfwGetJoystickUserPointer; - public delegate* unmanaged[Cdecl] glfwGetKey; - public delegate* unmanaged[Cdecl] glfwGetKeyName; - public delegate* unmanaged[Cdecl] glfwGetKeyScancode; - public delegate* unmanaged[Cdecl] glfwGetMonitorContentScale; - public delegate* unmanaged[Cdecl] glfwGetMonitorName; - public delegate* unmanaged[Cdecl] glfwGetMonitorPhysicalSize; - public delegate* unmanaged[Cdecl] glfwGetMonitorPos; - public delegate* unmanaged[Cdecl] glfwGetMonitors; - public delegate* unmanaged[Cdecl] glfwGetMonitorUserPointer; - public delegate* unmanaged[Cdecl] glfwGetMonitorWorkarea; - public delegate* unmanaged[Cdecl] glfwGetMouseButton; - public delegate* unmanaged[Cdecl] glfwGetPrimaryMonitor; - public delegate* unmanaged[Cdecl] glfwGetProcAddress; - public delegate* unmanaged[Cdecl] glfwGetRequiredInstanceExtensions; - public delegate* unmanaged[Cdecl] glfwGetTime; - public delegate* unmanaged[Cdecl] glfwGetTimerFrequency; - public delegate* unmanaged[Cdecl] glfwGetTimerValue; - public delegate* unmanaged[Cdecl] glfwGetVersionString; - public delegate* unmanaged[Cdecl] glfwGetVideoMode; - public delegate* unmanaged[Cdecl] glfwGetVideoModes; - public delegate* unmanaged[Cdecl] glfwGetWindowAttrib; - public delegate* unmanaged[Cdecl] glfwGetWindowContentScale; - public delegate* unmanaged[Cdecl] glfwGetWindowFrameSize; - public delegate* unmanaged[Cdecl] glfwGetWindowMonitor; - public delegate* unmanaged[Cdecl] glfwGetWindowOpacity; - public delegate* unmanaged[Cdecl] glfwGetWindowPos; - public delegate* unmanaged[Cdecl] glfwGetWindowSize; - public delegate* unmanaged[Cdecl] glfwGetWindowUserPointer; - public delegate* unmanaged[Cdecl] glfwHideWindow; - public delegate* unmanaged[Cdecl] glfwIconifyWindow; - public delegate* unmanaged[Cdecl] glfwInit; - public delegate* unmanaged[Cdecl] glfwInitHint; - public delegate* unmanaged[Cdecl] glfwJoystickIsGamepad; - public delegate* unmanaged[Cdecl] glfwJoystickPresent; - public delegate* unmanaged[Cdecl] glfwMakeContextCurrent; - public delegate* unmanaged[Cdecl] glfwMaximizeWindow; - public delegate* unmanaged[Cdecl] glfwPollEvents; - public delegate* unmanaged[Cdecl] glfwPostEmptyEvent; - public delegate* unmanaged[Cdecl] glfwRawMouseMotionSupported; - public delegate* unmanaged[Cdecl] glfwRequestWindowAttention; - public delegate* unmanaged[Cdecl] glfwRestoreWindow; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCharCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCharModsCallback; - public delegate* unmanaged[Cdecl] glfwSetClipboardString; - public delegate* unmanaged[Cdecl] glfwSetCursor; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCursorEnterCallback; - public delegate* unmanaged[Cdecl] glfwSetCursorPos; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCursorPosCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged [Cdecl]> glfwSetDropCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetFramebufferSizeCallback; - public delegate* unmanaged[Cdecl] glfwSetGamma; - public delegate* unmanaged[Cdecl] glfwSetGammaRamp; - public delegate* unmanaged[Cdecl] glfwSetInputMode; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetJoystickCallback; - public delegate* unmanaged[Cdecl] glfwSetJoystickUserPointer; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetKeyCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetMonitorCallback; - public delegate* unmanaged[Cdecl] glfwSetMonitorUserPointer; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetMouseButtonCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetScrollCallback; - public delegate* unmanaged[Cdecl] glfwSetTime; - public delegate* unmanaged[Cdecl] glfwSetWindowAspectRatio; - public delegate* unmanaged[Cdecl] glfwSetWindowAttrib; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowCloseCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowContentScaleCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowFocusCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowIcon; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowIconifyCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowMaximizeCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowMonitor; - public delegate* unmanaged[Cdecl] glfwSetWindowOpacity; - public delegate* unmanaged[Cdecl] glfwSetWindowPos; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowPosCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowRefreshCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowShouldClose; - public delegate* unmanaged[Cdecl] glfwSetWindowSize; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowSizeCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowSizeLimits; - public delegate* unmanaged[Cdecl] glfwSetWindowTitle; - public delegate* unmanaged[Cdecl] glfwSetWindowUserPointer; - public delegate* unmanaged[Cdecl] glfwShowWindow; - public delegate* unmanaged[Cdecl] glfwSwapBuffers; - public delegate* unmanaged[Cdecl] glfwSwapInterval; - public delegate* unmanaged[Cdecl] glfwTerminate; - public delegate* unmanaged[Cdecl] glfwUpdateGamepadMappings; - public delegate* unmanaged[Cdecl] glfwVulkanSupported; - public delegate* unmanaged[Cdecl] glfwWaitEvents; - public delegate* unmanaged[Cdecl] glfwWaitEventsTimeout; - public delegate* unmanaged[Cdecl] glfwWindowHint; - public delegate* unmanaged[Cdecl] glfwWindowHintString; - public delegate* unmanaged[Cdecl] glfwWindowShouldClose; - - } -} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/9AAA6918CC98F3847ABC52B791273D25 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/9AAA6918CC98F3847ABC52B791273D25 deleted file mode 100644 index d6228b3a..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/9AAA6918CC98F3847ABC52B791273D25 +++ /dev/null @@ -1,3 +0,0 @@ -#include "StgSharpNative.h" -#include "glfw_function_table.h" -#include diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA deleted file mode 100644 index dae34e16..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA +++ /dev/null @@ -1,123 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="InternalIO.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; -using StgSharp.Graphics.OpenGL; - -using System; -using System.Collections.Generic; -using System.IO; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -using System.Text; -using System.Threading; - -namespace StgSharp.Internal -{ - internal static unsafe partial class InternalIO - { - - internal const string SS_errorLog = - "SS_errorlog.log"; - - internal const string NativeLibName = - "StgSharp.C"; - - internal static Dictionary GLtype = []; - - internal static readonly GCHandle ssc_logHandle = - GCHandle.Alloc(new byte[512], GCHandleType.Pinned); - - internal static IntPtr _nativeLibPtr = IntPtr.Zero; - - internal static SemaphoreSlim logSyncSemaphore = new SemaphoreSlim(1, 1); - - static InternalIO() - { - GLtype.Add(TypeCode.Single, glConst.FLOAT); - GLtype.Add(TypeCode.Int32, glConst.INT); - GLtype.Add(TypeCode.UInt32, glConst.UNSIGNED_INT); - GLtype.Add(TypeCode.Int16, glConst.SHORT); - GLtype.Add(TypeCode.UInt16, glConst.UNSIGNED_SHORT); - GLtype.Add(TypeCode.SByte, glConst.BYTE); - GLtype.Add(TypeCode.Byte, glConst.UNSIGNED_BYTE); - } - - internal static void InternalAppendLog(string log) - { - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) { - logStream.WriteLine(log); - } - } - - internal static void InternalWriteLog(string logLine, LogType logType) - { - logSyncSemaphore.Wait(); - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) - { - logStream.WriteLine($"{logType}\t{DateTime.Now.ToString("o")}"); - logStream.WriteLine(logLine); - } - _ = logSyncSemaphore.Release(); - } - - internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType) - { - logSyncSemaphore.Wait(); - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) - { - logStream.WriteLine(beforeTime); - logStream.WriteLine($"{logType}\t@\t{DateTime.Now.ToString("o")}"); - logStream.WriteLine(logLine); - } - _ = logSyncSemaphore.Release(1); - } - - } -} diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/AB012CE381AA8B4E0A109D9731EEA0AF b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/AB012CE381AA8B4E0A109D9731EEA0AF deleted file mode 100644 index eb8ad827..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/AB012CE381AA8B4E0A109D9731EEA0AF +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef GLFW_FUNCTION_TABLE_H -#define GLFW_FUNCTION_TABLE_H - -#include "../glfw/glfw3.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct GLFWFunctionTable { - int (*glfwInit)(void); - void (*glfwTerminate)(void); - void (*glfwInitHint)(int hint, int value); - void (*glfwGetVersion)(int* major, int* minor, int* rev); - const char* (*glfwGetVersionString)(void); - int (*glfwGetError)(const char** description); - GLFWerrorfun (*glfwSetErrorCallback)(GLFWerrorfun callback); - GLFWmonitor** (*glfwGetMonitors)(int* count); - GLFWmonitor* (*glfwGetPrimaryMonitor)(void); - void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos); - void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height); - void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM); - void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale); - const char* (*glfwGetMonitorName)(GLFWmonitor* monitor); - void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer); - void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor); - GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback); - const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count); - const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor); - void (*glfwSetGamma)(GLFWmonitor* monitor, float gamma); - const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor); - void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp); - void (*glfwDefaultWindowHints)(void); - void (*glfwWindowHint)(int hint, int value); - void (*glfwWindowHintString)(int hint, const char* value); - GLFWwindow* (*glfwCreateWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share); - void (*glfwDestroyWindow)(GLFWwindow* window); - int (*glfwWindowShouldClose)(GLFWwindow* window); - void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value); - void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title); - void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images); - void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos); - void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos); - void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height); - void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); - void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom); - void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height); - void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height); - void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom); - void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale); - float (*glfwGetWindowOpacity)(GLFWwindow* window); - void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity); - void (*glfwIconifyWindow)(GLFWwindow* window); - void (*glfwRestoreWindow)(GLFWwindow* window); - void (*glfwMaximizeWindow)(GLFWwindow* window); - void (*glfwShowWindow)(GLFWwindow* window); - void (*glfwHideWindow)(GLFWwindow* window); - void (*glfwFocusWindow)(GLFWwindow* window); - void (*glfwRequestWindowAttention)(GLFWwindow* window); - GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window); - void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); - int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib); - void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value); - void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer); - void* (*glfwGetWindowUserPointer)(GLFWwindow* window); - GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback); - GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback); - GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback); - GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback); - GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback); - GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback); - GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback); - GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback); - GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback); - void (*glfwPollEvents)(void); - void (*glfwWaitEvents)(void); - void (*glfwWaitEventsTimeout)(double timeout); - void (*glfwPostEmptyEvent)(void); - int (*glfwGetInputMode)(GLFWwindow* window, int mode); - void (*glfwSetInputMode)(GLFWwindow* window, int mode, int value); - int (*glfwRawMouseMotionSupported)(void); - const char* (*glfwGetKeyName)(int key, int scancode); - int (*glfwGetKeyScancode)(int key); - int (*glfwGetKey)(GLFWwindow* window, int key); - int (*glfwGetMouseButton)(GLFWwindow* window, int button); - void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos); - void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos); - GLFWcursor* (*glfwCreateCursor)(const GLFWimage* image, int xhot, int yhot); - GLFWcursor* (*glfwCreateStandardCursor)(int shape); - void (*glfwDestroyCursor)(GLFWcursor* cursor); - void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor); - GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback); - GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback); - GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback); - GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback); - GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback); - GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback); - GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback); - GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback); - int (*glfwJoystickPresent)(int jid); - const float* (*glfwGetJoystickAxes)(int jid, int* count); - const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count); - const char* (*glfwGetJoystickGUID)(int jid); - const unsigned char* (*glfwGetJoystickHats)(int jid, int* count); - const char* (*glfwGetJoystickName)(int jid); - void* (*glfwGetJoystickUserPointer)(int jid); - int (*glfwJoystickIsGamepad)(int jid); - GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback); - int (*glfwUpdateGamepadMappings)(const char* str); - const char* (*glfwGetGamepadName)(int jid); - int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state); - void (*glfwSetClipboardString)(GLFWwindow* window, const char* str); - const char* (*glfwGetClipboardString)(GLFWwindow* window); - double (*glfwGetTime)(void); - void (*glfwSetTime)(double time); - unsigned long long (*glfwGetTimerValue)(void); - unsigned long long (*glfwGetTimerFrequency)(void); - void (*glfwMakeContextCurrent)(GLFWwindow* window); - GLFWwindow* (*glfwGetCurrentContext)(void); - void (*glfwSwapBuffers)(GLFWwindow* window); - void (*glfwSwapInterval)(int interval); - int (*glfwExtensionSupported)(const char* extension); - GLFWglproc (*glfwGetProcAddress)(const char* procname); - int (*glfwVulkanSupported)(void); - const char** (*glfwGetRequiredInstanceExtensions)(unsigned int* count); -} GLFWFunctionTable; - -#ifdef __cplusplus -} -#endif - -#endif \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/BF682B06259E1DAC71F7644A79308571 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/BF682B06259E1DAC71F7644A79308571 deleted file mode 100644 index 7fb941f2..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/BF682B06259E1DAC71F7644A79308571 +++ /dev/null @@ -1,366 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; - -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; - -namespace StgSharp.Internal -{ - internal unsafe partial class InternalIO - { - - private static GLFWFunction _glfw; - - [LibraryImport(NativeLibName, EntryPoint = "load_glfw_functions")] - internal static unsafe partial void glfwLoadLibrary(GLFWFunction* context); - - internal static unsafe void LoadGlfw() - { - _glfw = new GLFWFunction(); - fixed (GLFWFunction* func = &_glfw) { } - } - - #region api call - - internal static unsafe int glfwInit() => _glfw.glfwInit(); - - internal static unsafe void glfwTerminate() => _glfw.glfwTerminate(); - - internal static unsafe void glfwInitHint(int hint, int value) => _glfw.glfwInitHint(hint, value); - - internal static unsafe void glfwGetVersion(int* major, int* minor, int* rev) => _glfw.glfwGetVersion(major, minor, rev); - - internal static unsafe byte* glfwGetVersionString() => _glfw.glfwGetVersionString(); - - internal static unsafe int glfwGetError(byte** description) => _glfw.glfwGetError(description); - - internal static unsafe delegate* glfwSetErrorCallback(delegate* callback) => _glfw.glfwSetErrorCallback(callback); - - internal static unsafe IntPtr* glfwGetMonitors(int* count) => _glfw.glfwGetMonitors(count); - - internal static unsafe IntPtr glfwGetPrimaryMonitor() => _glfw.glfwGetPrimaryMonitor(); - - internal static unsafe void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos) => _glfw.glfwGetMonitorPos(monitor, xpos, ypos); - - internal static unsafe void glfwGetMonitorWorkarea( - IntPtr monitor, - int* xpos, - int* ypos, - int* width, - int* height) - { - _glfw.glfwGetMonitorWorkarea(monitor, xpos, ypos, width, height); - } - - internal static unsafe void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM) => _glfw.glfwGetMonitorPhysicalSize(monitor, widthMM, heightMM); - - internal static unsafe void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale) => _glfw.glfwGetMonitorContentScale(monitor, xscale, yscale); - - internal static unsafe byte* glfwGetMonitorName(IntPtr monitor) => _glfw.glfwGetMonitorName(monitor); - - internal static unsafe void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer) => _glfw.glfwSetMonitorUserPointer(monitor, pointer); - - internal static unsafe void* glfwGetMonitorUserPointer(IntPtr monitor) => _glfw.glfwGetMonitorUserPointer(monitor); - - internal static unsafe delegate* glfwSetMonitorCallback( - delegate* callback) => _glfw.glfwSetMonitorCallback(callback); - - internal static unsafe glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count) => _glfw.glfwGetVideoModes(monitor, count); - - internal static unsafe glfwVideomode* glfwGetVideoMode(IntPtr monitor) => _glfw.glfwGetVideoMode(monitor); - - internal static unsafe void glfwSetGamma(IntPtr monitor, float gamma) => _glfw.glfwSetGamma(monitor, gamma); - - internal static unsafe glfwGammaramp* glfwGetGammaRamp(IntPtr monitor) => _glfw.glfwGetGammaRamp(monitor); - - internal static unsafe void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp) => _glfw.glfwSetGammaRamp(monitor, ramp); - - internal static unsafe void glfwDefaultWindowHints() => _glfw.glfwDefaultWindowHints(); - - internal static unsafe void glfwWindowHint(int hint, int value) => _glfw.glfwWindowHint(hint, value); - - internal static unsafe void glfwWindowHintString(int hint, byte* value) => _glfw.glfwWindowHintString(hint, value); - - internal static unsafe IntPtr glfwCreateWindow( - int width, - int height, - byte[] title, - IntPtr monitor, - IntPtr share) => _glfw.glfwCreateWindow(width, height, title, monitor, share); - - internal static unsafe void glfwDestroyWindow(IntPtr window) => _glfw.glfwDestroyWindow(window); - - internal static unsafe int glfwWindowShouldClose(IntPtr window) => _glfw.glfwWindowShouldClose(window); - - internal static unsafe void glfwSetWindowShouldClose(IntPtr window, int value) => _glfw.glfwSetWindowShouldClose(window, value); - - internal static unsafe void glfwSetWindowTitle(IntPtr window, byte* title) => _glfw.glfwSetWindowTitle(window, title); - - internal static unsafe void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images) => _glfw.glfwSetWindowIcon(window, count, images); - - internal static unsafe void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos) => _glfw.glfwGetWindowPos(window, xpos, ypos); - - internal static unsafe void glfwSetWindowPos(IntPtr window, int xpos, int ypos) => _glfw.glfwSetWindowPos(window, xpos, ypos); - - internal static unsafe void glfwGetWindowSize(IntPtr window, int* width, int* height) => _glfw.glfwGetWindowSize(window, width, height); - - internal static unsafe void glfwSetWindowSizeLimits( - IntPtr window, - int minwidth, - int minheight, - int maxwidth, - int maxheight) => _glfw.glfwSetWindowSizeLimits(window, minwidth, minheight, maxwidth, maxheight); - - internal static unsafe void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom) => _glfw.glfwSetWindowAspectRatio(window, numer, denom); - - internal static unsafe void glfwSetWindowSize(IntPtr window, int width, int height) => _glfw.glfwSetWindowSize(window, width, height); - - internal static unsafe void glfwGetFramebufferSize(IntPtr window, int* width, int* height) => _glfw.glfwGetFramebufferSize(window, width, height); - - internal static unsafe void glfwGetWindowFrameSize(IntPtr window, int* left, int* top, int* right, int* bottom) => _glfw.glfwGetWindowFrameSize(window, left, top, right, bottom); - - internal static unsafe void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale) => _glfw.glfwGetWindowContentScale(window, xscale, yscale); - - internal static unsafe float glfwGetWindowOpacity(IntPtr window) => _glfw.glfwGetWindowOpacity(window); - - internal static unsafe void glfwSetWindowOpacity(IntPtr window, float opacity) => _glfw.glfwSetWindowOpacity(window, opacity); - - internal static unsafe void glfwIconifyWindow(IntPtr window) => _glfw.glfwIconifyWindow(window); - - internal static unsafe void glfwRestoreWindow(IntPtr window) => _glfw.glfwRestoreWindow(window); - - internal static unsafe void glfwMaximizeWindow(IntPtr window) => _glfw.glfwMaximizeWindow(window); - - internal static unsafe void glfwShowWindow(IntPtr window) => _glfw.glfwShowWindow(window); - - internal static unsafe void glfwHideWindow(IntPtr window) => _glfw.glfwHideWindow(window); - - internal static unsafe void glfwFocusWindow(IntPtr window) => _glfw.glfwFocusWindow(window); - - internal static unsafe void glfwRequestWindowAttention(IntPtr window) => _glfw.glfwRequestWindowAttention(window); - - internal static unsafe IntPtr glfwGetWindowMonitor(IntPtr window) => _glfw.glfwGetWindowMonitor(window); - - internal static unsafe void glfwSetWindowMonitor( - IntPtr window, - IntPtr monitor, - int xpos, - int ypos, - int width, - int height, - int refreshRate) => _glfw.glfwSetWindowMonitor( - window, monitor, xpos, ypos, width, height, refreshRate); - - internal static unsafe int glfwGetWindowAttrib(IntPtr window, int attrib) => _glfw.glfwGetWindowAttrib(window, attrib); - - internal static unsafe void glfwSetWindowAttrib(IntPtr window, int attrib, int value) => _glfw.glfwSetWindowAttrib(window, attrib, value); - - internal static unsafe void glfwSetWindowUserPointer(IntPtr window, void* pointer) => _glfw.glfwSetWindowUserPointer(window, pointer); - - internal static unsafe void* glfwGetWindowUserPointer(IntPtr window) => _glfw.glfwGetWindowUserPointer(window); - - internal static unsafe delegate* glfwSetWindowPosCallback( - IntPtr window, - IntPtr callback) => _glfw.glfwSetWindowPosCallback(window, callback); - - internal static unsafe delegate* glfwSetWindowSizeCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetWindowSizeCallback(window, callback); - - internal static unsafe delegate* glfwSetWindowCloseCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetWindowCloseCallback(window, callback); - - internal static unsafe delegate* glfwSetWindowRefreshCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetWindowRefreshCallback(window, callback); - - internal static unsafe delegate* glfwSetWindowFocusCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetWindowFocusCallback(window, callback); - - internal static unsafe delegate* glfwSetWindowIconifyCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetWindowIconifyCallback(window, callback); - - internal static unsafe delegate* glfwSetWindowMaximizeCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetWindowMaximizeCallback(window, callback); - - internal static unsafe FrameBufferSizeHandler glfwSetFramebufferSizeCallback(IntPtr window, IntPtr callback) => _glfw.glfwSetFramebufferSizeCallback(window, callback); - - internal static unsafe delegate* glfwSetWindowContentScaleCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetWindowContentScaleCallback(window, callback); - - internal static unsafe void glfwPollEvents() => _glfw.glfwPollEvents(); - - internal static unsafe void glfwWaitEvents() => _glfw.glfwWaitEvents(); - - internal static unsafe void glfwWaitEventsTimeout(double timeout) => _glfw.glfwWaitEventsTimeout(timeout); - - internal static unsafe void glfwPostEmptyEvent() => _glfw.glfwPostEmptyEvent(); - - internal static unsafe int glfwGetInputMode(IntPtr window, int mode) => _glfw.glfwGetInputMode(window, mode); - - internal static unsafe void glfwSetInputMode(IntPtr window, int mode, int value) => _glfw.glfwSetInputMode(window, mode, value); - - internal static unsafe int glfwRawMouseMotionSupported() => _glfw.glfwRawMouseMotionSupported(); - - internal static unsafe byte* glfwGetKeyName(int key, int scancode) => _glfw.glfwGetKeyName(key, scancode); - - internal static unsafe int glfwGetKeyScancode(int key) => _glfw.glfwGetKeyScancode(key); - - internal static unsafe KeyStatus glfwGetKey(IntPtr window, int key) => _glfw.glfwGetKey(window, key); - - internal static unsafe int glfwGetMouseButton(IntPtr window, int button) => _glfw.glfwGetMouseButton(window, button); - - internal static unsafe void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos) => _glfw.glfwGetCursorPos(window, xpos, ypos); - - internal static unsafe void glfwSetCursorPos(IntPtr window, double xpos, double ypos) => _glfw.glfwSetCursorPos(window, xpos, ypos); - - internal static unsafe GLFWcursor* glfwCreateCursor(GLFWimage* image, int xhot, int yhot) => _glfw.glfwCreateCursor(image, xhot, yhot); - - internal static unsafe GLFWcursor* glfwCreateStandardCursor(int shape) => _glfw.glfwCreateStandardCursor(shape); - - internal static unsafe void glfwDestroyCursor(GLFWcursor* cursor) => _glfw.glfwDestroyCursor(cursor); - - internal static unsafe void glfwSetCursor(IntPtr window, GLFWcursor* cursor) => _glfw.glfwSetCursor(window, cursor); - - internal static unsafe delegate* glfwSetKeyCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetKeyCallback(window, callback); - - internal static unsafe delegate* glfwSetCharCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetCharCallback(window, callback); - - internal static unsafe delegate* glfwSetCharModsCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetCharModsCallback(window, callback); - - internal static unsafe delegate* glfwSetMouseButtonCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetMouseButtonCallback(window, callback); - - internal static unsafe delegate* glfwSetCursorPosCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetCursorPosCallback(window, callback); - - internal static unsafe delegate* glfwSetCursorEnterCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetCursorEnterCallback(window, callback); - - internal static unsafe delegate* glfwSetScrollCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetScrollCallback(window, callback); - - internal static unsafe delegate* glfwSetDropCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetDropCallback(window, callback); - - internal static unsafe int glfwJoystickPresent(int jid) => _glfw.glfwJoystickPresent(jid); - - internal static unsafe float* glfwGetJoystickAxes(int jid, int* count) => _glfw.glfwGetJoystickAxes(jid, count); - - internal static unsafe byte* glfwGetJoystickButtons(int jid, int* count) => _glfw.glfwGetJoystickButtons(jid, count); - - internal static unsafe byte* glfwGetJoystickHats(int jid, int* count) => _glfw.glfwGetJoystickHats(jid, count); - - internal static unsafe byte* glfwGetJoystickName(int jid) => _glfw.glfwGetJoystickName(jid); - - internal static unsafe byte* glfwGetJoystickGUID(int jid) => _glfw.glfwGetJoystickGUID(jid); - - internal static unsafe void glfwSetJoystickUserPointer(int jid, void* pointer) => _glfw.glfwSetJoystickUserPointer(jid, pointer); - - internal static unsafe void* glfwGetJoystickUserPointer(int jid) => _glfw.glfwGetJoystickUserPointer(jid); - - internal static unsafe int glfwJoystickIsGamepad(int jid) => _glfw.glfwJoystickIsGamepad(jid); - - internal static unsafe delegate* glfwSetJoystickCallback(delegate* callback) => _glfw.glfwSetJoystickCallback(callback); - - internal static unsafe int glfwUpdateGamepadMappings(byte* str) => _glfw.glfwUpdateGamepadMappings(str); - - internal static unsafe byte* glfwGetGamepadName(int jid) => _glfw.glfwGetGamepadName(jid); - - internal static unsafe int glfwGetGamepadState(int jid, GLFWgamepadstate* state) => _glfw.glfwGetGamepadState(jid, state); - - internal static unsafe void glfwSetClipboardString(IntPtr window, byte* str) => _glfw.glfwSetClipboardString(window, str); - - internal static unsafe byte* glfwGetClipboardString(IntPtr window) => _glfw.glfwGetClipboardString(window); - - internal static unsafe double glfwGetTime() => _glfw.glfwGetTime(); - - internal static unsafe void glfwSetTime(double time) => _glfw.glfwSetTime(time); - - internal static unsafe ulong* glfwGetTimerValue() => _glfw.glfwGetTimerValue(); - - internal static unsafe ulong* glfwGetTimerFrequency() => _glfw.glfwGetTimerFrequency(); - - internal static unsafe void glfwMakeContextCurrent(IntPtr window) => _glfw.glfwMakeContextCurrent(window); - - internal static unsafe IntPtr glfwGetCurrentContext() => _glfw.glfwGetCurrentContext(); - - internal static unsafe void glfwSwapBuffers(IntPtr window) => _glfw.glfwSwapBuffers(window); - - internal static unsafe void glfwSwapInterval(int interval) => _glfw.glfwSwapInterval(interval); - - internal static unsafe int glfwExtensionSupported(byte* extension) => _glfw.glfwExtensionSupported(extension); - - internal static unsafe IntPtr glfwGetProcAddress(string procname) => _glfw.glfwGetProcAddress(procname); - - internal static unsafe int glfwVulkanSupported() => _glfw.glfwVulkanSupported(); - - internal static unsafe byte** glfwGetRequiredInstanceExtensions(uint* count) => _glfw.glfwGetRequiredInstanceExtensions(count); - - /* - [LibraryImport(NativeLibName, EntryPoint = "glfwGetInstanceProcAddress")] internal static unsafe partial delegate* glfwGetInstanceProcAddress( - VkInstance instance, - byte* procname); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetPhysicalDevicePresentationSupport")] internal static unsafe partial int glfwGetPhysicalDevicePresentationSupport( - VkInstance instance, - VkPhysicalDevice device, - uint* queuefamily); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindowSurface")] internal static unsafe partial VkResult glfwCreateWindowSurface( - VkInstance instance, - glfwWindow* window, - VkAllocationCallbacks* _allocator, - VkSurfaceKHR* surface); - /**/ - - #endregion api call - } -} diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/E85AA11F74CAA82F5E384A85CDBE0B61 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/E85AA11F74CAA82F5E384A85CDBE0B61 deleted file mode 100644 index 48081bd3..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/07A56C747E01C14A800160042D6692C6/E85AA11F74CAA82F5E384A85CDBE0B61 +++ /dev/null @@ -1,156 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw_function_table.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.InteropServices; - -namespace StgSharp.Internal -{ - [StructLayout(LayoutKind.Sequential)] - internal unsafe struct GLFWFunction - { - - public delegate* unmanaged[Cdecl] glfwCreateCursor; - public delegate* unmanaged[Cdecl] glfwCreateStandardCursor; - public delegate* unmanaged[Cdecl] glfwCreateWindow; - public delegate* unmanaged[Cdecl] glfwDefaultWindowHints; - public delegate* unmanaged[Cdecl] glfwDestroyCursor; - public delegate* unmanaged[Cdecl] glfwDestroyWindow; - public delegate* unmanaged[Cdecl] glfwExtensionSupported; - public delegate* unmanaged[Cdecl] glfwFocusWindow; - public delegate* unmanaged[Cdecl] glfwGetClipboardString; - public delegate* unmanaged[Cdecl] glfwGetCurrentContext; - public delegate* unmanaged[Cdecl] glfwGetCursorPos; - public delegate* unmanaged[Cdecl] glfwGetError; - public delegate* unmanaged[Cdecl] glfwGetFramebufferSize; - public delegate* unmanaged[Cdecl] glfwGetGamepadName; - public delegate* unmanaged[Cdecl] glfwGetGamepadState; - public delegate* unmanaged[Cdecl] glfwGetGammaRamp; - public delegate* unmanaged[Cdecl] glfwGetInputMode; - public delegate* unmanaged[Cdecl] glfwGetJoystickAxes; - public delegate* unmanaged[Cdecl] glfwGetJoystickButtons; - public delegate* unmanaged[Cdecl] glfwGetJoystickGUID; - public delegate* unmanaged[Cdecl] glfwGetJoystickHats; - public delegate* unmanaged[Cdecl] glfwGetJoystickName; - public delegate* unmanaged[Cdecl] glfwGetJoystickUserPointer; - public delegate* unmanaged[Cdecl] glfwGetKey; - public delegate* unmanaged[Cdecl] glfwGetKeyName; - public delegate* unmanaged[Cdecl] glfwGetKeyScancode; - public delegate* unmanaged[Cdecl] glfwGetMonitorContentScale; - public delegate* unmanaged[Cdecl] glfwGetMonitorName; - public delegate* unmanaged[Cdecl] glfwGetMonitorPhysicalSize; - public delegate* unmanaged[Cdecl] glfwGetMonitorPos; - public delegate* unmanaged[Cdecl] glfwGetMonitors; - public delegate* unmanaged[Cdecl] glfwGetMonitorUserPointer; - public delegate* unmanaged[Cdecl] glfwGetMonitorWorkarea; - public delegate* unmanaged[Cdecl] glfwGetMouseButton; - public delegate* unmanaged[Cdecl] glfwGetPrimaryMonitor; - public delegate* unmanaged[Cdecl] glfwGetProcAddress; - public delegate* unmanaged[Cdecl] glfwGetRequiredInstanceExtensions; - public delegate* unmanaged[Cdecl] glfwGetTime; - public delegate* unmanaged[Cdecl] glfwGetTimerFrequency; - public delegate* unmanaged[Cdecl] glfwGetTimerValue; - public delegate* unmanaged[Cdecl] glfwGetVersionString; - public delegate* unmanaged[Cdecl] glfwGetVideoMode; - public delegate* unmanaged[Cdecl] glfwGetVideoModes; - public delegate* unmanaged[Cdecl] glfwGetWindowAttrib; - public delegate* unmanaged[Cdecl] glfwGetWindowContentScale; - public delegate* unmanaged[Cdecl] glfwGetWindowFrameSize; - public delegate* unmanaged[Cdecl] glfwGetWindowMonitor; - public delegate* unmanaged[Cdecl] glfwGetWindowOpacity; - public delegate* unmanaged[Cdecl] glfwGetWindowPos; - public delegate* unmanaged[Cdecl] glfwGetWindowSize; - public delegate* unmanaged[Cdecl] glfwGetWindowUserPointer; - public delegate* unmanaged[Cdecl] glfwHideWindow; - public delegate* unmanaged[Cdecl] glfwIconifyWindow; - public delegate* unmanaged[Cdecl] glfwInit; - public delegate* unmanaged[Cdecl] glfwInitHint; - public delegate* unmanaged[Cdecl] glfwJoystickIsGamepad; - public delegate* unmanaged[Cdecl] glfwJoystickPresent; - public delegate* unmanaged[Cdecl] glfwMakeContextCurrent; - public delegate* unmanaged[Cdecl] glfwMaximizeWindow; - public delegate* unmanaged[Cdecl] glfwPollEvents; - public delegate* unmanaged[Cdecl] glfwPostEmptyEvent; - public delegate* unmanaged[Cdecl] glfwRawMouseMotionSupported; - public delegate* unmanaged[Cdecl] glfwRequestWindowAttention; - public delegate* unmanaged[Cdecl] glfwRestoreWindow; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCharCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCharModsCallback; - public delegate* unmanaged[Cdecl] glfwSetClipboardString; - public delegate* unmanaged[Cdecl] glfwSetCursor; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCursorEnterCallback; - public delegate* unmanaged[Cdecl] glfwSetCursorPos; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCursorPosCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged [Cdecl]> glfwSetDropCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetFramebufferSizeCallback; - public delegate* unmanaged[Cdecl] glfwSetGamma; - public delegate* unmanaged[Cdecl] glfwSetGammaRamp; - public delegate* unmanaged[Cdecl] glfwSetInputMode; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetJoystickCallback; - public delegate* unmanaged[Cdecl] glfwSetJoystickUserPointer; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetKeyCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetMonitorCallback; - public delegate* unmanaged[Cdecl] glfwSetMonitorUserPointer; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetMouseButtonCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetScrollCallback; - public delegate* unmanaged[Cdecl] glfwSetTime; - public delegate* unmanaged[Cdecl] glfwSetWindowAspectRatio; - public delegate* unmanaged[Cdecl] glfwSetWindowAttrib; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowCloseCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowContentScaleCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowFocusCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowIcon; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowIconifyCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowMaximizeCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowMonitor; - public delegate* unmanaged[Cdecl] glfwSetWindowOpacity; - public delegate* unmanaged[Cdecl] glfwSetWindowPos; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowPosCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowRefreshCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowShouldClose; - public delegate* unmanaged[Cdecl] glfwSetWindowSize; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowSizeCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowSizeLimits; - public delegate* unmanaged[Cdecl] glfwSetWindowTitle; - public delegate* unmanaged[Cdecl] glfwSetWindowUserPointer; - public delegate* unmanaged[Cdecl] glfwShowWindow; - public delegate* unmanaged[Cdecl] glfwSwapBuffers; - public delegate* unmanaged[Cdecl] glfwSwapInterval; - public delegate* unmanaged[Cdecl] glfwTerminate; - public delegate* unmanaged[Cdecl] glfwUpdateGamepadMappings; - public delegate* unmanaged[Cdecl] glfwVulkanSupported; - public delegate* unmanaged[Cdecl] glfwWaitEvents; - public delegate* unmanaged[Cdecl] glfwWaitEventsTimeout; - public delegate* unmanaged[Cdecl] glfwWindowHint; - public delegate* unmanaged[Cdecl] glfwWindowHintString; - public delegate* unmanaged[Cdecl] glfwWindowShouldClose; - - } -} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/516E4750BFA070C15018A44BF13AD02C b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/516E4750BFA070C15018A44BF13AD02C deleted file mode 100644 index 9713e517..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/516E4750BFA070C15018A44BF13AD02C +++ /dev/null @@ -1,133 +0,0 @@ -#ifndef GLFW_FUNCTION_TABLE_H -#define GLFW_FUNCTION_TABLE_H - -#include "glfw3_no_comments.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct GLFWFunctionTable { - int (*glfwInit)(void); - void (*glfwTerminate)(void); - void (*glfwInitHint)(int hint, int value); - const char* (*glfwGetVersionString)(void); - int (*glfwGetError)(const char** description); - GLFWmonitor** (*glfwGetMonitors)(int* count); - GLFWmonitor* (*glfwGetPrimaryMonitor)(void); - void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos); - void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height); - void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM); - void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale); - const char* (*glfwGetMonitorName)(GLFWmonitor* monitor); - void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer); - void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor); - GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback); - const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count); - const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor); - void (*glfwSetGamma)(GLFWmonitor* monitor, float gamma); - const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor); - void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp); - void (*glfwDefaultWindowHints)(void); - void (*glfwWindowHint)(int hint, int value); - void (*glfwWindowHintString)(int hint, const char* value); - GLFWwindow* (*glfwCreateWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share); - void (*glfwDestroyWindow)(GLFWwindow* window); - int (*glfwWindowShouldClose)(GLFWwindow* window); - void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value); - void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title); - void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images); - void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos); - void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos); - void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height); - void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); - void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom); - void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height); - void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height); - void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom); - void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale); - float (*glfwGetWindowOpacity)(GLFWwindow* window); - void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity); - void (*glfwIconifyWindow)(GLFWwindow* window); - void (*glfwRestoreWindow)(GLFWwindow* window); - void (*glfwMaximizeWindow)(GLFWwindow* window); - void (*glfwShowWindow)(GLFWwindow* window); - void (*glfwHideWindow)(GLFWwindow* window); - void (*glfwFocusWindow)(GLFWwindow* window); - void (*glfwRequestWindowAttention)(GLFWwindow* window); - GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window); - void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); - int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib); - void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value); - void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer); - void* (*glfwGetWindowUserPointer)(GLFWwindow* window); - GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback); - GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback); - GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback); - GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback); - GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback); - GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback); - GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback); - GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback); - GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback); - void (*glfwPollEvents)(void); - void (*glfwWaitEvents)(void); - void (*glfwWaitEventsTimeout)(double timeout); - void (*glfwPostEmptyEvent)(void); - int (*glfwGetInputMode)(GLFWwindow* window, int mode); - void (*glfwSetInputMode)(GLFWwindow* window, int mode, int value); - int (*glfwRawMouseMotionSupported)(void); - const char* (*glfwGetKeyName)(int key, int scancode); - int (*glfwGetKeyScancode)(int key); - int (*glfwGetKey)(GLFWwindow* window, int key); - int (*glfwGetMouseButton)(GLFWwindow* window, int button); - void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos); - void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos); - GLFWcursor* (*glfwCreateCursor)(const GLFWimage* image, int xhot, int yhot); - GLFWcursor* (*glfwCreateStandardCursor)(int shape); - void (*glfwDestroyCursor)(GLFWcursor* cursor); - void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor); - GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback); - GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback); - GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback); - GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback); - GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback); - GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback); - GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback); - GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback); - int (*glfwJoystickPresent)(int jid); - const float* (*glfwGetJoystickAxes)(int jid, int* count); - const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count); - const unsigned char* (*glfwGetJoystickHats)(int jid, int* count); - const char* (*glfwGetJoystickName)(int jid); - const char* (*glfwGetJoystickGUID)(int jid); - void (*glfwSetJoystickUserPointer)(int jid, void* pointer); - void* (*glfwGetJoystickUserPointer)(int jid); - int (*glfwJoystickIsGamepad)(int jid); - GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback); - int (*glfwUpdateGamepadMappings)(const char* string); - const char* (*glfwGetGamepadName)(int jid); - int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state); - void (*glfwSetClipboardString)(GLFWwindow* window, const char* string); - const char* (*glfwGetClipboardString)(GLFWwindow* window); - double (*glfwGetTime)(void); - void (*glfwSetTime)(double time); - uint64_t (*glfwGetTimerValue)(void); - uint64_t (*glfwGetTimerFrequency)(void); - void (*glfwMakeContextCurrent)(GLFWwindow* window); - GLFWwindow* (*glfwGetCurrentContext)(void); - void (*glfwSwapBuffers)(GLFWwindow* window); - void (*glfwSwapInterval)(int interval); - int (*glfwExtensionSupported)(const char* extension); - GLFWglproc (*glfwGetProcAddress)(const char* procname); - int (*glfwVulkanSupported)(void); - const char** (*glfwGetRequiredInstanceExtensions)(uint32_t* count); -} GLFWFunctionTable; - -void LoadGLFWFunctions(GLFWFunctionTable* table); - -#ifdef __cplusplus -} -#endif - -#endif \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/74D44AD1A916DFC2CCA17C39FB32075B b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/74D44AD1A916DFC2CCA17C39FB32075B deleted file mode 100644 index 44f6599f..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/74D44AD1A916DFC2CCA17C39FB32075B +++ /dev/null @@ -1,120 +0,0 @@ -#ifndef GLFW_FUNCTION_TABLE_H -#define GLFW_FUNCTION_TABLE_H - -#include "glfw3_no_comments.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct GLFWFunctionTable { - void (*glfwDefaultWindowHints)(void); - void (*glfwDestroyCursor)(GLFWcursor* cursor); - void (*glfwDestroyWindow)(GLFWwindow* window); - void (*glfwFocusWindow)(GLFWwindow* window); - const char* (*glfwGetClipboardString)(GLFWwindow* window); - GLFWwindow* (*glfwGetCurrentContext)(void); - void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos); - int (*glfwGetError)(const char** description); - void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height); - const char* (*glfwGetGamepadName)(int jid); - int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state); - const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor); - int (*glfwGetInputMode)(GLFWwindow* window, int mode); - const float* (*glfwGetJoystickAxes)(int jid, int* count); - const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count); - const char* (*glfwGetJoystickGUID)(int jid); - const unsigned char* (*glfwGetJoystickHats)(int jid, int* count); - const char* (*glfwGetJoystickName)(int jid); - void* (*glfwGetJoystickUserPointer)(int jid); - int (*glfwGetKey)(GLFWwindow* window, int key); - const char* (*glfwGetKeyName)(int key, int scancode); - int (*glfwGetKeyScancode)(int key); - void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale); - const char* (*glfwGetMonitorName)(GLFWmonitor* monitor); - void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM); - void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos); - GLFWmonitor** (*glfwGetMonitors)(int* count); - void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor); - void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height); - int (*glfwGetMouseButton)(GLFWwindow* window, int button); - GLFWmonitor* (*glfwGetPrimaryMonitor)(void); - double (*glfwGetTime)(void); - uint64_t (*glfwGetTimerFrequency)(void); - uint64_t (*glfwGetTimerValue)(void); - const char* (*glfwGetVersionString)(void); - const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor); - const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count); - int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib); - void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale); - void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom); - GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window); - float (*glfwGetWindowOpacity)(GLFWwindow* window); - void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos); - void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height); - void* (*glfwGetWindowUserPointer)(GLFWwindow* window); - void (*glfwHideWindow)(GLFWwindow* window); - void (*glfwIconifyWindow)(GLFWwindow* window); - int (*glfwInit)(void); - void (*glfwInitHint)(int hint, int value); - void (*glfwMakeContextCurrent)(GLFWwindow* window); - void (*glfwMaximizeWindow)(GLFWwindow* window); - void (*glfwPollEvents)(void); - void (*glfwPostEmptyEvent)(void); - void (*glfwRequestWindowAttention)(GLFWwindow* window); - int (*glfwRawMouseMotionSupported)(void); - void (*glfwRestoreWindow)(GLFWwindow* window); - void (*glfwSetClipboardString)(GLFWwindow* window, const char* string); - GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback); - GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback); - void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor); - GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback); - void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos); - GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback); - GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback); - void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp); - GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback); - void (*glfwSetJoystickUserPointer)(int jid, void* pointer); - GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback); - void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer); - GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback); - void (*glfwSetTime)(double time); - void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom); - void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value); - GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback); - void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images); - GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback); - GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback); - GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback); - GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback); - void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); - GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback); - void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity); - GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback); - void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos); - GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback); - void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value); - void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); - GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback); - void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height); - void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title); - void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer); - GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback); - GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback); - void (*glfwSwapBuffers)(GLFWwindow* window); - void (*glfwSwapInterval)(int interval); - void (*glfwTerminate)(void); - int (*glfwUpdateGamepadMappings)(const char* string); - void (*glfwWaitEvents)(void); - void (*glfwWaitEventsTimeout)(double timeout); - int (*glfwVulkanSupported)(void); - int (*glfwWindowShouldClose)(GLFWwindow* window); -} GLFWFunctionTable; - -void LoadGLFWFunctions(GLFWFunctionTable* table); - -#ifdef __cplusplus -} -#endif - -#endif \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/85640CC1F60032566B378A1E4081FD35 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/85640CC1F60032566B378A1E4081FD35 deleted file mode 100644 index d6228b3a..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/85640CC1F60032566B378A1E4081FD35 +++ /dev/null @@ -1,3 +0,0 @@ -#include "StgSharpNative.h" -#include "glfw_function_table.h" -#include diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/885C0127350D5D9423F07D688925FD75 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/885C0127350D5D9423F07D688925FD75 deleted file mode 100644 index 5c62bc49..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/885C0127350D5D9423F07D688925FD75 +++ /dev/null @@ -1,158 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw_function_table.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.InteropServices; - -namespace StgSharp.Internal -{ - [StructLayout(LayoutKind.Sequential)] - internal unsafe struct GLFWFunctionTable - { - - public delegate* unmanaged[Cdecl] glfwCreateCursor; - public delegate* unmanaged[Cdecl] glfwCreateStandardCursor; - public delegate* unmanaged[Cdecl] glfwCreateWindow; - public delegate* unmanaged[Cdecl] glfwDefaultWindowHints; - public delegate* unmanaged[Cdecl] glfwDestroyCursor; - public delegate* unmanaged[Cdecl] glfwDestroyWindow; - public delegate* unmanaged[Cdecl] glfwExtensionSupported; - public delegate* unmanaged[Cdecl] glfwFocusWindow; - public delegate* unmanaged[Cdecl] glfwGetClipboardString; - public delegate* unmanaged[Cdecl] glfwGetCurrentContext; - public delegate* unmanaged[Cdecl] glfwGetCursorPos; - public delegate* unmanaged[Cdecl] glfwGetError; - public delegate* unmanaged[Cdecl] glfwGetFramebufferSize; - public delegate* unmanaged[Cdecl] glfwGetGamepadName; - public delegate* unmanaged[Cdecl] glfwGetGamepadState; - public delegate* unmanaged[Cdecl] glfwGetGammaRamp; - public delegate* unmanaged[Cdecl] glfwGetInputMode; - public delegate* unmanaged[Cdecl] glfwGetJoystickAxes; - public delegate* unmanaged[Cdecl] glfwGetJoystickButtons; - public delegate* unmanaged[Cdecl] glfwGetJoystickGUID; - public delegate* unmanaged[Cdecl] glfwGetJoystickHats; - public delegate* unmanaged[Cdecl] glfwGetJoystickName; - public delegate* unmanaged[Cdecl] glfwGetJoystickUserPointer; - public delegate* unmanaged[Cdecl] glfwGetKey; - public delegate* unmanaged[Cdecl] glfwGetKeyName; - public delegate* unmanaged[Cdecl] glfwGetKeyScancode; - public delegate* unmanaged[Cdecl] glfwGetMonitorContentScale; - public delegate* unmanaged[Cdecl] glfwGetMonitorName; - public delegate* unmanaged[Cdecl] glfwGetMonitorPhysicalSize; - public delegate* unmanaged[Cdecl] glfwGetMonitorPos; - public delegate* unmanaged[Cdecl] glfwGetMonitors; - public delegate* unmanaged[Cdecl] glfwGetMonitorUserPointer; - public delegate* unmanaged[Cdecl] glfwGetMonitorWorkarea; - public delegate* unmanaged[Cdecl] glfwGetMouseButton; - public delegate* unmanaged[Cdecl] glfwGetPrimaryMonitor; - public delegate* unmanaged[Cdecl] glfwGetProcAddress; - public delegate* unmanaged[Cdecl] glfwGetRequiredInstanceExtensions; - public delegate* unmanaged[Cdecl] glfwGetTime; - public delegate* unmanaged[Cdecl] glfwGetTimerFrequency; - public delegate* unmanaged[Cdecl] glfwGetTimerValue; - public delegate* unmanaged[Cdecl] glfwGetVersionString; - public delegate* unmanaged[Cdecl] glfwGetVideoMode; - public delegate* unmanaged[Cdecl] glfwGetVideoModes; - public delegate* unmanaged[Cdecl] glfwGetWindowAttrib; - public delegate* unmanaged[Cdecl] glfwGetWindowContentScale; - public delegate* unmanaged[Cdecl] glfwGetWindowFrameSize; - public delegate* unmanaged[Cdecl] glfwGetWindowMonitor; - public delegate* unmanaged[Cdecl] glfwGetWindowOpacity; - public delegate* unmanaged[Cdecl] glfwGetWindowPos; - public delegate* unmanaged[Cdecl] glfwGetWindowSize; - public delegate* unmanaged[Cdecl] glfwGetWindowUserPointer; - public delegate* unmanaged[Cdecl] glfwHideWindow; - public delegate* unmanaged[Cdecl] glfwIconifyWindow; - public delegate* unmanaged[Cdecl] glfwInit; - public delegate* unmanaged[Cdecl] glfwInitHint; - public delegate* unmanaged[Cdecl] glfwJoystickIsGamepad; - public delegate* unmanaged[Cdecl] glfwJoystickPresent; - public delegate* unmanaged[Cdecl] glfwMakeContextCurrent; - public delegate* unmanaged[Cdecl] glfwMaximizeWindow; - public delegate* unmanaged[Cdecl] glfwPollEvents; - public delegate* unmanaged[Cdecl] glfwPostEmptyEvent; - public delegate* unmanaged[Cdecl] glfwRawMouseMotionSupported; - public delegate* unmanaged[Cdecl] glfwRequestWindowAttention; - public delegate* unmanaged[Cdecl] glfwRestoreWindow; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCharCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCharModsCallback; - public delegate* unmanaged[Cdecl] glfwSetClipboardString; - public delegate* unmanaged[Cdecl] glfwSetCursor; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCursorEnterCallback; - public delegate* unmanaged[Cdecl] glfwSetCursorPos; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCursorPosCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetFramebufferSizeCallback; - public delegate* unmanaged[Cdecl] glfwSetGamma; - public delegate* unmanaged[Cdecl] glfwSetGammaRamp; - public delegate* unmanaged[Cdecl] glfwSetInputMode; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetJoystickCallback; - public delegate* unmanaged[Cdecl] glfwSetJoystickUserPointer; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetKeyCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetMonitorCallback; - public delegate* unmanaged[Cdecl] glfwSetMonitorUserPointer; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetMouseButtonCallback; - public delegate* unmanaged[Cdecl] glfwSetTime; - public delegate* unmanaged[Cdecl] glfwSetWindowAspectRatio; - public delegate* unmanaged[Cdecl] glfwSetWindowAttrib; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowCloseCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowContentScaleCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowFocusCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowIcon; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowIconifyCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowMaximizeCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowMonitor; - public delegate* unmanaged[Cdecl] glfwSetWindowOpacity; - public delegate* unmanaged[Cdecl] glfwSetWindowPos; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowPosCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowRefreshCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowShouldClose; - public delegate* unmanaged[Cdecl] glfwSetWindowSize; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowSizeCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowSizeLimits; - public delegate* unmanaged[Cdecl] glfwSetWindowTitle; - public delegate* unmanaged[Cdecl] glfwSetWindowUserPointer; - public delegate* unmanaged[Cdecl] glfwShowWindow; - public delegate* unmanaged[Cdecl] glfwSwapBuffers; - public delegate* unmanaged[Cdecl] glfwSwapInterval; - public delegate* unmanaged[Cdecl] glfwTerminate; - public delegate* unmanaged[Cdecl] glfwUpdateGamepadMappings; - public delegate* unmanaged[Cdecl] glfwVulkanSupported; - public delegate* unmanaged[Cdecl] glfwWaitEvents; - public delegate* unmanaged[Cdecl] glfwWaitEventsTimeout; - public delegate* unmanaged[Cdecl] glfwWindowHint; - public delegate* unmanaged[Cdecl] glfwWindowHintString; - public delegate* unmanaged[Cdecl] glfwWindowShouldClose; - public delegate* unmanaged[Cdecl], delegate* unmanaged, delegate* unmanaged> glfwSetScrollCallback; -int, byte**, void>> glfwSetDropCallback; - - } -} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA deleted file mode 100644 index dae34e16..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA +++ /dev/null @@ -1,123 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="InternalIO.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; -using StgSharp.Graphics.OpenGL; - -using System; -using System.Collections.Generic; -using System.IO; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -using System.Text; -using System.Threading; - -namespace StgSharp.Internal -{ - internal static unsafe partial class InternalIO - { - - internal const string SS_errorLog = - "SS_errorlog.log"; - - internal const string NativeLibName = - "StgSharp.C"; - - internal static Dictionary GLtype = []; - - internal static readonly GCHandle ssc_logHandle = - GCHandle.Alloc(new byte[512], GCHandleType.Pinned); - - internal static IntPtr _nativeLibPtr = IntPtr.Zero; - - internal static SemaphoreSlim logSyncSemaphore = new SemaphoreSlim(1, 1); - - static InternalIO() - { - GLtype.Add(TypeCode.Single, glConst.FLOAT); - GLtype.Add(TypeCode.Int32, glConst.INT); - GLtype.Add(TypeCode.UInt32, glConst.UNSIGNED_INT); - GLtype.Add(TypeCode.Int16, glConst.SHORT); - GLtype.Add(TypeCode.UInt16, glConst.UNSIGNED_SHORT); - GLtype.Add(TypeCode.SByte, glConst.BYTE); - GLtype.Add(TypeCode.Byte, glConst.UNSIGNED_BYTE); - } - - internal static void InternalAppendLog(string log) - { - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) { - logStream.WriteLine(log); - } - } - - internal static void InternalWriteLog(string logLine, LogType logType) - { - logSyncSemaphore.Wait(); - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) - { - logStream.WriteLine($"{logType}\t{DateTime.Now.ToString("o")}"); - logStream.WriteLine(logLine); - } - _ = logSyncSemaphore.Release(); - } - - internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType) - { - logSyncSemaphore.Wait(); - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) - { - logStream.WriteLine(beforeTime); - logStream.WriteLine($"{logType}\t@\t{DateTime.Now.ToString("o")}"); - logStream.WriteLine(logLine); - } - _ = logSyncSemaphore.Release(1); - } - - } -} diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/A3919CCA57C33ABF0FE7102A8A97A697 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/A3919CCA57C33ABF0FE7102A8A97A697 deleted file mode 100644 index d0f6156e..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/A3919CCA57C33ABF0FE7102A8A97A697 +++ /dev/null @@ -1,120 +0,0 @@ -#include "glfw_function_table.h" -#include - -void LoadGLFWFunctions(GLFWFunctionTable* table) { - memset(table, 0, sizeof(GLFWFunctionTable)); - table->glfwInit = (int (*)(void))glfwGetProcAddress("glfwInit"); - table->glfwTerminate = (void (*)(void))glfwGetProcAddress("glfwTerminate"); - table->glfwInitHint = (void (*)(int, int))glfwGetProcAddress("glfwInitHint"); - table->glfwGetVersionString = (const char* (*)(void))glfwGetProcAddress("glfwGetVersionString"); - table->glfwGetError = (int (*)(const char**))glfwGetProcAddress("glfwGetError"); - table->glfwGetMonitors = (GLFWmonitor** (*)(int*))glfwGetProcAddress("glfwGetMonitors"); - table->glfwGetPrimaryMonitor = (GLFWmonitor* (*)(void))glfwGetProcAddress("glfwGetPrimaryMonitor"); - table->glfwGetMonitorPos = (void (*)(GLFWmonitor*, int*, int*))glfwGetProcAddress("glfwGetMonitorPos"); - table->glfwGetMonitorWorkarea = (void (*)(GLFWmonitor*, int*, int*, int*, int*))glfwGetProcAddress("glfwGetMonitorWorkarea"); - table->glfwGetMonitorPhysicalSize = (void (*)(GLFWmonitor*, int*, int*))glfwGetProcAddress("glfwGetMonitorPhysicalSize"); - table->glfwGetMonitorContentScale = (void (*)(GLFWmonitor*, float*, float*))glfwGetProcAddress("glfwGetMonitorContentScale"); - table->glfwGetMonitorName = (const char* (*)(GLFWmonitor*))glfwGetProcAddress("glfwGetMonitorName"); - table->glfwSetMonitorUserPointer = (void (*)(GLFWmonitor*, void*))glfwGetProcAddress("glfwSetMonitorUserPointer"); - table->glfwGetMonitorUserPointer = (void* (*)(GLFWmonitor*))glfwGetProcAddress("glfwGetMonitorUserPointer"); - table->glfwSetMonitorCallback = (GLFWmonitorfun (*)(GLFWmonitorfun))glfwGetProcAddress("glfwSetMonitorCallback"); - table->glfwGetVideoModes = (const GLFWvidmode* (*)(GLFWmonitor*, int*))glfwGetProcAddress("glfwGetVideoModes"); - table->glfwGetVideoMode = (const GLFWvidmode* (*)(GLFWmonitor*))glfwGetProcAddress("glfwGetVideoMode"); - table->glfwSetGamma = (void (*)(GLFWmonitor*, float))glfwGetProcAddress("glfwSetGamma"); - table->glfwGetGammaRamp = (const GLFWgammaramp* (*)(GLFWmonitor*))glfwGetProcAddress("glfwGetGammaRamp"); - table->glfwSetGammaRamp = (void (*)(GLFWmonitor*, const GLFWgammaramp*))glfwGetProcAddress("glfwSetGammaRamp"); - table->glfwDefaultWindowHints = (void (*)(void))glfwGetProcAddress("glfwDefaultWindowHints"); - table->glfwWindowHint = (void (*)(int, int))glfwGetProcAddress("glfwWindowHint"); - table->glfwWindowHintString = (void (*)(int, const char*))glfwGetProcAddress("glfwWindowHintString"); - table->glfwCreateWindow = (GLFWwindow* (*)(int, int, const char*, GLFWmonitor*, GLFWwindow*))glfwGetProcAddress("glfwCreateWindow"); - table->glfwDestroyWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwDestroyWindow"); - table->glfwWindowShouldClose = (int (*)(GLFWwindow*))glfwGetProcAddress("glfwWindowShouldClose"); - table->glfwSetWindowShouldClose = (void (*)(GLFWwindow*, int))glfwGetProcAddress("glfwSetWindowShouldClose"); - table->glfwSetWindowTitle = (void (*)(GLFWwindow*, const char*))glfwGetProcAddress("glfwSetWindowTitle"); - table->glfwSetWindowIcon = (void (*)(GLFWwindow*, int, const GLFWimage*))glfwGetProcAddress("glfwSetWindowIcon"); - table->glfwGetWindowPos = (void (*)(GLFWwindow*, int*, int*))glfwGetProcAddress("glfwGetWindowPos"); - table->glfwSetWindowPos = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetWindowPos"); - table->glfwGetWindowSize = (void (*)(GLFWwindow*, int*, int*))glfwGetProcAddress("glfwGetWindowSize"); - table->glfwSetWindowSizeLimits = (void (*)(GLFWwindow*, int, int, int, int))glfwGetProcAddress("glfwSetWindowSizeLimits"); - table->glfwSetWindowAspectRatio = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetWindowAspectRatio"); - table->glfwSetWindowSize = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetWindowSize"); - table->glfwGetFramebufferSize = (void (*)(GLFWwindow*, int*, int*))glfwGetProcAddress("glfwGetFramebufferSize"); - table->glfwGetWindowFrameSize = (void (*)(GLFWwindow*, int*, int*, int*, int*))glfwGetProcAddress("glfwGetWindowFrameSize"); - table->glfwGetWindowContentScale = (void (*)(GLFWwindow*, float*, float*))glfwGetProcAddress("glfwGetWindowContentScale"); - table->glfwGetWindowOpacity = (float (*)(GLFWwindow*))glfwGetProcAddress("glfwGetWindowOpacity"); - table->glfwSetWindowOpacity = (void (*)(GLFWwindow*, float))glfwGetProcAddress("glfwSetWindowOpacity"); - table->glfwIconifyWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwIconifyWindow"); - table->glfwRestoreWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwRestoreWindow"); - table->glfwMaximizeWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwMaximizeWindow"); - table->glfwShowWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwShowWindow"); - table->glfwHideWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwHideWindow"); - table->glfwFocusWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwFocusWindow"); - table->glfwRequestWindowAttention = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwRequestWindowAttention"); - table->glfwGetWindowMonitor = (GLFWmonitor* (*)(GLFWwindow*))glfwGetProcAddress("glfwGetWindowMonitor"); - table->glfwSetWindowMonitor = (void (*)(GLFWwindow*, GLFWmonitor*, int, int, int, int, int))glfwGetProcAddress("glfwSetWindowMonitor"); - table->glfwGetWindowAttrib = (int (*)(GLFWwindow*, int))glfwGetProcAddress("glfwGetWindowAttrib"); - table->glfwSetWindowAttrib = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetWindowAttrib"); - table->glfwSetWindowUserPointer = (void (*)(GLFWwindow*, void*))glfwGetProcAddress("glfwSetWindowUserPointer"); - table->glfwGetWindowUserPointer = (void* (*)(GLFWwindow*))glfwGetProcAddress("glfwGetWindowUserPointer"); - table->glfwSetWindowPosCallback = (GLFWwindowposfun (*)(GLFWwindow*, GLFWwindowposfun))glfwGetProcAddress("glfwSetWindowPosCallback"); - table->glfwSetWindowSizeCallback = (GLFWwindowsizefun (*)(GLFWwindow*, GLFWwindowsizefun))glfwGetProcAddress("glfwSetWindowSizeCallback"); - table->glfwSetWindowCloseCallback = (GLFWwindowclosefun (*)(GLFWwindow*, GLFWwindowclosefun))glfwGetProcAddress("glfwSetWindowCloseCallback"); - table->glfwSetWindowRefreshCallback = (GLFWwindowrefreshfun (*)(GLFWwindow*, GLFWwindowrefreshfun))glfwGetProcAddress("glfwSetWindowRefreshCallback"); - table->glfwSetWindowFocusCallback = (GLFWwindowfocusfun (*)(GLFWwindow*, GLFWwindowfocusfun))glfwGetProcAddress("glfwSetWindowFocusCallback"); - table->glfwSetWindowIconifyCallback = (GLFWwindowiconifyfun (*)(GLFWwindow*, GLFWwindowiconifyfun))glfwGetProcAddress("glfwSetWindowIconifyCallback"); - table->glfwSetWindowMaximizeCallback = (GLFWwindowmaximizefun (*)(GLFWwindow*, GLFWwindowmaximizefun))glfwGetProcAddress("glfwSetWindowMaximizeCallback"); - table->glfwSetFramebufferSizeCallback = (GLFWframebuffersizefun (*)(GLFWwindow*, GLFWframebuffersizefun))glfwGetProcAddress("glfwSetFramebufferSizeCallback"); - table->glfwSetWindowContentScaleCallback = (GLFWwindowcontentscalefun (*)(GLFWwindow*, GLFWwindowcontentscalefun))glfwGetProcAddress("glfwSetWindowContentScaleCallback"); - table->glfwPollEvents = (void (*)(void))glfwGetProcAddress("glfwPollEvents"); - table->glfwWaitEvents = (void (*)(void))glfwGetProcAddress("glfwWaitEvents"); - table->glfwWaitEventsTimeout = (void (*)(double))glfwGetProcAddress("glfwWaitEventsTimeout"); - table->glfwPostEmptyEvent = (void (*)(void))glfwGetProcAddress("glfwPostEmptyEvent"); - table->glfwGetInputMode = (int (*)(GLFWwindow*, int))glfwGetProcAddress("glfwGetInputMode"); - table->glfwSetInputMode = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetInputMode"); - table->glfwRawMouseMotionSupported = (int (*)(void))glfwGetProcAddress("glfwRawMouseMotionSupported"); - table->glfwGetKeyName = (const char* (*)(int, int))glfwGetProcAddress("glfwGetKeyName"); - table->glfwGetKeyScancode = (int (*)(int))glfwGetProcAddress("glfwGetKeyScancode"); - table->glfwGetKey = (int (*)(GLFWwindow*, int))glfwGetProcAddress("glfwGetKey"); - table->glfwGetMouseButton = (int (*)(GLFWwindow*, int))glfwGetProcAddress("glfwGetMouseButton"); - table->glfwGetCursorPos = (void (*)(GLFWwindow*, double*, double*))glfwGetProcAddress("glfwGetCursorPos"); - table->glfwSetCursorPos = (void (*)(GLFWwindow*, double, double))glfwGetProcAddress("glfwSetCursorPos"); - table->glfwCreateCursor = (GLFWcursor* (*)(const GLFWimage*, int, int))glfwGetProcAddress("glfwCreateCursor"); - table->glfwCreateStandardCursor = (GLFWcursor* (*)(int))glfwGetProcAddress("glfwCreateStandardCursor"); - table->glfwDestroyCursor = (void (*)(GLFWcursor*))glfwGetProcAddress("glfwDestroyCursor"); - table->glfwSetCursor = (void (*)(GLFWwindow*, GLFWcursor*))glfwGetProcAddress("glfwSetCursor"); - table->glfwSetKeyCallback = (GLFWkeyfun (*)(GLFWwindow*, GLFWkeyfun))glfwGetProcAddress("glfwSetKeyCallback"); - table->glfwSetCharCallback = (GLFWcharfun (*)(GLFWwindow*, GLFWcharfun))glfwGetProcAddress("glfwSetCharCallback"); - table->glfwSetCharModsCallback = (GLFWcharmodsfun (*)(GLFWwindow*, GLFWcharmodsfun))glfwGetProcAddress("glfwSetCharModsCallback"); - table->glfwSetMouseButtonCallback = (GLFWmousebuttonfun (*)(GLFWwindow*, GLFWmousebuttonfun))glfwGetProcAddress("glfwSetMouseButtonCallback"); - table->glfwSetCursorPosCallback = (GLFWcursorposfun (*)(GLFWwindow*, GLFWcursorposfun))glfwGetProcAddress("glfwSetCursorPosCallback"); - table->glfwSetCursorEnterCallback = (GLFWcursorenterfun (*)(GLFWwindow*, GLFWcursorenterfun))glfwGetProcAddress("glfwSetCursorEnterCallback"); - table->glfwSetScrollCallback = (GLFWscrollfun (*)(GLFWwindow*, GLFWscrollfun))glfwGetProcAddress("glfwSetScrollCallback"); - table->glfwSetDropCallback = (GLFWdropfun (*)(GLFWwindow*, GLFWdropfun))glfwGetProcAddress("glfwSetDropCallback"); - table->glfwJoystickPresent = (int (*)(int))glfwGetProcAddress("glfwJoystickPresent"); - table->glfwGetJoystickAxes = (const float* (*)(int, int*))glfwGetProcAddress("glfwGetJoystickAxes"); - table->glfwGetJoystickButtons = (const unsigned char* (*)(int, int*))glfwGetProcAddress("glfwGetJoystickButtons"); - table->glfwGetJoystickHats = (const unsigned char* (*)(int, int*))glfwGetProcAddress("glfwGetJoystickHats"); - table->glfwGetJoystickName = (const char* (*)(int))glfwGetProcAddress("glfwGetJoystickName"); - table->glfwGetJoystickGUID = (const char* (*)(int))glfwGetProcAddress("glfwGetJoystickGUID"); - table->glfwSetJoystickUserPointer = (void (*)(int, void*))glfwGetProcAddress("glfwSetJoystickUserPointer"); - table->glfwGetJoystickUserPointer = (void* (*)(int))glfwGetProcAddress("glfwGetJoystickUserPointer"); - table->glfwJoystickIsGamepad = (int (*)(int))glfwGetProcAddress("glfwJoystickIsGamepad"); - table->glfwSetJoystickCallback = (GLFWjoystickfun (*)(GLFWjoystickfun))glfwGetProcAddress("glfwSetJoystickCallback"); - table->glfwUpdateGamepadMappings = (int (*)(const char*))glfwGetProcAddress("glfwUpdateGamepadMappings"); - table->glfwGetGamepadName = (const char* (*)(int))glfwGetProcAddress("glfwGetGamepadName"); - table->glfwGetGamepadState = (int (*)(int, GLFWgamepadstate*))glfwGetProcAddress("glfwGetGamepadState"); - table->glfwSetClipboardString = (void (*)(GLFWwindow*, const char*))glfwGetProcAddress("glfwSetClipboardString"); - table->glfwGetClipboardString = (const char* (*)(GLFWwindow*))glfwGetProcAddress("glfwGetClipboardString"); - table->glfwGetTime = (double (*)(void))glfwGetProcAddress("glfwGetTime"); - table->glfwSetTime = (void (*)(double))glfwGetProcAddress("glfwSetTime"); - table->glfwGetTimerValue = (uint64_t (*)(void))glfwGetProcAddress("glfwGetTimerValue"); - table->glfwGetTimerFrequency = (uint64_t (*)(void))glfwGetProcAddress("glfwGetTimerFrequency"); - table->glfwMakeContextCurrent = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwMakeContextCurrent"); - table->glfwGetCurrentContext = (GLFWwindow* (*)(void))glfwGetProcAddress("glfwGetCurrentContext"); - table->glfwSwapBuffers = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwSwapBuffers"); - table->glfwSwapInterval = (void (*)(int))glfwGetProcAddress("glfwSwapInterval"); - table->glfwExtensionSupported = (int (*)(const char*))glfwGetProcAddress("glfwExtensionSupported"); - table->glfwGetProcAddress = (GLFWglproc (*)(const char*))glfwGetProcAddress("glfwGetProcAddress"); - table->glfwVulkanSupported = (int (*)(void))glfwGetProcAddress("glfwVulkanSupported"); - table->glfwGetRequiredInstanceExtensions = (const char** (*)(uint32_t*))glfwGetProcAddress("glfwGetRequiredInstanceExtensions"); -} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/BF682B06259E1DAC71F7644A79308571 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/BF682B06259E1DAC71F7644A79308571 deleted file mode 100644 index 15eb20da..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/BF682B06259E1DAC71F7644A79308571 +++ /dev/null @@ -1,486 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; - -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; - -namespace StgSharp.Internal -{ - internal unsafe partial class InternalIO - { - - private static GLFWFunction _glfw; - - [LibraryImport(NativeLibName, EntryPoint = "load_glfw_functions")] - internal static unsafe partial void glfwLoadLibrary(GLFWFunction* context); - - internal static unsafe void LoadGlfw() - { - _glfw = new GLFWFunction(); - fixed (GLFWFunction* func = &_glfw) { } - } - - #region api call - - [LibraryImport(NativeLibName, EntryPoint = "glfwInit")] - internal static unsafe partial int glfwInit(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwTerminate")] - internal static unsafe partial void glfwTerminate(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwInitHint")] - internal static unsafe partial void glfwInitHint(int hint, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetVersion")] - internal static unsafe partial void glfwGetVersion(int* major, int* minor, int* rev); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetVersionString")] - internal static unsafe partial byte* glfwGetVersionString(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetError")] - internal static unsafe partial int glfwGetError(byte** description); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetErrorCallback")] - internal static unsafe partial delegate* glfwSetErrorCallback( - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitors")] - internal static unsafe partial IntPtr* glfwGetMonitors(int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetPrimaryMonitor")] - internal static unsafe partial IntPtr glfwGetPrimaryMonitor(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorPos")] - internal static unsafe partial void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorWorkarea")] - internal static unsafe partial void glfwGetMonitorWorkarea( - IntPtr monitor, - int* xpos, - int* ypos, - int* width, - int* height); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorPhysicalSize")] - internal static unsafe partial void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorContentScale")] - internal static unsafe partial void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorName")] - internal static unsafe partial byte* glfwGetMonitorName(IntPtr monitor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetMonitorUserPointer")] - internal static unsafe partial void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorUserPointer")] - internal static unsafe partial void* glfwGetMonitorUserPointer(IntPtr monitor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetMonitorCallback")] - internal static unsafe partial delegate* glfwSetMonitorCallback( - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetVideoModes")] - internal static unsafe partial glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetVideoMode")] - internal static unsafe partial glfwVideomode* glfwGetVideoMode(IntPtr monitor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetGamma")] - internal static unsafe partial void glfwSetGamma(IntPtr monitor, float gamma); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetGammaRamp")] - internal static unsafe partial glfwGammaramp* glfwGetGammaRamp(IntPtr monitor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetGammaRamp")] - internal static unsafe partial void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp); - - [LibraryImport(NativeLibName, EntryPoint = "glfwDefaultWindowHints")] - internal static unsafe partial void glfwDefaultWindowHints(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWindowHint")] - internal static unsafe partial void glfwWindowHint(int hint, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWindowHintString")] - internal static unsafe partial void glfwWindowHintString(int hint, byte* value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindow")] - internal static unsafe partial IntPtr glfwCreateWindow( - int width, - int height, - byte[] title, - IntPtr monitor, - IntPtr share); - - [LibraryImport(NativeLibName, EntryPoint = "glfwDestroyWindow")] - internal static unsafe partial void glfwDestroyWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWindowShouldClose")] - internal static unsafe partial int glfwWindowShouldClose(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowShouldClose")] - internal static unsafe partial void glfwSetWindowShouldClose(IntPtr window, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowTitle")] - internal static unsafe partial void glfwSetWindowTitle(IntPtr window, byte* title); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowIcon")] - internal static unsafe partial void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowPos")] - internal static unsafe partial void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowPos")] - internal static unsafe partial void glfwSetWindowPos(IntPtr window, int xpos, int ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowSize")] - internal static unsafe partial void glfwGetWindowSize(IntPtr window, int* width, int* height); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSizeLimits")] - internal static unsafe partial void glfwSetWindowSizeLimits( - IntPtr window, - int minwidth, - int minheight, - int maxwidth, - int maxheight); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowAspectRatio")] - internal static unsafe partial void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSize")] - internal static unsafe partial void glfwSetWindowSize(IntPtr window, int width, int height); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetFramebufferSize")] - internal static unsafe partial void glfwGetFramebufferSize(IntPtr window, int* width, int* height); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowFrameSize")] - internal static unsafe partial void glfwGetWindowFrameSize( - IntPtr window, - int* left, - int* top, - int* right, - int* bottom); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowContentScale")] - internal static unsafe partial void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowOpacity")] - internal static unsafe partial float glfwGetWindowOpacity(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowOpacity")] - internal static unsafe partial void glfwSetWindowOpacity(IntPtr window, float opacity); - - [LibraryImport(NativeLibName, EntryPoint = "glfwIconifyWindow")] - internal static unsafe partial void glfwIconifyWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwRestoreWindow")] - internal static unsafe partial void glfwRestoreWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwMaximizeWindow")] - internal static unsafe partial void glfwMaximizeWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwShowWindow")] - internal static unsafe partial void glfwShowWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwHideWindow")] - internal static unsafe partial void glfwHideWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwFocusWindow")] - internal static unsafe partial void glfwFocusWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwRequestWindowAttention")] - internal static unsafe partial void glfwRequestWindowAttention(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowMonitor")] - internal static unsafe partial IntPtr glfwGetWindowMonitor(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowMonitor")] - internal static unsafe partial void glfwSetWindowMonitor( - IntPtr window, - IntPtr monitor, - int xpos, - int ypos, - int width, - int height, - int refreshRate); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowAttrib")] - internal static unsafe partial int glfwGetWindowAttrib(IntPtr window, int attrib); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowAttrib")] - internal static unsafe partial void glfwSetWindowAttrib(IntPtr window, int attrib, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowUserPointer")] - internal static unsafe partial void glfwSetWindowUserPointer(IntPtr window, void* pointer); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowUserPointer")] - internal static unsafe partial void* glfwGetWindowUserPointer(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowPosCallback")] - internal static unsafe partial delegate* glfwSetWindowPosCallback( - IntPtr window, - IntPtr callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSizeCallback")] - internal static unsafe partial delegate* glfwSetWindowSizeCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowCloseCallback")] - internal static unsafe partial delegate* glfwSetWindowCloseCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowRefreshCallback")] - internal static unsafe partial delegate* glfwSetWindowRefreshCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowFocusCallback")] - internal static unsafe partial delegate* glfwSetWindowFocusCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowIconifyCallback")] - internal static unsafe partial delegate* glfwSetWindowIconifyCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowMaximizeCallback")] - internal static unsafe partial delegate* glfwSetWindowMaximizeCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetFramebufferSizeCallback")] - internal static unsafe partial FrameBufferSizeHandler glfwSetFramebufferSizeCallback( - IntPtr window, - IntPtr callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowContentScaleCallback")] - internal static unsafe partial delegate* glfwSetWindowContentScaleCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwPollEvents")] - internal static unsafe partial void glfwPollEvents(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWaitEvents")] - internal static unsafe partial void glfwWaitEvents(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWaitEventsTimeout")] - internal static unsafe partial void glfwWaitEventsTimeout(double timeout); - - [LibraryImport(NativeLibName, EntryPoint = "glfwPostEmptyEvent")] - internal static unsafe partial void glfwPostEmptyEvent(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetInputMode")] - internal static unsafe partial int glfwGetInputMode(IntPtr window, int mode); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetInputMode")] - internal static unsafe partial void glfwSetInputMode(IntPtr window, int mode, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwRawMouseMotionSupported")] - internal static unsafe partial int glfwRawMouseMotionSupported(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetKeyName")] - internal static unsafe partial byte* glfwGetKeyName(int key, int scancode); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetKeyScancode")] - internal static unsafe partial int glfwGetKeyScancode(int key); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetKey")] - internal static unsafe partial KeyStatus glfwGetKey(IntPtr window, int key); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMouseButton")] - internal static unsafe partial int glfwGetMouseButton(IntPtr window, int button); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetCursorPos")] - internal static unsafe partial void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorPos")] - internal static unsafe partial void glfwSetCursorPos(IntPtr window, double xpos, double ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateCursor")] - internal static unsafe partial GLFWcursor* glfwCreateCursor(GLFWimage* image, int xhot, int yhot); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateStandardCursor")] - internal static unsafe partial GLFWcursor* glfwCreateStandardCursor(int shape); - - [LibraryImport(NativeLibName, EntryPoint = "glfwDestroyCursor")] - internal static unsafe partial void glfwDestroyCursor(GLFWcursor* cursor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCursor")] - internal static unsafe partial void glfwSetCursor(IntPtr window, GLFWcursor* cursor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetKeyCallback")] - internal static unsafe partial delegate* glfwSetKeyCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCharCallback")] - internal static unsafe partial delegate* glfwSetCharCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCharModsCallback")] - internal static unsafe partial delegate* glfwSetCharModsCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetMouseButtonCallback")] - internal static unsafe partial delegate* glfwSetMouseButtonCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorPosCallback")] - internal static unsafe partial delegate* glfwSetCursorPosCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorEnterCallback")] - internal static unsafe partial delegate* glfwSetCursorEnterCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetScrollCallback")] - internal static unsafe partial delegate* glfwSetScrollCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetDropCallback")] - internal static unsafe partial delegate* glfwSetDropCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwJoystickPresent")] - internal static unsafe partial int glfwJoystickPresent(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickAxes")] - internal static unsafe partial float* glfwGetJoystickAxes(int jid, int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickButtons")] - internal static unsafe partial byte* glfwGetJoystickButtons(int jid, int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickHats")] - internal static unsafe partial byte* glfwGetJoystickHats(int jid, int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickName")] - internal static unsafe partial byte* glfwGetJoystickName(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickGUID")] - internal static unsafe partial byte* glfwGetJoystickGUID(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetJoystickUserPointer")] - internal static unsafe partial void glfwSetJoystickUserPointer(int jid, void* pointer); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickUserPointer")] - internal static unsafe partial void* glfwGetJoystickUserPointer(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwJoystickIsGamepad")] - internal static unsafe partial int glfwJoystickIsGamepad(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetJoystickCallback")] - internal static unsafe partial delegate* glfwSetJoystickCallback(delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwUpdateGamepadMappings")] - internal static unsafe partial int glfwUpdateGamepadMappings(byte* str); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetGamepadName")] - internal static unsafe partial byte* glfwGetGamepadName(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetGamepadState")] - internal static unsafe partial int glfwGetGamepadState(int jid, GLFWgamepadstate* state); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetClipboardString")] - internal static unsafe partial void glfwSetClipboardString(IntPtr window, byte* str); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetClipboardString")] - internal static unsafe partial byte* glfwGetClipboardString(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetTime")] - internal static unsafe partial double glfwGetTime(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetTime")] - internal static unsafe partial void glfwSetTime(double time); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetTimerValue")] - internal static unsafe partial ulong* glfwGetTimerValue(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetTimerFrequency")] - internal static unsafe partial ulong* glfwGetTimerFrequency(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwMakeContextCurrent")] - internal static unsafe partial void glfwMakeContextCurrent(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetCurrentContext")] - internal static unsafe partial IntPtr glfwGetCurrentContext(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSwapBuffers")] - internal static unsafe partial void glfwSwapBuffers(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSwapInterval")] - internal static unsafe partial void glfwSwapInterval(int interval); - - [LibraryImport(NativeLibName, EntryPoint = "glfwExtensionSupported")] - internal static unsafe partial int glfwExtensionSupported(byte* extension); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetProcAddress", StringMarshalling = StringMarshalling.Utf8)] - internal static unsafe partial IntPtr glfwGetProcAddress(string procname); - - [LibraryImport(NativeLibName, EntryPoint = "glfwVulkanSupported")] - internal static unsafe partial int glfwVulkanSupported(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetRequiredInstanceExtensions")] - internal static unsafe partial byte** glfwGetRequiredInstanceExtensions(uint* count); - - /* - [LibraryImport(NativeLibName, EntryPoint = "glfwGetInstanceProcAddress")] internal static unsafe partial delegate* glfwGetInstanceProcAddress( - VkInstance instance, - byte* procname); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetPhysicalDevicePresentationSupport")] internal static unsafe partial int glfwGetPhysicalDevicePresentationSupport( - VkInstance instance, - VkPhysicalDevice device, - uint* queuefamily); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindowSurface")] internal static unsafe partial VkResult glfwCreateWindowSurface( - VkInstance instance, - glfwWindow* window, - VkAllocationCallbacks* _allocator, - VkSurfaceKHR* surface); - /**/ - - #endregion api call - } -} diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/D0D02C41A4CB24695F0E26F6E5D49CAD b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/D0D02C41A4CB24695F0E26F6E5D49CAD deleted file mode 100644 index 9713e517..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/D0D02C41A4CB24695F0E26F6E5D49CAD +++ /dev/null @@ -1,133 +0,0 @@ -#ifndef GLFW_FUNCTION_TABLE_H -#define GLFW_FUNCTION_TABLE_H - -#include "glfw3_no_comments.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct GLFWFunctionTable { - int (*glfwInit)(void); - void (*glfwTerminate)(void); - void (*glfwInitHint)(int hint, int value); - const char* (*glfwGetVersionString)(void); - int (*glfwGetError)(const char** description); - GLFWmonitor** (*glfwGetMonitors)(int* count); - GLFWmonitor* (*glfwGetPrimaryMonitor)(void); - void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos); - void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height); - void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM); - void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale); - const char* (*glfwGetMonitorName)(GLFWmonitor* monitor); - void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer); - void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor); - GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback); - const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count); - const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor); - void (*glfwSetGamma)(GLFWmonitor* monitor, float gamma); - const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor); - void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp); - void (*glfwDefaultWindowHints)(void); - void (*glfwWindowHint)(int hint, int value); - void (*glfwWindowHintString)(int hint, const char* value); - GLFWwindow* (*glfwCreateWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share); - void (*glfwDestroyWindow)(GLFWwindow* window); - int (*glfwWindowShouldClose)(GLFWwindow* window); - void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value); - void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title); - void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images); - void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos); - void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos); - void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height); - void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); - void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom); - void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height); - void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height); - void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom); - void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale); - float (*glfwGetWindowOpacity)(GLFWwindow* window); - void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity); - void (*glfwIconifyWindow)(GLFWwindow* window); - void (*glfwRestoreWindow)(GLFWwindow* window); - void (*glfwMaximizeWindow)(GLFWwindow* window); - void (*glfwShowWindow)(GLFWwindow* window); - void (*glfwHideWindow)(GLFWwindow* window); - void (*glfwFocusWindow)(GLFWwindow* window); - void (*glfwRequestWindowAttention)(GLFWwindow* window); - GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window); - void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); - int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib); - void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value); - void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer); - void* (*glfwGetWindowUserPointer)(GLFWwindow* window); - GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback); - GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback); - GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback); - GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback); - GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback); - GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback); - GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback); - GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback); - GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback); - void (*glfwPollEvents)(void); - void (*glfwWaitEvents)(void); - void (*glfwWaitEventsTimeout)(double timeout); - void (*glfwPostEmptyEvent)(void); - int (*glfwGetInputMode)(GLFWwindow* window, int mode); - void (*glfwSetInputMode)(GLFWwindow* window, int mode, int value); - int (*glfwRawMouseMotionSupported)(void); - const char* (*glfwGetKeyName)(int key, int scancode); - int (*glfwGetKeyScancode)(int key); - int (*glfwGetKey)(GLFWwindow* window, int key); - int (*glfwGetMouseButton)(GLFWwindow* window, int button); - void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos); - void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos); - GLFWcursor* (*glfwCreateCursor)(const GLFWimage* image, int xhot, int yhot); - GLFWcursor* (*glfwCreateStandardCursor)(int shape); - void (*glfwDestroyCursor)(GLFWcursor* cursor); - void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor); - GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback); - GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback); - GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback); - GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback); - GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback); - GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback); - GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback); - GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback); - int (*glfwJoystickPresent)(int jid); - const float* (*glfwGetJoystickAxes)(int jid, int* count); - const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count); - const unsigned char* (*glfwGetJoystickHats)(int jid, int* count); - const char* (*glfwGetJoystickName)(int jid); - const char* (*glfwGetJoystickGUID)(int jid); - void (*glfwSetJoystickUserPointer)(int jid, void* pointer); - void* (*glfwGetJoystickUserPointer)(int jid); - int (*glfwJoystickIsGamepad)(int jid); - GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback); - int (*glfwUpdateGamepadMappings)(const char* string); - const char* (*glfwGetGamepadName)(int jid); - int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state); - void (*glfwSetClipboardString)(GLFWwindow* window, const char* string); - const char* (*glfwGetClipboardString)(GLFWwindow* window); - double (*glfwGetTime)(void); - void (*glfwSetTime)(double time); - uint64_t (*glfwGetTimerValue)(void); - uint64_t (*glfwGetTimerFrequency)(void); - void (*glfwMakeContextCurrent)(GLFWwindow* window); - GLFWwindow* (*glfwGetCurrentContext)(void); - void (*glfwSwapBuffers)(GLFWwindow* window); - void (*glfwSwapInterval)(int interval); - int (*glfwExtensionSupported)(const char* extension); - GLFWglproc (*glfwGetProcAddress)(const char* procname); - int (*glfwVulkanSupported)(void); - const char** (*glfwGetRequiredInstanceExtensions)(uint32_t* count); -} GLFWFunctionTable; - -void LoadGLFWFunctions(GLFWFunctionTable* table); - -#ifdef __cplusplus -} -#endif - -#endif \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/D84800670EDBDF73557D51EC21EBA223 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/D84800670EDBDF73557D51EC21EBA223 deleted file mode 100644 index 22f6e571..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/D84800670EDBDF73557D51EC21EBA223 +++ /dev/null @@ -1,107 +0,0 @@ -#include "glfw_function_table.h" -#include - -void LoadGLFWFunctions(GLFWFunctionTable* table) { - memset(table, 0, sizeof(GLFWFunctionTable)); - table->glfwDefaultWindowHints = glfwDefaultWindowHints; - table->glfwDestroyCursor = glfwDestroyCursor; - table->glfwDestroyWindow = glfwDestroyWindow; - table->glfwFocusWindow = glfwFocusWindow; - table->glfwGetClipboardString = glfwGetClipboardString; - table->glfwGetCurrentContext = glfwGetCurrentContext; - table->glfwGetCursorPos = glfwGetCursorPos; - table->glfwGetError = glfwGetError; - table->glfwGetFramebufferSize = glfwGetFramebufferSize; - table->glfwGetGamepadName = glfwGetGamepadName; - table->glfwGetGamepadState = glfwGetGamepadState; - table->glfwGetGammaRamp = glfwGetGammaRamp; - table->glfwGetInputMode = glfwGetInputMode; - table->glfwGetJoystickAxes = glfwGetJoystickAxes; - table->glfwGetJoystickButtons = glfwGetJoystickButtons; - table->glfwGetJoystickGUID = glfwGetJoystickGUID; - table->glfwGetJoystickHats = glfwGetJoystickHats; - table->glfwGetJoystickName = glfwGetJoystickName; - table->glfwGetJoystickUserPointer = glfwGetJoystickUserPointer; - table->glfwGetKey = glfwGetKey; - table->glfwGetKeyName = glfwGetKeyName; - table->glfwGetKeyScancode = glfwGetKeyScancode; - table->glfwGetMonitorContentScale = glfwGetMonitorContentScale; - table->glfwGetMonitorName = glfwGetMonitorName; - table->glfwGetMonitorPhysicalSize = glfwGetMonitorPhysicalSize; - table->glfwGetMonitorPos = glfwGetMonitorPos; - table->glfwGetMonitors = glfwGetMonitors; - table->glfwGetMonitorUserPointer = glfwGetMonitorUserPointer; - table->glfwGetMonitorWorkarea = glfwGetMonitorWorkarea; - table->glfwGetMouseButton = glfwGetMouseButton; - table->glfwGetPrimaryMonitor = glfwGetPrimaryMonitor; - table->glfwGetTime = glfwGetTime; - table->glfwGetTimerFrequency = glfwGetTimerFrequency; - table->glfwGetTimerValue = glfwGetTimerValue; - table->glfwGetVersionString = glfwGetVersionString; - table->glfwGetVideoMode = glfwGetVideoMode; - table->glfwGetVideoModes = glfwGetVideoModes; - table->glfwGetWindowAttrib = glfwGetWindowAttrib; - table->glfwGetWindowContentScale = glfwGetWindowContentScale; - table->glfwGetWindowFrameSize = glfwGetWindowFrameSize; - table->glfwGetWindowMonitor = glfwGetWindowMonitor; - table->glfwGetWindowOpacity = glfwGetWindowOpacity; - table->glfwGetWindowPos = glfwGetWindowPos; - table->glfwGetWindowSize = glfwGetWindowSize; - table->glfwGetWindowUserPointer = glfwGetWindowUserPointer; - table->glfwHideWindow = glfwHideWindow; - table->glfwIconifyWindow = glfwIconifyWindow; - table->glfwInit = glfwInit; - table->glfwInitHint = glfwInitHint; - table->glfwMakeContextCurrent = glfwMakeContextCurrent; - table->glfwMaximizeWindow = glfwMaximizeWindow; - table->glfwPollEvents = glfwPollEvents; - table->glfwPostEmptyEvent = glfwPostEmptyEvent; - table->glfwRequestWindowAttention = glfwRequestWindowAttention; - table->glfwRawMouseMotionSupported = glfwRawMouseMotionSupported; - table->glfwRestoreWindow = glfwRestoreWindow; - table->glfwSetClipboardString = glfwSetClipboardString; - table->glfwSetCharCallback = glfwSetCharCallback; - table->glfwSetCharModsCallback = glfwSetCharModsCallback; - table->glfwSetCursor = glfwSetCursor; - table->glfwSetCursorEnterCallback = glfwSetCursorEnterCallback; - table->glfwSetCursorPos = glfwSetCursorPos; - table->glfwSetCursorPosCallback = glfwSetCursorPosCallback; - table->glfwSetDropCallback = glfwSetDropCallback; - table->glfwSetGammaRamp = glfwSetGammaRamp; - table->glfwSetJoystickCallback = glfwSetJoystickCallback; - table->glfwSetJoystickUserPointer = glfwSetJoystickUserPointer; - table->glfwSetKeyCallback = glfwSetKeyCallback; - table->glfwSetMonitorUserPointer = glfwSetMonitorUserPointer; - table->glfwSetMonitorCallback = glfwSetMonitorCallback; - table->glfwSetTime = glfwSetTime; - table->glfwSetWindowAspectRatio = glfwSetWindowAspectRatio; - table->glfwSetWindowAttrib = glfwSetWindowAttrib; - table->glfwSetWindowCloseCallback = glfwSetWindowCloseCallback; - table->glfwSetWindowIcon = glfwSetWindowIcon; - table->glfwSetWindowIconifyCallback = glfwSetWindowIconifyCallback; - table->glfwSetWindowFocusCallback = glfwSetWindowFocusCallback; - table->glfwSetFramebufferSizeCallback = glfwSetFramebufferSizeCallback; - table->glfwSetWindowMaximizeCallback = glfwSetWindowMaximizeCallback; - table->glfwSetWindowMonitor = glfwSetWindowMonitor; - table->glfwSetMouseButtonCallback = glfwSetMouseButtonCallback; - table->glfwSetWindowOpacity = glfwSetWindowOpacity; - table->glfwSetWindowPosCallback = glfwSetWindowPosCallback; - table->glfwSetWindowPos = glfwSetWindowPos; - table->glfwSetScrollCallback = glfwSetScrollCallback; - table->glfwSetWindowShouldClose = glfwSetWindowShouldClose; - table->glfwSetWindowSizeLimits = glfwSetWindowSizeLimits; - table->glfwSetWindowSizeCallback = glfwSetWindowSizeCallback; - table->glfwSetWindowSize = glfwSetWindowSize; - table->glfwSetWindowTitle = glfwSetWindowTitle; - table->glfwSetWindowUserPointer = glfwSetWindowUserPointer; - table->glfwSetWindowRefreshCallback = glfwSetWindowRefreshCallback; - table->glfwSetWindowContentScaleCallback = glfwSetWindowContentScaleCallback; - table->glfwSwapBuffers = glfwSwapBuffers; - table->glfwSwapInterval = glfwSwapInterval; - table->glfwTerminate = glfwTerminate; - table->glfwUpdateGamepadMappings = glfwUpdateGamepadMappings; - table->glfwWaitEvents = glfwWaitEvents; - table->glfwWaitEventsTimeout = glfwWaitEventsTimeout; - table->glfwVulkanSupported = glfwVulkanSupported; - table->glfwWindowShouldClose = glfwWindowShouldClose; -} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/DD16E038CD3A3656EFD7A46529D83D94 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/DD16E038CD3A3656EFD7A46529D83D94 deleted file mode 100644 index d0f6156e..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/DD16E038CD3A3656EFD7A46529D83D94 +++ /dev/null @@ -1,120 +0,0 @@ -#include "glfw_function_table.h" -#include - -void LoadGLFWFunctions(GLFWFunctionTable* table) { - memset(table, 0, sizeof(GLFWFunctionTable)); - table->glfwInit = (int (*)(void))glfwGetProcAddress("glfwInit"); - table->glfwTerminate = (void (*)(void))glfwGetProcAddress("glfwTerminate"); - table->glfwInitHint = (void (*)(int, int))glfwGetProcAddress("glfwInitHint"); - table->glfwGetVersionString = (const char* (*)(void))glfwGetProcAddress("glfwGetVersionString"); - table->glfwGetError = (int (*)(const char**))glfwGetProcAddress("glfwGetError"); - table->glfwGetMonitors = (GLFWmonitor** (*)(int*))glfwGetProcAddress("glfwGetMonitors"); - table->glfwGetPrimaryMonitor = (GLFWmonitor* (*)(void))glfwGetProcAddress("glfwGetPrimaryMonitor"); - table->glfwGetMonitorPos = (void (*)(GLFWmonitor*, int*, int*))glfwGetProcAddress("glfwGetMonitorPos"); - table->glfwGetMonitorWorkarea = (void (*)(GLFWmonitor*, int*, int*, int*, int*))glfwGetProcAddress("glfwGetMonitorWorkarea"); - table->glfwGetMonitorPhysicalSize = (void (*)(GLFWmonitor*, int*, int*))glfwGetProcAddress("glfwGetMonitorPhysicalSize"); - table->glfwGetMonitorContentScale = (void (*)(GLFWmonitor*, float*, float*))glfwGetProcAddress("glfwGetMonitorContentScale"); - table->glfwGetMonitorName = (const char* (*)(GLFWmonitor*))glfwGetProcAddress("glfwGetMonitorName"); - table->glfwSetMonitorUserPointer = (void (*)(GLFWmonitor*, void*))glfwGetProcAddress("glfwSetMonitorUserPointer"); - table->glfwGetMonitorUserPointer = (void* (*)(GLFWmonitor*))glfwGetProcAddress("glfwGetMonitorUserPointer"); - table->glfwSetMonitorCallback = (GLFWmonitorfun (*)(GLFWmonitorfun))glfwGetProcAddress("glfwSetMonitorCallback"); - table->glfwGetVideoModes = (const GLFWvidmode* (*)(GLFWmonitor*, int*))glfwGetProcAddress("glfwGetVideoModes"); - table->glfwGetVideoMode = (const GLFWvidmode* (*)(GLFWmonitor*))glfwGetProcAddress("glfwGetVideoMode"); - table->glfwSetGamma = (void (*)(GLFWmonitor*, float))glfwGetProcAddress("glfwSetGamma"); - table->glfwGetGammaRamp = (const GLFWgammaramp* (*)(GLFWmonitor*))glfwGetProcAddress("glfwGetGammaRamp"); - table->glfwSetGammaRamp = (void (*)(GLFWmonitor*, const GLFWgammaramp*))glfwGetProcAddress("glfwSetGammaRamp"); - table->glfwDefaultWindowHints = (void (*)(void))glfwGetProcAddress("glfwDefaultWindowHints"); - table->glfwWindowHint = (void (*)(int, int))glfwGetProcAddress("glfwWindowHint"); - table->glfwWindowHintString = (void (*)(int, const char*))glfwGetProcAddress("glfwWindowHintString"); - table->glfwCreateWindow = (GLFWwindow* (*)(int, int, const char*, GLFWmonitor*, GLFWwindow*))glfwGetProcAddress("glfwCreateWindow"); - table->glfwDestroyWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwDestroyWindow"); - table->glfwWindowShouldClose = (int (*)(GLFWwindow*))glfwGetProcAddress("glfwWindowShouldClose"); - table->glfwSetWindowShouldClose = (void (*)(GLFWwindow*, int))glfwGetProcAddress("glfwSetWindowShouldClose"); - table->glfwSetWindowTitle = (void (*)(GLFWwindow*, const char*))glfwGetProcAddress("glfwSetWindowTitle"); - table->glfwSetWindowIcon = (void (*)(GLFWwindow*, int, const GLFWimage*))glfwGetProcAddress("glfwSetWindowIcon"); - table->glfwGetWindowPos = (void (*)(GLFWwindow*, int*, int*))glfwGetProcAddress("glfwGetWindowPos"); - table->glfwSetWindowPos = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetWindowPos"); - table->glfwGetWindowSize = (void (*)(GLFWwindow*, int*, int*))glfwGetProcAddress("glfwGetWindowSize"); - table->glfwSetWindowSizeLimits = (void (*)(GLFWwindow*, int, int, int, int))glfwGetProcAddress("glfwSetWindowSizeLimits"); - table->glfwSetWindowAspectRatio = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetWindowAspectRatio"); - table->glfwSetWindowSize = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetWindowSize"); - table->glfwGetFramebufferSize = (void (*)(GLFWwindow*, int*, int*))glfwGetProcAddress("glfwGetFramebufferSize"); - table->glfwGetWindowFrameSize = (void (*)(GLFWwindow*, int*, int*, int*, int*))glfwGetProcAddress("glfwGetWindowFrameSize"); - table->glfwGetWindowContentScale = (void (*)(GLFWwindow*, float*, float*))glfwGetProcAddress("glfwGetWindowContentScale"); - table->glfwGetWindowOpacity = (float (*)(GLFWwindow*))glfwGetProcAddress("glfwGetWindowOpacity"); - table->glfwSetWindowOpacity = (void (*)(GLFWwindow*, float))glfwGetProcAddress("glfwSetWindowOpacity"); - table->glfwIconifyWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwIconifyWindow"); - table->glfwRestoreWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwRestoreWindow"); - table->glfwMaximizeWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwMaximizeWindow"); - table->glfwShowWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwShowWindow"); - table->glfwHideWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwHideWindow"); - table->glfwFocusWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwFocusWindow"); - table->glfwRequestWindowAttention = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwRequestWindowAttention"); - table->glfwGetWindowMonitor = (GLFWmonitor* (*)(GLFWwindow*))glfwGetProcAddress("glfwGetWindowMonitor"); - table->glfwSetWindowMonitor = (void (*)(GLFWwindow*, GLFWmonitor*, int, int, int, int, int))glfwGetProcAddress("glfwSetWindowMonitor"); - table->glfwGetWindowAttrib = (int (*)(GLFWwindow*, int))glfwGetProcAddress("glfwGetWindowAttrib"); - table->glfwSetWindowAttrib = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetWindowAttrib"); - table->glfwSetWindowUserPointer = (void (*)(GLFWwindow*, void*))glfwGetProcAddress("glfwSetWindowUserPointer"); - table->glfwGetWindowUserPointer = (void* (*)(GLFWwindow*))glfwGetProcAddress("glfwGetWindowUserPointer"); - table->glfwSetWindowPosCallback = (GLFWwindowposfun (*)(GLFWwindow*, GLFWwindowposfun))glfwGetProcAddress("glfwSetWindowPosCallback"); - table->glfwSetWindowSizeCallback = (GLFWwindowsizefun (*)(GLFWwindow*, GLFWwindowsizefun))glfwGetProcAddress("glfwSetWindowSizeCallback"); - table->glfwSetWindowCloseCallback = (GLFWwindowclosefun (*)(GLFWwindow*, GLFWwindowclosefun))glfwGetProcAddress("glfwSetWindowCloseCallback"); - table->glfwSetWindowRefreshCallback = (GLFWwindowrefreshfun (*)(GLFWwindow*, GLFWwindowrefreshfun))glfwGetProcAddress("glfwSetWindowRefreshCallback"); - table->glfwSetWindowFocusCallback = (GLFWwindowfocusfun (*)(GLFWwindow*, GLFWwindowfocusfun))glfwGetProcAddress("glfwSetWindowFocusCallback"); - table->glfwSetWindowIconifyCallback = (GLFWwindowiconifyfun (*)(GLFWwindow*, GLFWwindowiconifyfun))glfwGetProcAddress("glfwSetWindowIconifyCallback"); - table->glfwSetWindowMaximizeCallback = (GLFWwindowmaximizefun (*)(GLFWwindow*, GLFWwindowmaximizefun))glfwGetProcAddress("glfwSetWindowMaximizeCallback"); - table->glfwSetFramebufferSizeCallback = (GLFWframebuffersizefun (*)(GLFWwindow*, GLFWframebuffersizefun))glfwGetProcAddress("glfwSetFramebufferSizeCallback"); - table->glfwSetWindowContentScaleCallback = (GLFWwindowcontentscalefun (*)(GLFWwindow*, GLFWwindowcontentscalefun))glfwGetProcAddress("glfwSetWindowContentScaleCallback"); - table->glfwPollEvents = (void (*)(void))glfwGetProcAddress("glfwPollEvents"); - table->glfwWaitEvents = (void (*)(void))glfwGetProcAddress("glfwWaitEvents"); - table->glfwWaitEventsTimeout = (void (*)(double))glfwGetProcAddress("glfwWaitEventsTimeout"); - table->glfwPostEmptyEvent = (void (*)(void))glfwGetProcAddress("glfwPostEmptyEvent"); - table->glfwGetInputMode = (int (*)(GLFWwindow*, int))glfwGetProcAddress("glfwGetInputMode"); - table->glfwSetInputMode = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetInputMode"); - table->glfwRawMouseMotionSupported = (int (*)(void))glfwGetProcAddress("glfwRawMouseMotionSupported"); - table->glfwGetKeyName = (const char* (*)(int, int))glfwGetProcAddress("glfwGetKeyName"); - table->glfwGetKeyScancode = (int (*)(int))glfwGetProcAddress("glfwGetKeyScancode"); - table->glfwGetKey = (int (*)(GLFWwindow*, int))glfwGetProcAddress("glfwGetKey"); - table->glfwGetMouseButton = (int (*)(GLFWwindow*, int))glfwGetProcAddress("glfwGetMouseButton"); - table->glfwGetCursorPos = (void (*)(GLFWwindow*, double*, double*))glfwGetProcAddress("glfwGetCursorPos"); - table->glfwSetCursorPos = (void (*)(GLFWwindow*, double, double))glfwGetProcAddress("glfwSetCursorPos"); - table->glfwCreateCursor = (GLFWcursor* (*)(const GLFWimage*, int, int))glfwGetProcAddress("glfwCreateCursor"); - table->glfwCreateStandardCursor = (GLFWcursor* (*)(int))glfwGetProcAddress("glfwCreateStandardCursor"); - table->glfwDestroyCursor = (void (*)(GLFWcursor*))glfwGetProcAddress("glfwDestroyCursor"); - table->glfwSetCursor = (void (*)(GLFWwindow*, GLFWcursor*))glfwGetProcAddress("glfwSetCursor"); - table->glfwSetKeyCallback = (GLFWkeyfun (*)(GLFWwindow*, GLFWkeyfun))glfwGetProcAddress("glfwSetKeyCallback"); - table->glfwSetCharCallback = (GLFWcharfun (*)(GLFWwindow*, GLFWcharfun))glfwGetProcAddress("glfwSetCharCallback"); - table->glfwSetCharModsCallback = (GLFWcharmodsfun (*)(GLFWwindow*, GLFWcharmodsfun))glfwGetProcAddress("glfwSetCharModsCallback"); - table->glfwSetMouseButtonCallback = (GLFWmousebuttonfun (*)(GLFWwindow*, GLFWmousebuttonfun))glfwGetProcAddress("glfwSetMouseButtonCallback"); - table->glfwSetCursorPosCallback = (GLFWcursorposfun (*)(GLFWwindow*, GLFWcursorposfun))glfwGetProcAddress("glfwSetCursorPosCallback"); - table->glfwSetCursorEnterCallback = (GLFWcursorenterfun (*)(GLFWwindow*, GLFWcursorenterfun))glfwGetProcAddress("glfwSetCursorEnterCallback"); - table->glfwSetScrollCallback = (GLFWscrollfun (*)(GLFWwindow*, GLFWscrollfun))glfwGetProcAddress("glfwSetScrollCallback"); - table->glfwSetDropCallback = (GLFWdropfun (*)(GLFWwindow*, GLFWdropfun))glfwGetProcAddress("glfwSetDropCallback"); - table->glfwJoystickPresent = (int (*)(int))glfwGetProcAddress("glfwJoystickPresent"); - table->glfwGetJoystickAxes = (const float* (*)(int, int*))glfwGetProcAddress("glfwGetJoystickAxes"); - table->glfwGetJoystickButtons = (const unsigned char* (*)(int, int*))glfwGetProcAddress("glfwGetJoystickButtons"); - table->glfwGetJoystickHats = (const unsigned char* (*)(int, int*))glfwGetProcAddress("glfwGetJoystickHats"); - table->glfwGetJoystickName = (const char* (*)(int))glfwGetProcAddress("glfwGetJoystickName"); - table->glfwGetJoystickGUID = (const char* (*)(int))glfwGetProcAddress("glfwGetJoystickGUID"); - table->glfwSetJoystickUserPointer = (void (*)(int, void*))glfwGetProcAddress("glfwSetJoystickUserPointer"); - table->glfwGetJoystickUserPointer = (void* (*)(int))glfwGetProcAddress("glfwGetJoystickUserPointer"); - table->glfwJoystickIsGamepad = (int (*)(int))glfwGetProcAddress("glfwJoystickIsGamepad"); - table->glfwSetJoystickCallback = (GLFWjoystickfun (*)(GLFWjoystickfun))glfwGetProcAddress("glfwSetJoystickCallback"); - table->glfwUpdateGamepadMappings = (int (*)(const char*))glfwGetProcAddress("glfwUpdateGamepadMappings"); - table->glfwGetGamepadName = (const char* (*)(int))glfwGetProcAddress("glfwGetGamepadName"); - table->glfwGetGamepadState = (int (*)(int, GLFWgamepadstate*))glfwGetProcAddress("glfwGetGamepadState"); - table->glfwSetClipboardString = (void (*)(GLFWwindow*, const char*))glfwGetProcAddress("glfwSetClipboardString"); - table->glfwGetClipboardString = (const char* (*)(GLFWwindow*))glfwGetProcAddress("glfwGetClipboardString"); - table->glfwGetTime = (double (*)(void))glfwGetProcAddress("glfwGetTime"); - table->glfwSetTime = (void (*)(double))glfwGetProcAddress("glfwSetTime"); - table->glfwGetTimerValue = (uint64_t (*)(void))glfwGetProcAddress("glfwGetTimerValue"); - table->glfwGetTimerFrequency = (uint64_t (*)(void))glfwGetProcAddress("glfwGetTimerFrequency"); - table->glfwMakeContextCurrent = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwMakeContextCurrent"); - table->glfwGetCurrentContext = (GLFWwindow* (*)(void))glfwGetProcAddress("glfwGetCurrentContext"); - table->glfwSwapBuffers = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwSwapBuffers"); - table->glfwSwapInterval = (void (*)(int))glfwGetProcAddress("glfwSwapInterval"); - table->glfwExtensionSupported = (int (*)(const char*))glfwGetProcAddress("glfwExtensionSupported"); - table->glfwGetProcAddress = (GLFWglproc (*)(const char*))glfwGetProcAddress("glfwGetProcAddress"); - table->glfwVulkanSupported = (int (*)(void))glfwGetProcAddress("glfwVulkanSupported"); - table->glfwGetRequiredInstanceExtensions = (const char** (*)(uint32_t*))glfwGetProcAddress("glfwGetRequiredInstanceExtensions"); -} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/E85AA11F74CAA82F5E384A85CDBE0B61 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/E85AA11F74CAA82F5E384A85CDBE0B61 deleted file mode 100644 index 48081bd3..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/39DC5D1EA1DFFB40BEFB79AC8FD4EE42/E85AA11F74CAA82F5E384A85CDBE0B61 +++ /dev/null @@ -1,156 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw_function_table.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.InteropServices; - -namespace StgSharp.Internal -{ - [StructLayout(LayoutKind.Sequential)] - internal unsafe struct GLFWFunction - { - - public delegate* unmanaged[Cdecl] glfwCreateCursor; - public delegate* unmanaged[Cdecl] glfwCreateStandardCursor; - public delegate* unmanaged[Cdecl] glfwCreateWindow; - public delegate* unmanaged[Cdecl] glfwDefaultWindowHints; - public delegate* unmanaged[Cdecl] glfwDestroyCursor; - public delegate* unmanaged[Cdecl] glfwDestroyWindow; - public delegate* unmanaged[Cdecl] glfwExtensionSupported; - public delegate* unmanaged[Cdecl] glfwFocusWindow; - public delegate* unmanaged[Cdecl] glfwGetClipboardString; - public delegate* unmanaged[Cdecl] glfwGetCurrentContext; - public delegate* unmanaged[Cdecl] glfwGetCursorPos; - public delegate* unmanaged[Cdecl] glfwGetError; - public delegate* unmanaged[Cdecl] glfwGetFramebufferSize; - public delegate* unmanaged[Cdecl] glfwGetGamepadName; - public delegate* unmanaged[Cdecl] glfwGetGamepadState; - public delegate* unmanaged[Cdecl] glfwGetGammaRamp; - public delegate* unmanaged[Cdecl] glfwGetInputMode; - public delegate* unmanaged[Cdecl] glfwGetJoystickAxes; - public delegate* unmanaged[Cdecl] glfwGetJoystickButtons; - public delegate* unmanaged[Cdecl] glfwGetJoystickGUID; - public delegate* unmanaged[Cdecl] glfwGetJoystickHats; - public delegate* unmanaged[Cdecl] glfwGetJoystickName; - public delegate* unmanaged[Cdecl] glfwGetJoystickUserPointer; - public delegate* unmanaged[Cdecl] glfwGetKey; - public delegate* unmanaged[Cdecl] glfwGetKeyName; - public delegate* unmanaged[Cdecl] glfwGetKeyScancode; - public delegate* unmanaged[Cdecl] glfwGetMonitorContentScale; - public delegate* unmanaged[Cdecl] glfwGetMonitorName; - public delegate* unmanaged[Cdecl] glfwGetMonitorPhysicalSize; - public delegate* unmanaged[Cdecl] glfwGetMonitorPos; - public delegate* unmanaged[Cdecl] glfwGetMonitors; - public delegate* unmanaged[Cdecl] glfwGetMonitorUserPointer; - public delegate* unmanaged[Cdecl] glfwGetMonitorWorkarea; - public delegate* unmanaged[Cdecl] glfwGetMouseButton; - public delegate* unmanaged[Cdecl] glfwGetPrimaryMonitor; - public delegate* unmanaged[Cdecl] glfwGetProcAddress; - public delegate* unmanaged[Cdecl] glfwGetRequiredInstanceExtensions; - public delegate* unmanaged[Cdecl] glfwGetTime; - public delegate* unmanaged[Cdecl] glfwGetTimerFrequency; - public delegate* unmanaged[Cdecl] glfwGetTimerValue; - public delegate* unmanaged[Cdecl] glfwGetVersionString; - public delegate* unmanaged[Cdecl] glfwGetVideoMode; - public delegate* unmanaged[Cdecl] glfwGetVideoModes; - public delegate* unmanaged[Cdecl] glfwGetWindowAttrib; - public delegate* unmanaged[Cdecl] glfwGetWindowContentScale; - public delegate* unmanaged[Cdecl] glfwGetWindowFrameSize; - public delegate* unmanaged[Cdecl] glfwGetWindowMonitor; - public delegate* unmanaged[Cdecl] glfwGetWindowOpacity; - public delegate* unmanaged[Cdecl] glfwGetWindowPos; - public delegate* unmanaged[Cdecl] glfwGetWindowSize; - public delegate* unmanaged[Cdecl] glfwGetWindowUserPointer; - public delegate* unmanaged[Cdecl] glfwHideWindow; - public delegate* unmanaged[Cdecl] glfwIconifyWindow; - public delegate* unmanaged[Cdecl] glfwInit; - public delegate* unmanaged[Cdecl] glfwInitHint; - public delegate* unmanaged[Cdecl] glfwJoystickIsGamepad; - public delegate* unmanaged[Cdecl] glfwJoystickPresent; - public delegate* unmanaged[Cdecl] glfwMakeContextCurrent; - public delegate* unmanaged[Cdecl] glfwMaximizeWindow; - public delegate* unmanaged[Cdecl] glfwPollEvents; - public delegate* unmanaged[Cdecl] glfwPostEmptyEvent; - public delegate* unmanaged[Cdecl] glfwRawMouseMotionSupported; - public delegate* unmanaged[Cdecl] glfwRequestWindowAttention; - public delegate* unmanaged[Cdecl] glfwRestoreWindow; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCharCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCharModsCallback; - public delegate* unmanaged[Cdecl] glfwSetClipboardString; - public delegate* unmanaged[Cdecl] glfwSetCursor; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCursorEnterCallback; - public delegate* unmanaged[Cdecl] glfwSetCursorPos; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCursorPosCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged [Cdecl]> glfwSetDropCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetFramebufferSizeCallback; - public delegate* unmanaged[Cdecl] glfwSetGamma; - public delegate* unmanaged[Cdecl] glfwSetGammaRamp; - public delegate* unmanaged[Cdecl] glfwSetInputMode; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetJoystickCallback; - public delegate* unmanaged[Cdecl] glfwSetJoystickUserPointer; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetKeyCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetMonitorCallback; - public delegate* unmanaged[Cdecl] glfwSetMonitorUserPointer; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetMouseButtonCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetScrollCallback; - public delegate* unmanaged[Cdecl] glfwSetTime; - public delegate* unmanaged[Cdecl] glfwSetWindowAspectRatio; - public delegate* unmanaged[Cdecl] glfwSetWindowAttrib; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowCloseCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowContentScaleCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowFocusCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowIcon; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowIconifyCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowMaximizeCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowMonitor; - public delegate* unmanaged[Cdecl] glfwSetWindowOpacity; - public delegate* unmanaged[Cdecl] glfwSetWindowPos; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowPosCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowRefreshCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowShouldClose; - public delegate* unmanaged[Cdecl] glfwSetWindowSize; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowSizeCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowSizeLimits; - public delegate* unmanaged[Cdecl] glfwSetWindowTitle; - public delegate* unmanaged[Cdecl] glfwSetWindowUserPointer; - public delegate* unmanaged[Cdecl] glfwShowWindow; - public delegate* unmanaged[Cdecl] glfwSwapBuffers; - public delegate* unmanaged[Cdecl] glfwSwapInterval; - public delegate* unmanaged[Cdecl] glfwTerminate; - public delegate* unmanaged[Cdecl] glfwUpdateGamepadMappings; - public delegate* unmanaged[Cdecl] glfwVulkanSupported; - public delegate* unmanaged[Cdecl] glfwWaitEvents; - public delegate* unmanaged[Cdecl] glfwWaitEventsTimeout; - public delegate* unmanaged[Cdecl] glfwWindowHint; - public delegate* unmanaged[Cdecl] glfwWindowHintString; - public delegate* unmanaged[Cdecl] glfwWindowShouldClose; - - } -} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/8AD2841AAC5BA84DBBB4A918C1CCB20A/516E4750BFA070C15018A44BF13AD02C b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/8AD2841AAC5BA84DBBB4A918C1CCB20A/516E4750BFA070C15018A44BF13AD02C deleted file mode 100644 index f3f91a8e..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/8AD2841AAC5BA84DBBB4A918C1CCB20A/516E4750BFA070C15018A44BF13AD02C +++ /dev/null @@ -1,123 +0,0 @@ -#ifndef GLFW_FUNCTION_TABLE_H -#define GLFW_FUNCTION_TABLE_H - -#include "../glfw/glfw3.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct GLFWFunctionTable { - void (*glfwCreateCursor)(GLFWimage* image, int xhot, int yhot); - GLFWcursor* (*glfwCreateStandardCursor)(int shape); - GLFWwindow* (*glfwCreateWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share); - void (*glfwDefaultWindowHints)(void); - void (*glfwDestroyCursor)(GLFWcursor* cursor); - void (*glfwDestroyWindow)(GLFWwindow* window); - void (*glfwFocusWindow)(GLFWwindow* window); - const char* (*glfwGetClipboardString)(GLFWwindow* window); - GLFWwindow* (*glfwGetCurrentContext)(void); - void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos); - int (*glfwGetError)(const char** description); - void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height); - const char* (*glfwGetGamepadName)(int jid); - int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state); - const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor); - int (*glfwGetInputMode)(GLFWwindow* window, int mode); - const float* (*glfwGetJoystickAxes)(int jid, int* count); - const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count); - const char* (*glfwGetJoystickGUID)(int jid); - const unsigned char* (*glfwGetJoystickHats)(int jid, int* count); - const char* (*glfwGetJoystickName)(int jid); - void* (*glfwGetJoystickUserPointer)(int jid); - int (*glfwGetKey)(GLFWwindow* window, int key); - const char* (*glfwGetKeyName)(int key, int scancode); - int (*glfwGetKeyScancode)(int key); - void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale); - const char* (*glfwGetMonitorName)(GLFWmonitor* monitor); - void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM); - void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos); - GLFWmonitor** (*glfwGetMonitors)(int* count); - void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor); - void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height); - int (*glfwGetMouseButton)(GLFWwindow* window, int button); - GLFWmonitor* (*glfwGetPrimaryMonitor)(void); - double (*glfwGetTime)(void); - uint64_t (*glfwGetTimerFrequency)(void); - uint64_t (*glfwGetTimerValue)(void); - const char* (*glfwGetVersionString)(void); - const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor); - const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count); - int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib); - void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale); - void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom); - GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window); - float (*glfwGetWindowOpacity)(GLFWwindow* window); - void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos); - void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height); - void* (*glfwGetWindowUserPointer)(GLFWwindow* window); - void (*glfwHideWindow)(GLFWwindow* window); - void (*glfwIconifyWindow)(GLFWwindow* window); - int (*glfwInit)(void); - void (*glfwInitHint)(int hint, int value); - void (*glfwMakeContextCurrent)(GLFWwindow* window); - void (*glfwMaximizeWindow)(GLFWwindow* window); - void (*glfwPollEvents)(void); - void (*glfwPostEmptyEvent)(void); - void (*glfwRequestWindowAttention)(GLFWwindow* window); - int (*glfwRawMouseMotionSupported)(void); - void (*glfwRestoreWindow)(GLFWwindow* window); - void (*glfwSetClipboardString)(GLFWwindow* window, const char* string); - GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback); - GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback); - void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor); - GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback); - void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos); - GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback); - GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback); - void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp); - GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback); - void (*glfwSetJoystickUserPointer)(int jid, void* pointer); - GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback); - void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer); - GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback); - void (*glfwSetTime)(double time); - void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom); - void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value); - GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback); - void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images); - GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback); - GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback); - GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback); - GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback); - void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); - GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback); - void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity); - GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback); - void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos); - GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback); - void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value); - void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); - GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback); - void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height); - void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title); - void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer); - GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback); - GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback); - void (*glfwSwapBuffers)(GLFWwindow* window); - void (*glfwSwapInterval)(int interval); - void (*glfwTerminate)(void); - int (*glfwUpdateGamepadMappings)(const char* string); - void (*glfwWaitEvents)(void); - void (*glfwWaitEventsTimeout)(double timeout); - int (*glfwVulkanSupported)(void); - int (*glfwWindowShouldClose)(GLFWwindow* window); -} GLFWFunctionTable; - -void LoadGLFWFunctions(GLFWFunctionTable* table); - -#ifdef __cplusplus -} -#endif - -#endif \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/8AD2841AAC5BA84DBBB4A918C1CCB20A/85640CC1F60032566B378A1E4081FD35 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/8AD2841AAC5BA84DBBB4A918C1CCB20A/85640CC1F60032566B378A1E4081FD35 deleted file mode 100644 index d6228b3a..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/8AD2841AAC5BA84DBBB4A918C1CCB20A/85640CC1F60032566B378A1E4081FD35 +++ /dev/null @@ -1,3 +0,0 @@ -#include "StgSharpNative.h" -#include "glfw_function_table.h" -#include diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/8AD2841AAC5BA84DBBB4A918C1CCB20A/87118C9C734455006A08292BCBA1DB36 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/8AD2841AAC5BA84DBBB4A918C1CCB20A/87118C9C734455006A08292BCBA1DB36 deleted file mode 100644 index 15eb20da..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/8AD2841AAC5BA84DBBB4A918C1CCB20A/87118C9C734455006A08292BCBA1DB36 +++ /dev/null @@ -1,486 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; - -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; - -namespace StgSharp.Internal -{ - internal unsafe partial class InternalIO - { - - private static GLFWFunction _glfw; - - [LibraryImport(NativeLibName, EntryPoint = "load_glfw_functions")] - internal static unsafe partial void glfwLoadLibrary(GLFWFunction* context); - - internal static unsafe void LoadGlfw() - { - _glfw = new GLFWFunction(); - fixed (GLFWFunction* func = &_glfw) { } - } - - #region api call - - [LibraryImport(NativeLibName, EntryPoint = "glfwInit")] - internal static unsafe partial int glfwInit(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwTerminate")] - internal static unsafe partial void glfwTerminate(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwInitHint")] - internal static unsafe partial void glfwInitHint(int hint, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetVersion")] - internal static unsafe partial void glfwGetVersion(int* major, int* minor, int* rev); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetVersionString")] - internal static unsafe partial byte* glfwGetVersionString(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetError")] - internal static unsafe partial int glfwGetError(byte** description); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetErrorCallback")] - internal static unsafe partial delegate* glfwSetErrorCallback( - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitors")] - internal static unsafe partial IntPtr* glfwGetMonitors(int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetPrimaryMonitor")] - internal static unsafe partial IntPtr glfwGetPrimaryMonitor(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorPos")] - internal static unsafe partial void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorWorkarea")] - internal static unsafe partial void glfwGetMonitorWorkarea( - IntPtr monitor, - int* xpos, - int* ypos, - int* width, - int* height); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorPhysicalSize")] - internal static unsafe partial void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorContentScale")] - internal static unsafe partial void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorName")] - internal static unsafe partial byte* glfwGetMonitorName(IntPtr monitor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetMonitorUserPointer")] - internal static unsafe partial void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorUserPointer")] - internal static unsafe partial void* glfwGetMonitorUserPointer(IntPtr monitor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetMonitorCallback")] - internal static unsafe partial delegate* glfwSetMonitorCallback( - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetVideoModes")] - internal static unsafe partial glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetVideoMode")] - internal static unsafe partial glfwVideomode* glfwGetVideoMode(IntPtr monitor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetGamma")] - internal static unsafe partial void glfwSetGamma(IntPtr monitor, float gamma); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetGammaRamp")] - internal static unsafe partial glfwGammaramp* glfwGetGammaRamp(IntPtr monitor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetGammaRamp")] - internal static unsafe partial void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp); - - [LibraryImport(NativeLibName, EntryPoint = "glfwDefaultWindowHints")] - internal static unsafe partial void glfwDefaultWindowHints(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWindowHint")] - internal static unsafe partial void glfwWindowHint(int hint, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWindowHintString")] - internal static unsafe partial void glfwWindowHintString(int hint, byte* value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindow")] - internal static unsafe partial IntPtr glfwCreateWindow( - int width, - int height, - byte[] title, - IntPtr monitor, - IntPtr share); - - [LibraryImport(NativeLibName, EntryPoint = "glfwDestroyWindow")] - internal static unsafe partial void glfwDestroyWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWindowShouldClose")] - internal static unsafe partial int glfwWindowShouldClose(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowShouldClose")] - internal static unsafe partial void glfwSetWindowShouldClose(IntPtr window, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowTitle")] - internal static unsafe partial void glfwSetWindowTitle(IntPtr window, byte* title); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowIcon")] - internal static unsafe partial void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowPos")] - internal static unsafe partial void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowPos")] - internal static unsafe partial void glfwSetWindowPos(IntPtr window, int xpos, int ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowSize")] - internal static unsafe partial void glfwGetWindowSize(IntPtr window, int* width, int* height); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSizeLimits")] - internal static unsafe partial void glfwSetWindowSizeLimits( - IntPtr window, - int minwidth, - int minheight, - int maxwidth, - int maxheight); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowAspectRatio")] - internal static unsafe partial void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSize")] - internal static unsafe partial void glfwSetWindowSize(IntPtr window, int width, int height); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetFramebufferSize")] - internal static unsafe partial void glfwGetFramebufferSize(IntPtr window, int* width, int* height); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowFrameSize")] - internal static unsafe partial void glfwGetWindowFrameSize( - IntPtr window, - int* left, - int* top, - int* right, - int* bottom); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowContentScale")] - internal static unsafe partial void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowOpacity")] - internal static unsafe partial float glfwGetWindowOpacity(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowOpacity")] - internal static unsafe partial void glfwSetWindowOpacity(IntPtr window, float opacity); - - [LibraryImport(NativeLibName, EntryPoint = "glfwIconifyWindow")] - internal static unsafe partial void glfwIconifyWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwRestoreWindow")] - internal static unsafe partial void glfwRestoreWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwMaximizeWindow")] - internal static unsafe partial void glfwMaximizeWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwShowWindow")] - internal static unsafe partial void glfwShowWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwHideWindow")] - internal static unsafe partial void glfwHideWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwFocusWindow")] - internal static unsafe partial void glfwFocusWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwRequestWindowAttention")] - internal static unsafe partial void glfwRequestWindowAttention(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowMonitor")] - internal static unsafe partial IntPtr glfwGetWindowMonitor(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowMonitor")] - internal static unsafe partial void glfwSetWindowMonitor( - IntPtr window, - IntPtr monitor, - int xpos, - int ypos, - int width, - int height, - int refreshRate); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowAttrib")] - internal static unsafe partial int glfwGetWindowAttrib(IntPtr window, int attrib); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowAttrib")] - internal static unsafe partial void glfwSetWindowAttrib(IntPtr window, int attrib, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowUserPointer")] - internal static unsafe partial void glfwSetWindowUserPointer(IntPtr window, void* pointer); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowUserPointer")] - internal static unsafe partial void* glfwGetWindowUserPointer(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowPosCallback")] - internal static unsafe partial delegate* glfwSetWindowPosCallback( - IntPtr window, - IntPtr callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSizeCallback")] - internal static unsafe partial delegate* glfwSetWindowSizeCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowCloseCallback")] - internal static unsafe partial delegate* glfwSetWindowCloseCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowRefreshCallback")] - internal static unsafe partial delegate* glfwSetWindowRefreshCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowFocusCallback")] - internal static unsafe partial delegate* glfwSetWindowFocusCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowIconifyCallback")] - internal static unsafe partial delegate* glfwSetWindowIconifyCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowMaximizeCallback")] - internal static unsafe partial delegate* glfwSetWindowMaximizeCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetFramebufferSizeCallback")] - internal static unsafe partial FrameBufferSizeHandler glfwSetFramebufferSizeCallback( - IntPtr window, - IntPtr callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowContentScaleCallback")] - internal static unsafe partial delegate* glfwSetWindowContentScaleCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwPollEvents")] - internal static unsafe partial void glfwPollEvents(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWaitEvents")] - internal static unsafe partial void glfwWaitEvents(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWaitEventsTimeout")] - internal static unsafe partial void glfwWaitEventsTimeout(double timeout); - - [LibraryImport(NativeLibName, EntryPoint = "glfwPostEmptyEvent")] - internal static unsafe partial void glfwPostEmptyEvent(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetInputMode")] - internal static unsafe partial int glfwGetInputMode(IntPtr window, int mode); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetInputMode")] - internal static unsafe partial void glfwSetInputMode(IntPtr window, int mode, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwRawMouseMotionSupported")] - internal static unsafe partial int glfwRawMouseMotionSupported(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetKeyName")] - internal static unsafe partial byte* glfwGetKeyName(int key, int scancode); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetKeyScancode")] - internal static unsafe partial int glfwGetKeyScancode(int key); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetKey")] - internal static unsafe partial KeyStatus glfwGetKey(IntPtr window, int key); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMouseButton")] - internal static unsafe partial int glfwGetMouseButton(IntPtr window, int button); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetCursorPos")] - internal static unsafe partial void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorPos")] - internal static unsafe partial void glfwSetCursorPos(IntPtr window, double xpos, double ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateCursor")] - internal static unsafe partial GLFWcursor* glfwCreateCursor(GLFWimage* image, int xhot, int yhot); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateStandardCursor")] - internal static unsafe partial GLFWcursor* glfwCreateStandardCursor(int shape); - - [LibraryImport(NativeLibName, EntryPoint = "glfwDestroyCursor")] - internal static unsafe partial void glfwDestroyCursor(GLFWcursor* cursor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCursor")] - internal static unsafe partial void glfwSetCursor(IntPtr window, GLFWcursor* cursor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetKeyCallback")] - internal static unsafe partial delegate* glfwSetKeyCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCharCallback")] - internal static unsafe partial delegate* glfwSetCharCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCharModsCallback")] - internal static unsafe partial delegate* glfwSetCharModsCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetMouseButtonCallback")] - internal static unsafe partial delegate* glfwSetMouseButtonCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorPosCallback")] - internal static unsafe partial delegate* glfwSetCursorPosCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorEnterCallback")] - internal static unsafe partial delegate* glfwSetCursorEnterCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetScrollCallback")] - internal static unsafe partial delegate* glfwSetScrollCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetDropCallback")] - internal static unsafe partial delegate* glfwSetDropCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwJoystickPresent")] - internal static unsafe partial int glfwJoystickPresent(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickAxes")] - internal static unsafe partial float* glfwGetJoystickAxes(int jid, int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickButtons")] - internal static unsafe partial byte* glfwGetJoystickButtons(int jid, int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickHats")] - internal static unsafe partial byte* glfwGetJoystickHats(int jid, int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickName")] - internal static unsafe partial byte* glfwGetJoystickName(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickGUID")] - internal static unsafe partial byte* glfwGetJoystickGUID(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetJoystickUserPointer")] - internal static unsafe partial void glfwSetJoystickUserPointer(int jid, void* pointer); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickUserPointer")] - internal static unsafe partial void* glfwGetJoystickUserPointer(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwJoystickIsGamepad")] - internal static unsafe partial int glfwJoystickIsGamepad(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetJoystickCallback")] - internal static unsafe partial delegate* glfwSetJoystickCallback(delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwUpdateGamepadMappings")] - internal static unsafe partial int glfwUpdateGamepadMappings(byte* str); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetGamepadName")] - internal static unsafe partial byte* glfwGetGamepadName(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetGamepadState")] - internal static unsafe partial int glfwGetGamepadState(int jid, GLFWgamepadstate* state); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetClipboardString")] - internal static unsafe partial void glfwSetClipboardString(IntPtr window, byte* str); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetClipboardString")] - internal static unsafe partial byte* glfwGetClipboardString(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetTime")] - internal static unsafe partial double glfwGetTime(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetTime")] - internal static unsafe partial void glfwSetTime(double time); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetTimerValue")] - internal static unsafe partial ulong* glfwGetTimerValue(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetTimerFrequency")] - internal static unsafe partial ulong* glfwGetTimerFrequency(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwMakeContextCurrent")] - internal static unsafe partial void glfwMakeContextCurrent(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetCurrentContext")] - internal static unsafe partial IntPtr glfwGetCurrentContext(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSwapBuffers")] - internal static unsafe partial void glfwSwapBuffers(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSwapInterval")] - internal static unsafe partial void glfwSwapInterval(int interval); - - [LibraryImport(NativeLibName, EntryPoint = "glfwExtensionSupported")] - internal static unsafe partial int glfwExtensionSupported(byte* extension); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetProcAddress", StringMarshalling = StringMarshalling.Utf8)] - internal static unsafe partial IntPtr glfwGetProcAddress(string procname); - - [LibraryImport(NativeLibName, EntryPoint = "glfwVulkanSupported")] - internal static unsafe partial int glfwVulkanSupported(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetRequiredInstanceExtensions")] - internal static unsafe partial byte** glfwGetRequiredInstanceExtensions(uint* count); - - /* - [LibraryImport(NativeLibName, EntryPoint = "glfwGetInstanceProcAddress")] internal static unsafe partial delegate* glfwGetInstanceProcAddress( - VkInstance instance, - byte* procname); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetPhysicalDevicePresentationSupport")] internal static unsafe partial int glfwGetPhysicalDevicePresentationSupport( - VkInstance instance, - VkPhysicalDevice device, - uint* queuefamily); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindowSurface")] internal static unsafe partial VkResult glfwCreateWindowSurface( - VkInstance instance, - glfwWindow* window, - VkAllocationCallbacks* _allocator, - VkSurfaceKHR* surface); - /**/ - - #endregion api call - } -} diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/8AD2841AAC5BA84DBBB4A918C1CCB20A/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/8AD2841AAC5BA84DBBB4A918C1CCB20A/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA deleted file mode 100644 index dae34e16..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/8AD2841AAC5BA84DBBB4A918C1CCB20A/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA +++ /dev/null @@ -1,123 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="InternalIO.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; -using StgSharp.Graphics.OpenGL; - -using System; -using System.Collections.Generic; -using System.IO; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -using System.Text; -using System.Threading; - -namespace StgSharp.Internal -{ - internal static unsafe partial class InternalIO - { - - internal const string SS_errorLog = - "SS_errorlog.log"; - - internal const string NativeLibName = - "StgSharp.C"; - - internal static Dictionary GLtype = []; - - internal static readonly GCHandle ssc_logHandle = - GCHandle.Alloc(new byte[512], GCHandleType.Pinned); - - internal static IntPtr _nativeLibPtr = IntPtr.Zero; - - internal static SemaphoreSlim logSyncSemaphore = new SemaphoreSlim(1, 1); - - static InternalIO() - { - GLtype.Add(TypeCode.Single, glConst.FLOAT); - GLtype.Add(TypeCode.Int32, glConst.INT); - GLtype.Add(TypeCode.UInt32, glConst.UNSIGNED_INT); - GLtype.Add(TypeCode.Int16, glConst.SHORT); - GLtype.Add(TypeCode.UInt16, glConst.UNSIGNED_SHORT); - GLtype.Add(TypeCode.SByte, glConst.BYTE); - GLtype.Add(TypeCode.Byte, glConst.UNSIGNED_BYTE); - } - - internal static void InternalAppendLog(string log) - { - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) { - logStream.WriteLine(log); - } - } - - internal static void InternalWriteLog(string logLine, LogType logType) - { - logSyncSemaphore.Wait(); - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) - { - logStream.WriteLine($"{logType}\t{DateTime.Now.ToString("o")}"); - logStream.WriteLine(logLine); - } - _ = logSyncSemaphore.Release(); - } - - internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType) - { - logSyncSemaphore.Wait(); - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) - { - logStream.WriteLine(beforeTime); - logStream.WriteLine($"{logType}\t@\t{DateTime.Now.ToString("o")}"); - logStream.WriteLine(logLine); - } - _ = logSyncSemaphore.Release(1); - } - - } -} diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/8AD2841AAC5BA84DBBB4A918C1CCB20A/BF682B06259E1DAC71F7644A79308571 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/8AD2841AAC5BA84DBBB4A918C1CCB20A/BF682B06259E1DAC71F7644A79308571 deleted file mode 100644 index 15eb20da..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/8AD2841AAC5BA84DBBB4A918C1CCB20A/BF682B06259E1DAC71F7644A79308571 +++ /dev/null @@ -1,486 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; - -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; - -namespace StgSharp.Internal -{ - internal unsafe partial class InternalIO - { - - private static GLFWFunction _glfw; - - [LibraryImport(NativeLibName, EntryPoint = "load_glfw_functions")] - internal static unsafe partial void glfwLoadLibrary(GLFWFunction* context); - - internal static unsafe void LoadGlfw() - { - _glfw = new GLFWFunction(); - fixed (GLFWFunction* func = &_glfw) { } - } - - #region api call - - [LibraryImport(NativeLibName, EntryPoint = "glfwInit")] - internal static unsafe partial int glfwInit(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwTerminate")] - internal static unsafe partial void glfwTerminate(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwInitHint")] - internal static unsafe partial void glfwInitHint(int hint, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetVersion")] - internal static unsafe partial void glfwGetVersion(int* major, int* minor, int* rev); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetVersionString")] - internal static unsafe partial byte* glfwGetVersionString(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetError")] - internal static unsafe partial int glfwGetError(byte** description); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetErrorCallback")] - internal static unsafe partial delegate* glfwSetErrorCallback( - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitors")] - internal static unsafe partial IntPtr* glfwGetMonitors(int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetPrimaryMonitor")] - internal static unsafe partial IntPtr glfwGetPrimaryMonitor(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorPos")] - internal static unsafe partial void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorWorkarea")] - internal static unsafe partial void glfwGetMonitorWorkarea( - IntPtr monitor, - int* xpos, - int* ypos, - int* width, - int* height); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorPhysicalSize")] - internal static unsafe partial void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorContentScale")] - internal static unsafe partial void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorName")] - internal static unsafe partial byte* glfwGetMonitorName(IntPtr monitor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetMonitorUserPointer")] - internal static unsafe partial void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorUserPointer")] - internal static unsafe partial void* glfwGetMonitorUserPointer(IntPtr monitor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetMonitorCallback")] - internal static unsafe partial delegate* glfwSetMonitorCallback( - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetVideoModes")] - internal static unsafe partial glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetVideoMode")] - internal static unsafe partial glfwVideomode* glfwGetVideoMode(IntPtr monitor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetGamma")] - internal static unsafe partial void glfwSetGamma(IntPtr monitor, float gamma); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetGammaRamp")] - internal static unsafe partial glfwGammaramp* glfwGetGammaRamp(IntPtr monitor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetGammaRamp")] - internal static unsafe partial void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp); - - [LibraryImport(NativeLibName, EntryPoint = "glfwDefaultWindowHints")] - internal static unsafe partial void glfwDefaultWindowHints(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWindowHint")] - internal static unsafe partial void glfwWindowHint(int hint, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWindowHintString")] - internal static unsafe partial void glfwWindowHintString(int hint, byte* value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindow")] - internal static unsafe partial IntPtr glfwCreateWindow( - int width, - int height, - byte[] title, - IntPtr monitor, - IntPtr share); - - [LibraryImport(NativeLibName, EntryPoint = "glfwDestroyWindow")] - internal static unsafe partial void glfwDestroyWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWindowShouldClose")] - internal static unsafe partial int glfwWindowShouldClose(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowShouldClose")] - internal static unsafe partial void glfwSetWindowShouldClose(IntPtr window, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowTitle")] - internal static unsafe partial void glfwSetWindowTitle(IntPtr window, byte* title); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowIcon")] - internal static unsafe partial void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowPos")] - internal static unsafe partial void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowPos")] - internal static unsafe partial void glfwSetWindowPos(IntPtr window, int xpos, int ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowSize")] - internal static unsafe partial void glfwGetWindowSize(IntPtr window, int* width, int* height); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSizeLimits")] - internal static unsafe partial void glfwSetWindowSizeLimits( - IntPtr window, - int minwidth, - int minheight, - int maxwidth, - int maxheight); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowAspectRatio")] - internal static unsafe partial void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSize")] - internal static unsafe partial void glfwSetWindowSize(IntPtr window, int width, int height); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetFramebufferSize")] - internal static unsafe partial void glfwGetFramebufferSize(IntPtr window, int* width, int* height); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowFrameSize")] - internal static unsafe partial void glfwGetWindowFrameSize( - IntPtr window, - int* left, - int* top, - int* right, - int* bottom); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowContentScale")] - internal static unsafe partial void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowOpacity")] - internal static unsafe partial float glfwGetWindowOpacity(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowOpacity")] - internal static unsafe partial void glfwSetWindowOpacity(IntPtr window, float opacity); - - [LibraryImport(NativeLibName, EntryPoint = "glfwIconifyWindow")] - internal static unsafe partial void glfwIconifyWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwRestoreWindow")] - internal static unsafe partial void glfwRestoreWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwMaximizeWindow")] - internal static unsafe partial void glfwMaximizeWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwShowWindow")] - internal static unsafe partial void glfwShowWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwHideWindow")] - internal static unsafe partial void glfwHideWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwFocusWindow")] - internal static unsafe partial void glfwFocusWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwRequestWindowAttention")] - internal static unsafe partial void glfwRequestWindowAttention(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowMonitor")] - internal static unsafe partial IntPtr glfwGetWindowMonitor(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowMonitor")] - internal static unsafe partial void glfwSetWindowMonitor( - IntPtr window, - IntPtr monitor, - int xpos, - int ypos, - int width, - int height, - int refreshRate); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowAttrib")] - internal static unsafe partial int glfwGetWindowAttrib(IntPtr window, int attrib); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowAttrib")] - internal static unsafe partial void glfwSetWindowAttrib(IntPtr window, int attrib, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowUserPointer")] - internal static unsafe partial void glfwSetWindowUserPointer(IntPtr window, void* pointer); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowUserPointer")] - internal static unsafe partial void* glfwGetWindowUserPointer(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowPosCallback")] - internal static unsafe partial delegate* glfwSetWindowPosCallback( - IntPtr window, - IntPtr callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSizeCallback")] - internal static unsafe partial delegate* glfwSetWindowSizeCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowCloseCallback")] - internal static unsafe partial delegate* glfwSetWindowCloseCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowRefreshCallback")] - internal static unsafe partial delegate* glfwSetWindowRefreshCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowFocusCallback")] - internal static unsafe partial delegate* glfwSetWindowFocusCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowIconifyCallback")] - internal static unsafe partial delegate* glfwSetWindowIconifyCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowMaximizeCallback")] - internal static unsafe partial delegate* glfwSetWindowMaximizeCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetFramebufferSizeCallback")] - internal static unsafe partial FrameBufferSizeHandler glfwSetFramebufferSizeCallback( - IntPtr window, - IntPtr callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowContentScaleCallback")] - internal static unsafe partial delegate* glfwSetWindowContentScaleCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwPollEvents")] - internal static unsafe partial void glfwPollEvents(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWaitEvents")] - internal static unsafe partial void glfwWaitEvents(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWaitEventsTimeout")] - internal static unsafe partial void glfwWaitEventsTimeout(double timeout); - - [LibraryImport(NativeLibName, EntryPoint = "glfwPostEmptyEvent")] - internal static unsafe partial void glfwPostEmptyEvent(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetInputMode")] - internal static unsafe partial int glfwGetInputMode(IntPtr window, int mode); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetInputMode")] - internal static unsafe partial void glfwSetInputMode(IntPtr window, int mode, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwRawMouseMotionSupported")] - internal static unsafe partial int glfwRawMouseMotionSupported(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetKeyName")] - internal static unsafe partial byte* glfwGetKeyName(int key, int scancode); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetKeyScancode")] - internal static unsafe partial int glfwGetKeyScancode(int key); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetKey")] - internal static unsafe partial KeyStatus glfwGetKey(IntPtr window, int key); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMouseButton")] - internal static unsafe partial int glfwGetMouseButton(IntPtr window, int button); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetCursorPos")] - internal static unsafe partial void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorPos")] - internal static unsafe partial void glfwSetCursorPos(IntPtr window, double xpos, double ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateCursor")] - internal static unsafe partial GLFWcursor* glfwCreateCursor(GLFWimage* image, int xhot, int yhot); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateStandardCursor")] - internal static unsafe partial GLFWcursor* glfwCreateStandardCursor(int shape); - - [LibraryImport(NativeLibName, EntryPoint = "glfwDestroyCursor")] - internal static unsafe partial void glfwDestroyCursor(GLFWcursor* cursor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCursor")] - internal static unsafe partial void glfwSetCursor(IntPtr window, GLFWcursor* cursor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetKeyCallback")] - internal static unsafe partial delegate* glfwSetKeyCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCharCallback")] - internal static unsafe partial delegate* glfwSetCharCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCharModsCallback")] - internal static unsafe partial delegate* glfwSetCharModsCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetMouseButtonCallback")] - internal static unsafe partial delegate* glfwSetMouseButtonCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorPosCallback")] - internal static unsafe partial delegate* glfwSetCursorPosCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorEnterCallback")] - internal static unsafe partial delegate* glfwSetCursorEnterCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetScrollCallback")] - internal static unsafe partial delegate* glfwSetScrollCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetDropCallback")] - internal static unsafe partial delegate* glfwSetDropCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwJoystickPresent")] - internal static unsafe partial int glfwJoystickPresent(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickAxes")] - internal static unsafe partial float* glfwGetJoystickAxes(int jid, int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickButtons")] - internal static unsafe partial byte* glfwGetJoystickButtons(int jid, int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickHats")] - internal static unsafe partial byte* glfwGetJoystickHats(int jid, int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickName")] - internal static unsafe partial byte* glfwGetJoystickName(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickGUID")] - internal static unsafe partial byte* glfwGetJoystickGUID(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetJoystickUserPointer")] - internal static unsafe partial void glfwSetJoystickUserPointer(int jid, void* pointer); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickUserPointer")] - internal static unsafe partial void* glfwGetJoystickUserPointer(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwJoystickIsGamepad")] - internal static unsafe partial int glfwJoystickIsGamepad(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetJoystickCallback")] - internal static unsafe partial delegate* glfwSetJoystickCallback(delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwUpdateGamepadMappings")] - internal static unsafe partial int glfwUpdateGamepadMappings(byte* str); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetGamepadName")] - internal static unsafe partial byte* glfwGetGamepadName(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetGamepadState")] - internal static unsafe partial int glfwGetGamepadState(int jid, GLFWgamepadstate* state); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetClipboardString")] - internal static unsafe partial void glfwSetClipboardString(IntPtr window, byte* str); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetClipboardString")] - internal static unsafe partial byte* glfwGetClipboardString(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetTime")] - internal static unsafe partial double glfwGetTime(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetTime")] - internal static unsafe partial void glfwSetTime(double time); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetTimerValue")] - internal static unsafe partial ulong* glfwGetTimerValue(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetTimerFrequency")] - internal static unsafe partial ulong* glfwGetTimerFrequency(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwMakeContextCurrent")] - internal static unsafe partial void glfwMakeContextCurrent(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetCurrentContext")] - internal static unsafe partial IntPtr glfwGetCurrentContext(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSwapBuffers")] - internal static unsafe partial void glfwSwapBuffers(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSwapInterval")] - internal static unsafe partial void glfwSwapInterval(int interval); - - [LibraryImport(NativeLibName, EntryPoint = "glfwExtensionSupported")] - internal static unsafe partial int glfwExtensionSupported(byte* extension); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetProcAddress", StringMarshalling = StringMarshalling.Utf8)] - internal static unsafe partial IntPtr glfwGetProcAddress(string procname); - - [LibraryImport(NativeLibName, EntryPoint = "glfwVulkanSupported")] - internal static unsafe partial int glfwVulkanSupported(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetRequiredInstanceExtensions")] - internal static unsafe partial byte** glfwGetRequiredInstanceExtensions(uint* count); - - /* - [LibraryImport(NativeLibName, EntryPoint = "glfwGetInstanceProcAddress")] internal static unsafe partial delegate* glfwGetInstanceProcAddress( - VkInstance instance, - byte* procname); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetPhysicalDevicePresentationSupport")] internal static unsafe partial int glfwGetPhysicalDevicePresentationSupport( - VkInstance instance, - VkPhysicalDevice device, - uint* queuefamily); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindowSurface")] internal static unsafe partial VkResult glfwCreateWindowSurface( - VkInstance instance, - glfwWindow* window, - VkAllocationCallbacks* _allocator, - VkSurfaceKHR* surface); - /**/ - - #endregion api call - } -} diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/8AD2841AAC5BA84DBBB4A918C1CCB20A/C5E335BE0DFC4486ECB4E3269A44DEA1 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/8AD2841AAC5BA84DBBB4A918C1CCB20A/C5E335BE0DFC4486ECB4E3269A44DEA1 deleted file mode 100644 index 449f6060..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/8AD2841AAC5BA84DBBB4A918C1CCB20A/C5E335BE0DFC4486ECB4E3269A44DEA1 +++ /dev/null @@ -1,363 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; - -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; - -namespace StgSharp.Internal -{ - internal unsafe partial class InternalIO - { - - private static GLFWFunction _glfw; - - [LibraryImport(NativeLibName, EntryPoint = "load_glfw_functions")] - internal static unsafe partial void glfwLoadLibrary(GLFWFunction* context); - - internal static unsafe void LoadGlfw() - { - _glfw = new GLFWFunction(); - fixed (GLFWFunction* func = &_glfw) { } - } - - #region api call - - internal static unsafe int glfwInit() => _glfw.glfwInit(); - - internal static unsafe void glfwTerminate() => _glfw.glfwTerminate(); - - internal static unsafe void glfwInitHint(int hint, int value) => _glfw.glfwInitHint(hint, value); - - internal static unsafe void glfwGetVersion(int* major, int* minor, int* rev) => _glfw.glfwGetVersion(major, minor, rev); - - internal static unsafe byte* glfwGetVersionString() => _glfw.glfwGetVersionString(); - - internal static unsafe int glfwGetError(byte** description) => _glfw.glfwGetError(description); - - internal static unsafe delegate* glfwSetErrorCallback(delegate* callback) => _glfw.glfwSetErrorCallback(callback); - - internal static unsafe IntPtr* glfwGetMonitors(int* count) => _glfw.glfwGetMonitors(count); - - internal static unsafe IntPtr glfwGetPrimaryMonitor() => _glfw.glfwGetPrimaryMonitor(); - - internal static unsafe void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos) => _glfw.glfwGetMonitorPos(monitor, xpos, ypos); - - internal static unsafe void glfwGetMonitorWorkarea( - IntPtr monitor, - int* xpos, - int* ypos, - int* width, - int* height) => _glfw.glfwGetMonitorWorkarea(monitor, xpos, ypos, width, height); - - internal static unsafe void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM) => _glfw.glfwGetMonitorPhysicalSize(monitor, widthMM, heightMM); - - internal static unsafe void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale) => _glfw.glfwGetMonitorContentScale(monitor, xscale, yscale); - - internal static unsafe byte* glfwGetMonitorName(IntPtr monitor) => _glfw.glfwGetMonitorName(monitor); - - internal static unsafe void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer) => _glfw.glfwSetMonitorUserPointer(monitor, pointer); - - internal static unsafe void* glfwGetMonitorUserPointer(IntPtr monitor) => _glfw.glfwGetMonitorUserPointer(monitor); - - internal static unsafe delegate* glfwSetMonitorCallback( - delegate* callback) => _glfw.glfwSetMonitorCallback(callback); - - internal static unsafe glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count) => _glfw.glfwGetVideoModes(monitor, count); - - internal static unsafe glfwVideomode* glfwGetVideoMode(IntPtr monitor) => _glfw.glfwGetVideoMode(monitor); - - internal static unsafe void glfwSetGamma(IntPtr monitor, float gamma) => _glfw.glfwSetGamma(monitor, gamma); - - internal static unsafe glfwGammaramp* glfwGetGammaRamp(IntPtr monitor) => _glfw.glfwGetGammaRamp(monitor); - - internal static unsafe void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp) => _glfw.glfwSetGammaRamp(monitor, ramp); - - internal static unsafe void glfwDefaultWindowHints() => _glfw.glfwDefaultWindowHints(); - - internal static unsafe void glfwWindowHint(int hint, int value) => _glfw.glfwWindowHint(hint, value); - - internal static unsafe void glfwWindowHintString(int hint, byte* value) => _glfw.glfwWindowHintString(hint, value); - - internal static unsafe IntPtr glfwCreateWindow( - int width, - int height, - byte[] title, - IntPtr monitor, - IntPtr share) => _glfw.glfwCreateWindow(width, height, title, monitor, share); - - internal static unsafe void glfwDestroyWindow(IntPtr window) => _glfw.glfwDestroyWindow(window); - - internal static unsafe int glfwWindowShouldClose(IntPtr window) => _glfw.glfwWindowShouldClose(window); - - internal static unsafe void glfwSetWindowShouldClose(IntPtr window, int value) => _glfw.glfwSetWindowShouldClose(window, value); - - internal static unsafe void glfwSetWindowTitle(IntPtr window, byte* title) => _glfw.glfwSetWindowTitle(window, title); - - internal static unsafe void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images) => _glfw.glfwSetWindowIcon(window, count, images); - - internal static unsafe void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos) => _glfw.glfwGetWindowPos(window, xpos, ypos); - - internal static unsafe void glfwSetWindowPos(IntPtr window, int xpos, int ypos) => _glfw.glfwSetWindowPos(window, xpos, ypos); - - internal static unsafe void glfwGetWindowSize(IntPtr window, int* width, int* height) => _glfw.glfwGetWindowSize(window, width, height); - - internal static unsafe void glfwSetWindowSizeLimits( - IntPtr window, - int minwidth, - int minheight, - int maxwidth, - int maxheight) => _glfw.glfwSetWindowSizeLimits(window, minwidth, minheight, maxwidth, maxheight); - - internal static unsafe void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom) => _glfw.glfwSetWindowAspectRatio(window, numer, denom); - - internal static unsafe void glfwSetWindowSize(IntPtr window, int width, int height) => _glfw.glfwSetWindowSize(window, width, height); - - internal static unsafe void glfwGetFramebufferSize(IntPtr window, int* width, int* height) => _glfw.glfwGetFramebufferSize(window, width, height); - - internal static unsafe void glfwGetWindowFrameSize(IntPtr window, int* left, int* top, int* right, int* bottom) => _glfw.glfwGetWindowFrameSize(window, left, top, right, bottom); - - internal static unsafe void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale) => _glfw.glfwGetWindowContentScale(window, xscale, yscale); - - internal static unsafe float glfwGetWindowOpacity(IntPtr window) => _glfw.glfwGetWindowOpacity(window); - - internal static unsafe void glfwSetWindowOpacity(IntPtr window, float opacity) => _glfw.glfwSetWindowOpacity(window, opacity); - - internal static unsafe void glfwIconifyWindow(IntPtr window) => _glfw.glfwIconifyWindow(window); - - internal static unsafe void glfwRestoreWindow(IntPtr window) => _glfw.glfwRestoreWindow(window); - - internal static unsafe void glfwMaximizeWindow(IntPtr window) => _glfw.glfwMaximizeWindow(window); - - internal static unsafe void glfwShowWindow(IntPtr window) => _glfw.glfwShowWindow(window); - - internal static unsafe void glfwHideWindow(IntPtr window) => _glfw.glfwHideWindow(window); - - internal static unsafe void glfwFocusWindow(IntPtr window) => _glfw.glfwFocusWindow(window); - - internal static unsafe void glfwRequestWindowAttention(IntPtr window) => _glfw.glfwRequestWindowAttention(window); - - internal static unsafe IntPtr glfwGetWindowMonitor(IntPtr window) => _glfw.glfwGetWindowMonitor(window); - - internal static unsafe void glfwSetWindowMonitor( - IntPtr window, - IntPtr monitor, - int xpos, - int ypos, - int width, - int height, - int refreshRate) => _glfw.glfwSetWindowMonitor( - window, monitor, xpos, ypos, width, height, refreshRate); - - internal static unsafe int glfwGetWindowAttrib(IntPtr window, int attrib) => _glfw.glfwGetWindowAttrib(window, attrib); - - internal static unsafe void glfwSetWindowAttrib(IntPtr window, int attrib, int value) => _glfw.glfwSetWindowAttrib(window, attrib, value); - - internal static unsafe void glfwSetWindowUserPointer(IntPtr window, void* pointer) => _glfw.glfwSetWindowUserPointer(window, pointer); - - internal static unsafe void* glfwGetWindowUserPointer(IntPtr window) => _glfw.glfwGetWindowUserPointer(window); - - internal static unsafe delegate* glfwSetWindowPosCallback( - IntPtr window, - IntPtr callback) => _glfw.glfwSetWindowPosCallback(window, callback); - - internal static unsafe delegate* glfwSetWindowSizeCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetWindowSizeCallback(window, callback); - - internal static unsafe delegate* glfwSetWindowCloseCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetWindowCloseCallback(window, callback); - - internal static unsafe delegate* glfwSetWindowRefreshCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetWindowRefreshCallback(window, callback); - - internal static unsafe delegate* glfwSetWindowFocusCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetWindowFocusCallback(window, callback); - - internal static unsafe delegate* glfwSetWindowIconifyCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetWindowIconifyCallback(window, callback); - - internal static unsafe delegate* glfwSetWindowMaximizeCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetWindowMaximizeCallback(window, callback); - - internal static unsafe FrameBufferSizeHandler glfwSetFramebufferSizeCallback(IntPtr window, IntPtr callback) => _glfw.glfwSetFramebufferSizeCallback(window, callback); - - internal static unsafe delegate* glfwSetWindowContentScaleCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetWindowContentScaleCallback(window, callback); - - internal static unsafe void glfwPollEvents() => _glfw.glfwPollEvents(); - - internal static unsafe void glfwWaitEvents() => _glfw.glfwWaitEvents(); - - internal static unsafe void glfwWaitEventsTimeout(double timeout) => _glfw.glfwWaitEventsTimeout(timeout); - - internal static unsafe void glfwPostEmptyEvent() => _glfw.glfwPostEmptyEvent(); - - internal static unsafe int glfwGetInputMode(IntPtr window, int mode) => _glfw.glfwGetInputMode(window, mode); - - internal static unsafe void glfwSetInputMode(IntPtr window, int mode, int value) => _glfw.glfwSetInputMode(window, mode, value); - - internal static unsafe int glfwRawMouseMotionSupported() => _glfw.glfwRawMouseMotionSupported(); - - internal static unsafe byte* glfwGetKeyName(int key, int scancode) => _glfw.glfwGetKeyName(key, scancode); - - internal static unsafe int glfwGetKeyScancode(int key) => _glfw.glfwGetKeyScancode(key); - - internal static unsafe KeyStatus glfwGetKey(IntPtr window, int key) => _glfw.glfwGetKey(window, key); - - internal static unsafe int glfwGetMouseButton(IntPtr window, int button) => _glfw.glfwGetMouseButton(window, button); - - internal static unsafe void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos) => _glfw.glfwGetCursorPos(window, xpos, ypos); - - internal static unsafe void glfwSetCursorPos(IntPtr window, double xpos, double ypos) => _glfw.glfwSetCursorPos(window, xpos, ypos); - - internal static unsafe GLFWcursor* glfwCreateCursor(GLFWimage* image, int xhot, int yhot) => _glfw.glfwCreateCursor(image, xhot, yhot); - - internal static unsafe GLFWcursor* glfwCreateStandardCursor(int shape) => _glfw.glfwCreateStandardCursor(shape); - - internal static unsafe void glfwDestroyCursor(GLFWcursor* cursor) => _glfw.glfwDestroyCursor(cursor); - - internal static unsafe void glfwSetCursor(IntPtr window, GLFWcursor* cursor) => _glfw.glfwSetCursor(window, cursor); - - internal static unsafe delegate* glfwSetKeyCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetKeyCallback(window, callback); - - internal static unsafe delegate* glfwSetCharCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetCharCallback(window, callback); - - internal static unsafe delegate* glfwSetCharModsCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetCharModsCallback(window, callback); - - internal static unsafe delegate* glfwSetMouseButtonCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetMouseButtonCallback(window, callback); - - internal static unsafe delegate* glfwSetCursorPosCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetCursorPosCallback(window, callback); - - internal static unsafe delegate* glfwSetCursorEnterCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetCursorEnterCallback(window, callback); - - internal static unsafe delegate* glfwSetScrollCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetScrollCallback(window, callback); - - internal static unsafe delegate* glfwSetDropCallback( - IntPtr window, - delegate* callback) => _glfw.glfwSetDropCallback(window, callback); - - internal static unsafe int glfwJoystickPresent(int jid) => _glfw.glfwJoystickPresent(jid); - - internal static unsafe float* glfwGetJoystickAxes(int jid, int* count) => _glfw.glfwGetJoystickAxes(jid, count); - - internal static unsafe byte* glfwGetJoystickButtons(int jid, int* count) => _glfw.glfwGetJoystickButtons(jid, count); - - internal static unsafe byte* glfwGetJoystickHats(int jid, int* count) => _glfw.glfwGetJoystickHats(jid, count); - - internal static unsafe byte* glfwGetJoystickName(int jid) => _glfw.glfwGetJoystickName(jid); - - internal static unsafe byte* glfwGetJoystickGUID(int jid) => _glfw.glfwGetJoystickGUID(jid); - - internal static unsafe void glfwSetJoystickUserPointer(int jid, void* pointer) => _glfw.glfwSetJoystickUserPointer(jid, pointer); - - internal static unsafe void* glfwGetJoystickUserPointer(int jid) => _glfw.glfwGetJoystickUserPointer(jid); - - internal static unsafe int glfwJoystickIsGamepad(int jid) => _glfw.glfwJoystickIsGamepad(jid); - - internal static unsafe delegate* glfwSetJoystickCallback(delegate* callback) => _glfw.glfwSetJoystickCallback(callback); - - internal static unsafe int glfwUpdateGamepadMappings(byte* str) => _glfw.glfwUpdateGamepadMappings(str); - - internal static unsafe byte* glfwGetGamepadName(int jid) => _glfw.glfwGetGamepadName(jid); - - internal static unsafe int glfwGetGamepadState(int jid, GLFWgamepadstate* state) => _glfw.glfwGetGamepadState(jid, state); - - internal static unsafe void glfwSetClipboardString(IntPtr window, byte* str) => _glfw.glfwSetClipboardString(window, str); - - internal static unsafe byte* glfwGetClipboardString(IntPtr window) => _glfw.glfwGetClipboardString(window); - - internal static unsafe double glfwGetTime() => _glfw.glfwGetTime(); - - internal static unsafe void glfwSetTime(double time) => _glfw.glfwSetTime(time); - - internal static unsafe ulong* glfwGetTimerValue() => _glfw.glfwGetTimerValue(); - - internal static unsafe ulong* glfwGetTimerFrequency() => _glfw.glfwGetTimerFrequency(); - - internal static unsafe void glfwMakeContextCurrent(IntPtr window) => _glfw.glfwMakeContextCurrent(window); - - internal static unsafe IntPtr glfwGetCurrentContext() => _glfw.glfwGetCurrentContext(); - - internal static unsafe void glfwSwapBuffers(IntPtr window) => _glfw.glfwSwapBuffers(window); - - internal static unsafe void glfwSwapInterval(int interval) => _glfw.glfwSwapInterval(interval); - - internal static unsafe int glfwExtensionSupported(byte* extension) => _glfw.glfwExtensionSupported(extension); - - internal static unsafe IntPtr glfwGetProcAddress(string procname) => _glfw.glfwGetProcAddress(procname); - - internal static unsafe int glfwVulkanSupported() => _glfw.glfwVulkanSupported(); - - internal static unsafe byte** glfwGetRequiredInstanceExtensions(uint* count) => _glfw.glfwGetRequiredInstanceExtensions(count); - - /* - [LibraryImport(NativeLibName, EntryPoint = "glfwGetInstanceProcAddress")] internal static unsafe partial delegate* glfwGetInstanceProcAddress( - VkInstance instance, - byte* procname); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetPhysicalDevicePresentationSupport")] internal static unsafe partial int glfwGetPhysicalDevicePresentationSupport( - VkInstance instance, - VkPhysicalDevice device, - uint* queuefamily); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindowSurface")] internal static unsafe partial VkResult glfwCreateWindowSurface( - VkInstance instance, - glfwWindow* window, - VkAllocationCallbacks* _allocator, - VkSurfaceKHR* surface); - /**/ - - #endregion api call - } -} diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/8AD2841AAC5BA84DBBB4A918C1CCB20A/E85AA11F74CAA82F5E384A85CDBE0B61 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/8AD2841AAC5BA84DBBB4A918C1CCB20A/E85AA11F74CAA82F5E384A85CDBE0B61 deleted file mode 100644 index 48081bd3..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/8AD2841AAC5BA84DBBB4A918C1CCB20A/E85AA11F74CAA82F5E384A85CDBE0B61 +++ /dev/null @@ -1,156 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw_function_table.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.InteropServices; - -namespace StgSharp.Internal -{ - [StructLayout(LayoutKind.Sequential)] - internal unsafe struct GLFWFunction - { - - public delegate* unmanaged[Cdecl] glfwCreateCursor; - public delegate* unmanaged[Cdecl] glfwCreateStandardCursor; - public delegate* unmanaged[Cdecl] glfwCreateWindow; - public delegate* unmanaged[Cdecl] glfwDefaultWindowHints; - public delegate* unmanaged[Cdecl] glfwDestroyCursor; - public delegate* unmanaged[Cdecl] glfwDestroyWindow; - public delegate* unmanaged[Cdecl] glfwExtensionSupported; - public delegate* unmanaged[Cdecl] glfwFocusWindow; - public delegate* unmanaged[Cdecl] glfwGetClipboardString; - public delegate* unmanaged[Cdecl] glfwGetCurrentContext; - public delegate* unmanaged[Cdecl] glfwGetCursorPos; - public delegate* unmanaged[Cdecl] glfwGetError; - public delegate* unmanaged[Cdecl] glfwGetFramebufferSize; - public delegate* unmanaged[Cdecl] glfwGetGamepadName; - public delegate* unmanaged[Cdecl] glfwGetGamepadState; - public delegate* unmanaged[Cdecl] glfwGetGammaRamp; - public delegate* unmanaged[Cdecl] glfwGetInputMode; - public delegate* unmanaged[Cdecl] glfwGetJoystickAxes; - public delegate* unmanaged[Cdecl] glfwGetJoystickButtons; - public delegate* unmanaged[Cdecl] glfwGetJoystickGUID; - public delegate* unmanaged[Cdecl] glfwGetJoystickHats; - public delegate* unmanaged[Cdecl] glfwGetJoystickName; - public delegate* unmanaged[Cdecl] glfwGetJoystickUserPointer; - public delegate* unmanaged[Cdecl] glfwGetKey; - public delegate* unmanaged[Cdecl] glfwGetKeyName; - public delegate* unmanaged[Cdecl] glfwGetKeyScancode; - public delegate* unmanaged[Cdecl] glfwGetMonitorContentScale; - public delegate* unmanaged[Cdecl] glfwGetMonitorName; - public delegate* unmanaged[Cdecl] glfwGetMonitorPhysicalSize; - public delegate* unmanaged[Cdecl] glfwGetMonitorPos; - public delegate* unmanaged[Cdecl] glfwGetMonitors; - public delegate* unmanaged[Cdecl] glfwGetMonitorUserPointer; - public delegate* unmanaged[Cdecl] glfwGetMonitorWorkarea; - public delegate* unmanaged[Cdecl] glfwGetMouseButton; - public delegate* unmanaged[Cdecl] glfwGetPrimaryMonitor; - public delegate* unmanaged[Cdecl] glfwGetProcAddress; - public delegate* unmanaged[Cdecl] glfwGetRequiredInstanceExtensions; - public delegate* unmanaged[Cdecl] glfwGetTime; - public delegate* unmanaged[Cdecl] glfwGetTimerFrequency; - public delegate* unmanaged[Cdecl] glfwGetTimerValue; - public delegate* unmanaged[Cdecl] glfwGetVersionString; - public delegate* unmanaged[Cdecl] glfwGetVideoMode; - public delegate* unmanaged[Cdecl] glfwGetVideoModes; - public delegate* unmanaged[Cdecl] glfwGetWindowAttrib; - public delegate* unmanaged[Cdecl] glfwGetWindowContentScale; - public delegate* unmanaged[Cdecl] glfwGetWindowFrameSize; - public delegate* unmanaged[Cdecl] glfwGetWindowMonitor; - public delegate* unmanaged[Cdecl] glfwGetWindowOpacity; - public delegate* unmanaged[Cdecl] glfwGetWindowPos; - public delegate* unmanaged[Cdecl] glfwGetWindowSize; - public delegate* unmanaged[Cdecl] glfwGetWindowUserPointer; - public delegate* unmanaged[Cdecl] glfwHideWindow; - public delegate* unmanaged[Cdecl] glfwIconifyWindow; - public delegate* unmanaged[Cdecl] glfwInit; - public delegate* unmanaged[Cdecl] glfwInitHint; - public delegate* unmanaged[Cdecl] glfwJoystickIsGamepad; - public delegate* unmanaged[Cdecl] glfwJoystickPresent; - public delegate* unmanaged[Cdecl] glfwMakeContextCurrent; - public delegate* unmanaged[Cdecl] glfwMaximizeWindow; - public delegate* unmanaged[Cdecl] glfwPollEvents; - public delegate* unmanaged[Cdecl] glfwPostEmptyEvent; - public delegate* unmanaged[Cdecl] glfwRawMouseMotionSupported; - public delegate* unmanaged[Cdecl] glfwRequestWindowAttention; - public delegate* unmanaged[Cdecl] glfwRestoreWindow; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCharCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCharModsCallback; - public delegate* unmanaged[Cdecl] glfwSetClipboardString; - public delegate* unmanaged[Cdecl] glfwSetCursor; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCursorEnterCallback; - public delegate* unmanaged[Cdecl] glfwSetCursorPos; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCursorPosCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged [Cdecl]> glfwSetDropCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetFramebufferSizeCallback; - public delegate* unmanaged[Cdecl] glfwSetGamma; - public delegate* unmanaged[Cdecl] glfwSetGammaRamp; - public delegate* unmanaged[Cdecl] glfwSetInputMode; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetJoystickCallback; - public delegate* unmanaged[Cdecl] glfwSetJoystickUserPointer; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetKeyCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetMonitorCallback; - public delegate* unmanaged[Cdecl] glfwSetMonitorUserPointer; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetMouseButtonCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetScrollCallback; - public delegate* unmanaged[Cdecl] glfwSetTime; - public delegate* unmanaged[Cdecl] glfwSetWindowAspectRatio; - public delegate* unmanaged[Cdecl] glfwSetWindowAttrib; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowCloseCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowContentScaleCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowFocusCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowIcon; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowIconifyCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowMaximizeCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowMonitor; - public delegate* unmanaged[Cdecl] glfwSetWindowOpacity; - public delegate* unmanaged[Cdecl] glfwSetWindowPos; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowPosCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowRefreshCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowShouldClose; - public delegate* unmanaged[Cdecl] glfwSetWindowSize; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowSizeCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowSizeLimits; - public delegate* unmanaged[Cdecl] glfwSetWindowTitle; - public delegate* unmanaged[Cdecl] glfwSetWindowUserPointer; - public delegate* unmanaged[Cdecl] glfwShowWindow; - public delegate* unmanaged[Cdecl] glfwSwapBuffers; - public delegate* unmanaged[Cdecl] glfwSwapInterval; - public delegate* unmanaged[Cdecl] glfwTerminate; - public delegate* unmanaged[Cdecl] glfwUpdateGamepadMappings; - public delegate* unmanaged[Cdecl] glfwVulkanSupported; - public delegate* unmanaged[Cdecl] glfwWaitEvents; - public delegate* unmanaged[Cdecl] glfwWaitEventsTimeout; - public delegate* unmanaged[Cdecl] glfwWindowHint; - public delegate* unmanaged[Cdecl] glfwWindowHintString; - public delegate* unmanaged[Cdecl] glfwWindowShouldClose; - - } -} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/95AD261B34E2664480B096A1420708F7/9CF5BA7363CBC08C651336CD881AF3EA b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/95AD261B34E2664480B096A1420708F7/9CF5BA7363CBC08C651336CD881AF3EA deleted file mode 100644 index dae34e16..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/95AD261B34E2664480B096A1420708F7/9CF5BA7363CBC08C651336CD881AF3EA +++ /dev/null @@ -1,123 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="InternalIO.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; -using StgSharp.Graphics.OpenGL; - -using System; -using System.Collections.Generic; -using System.IO; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -using System.Text; -using System.Threading; - -namespace StgSharp.Internal -{ - internal static unsafe partial class InternalIO - { - - internal const string SS_errorLog = - "SS_errorlog.log"; - - internal const string NativeLibName = - "StgSharp.C"; - - internal static Dictionary GLtype = []; - - internal static readonly GCHandle ssc_logHandle = - GCHandle.Alloc(new byte[512], GCHandleType.Pinned); - - internal static IntPtr _nativeLibPtr = IntPtr.Zero; - - internal static SemaphoreSlim logSyncSemaphore = new SemaphoreSlim(1, 1); - - static InternalIO() - { - GLtype.Add(TypeCode.Single, glConst.FLOAT); - GLtype.Add(TypeCode.Int32, glConst.INT); - GLtype.Add(TypeCode.UInt32, glConst.UNSIGNED_INT); - GLtype.Add(TypeCode.Int16, glConst.SHORT); - GLtype.Add(TypeCode.UInt16, glConst.UNSIGNED_SHORT); - GLtype.Add(TypeCode.SByte, glConst.BYTE); - GLtype.Add(TypeCode.Byte, glConst.UNSIGNED_BYTE); - } - - internal static void InternalAppendLog(string log) - { - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) { - logStream.WriteLine(log); - } - } - - internal static void InternalWriteLog(string logLine, LogType logType) - { - logSyncSemaphore.Wait(); - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) - { - logStream.WriteLine($"{logType}\t{DateTime.Now.ToString("o")}"); - logStream.WriteLine(logLine); - } - _ = logSyncSemaphore.Release(); - } - - internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType) - { - logSyncSemaphore.Wait(); - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) - { - logStream.WriteLine(beforeTime); - logStream.WriteLine($"{logType}\t@\t{DateTime.Now.ToString("o")}"); - logStream.WriteLine(logLine); - } - _ = logSyncSemaphore.Release(1); - } - - } -} diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/95AD261B34E2664480B096A1420708F7/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/95AD261B34E2664480B096A1420708F7/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA deleted file mode 100644 index dae34e16..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/95AD261B34E2664480B096A1420708F7/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA +++ /dev/null @@ -1,123 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="InternalIO.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; -using StgSharp.Graphics.OpenGL; - -using System; -using System.Collections.Generic; -using System.IO; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -using System.Text; -using System.Threading; - -namespace StgSharp.Internal -{ - internal static unsafe partial class InternalIO - { - - internal const string SS_errorLog = - "SS_errorlog.log"; - - internal const string NativeLibName = - "StgSharp.C"; - - internal static Dictionary GLtype = []; - - internal static readonly GCHandle ssc_logHandle = - GCHandle.Alloc(new byte[512], GCHandleType.Pinned); - - internal static IntPtr _nativeLibPtr = IntPtr.Zero; - - internal static SemaphoreSlim logSyncSemaphore = new SemaphoreSlim(1, 1); - - static InternalIO() - { - GLtype.Add(TypeCode.Single, glConst.FLOAT); - GLtype.Add(TypeCode.Int32, glConst.INT); - GLtype.Add(TypeCode.UInt32, glConst.UNSIGNED_INT); - GLtype.Add(TypeCode.Int16, glConst.SHORT); - GLtype.Add(TypeCode.UInt16, glConst.UNSIGNED_SHORT); - GLtype.Add(TypeCode.SByte, glConst.BYTE); - GLtype.Add(TypeCode.Byte, glConst.UNSIGNED_BYTE); - } - - internal static void InternalAppendLog(string log) - { - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) { - logStream.WriteLine(log); - } - } - - internal static void InternalWriteLog(string logLine, LogType logType) - { - logSyncSemaphore.Wait(); - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) - { - logStream.WriteLine($"{logType}\t{DateTime.Now.ToString("o")}"); - logStream.WriteLine(logLine); - } - _ = logSyncSemaphore.Release(); - } - - internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType) - { - logSyncSemaphore.Wait(); - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) - { - logStream.WriteLine(beforeTime); - logStream.WriteLine($"{logType}\t@\t{DateTime.Now.ToString("o")}"); - logStream.WriteLine(logLine); - } - _ = logSyncSemaphore.Release(1); - } - - } -} diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/95AD261B34E2664480B096A1420708F7/AAC2855D02D37DD04D9696D14FB1C1F5 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/95AD261B34E2664480B096A1420708F7/AAC2855D02D37DD04D9696D14FB1C1F5 deleted file mode 100644 index 0938abe3..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/95AD261B34E2664480B096A1420708F7/AAC2855D02D37DD04D9696D14FB1C1F5 +++ /dev/null @@ -1,153 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="InternalIO.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; -using StgSharp.Graphics.OpenGL; - -using System; -using System.Collections.Generic; -using System.IO; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -using System.Text; -using System.Threading; - -namespace StgSharp.Internal -{ - internal static unsafe partial class InternalIO - { - - private const long MaxLogFileSize = 10 * 1024 * 1024; // 10 MB - - internal const string NativeLibName = - "StgSharp.C"; - - internal const string SS_errorLog = - "SS_errorlog.log"; - - private static LogType _currentLogLevel = LogType.Info; - - internal static Dictionary GLtype = []; - - internal static readonly GCHandle ssc_logHandle = - GCHandle.Alloc(new byte[512], GCHandleType.Pinned); - - internal static IntPtr _nativeLibPtr = IntPtr.Zero; - - internal static SemaphoreSlim logSyncSemaphore = new SemaphoreSlim(1, 1); - - static InternalIO() - { - GLtype.Add(TypeCode.Single, glConst.FLOAT); - GLtype.Add(TypeCode.Int32, glConst.INT); - GLtype.Add(TypeCode.UInt32, glConst.UNSIGNED_INT); - GLtype.Add(TypeCode.Int16, glConst.SHORT); - GLtype.Add(TypeCode.UInt16, glConst.UNSIGNED_SHORT); - GLtype.Add(TypeCode.SByte, glConst.BYTE); - GLtype.Add(TypeCode.Byte, glConst.UNSIGNED_BYTE); - } - - internal static void InternalAppendLog(string log) - { - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) { - logStream.WriteLine(log); - } - } - - internal static void InternalWriteLog(string logLine, LogType logType) - { - if (logType < _currentLogLevel) { - return; - } - - logSyncSemaphore.Wait(); - try - { - RotateLogFile(); - - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) { - logStream.WriteLine($"[{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff}] [{logType}] {logLine}"); - } - } - finally - { - logSyncSemaphore.Release(); - } - } - - internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType) - { - logSyncSemaphore.Wait(); - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) - { - logStream.WriteLine(beforeTime); - logStream.WriteLine($"[{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff}] [{logType}] {logLine}"); - } - _ = logSyncSemaphore.Release(1); - } - - internal static void SetLogLevel(LogType logLevel) - { - _currentLogLevel = logLevel; - } - - private static void RotateLogFile() - { - if (File.Exists(SS_errorLog) && new FileInfo(SS_errorLog).Length > MaxLogFileSize) - { - string backupFile = SS_errorLog + ".backup"; - if (File.Exists(backupFile)) { - File.Delete(backupFile); - } - File.Move(SS_errorLog, backupFile); - } - } - - } -} diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/B5694BA42809184D93CE3D299084555B/516E4750BFA070C15018A44BF13AD02C b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/B5694BA42809184D93CE3D299084555B/516E4750BFA070C15018A44BF13AD02C deleted file mode 100644 index eb8ad827..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/B5694BA42809184D93CE3D299084555B/516E4750BFA070C15018A44BF13AD02C +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef GLFW_FUNCTION_TABLE_H -#define GLFW_FUNCTION_TABLE_H - -#include "../glfw/glfw3.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct GLFWFunctionTable { - int (*glfwInit)(void); - void (*glfwTerminate)(void); - void (*glfwInitHint)(int hint, int value); - void (*glfwGetVersion)(int* major, int* minor, int* rev); - const char* (*glfwGetVersionString)(void); - int (*glfwGetError)(const char** description); - GLFWerrorfun (*glfwSetErrorCallback)(GLFWerrorfun callback); - GLFWmonitor** (*glfwGetMonitors)(int* count); - GLFWmonitor* (*glfwGetPrimaryMonitor)(void); - void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos); - void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height); - void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM); - void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale); - const char* (*glfwGetMonitorName)(GLFWmonitor* monitor); - void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer); - void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor); - GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback); - const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count); - const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor); - void (*glfwSetGamma)(GLFWmonitor* monitor, float gamma); - const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor); - void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp); - void (*glfwDefaultWindowHints)(void); - void (*glfwWindowHint)(int hint, int value); - void (*glfwWindowHintString)(int hint, const char* value); - GLFWwindow* (*glfwCreateWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share); - void (*glfwDestroyWindow)(GLFWwindow* window); - int (*glfwWindowShouldClose)(GLFWwindow* window); - void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value); - void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title); - void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images); - void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos); - void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos); - void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height); - void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); - void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom); - void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height); - void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height); - void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom); - void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale); - float (*glfwGetWindowOpacity)(GLFWwindow* window); - void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity); - void (*glfwIconifyWindow)(GLFWwindow* window); - void (*glfwRestoreWindow)(GLFWwindow* window); - void (*glfwMaximizeWindow)(GLFWwindow* window); - void (*glfwShowWindow)(GLFWwindow* window); - void (*glfwHideWindow)(GLFWwindow* window); - void (*glfwFocusWindow)(GLFWwindow* window); - void (*glfwRequestWindowAttention)(GLFWwindow* window); - GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window); - void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); - int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib); - void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value); - void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer); - void* (*glfwGetWindowUserPointer)(GLFWwindow* window); - GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback); - GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback); - GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback); - GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback); - GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback); - GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback); - GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback); - GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback); - GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback); - void (*glfwPollEvents)(void); - void (*glfwWaitEvents)(void); - void (*glfwWaitEventsTimeout)(double timeout); - void (*glfwPostEmptyEvent)(void); - int (*glfwGetInputMode)(GLFWwindow* window, int mode); - void (*glfwSetInputMode)(GLFWwindow* window, int mode, int value); - int (*glfwRawMouseMotionSupported)(void); - const char* (*glfwGetKeyName)(int key, int scancode); - int (*glfwGetKeyScancode)(int key); - int (*glfwGetKey)(GLFWwindow* window, int key); - int (*glfwGetMouseButton)(GLFWwindow* window, int button); - void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos); - void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos); - GLFWcursor* (*glfwCreateCursor)(const GLFWimage* image, int xhot, int yhot); - GLFWcursor* (*glfwCreateStandardCursor)(int shape); - void (*glfwDestroyCursor)(GLFWcursor* cursor); - void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor); - GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback); - GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback); - GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback); - GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback); - GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback); - GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback); - GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback); - GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback); - int (*glfwJoystickPresent)(int jid); - const float* (*glfwGetJoystickAxes)(int jid, int* count); - const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count); - const char* (*glfwGetJoystickGUID)(int jid); - const unsigned char* (*glfwGetJoystickHats)(int jid, int* count); - const char* (*glfwGetJoystickName)(int jid); - void* (*glfwGetJoystickUserPointer)(int jid); - int (*glfwJoystickIsGamepad)(int jid); - GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback); - int (*glfwUpdateGamepadMappings)(const char* str); - const char* (*glfwGetGamepadName)(int jid); - int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state); - void (*glfwSetClipboardString)(GLFWwindow* window, const char* str); - const char* (*glfwGetClipboardString)(GLFWwindow* window); - double (*glfwGetTime)(void); - void (*glfwSetTime)(double time); - unsigned long long (*glfwGetTimerValue)(void); - unsigned long long (*glfwGetTimerFrequency)(void); - void (*glfwMakeContextCurrent)(GLFWwindow* window); - GLFWwindow* (*glfwGetCurrentContext)(void); - void (*glfwSwapBuffers)(GLFWwindow* window); - void (*glfwSwapInterval)(int interval); - int (*glfwExtensionSupported)(const char* extension); - GLFWglproc (*glfwGetProcAddress)(const char* procname); - int (*glfwVulkanSupported)(void); - const char** (*glfwGetRequiredInstanceExtensions)(unsigned int* count); -} GLFWFunctionTable; - -#ifdef __cplusplus -} -#endif - -#endif \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/B5694BA42809184D93CE3D299084555B/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/B5694BA42809184D93CE3D299084555B/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA deleted file mode 100644 index dae34e16..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/B5694BA42809184D93CE3D299084555B/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA +++ /dev/null @@ -1,123 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="InternalIO.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; -using StgSharp.Graphics.OpenGL; - -using System; -using System.Collections.Generic; -using System.IO; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -using System.Text; -using System.Threading; - -namespace StgSharp.Internal -{ - internal static unsafe partial class InternalIO - { - - internal const string SS_errorLog = - "SS_errorlog.log"; - - internal const string NativeLibName = - "StgSharp.C"; - - internal static Dictionary GLtype = []; - - internal static readonly GCHandle ssc_logHandle = - GCHandle.Alloc(new byte[512], GCHandleType.Pinned); - - internal static IntPtr _nativeLibPtr = IntPtr.Zero; - - internal static SemaphoreSlim logSyncSemaphore = new SemaphoreSlim(1, 1); - - static InternalIO() - { - GLtype.Add(TypeCode.Single, glConst.FLOAT); - GLtype.Add(TypeCode.Int32, glConst.INT); - GLtype.Add(TypeCode.UInt32, glConst.UNSIGNED_INT); - GLtype.Add(TypeCode.Int16, glConst.SHORT); - GLtype.Add(TypeCode.UInt16, glConst.UNSIGNED_SHORT); - GLtype.Add(TypeCode.SByte, glConst.BYTE); - GLtype.Add(TypeCode.Byte, glConst.UNSIGNED_BYTE); - } - - internal static void InternalAppendLog(string log) - { - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) { - logStream.WriteLine(log); - } - } - - internal static void InternalWriteLog(string logLine, LogType logType) - { - logSyncSemaphore.Wait(); - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) - { - logStream.WriteLine($"{logType}\t{DateTime.Now.ToString("o")}"); - logStream.WriteLine(logLine); - } - _ = logSyncSemaphore.Release(); - } - - internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType) - { - logSyncSemaphore.Wait(); - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) - { - logStream.WriteLine(beforeTime); - logStream.WriteLine($"{logType}\t@\t{DateTime.Now.ToString("o")}"); - logStream.WriteLine(logLine); - } - _ = logSyncSemaphore.Release(1); - } - - } -} diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/B5694BA42809184D93CE3D299084555B/A5863C09A216367D15EF0D0595D47FEC b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/B5694BA42809184D93CE3D299084555B/A5863C09A216367D15EF0D0595D47FEC deleted file mode 100644 index eb8ad827..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/B5694BA42809184D93CE3D299084555B/A5863C09A216367D15EF0D0595D47FEC +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef GLFW_FUNCTION_TABLE_H -#define GLFW_FUNCTION_TABLE_H - -#include "../glfw/glfw3.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct GLFWFunctionTable { - int (*glfwInit)(void); - void (*glfwTerminate)(void); - void (*glfwInitHint)(int hint, int value); - void (*glfwGetVersion)(int* major, int* minor, int* rev); - const char* (*glfwGetVersionString)(void); - int (*glfwGetError)(const char** description); - GLFWerrorfun (*glfwSetErrorCallback)(GLFWerrorfun callback); - GLFWmonitor** (*glfwGetMonitors)(int* count); - GLFWmonitor* (*glfwGetPrimaryMonitor)(void); - void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos); - void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height); - void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM); - void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale); - const char* (*glfwGetMonitorName)(GLFWmonitor* monitor); - void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer); - void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor); - GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback); - const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count); - const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor); - void (*glfwSetGamma)(GLFWmonitor* monitor, float gamma); - const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor); - void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp); - void (*glfwDefaultWindowHints)(void); - void (*glfwWindowHint)(int hint, int value); - void (*glfwWindowHintString)(int hint, const char* value); - GLFWwindow* (*glfwCreateWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share); - void (*glfwDestroyWindow)(GLFWwindow* window); - int (*glfwWindowShouldClose)(GLFWwindow* window); - void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value); - void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title); - void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images); - void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos); - void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos); - void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height); - void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); - void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom); - void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height); - void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height); - void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom); - void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale); - float (*glfwGetWindowOpacity)(GLFWwindow* window); - void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity); - void (*glfwIconifyWindow)(GLFWwindow* window); - void (*glfwRestoreWindow)(GLFWwindow* window); - void (*glfwMaximizeWindow)(GLFWwindow* window); - void (*glfwShowWindow)(GLFWwindow* window); - void (*glfwHideWindow)(GLFWwindow* window); - void (*glfwFocusWindow)(GLFWwindow* window); - void (*glfwRequestWindowAttention)(GLFWwindow* window); - GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window); - void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); - int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib); - void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value); - void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer); - void* (*glfwGetWindowUserPointer)(GLFWwindow* window); - GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback); - GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback); - GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback); - GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback); - GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback); - GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback); - GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback); - GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback); - GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback); - void (*glfwPollEvents)(void); - void (*glfwWaitEvents)(void); - void (*glfwWaitEventsTimeout)(double timeout); - void (*glfwPostEmptyEvent)(void); - int (*glfwGetInputMode)(GLFWwindow* window, int mode); - void (*glfwSetInputMode)(GLFWwindow* window, int mode, int value); - int (*glfwRawMouseMotionSupported)(void); - const char* (*glfwGetKeyName)(int key, int scancode); - int (*glfwGetKeyScancode)(int key); - int (*glfwGetKey)(GLFWwindow* window, int key); - int (*glfwGetMouseButton)(GLFWwindow* window, int button); - void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos); - void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos); - GLFWcursor* (*glfwCreateCursor)(const GLFWimage* image, int xhot, int yhot); - GLFWcursor* (*glfwCreateStandardCursor)(int shape); - void (*glfwDestroyCursor)(GLFWcursor* cursor); - void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor); - GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback); - GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback); - GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback); - GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback); - GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback); - GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback); - GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback); - GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback); - int (*glfwJoystickPresent)(int jid); - const float* (*glfwGetJoystickAxes)(int jid, int* count); - const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count); - const char* (*glfwGetJoystickGUID)(int jid); - const unsigned char* (*glfwGetJoystickHats)(int jid, int* count); - const char* (*glfwGetJoystickName)(int jid); - void* (*glfwGetJoystickUserPointer)(int jid); - int (*glfwJoystickIsGamepad)(int jid); - GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback); - int (*glfwUpdateGamepadMappings)(const char* str); - const char* (*glfwGetGamepadName)(int jid); - int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state); - void (*glfwSetClipboardString)(GLFWwindow* window, const char* str); - const char* (*glfwGetClipboardString)(GLFWwindow* window); - double (*glfwGetTime)(void); - void (*glfwSetTime)(double time); - unsigned long long (*glfwGetTimerValue)(void); - unsigned long long (*glfwGetTimerFrequency)(void); - void (*glfwMakeContextCurrent)(GLFWwindow* window); - GLFWwindow* (*glfwGetCurrentContext)(void); - void (*glfwSwapBuffers)(GLFWwindow* window); - void (*glfwSwapInterval)(int interval); - int (*glfwExtensionSupported)(const char* extension); - GLFWglproc (*glfwGetProcAddress)(const char* procname); - int (*glfwVulkanSupported)(void); - const char** (*glfwGetRequiredInstanceExtensions)(unsigned int* count); -} GLFWFunctionTable; - -#ifdef __cplusplus -} -#endif - -#endif \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/B5694BA42809184D93CE3D299084555B/BF682B06259E1DAC71F7644A79308571 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/B5694BA42809184D93CE3D299084555B/BF682B06259E1DAC71F7644A79308571 deleted file mode 100644 index fd637f22..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/B5694BA42809184D93CE3D299084555B/BF682B06259E1DAC71F7644A79308571 +++ /dev/null @@ -1,711 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; - -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; - -namespace StgSharp.Internal -{ - internal unsafe partial class InternalIO - { - - private static readonly GLFWFunction _glfw = new GLFWFunction(); - - public static GLFWFunction glfwContext => _glfw; - - [LibraryImport(NativeLibName, EntryPoint = "load_glfw_functions")] - internal static unsafe partial void glfwLoadLibrary(GLFWFunction* context); - - internal static unsafe void LoadGlfw() - { - fixed (GLFWFunction* func = &_glfw) { - glfwLoadLibrary(func); - } - } - - #region api call - - internal static unsafe int glfwInit() - { - return _glfw.glfwInit(); - } - - internal static unsafe void glfwTerminate() - { - _glfw.glfwTerminate(); - } - - internal static unsafe void glfwInitHint(int hint, int value) - { - _glfw.glfwInitHint(hint, value); - } - - internal static unsafe void glfwGetVersion(int* major, int* minor, int* rev) - { - _glfw.glfwGetVersion(major, minor, rev); - } - - internal static unsafe byte* glfwGetVersionString() - { - return _glfw.glfwGetVersionString(); - } - - internal static unsafe int glfwGetError(byte** description) - { - return _glfw.glfwGetError(description); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetErrorCallback( - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetErrorCallback(callback); - } - - internal static unsafe IntPtr* glfwGetMonitors(int* count) - { - return _glfw.glfwGetMonitors(count); - } - - internal static unsafe IntPtr glfwGetPrimaryMonitor() - { - return _glfw.glfwGetPrimaryMonitor(); - } - - internal static unsafe void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos) - { - _glfw.glfwGetMonitorPos(monitor, xpos, ypos); - } - - internal static unsafe void glfwGetMonitorWorkarea( - IntPtr monitor, - int* xpos, - int* ypos, - int* width, - int* height) - { - _glfw.glfwGetMonitorWorkarea(monitor, xpos, ypos, width, height); - } - - internal static unsafe void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM) - { - _glfw.glfwGetMonitorPhysicalSize(monitor, widthMM, heightMM); - } - - internal static unsafe void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale) - { - _glfw.glfwGetMonitorContentScale(monitor, xscale, yscale); - } - - internal static unsafe byte* glfwGetMonitorName(IntPtr monitor) - { - return _glfw.glfwGetMonitorName(monitor); - } - - internal static unsafe void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer) - { - _glfw.glfwSetMonitorUserPointer(monitor, pointer); - } - - internal static unsafe void* glfwGetMonitorUserPointer(IntPtr monitor) - { - return _glfw.glfwGetMonitorUserPointer(monitor); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetMonitorCallback( - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetMonitorCallback(callback); - } - - internal static unsafe glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count) - { - return (glfwVideomode*)_glfw.glfwGetVideoModes(monitor, count); - } - - internal static unsafe glfwVideomode* glfwGetVideoMode(IntPtr monitor) - { - return (glfwVideomode*)_glfw.glfwGetVideoMode(monitor); - } - - internal static unsafe void glfwSetGamma(IntPtr monitor, float gamma) - { - _glfw.glfwSetGamma(monitor, gamma); - } - - internal static unsafe glfwGammaramp* glfwGetGammaRamp(IntPtr monitor) - { - return (glfwGammaramp*)_glfw.glfwGetGammaRamp(monitor); - } - - internal static unsafe void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp) - { - _glfw.glfwSetGammaRamp(monitor, (IntPtr)ramp); - } - - internal static unsafe void glfwDefaultWindowHints() - { - _glfw.glfwDefaultWindowHints(); - } - - internal static unsafe void glfwWindowHint(int hint, int value) - { - _glfw.glfwWindowHint(hint, value); - } - - internal static unsafe void glfwWindowHintString(int hint, byte* value) - { - _glfw.glfwWindowHintString(hint, value); - } - - internal static unsafe IntPtr glfwCreateWindow( - int width, - int height, - Span title, - IntPtr monitor, - IntPtr share) - { - fixed (byte* titlePtr = title) { - return _glfw.glfwCreateWindow(width, height, titlePtr, monitor, share); - } - } - - internal static unsafe void glfwDestroyWindow(IntPtr window) - { - _glfw.glfwDestroyWindow(window); - } - - internal static unsafe int glfwWindowShouldClose(IntPtr window) - { - return _glfw.glfwWindowShouldClose(window); - } - - internal static unsafe void glfwSetWindowShouldClose(IntPtr window, int value) - { - _glfw.glfwSetWindowShouldClose(window, value); - } - - internal static unsafe void glfwSetWindowTitle(IntPtr window, byte* title) - { - _glfw.glfwSetWindowTitle(window, title); - } - - internal static unsafe void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images) - { - _glfw.glfwSetWindowIcon(window, count, (IntPtr)images); - } - - internal static unsafe void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos) - { - _glfw.glfwGetWindowPos(window, xpos, ypos); - } - - internal static unsafe void glfwSetWindowPos(IntPtr window, int xpos, int ypos) - { - _glfw.glfwSetWindowPos(window, xpos, ypos); - } - - internal static unsafe void glfwGetWindowSize(IntPtr window, int* width, int* height) - { - _glfw.glfwGetWindowSize(window, width, height); - } - - internal static unsafe void glfwSetWindowSizeLimits( - IntPtr window, - int minwidth, - int minheight, - int maxwidth, - int maxheight) - { - _glfw.glfwSetWindowSizeLimits(window, minwidth, minheight, maxwidth, maxheight); - } - - internal static unsafe void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom) - { - _glfw.glfwSetWindowAspectRatio(window, numer, denom); - } - - internal static unsafe void glfwSetWindowSize(IntPtr window, int width, int height) - { - _glfw.glfwSetWindowSize(window, width, height); - } - - internal static unsafe void glfwGetFramebufferSize(IntPtr window, int* width, int* height) - { - _glfw.glfwGetFrameBufferSize(window, width, height); - } - - internal static unsafe void glfwGetWindowFrameSize(IntPtr window, int* left, int* top, int* right, int* bottom) - { - _glfw.glfwGetWindowFrameSize(window, left, top, right, bottom); - } - - internal static unsafe void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale) - { - _glfw.glfwGetWindowContentScale(window, xscale, yscale); - } - - internal static unsafe float glfwGetWindowOpacity(IntPtr window) - { - return _glfw.glfwGetWindowOpacity(window); - } - - internal static unsafe void glfwSetWindowOpacity(IntPtr window, float opacity) - { - _glfw.glfwSetWindowOpacity(window, opacity); - } - - internal static unsafe void glfwIconifyWindow(IntPtr window) - { - _glfw.glfwIconifyWindow(window); - } - - internal static unsafe void glfwRestoreWindow(IntPtr window) - { - _glfw.glfwRestoreWindow(window); - } - - internal static unsafe void glfwMaximizeWindow(IntPtr window) - { - _glfw.glfwMaximizeWindow(window); - } - - internal static unsafe void glfwShowWindow(IntPtr window) - { - _glfw.glfwShowWindow(window); - } - - internal static unsafe void glfwHideWindow(IntPtr window) - { - _glfw.glfwHideWindow(window); - } - - internal static unsafe void glfwFocusWindow(IntPtr window) - { - _glfw.glfwFocusWindow(window); - } - - internal static unsafe void glfwRequestWindowAttention(IntPtr window) - { - _glfw.glfwRequestWindowAttention(window); - } - - internal static unsafe IntPtr glfwGetWindowMonitor(IntPtr window) - { - return _glfw.glfwGetWindowMonitor(window); - } - - internal static unsafe void glfwSetWindowMonitor( - IntPtr window, - IntPtr monitor, - int xpos, - int ypos, - int width, - int height, - int refreshRate) - { - _glfw.glfwSetWindowMonitor(window, monitor, xpos, ypos, width, height, refreshRate); - } - - internal static unsafe int glfwGetWindowAttrib(IntPtr window, int attrib) - { - return _glfw.glfwGetWindowAttrib(window, attrib); - } - - internal static unsafe void glfwSetWindowAttrib(IntPtr window, int attrib, int value) - { - _glfw.glfwSetWindowAttrib(window, attrib, value); - } - - internal static unsafe void glfwSetWindowUserPointer(IntPtr window, void* pointer) - { - _glfw.glfwSetWindowUserPointer(window, pointer); - } - - internal static unsafe void* glfwGetWindowUserPointer(IntPtr window) - { - return _glfw.glfwGetWindowUserPointer(window); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowPosCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowPosCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowSizeCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowSizeCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowCloseCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowCloseCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowRefreshCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowRefreshCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowFocusCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowFocusCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowIconifyCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowIconifyCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowMaximizeCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowMaximizeCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetFrameBufferSizeCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetFramebufferSizeCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowContentScaleCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowContentScaleCallback(window, callback); - } - - internal static unsafe void glfwPollEvents() - { - _glfw.glfwPollEvents(); - } - - internal static unsafe void glfwWaitEvents() - { - _glfw.glfwWaitEvents(); - } - - internal static unsafe void glfwWaitEventsTimeout(double timeout) - { - _glfw.glfwWaitEventsTimeout(timeout); - } - - internal static unsafe void glfwPostEmptyEvent() - { - _glfw.glfwPostEmptyEvent(); - } - - internal static unsafe int glfwGetInputMode(IntPtr window, int mode) - { - return _glfw.glfwGetInputMode(window, mode); - } - - internal static unsafe void glfwSetInputMode(IntPtr window, int mode, int value) - { - _glfw.glfwSetInputMode(window, mode, value); - } - - internal static unsafe int glfwRawMouseMotionSupported() - { - return _glfw.glfwRawMouseMotionSupported(); - } - - internal static unsafe byte* glfwGetKeyName(int key, int scancode) - { - return _glfw.glfwGetKeyName(key, scancode); - } - - internal static unsafe int glfwGetKeyScancode(int key) - { - return _glfw.glfwGetKeyScancode(key); - } - - internal static unsafe KeyStatus glfwGetKey(IntPtr window, int key) - { - return _glfw.glfwGetKey(window, key); - } - - internal static unsafe int glfwGetMouseButton(IntPtr window, int button) - { - return _glfw.glfwGetMouseButton(window, button); - } - - internal static unsafe void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos) - { - _glfw.glfwGetCursorPos(window, xpos, ypos); - } - - internal static unsafe void glfwSetCursorPos(IntPtr window, double xpos, double ypos) - { - _glfw.glfwSetCursorPos(window, xpos, ypos); - } - - internal static unsafe IntPtr glfwCreateCursor(GLFWimage* image, int xhot, int yhot) - { - return _glfw.glfwCreateCursor((IntPtr)image, xhot, yhot); - } - - internal static unsafe IntPtr glfwCreateStandardCursor(int shape) - { - return _glfw.glfwCreateStandardCursor(shape); - } - - internal static unsafe void glfwDestroyCursor(IntPtr cursor) - { - _glfw.glfwDestroyCursor(cursor); - } - - internal static unsafe void glfwSetCursor(IntPtr window, IntPtr cursor) - { - _glfw.glfwSetCursor(window, cursor); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetKeyCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetKeyCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetCharCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetCharCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetCharModsCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetCharModsCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetMouseButtonCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetMouseButtonCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetCursorPosCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetCursorPosCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetCursorEnterCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetCursorEnterCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetScrollCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetScrollCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetDropCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetDropCallback(window, callback); - } - - internal static unsafe int glfwJoystickPresent(int jid) - { - return _glfw.glfwJoystickPresent(jid); - } - - internal static unsafe float* glfwGetJoystickAxes(int jid, int* count) - { - return _glfw.glfwGetJoystickAxes(jid, count); - } - - internal static unsafe byte* glfwGetJoystickButtons(int jid, int* count) - { - return _glfw.glfwGetJoystickButtons(jid, count); - } - - internal static unsafe byte* glfwGetJoystickHats(int jid, int* count) - { - return _glfw.glfwGetJoystickHats(jid, count); - } - - internal static unsafe byte* glfwGetJoystickName(int jid) - { - return _glfw.glfwGetJoystickName(jid); - } - - internal static unsafe byte* glfwGetJoystickGUID(int jid) - { - return _glfw.glfwGetJoystickGUID(jid); - } - - internal static unsafe void glfwSetJoystickUserPointer(int jid, void* pointer) - { - _glfw.glfwSetJoystickUserPointer(jid, pointer); - } - - internal static unsafe void* glfwGetJoystickUserPointer(int jid) - { - return _glfw.glfwGetJoystickUserPointer(jid); - } - - internal static unsafe int glfwJoystickIsGamepad(int jid) - { - return _glfw.glfwJoystickIsGamePad(jid); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetJoystickCallback( - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetJoystickCallback(callback); - } - - internal static unsafe int glfwUpdateGamePadMappings(byte* str) - { - return _glfw.glfwUpdateGamePadMappings(str); - } - - internal static unsafe byte* glfwGetGamePadName(int jid) - { - return _glfw.glfwGetGamepadName(jid); - } - - internal static unsafe int glfwGetGamePadState(int jid, GLFWgamepadstate* state) - { - return _glfw.glfwGetGamepadState(jid, (IntPtr)state); - } - - internal static unsafe void glfwSetClipboardString(IntPtr window, byte* str) - { - _glfw.glfwSetClipboardString(window, str); - } - - internal static unsafe byte* glfwGetClipboardString(IntPtr window) - { - return _glfw.glfwGetClipboardString(window); - } - - internal static unsafe double glfwGetTime() - { - return _glfw.glfwGetTime(); - } - - internal static unsafe void glfwSetTime(double time) - { - _glfw.glfwSetTime(time); - } - - internal static unsafe ulong glfwGetTimerValue() - { - return _glfw.glfwGetTimerValue(); - } - - internal static unsafe ulong glfwGetTimerFrequency() - { - return _glfw.glfwGetTimerFrequency(); - } - - internal static unsafe void glfwMakeContextCurrent(IntPtr window) - { - _glfw.glfwMakeContextCurrent(window); - } - - internal static unsafe IntPtr glfwGetCurrentContext() - { - return _glfw.glfwGetCurrentContext(); - } - - internal static unsafe void glfwSwapBuffers(IntPtr window) - { - _glfw.glfwSwapBuffers(window); - } - - internal static unsafe void glfwSwapInterval(int interval) - { - _glfw.glfwSwapInterval(interval); - } - - internal static unsafe int glfwExtensionSupported(byte* extension) - { - return _glfw.glfwExtensionSupported(extension); - } - - internal static unsafe IntPtr glfwGetProcAddress(string procName) - { - return glfwGetProcAddress(Encoding.UTF8.GetBytes(procName)); - } - - internal static unsafe IntPtr glfwGetProcAddress(Span procName) - { - fixed (byte* bPtr = procName) { - return _glfw.glfwGetProcAddress(bPtr); - } - } - - internal static unsafe int glfwVulkanSupported() - { - return _glfw.glfwVulkanSupported(); - } - - internal static unsafe byte** glfwGetRequiredInstanceExtensions(uint* count) - { - return _glfw.glfwGetRequiredInstanceExtensions(count); - } - - } -} - -#endregion - diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/B5694BA42809184D93CE3D299084555B/E20C7358DB04EBF92C31F26D9AD7A1EB b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/B5694BA42809184D93CE3D299084555B/E20C7358DB04EBF92C31F26D9AD7A1EB deleted file mode 100644 index eb8ad827..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/B5694BA42809184D93CE3D299084555B/E20C7358DB04EBF92C31F26D9AD7A1EB +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef GLFW_FUNCTION_TABLE_H -#define GLFW_FUNCTION_TABLE_H - -#include "../glfw/glfw3.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct GLFWFunctionTable { - int (*glfwInit)(void); - void (*glfwTerminate)(void); - void (*glfwInitHint)(int hint, int value); - void (*glfwGetVersion)(int* major, int* minor, int* rev); - const char* (*glfwGetVersionString)(void); - int (*glfwGetError)(const char** description); - GLFWerrorfun (*glfwSetErrorCallback)(GLFWerrorfun callback); - GLFWmonitor** (*glfwGetMonitors)(int* count); - GLFWmonitor* (*glfwGetPrimaryMonitor)(void); - void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos); - void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height); - void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM); - void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale); - const char* (*glfwGetMonitorName)(GLFWmonitor* monitor); - void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer); - void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor); - GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback); - const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count); - const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor); - void (*glfwSetGamma)(GLFWmonitor* monitor, float gamma); - const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor); - void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp); - void (*glfwDefaultWindowHints)(void); - void (*glfwWindowHint)(int hint, int value); - void (*glfwWindowHintString)(int hint, const char* value); - GLFWwindow* (*glfwCreateWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share); - void (*glfwDestroyWindow)(GLFWwindow* window); - int (*glfwWindowShouldClose)(GLFWwindow* window); - void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value); - void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title); - void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images); - void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos); - void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos); - void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height); - void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); - void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom); - void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height); - void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height); - void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom); - void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale); - float (*glfwGetWindowOpacity)(GLFWwindow* window); - void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity); - void (*glfwIconifyWindow)(GLFWwindow* window); - void (*glfwRestoreWindow)(GLFWwindow* window); - void (*glfwMaximizeWindow)(GLFWwindow* window); - void (*glfwShowWindow)(GLFWwindow* window); - void (*glfwHideWindow)(GLFWwindow* window); - void (*glfwFocusWindow)(GLFWwindow* window); - void (*glfwRequestWindowAttention)(GLFWwindow* window); - GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window); - void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); - int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib); - void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value); - void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer); - void* (*glfwGetWindowUserPointer)(GLFWwindow* window); - GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback); - GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback); - GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback); - GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback); - GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback); - GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback); - GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback); - GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback); - GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback); - void (*glfwPollEvents)(void); - void (*glfwWaitEvents)(void); - void (*glfwWaitEventsTimeout)(double timeout); - void (*glfwPostEmptyEvent)(void); - int (*glfwGetInputMode)(GLFWwindow* window, int mode); - void (*glfwSetInputMode)(GLFWwindow* window, int mode, int value); - int (*glfwRawMouseMotionSupported)(void); - const char* (*glfwGetKeyName)(int key, int scancode); - int (*glfwGetKeyScancode)(int key); - int (*glfwGetKey)(GLFWwindow* window, int key); - int (*glfwGetMouseButton)(GLFWwindow* window, int button); - void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos); - void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos); - GLFWcursor* (*glfwCreateCursor)(const GLFWimage* image, int xhot, int yhot); - GLFWcursor* (*glfwCreateStandardCursor)(int shape); - void (*glfwDestroyCursor)(GLFWcursor* cursor); - void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor); - GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback); - GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback); - GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback); - GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback); - GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback); - GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback); - GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback); - GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback); - int (*glfwJoystickPresent)(int jid); - const float* (*glfwGetJoystickAxes)(int jid, int* count); - const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count); - const char* (*glfwGetJoystickGUID)(int jid); - const unsigned char* (*glfwGetJoystickHats)(int jid, int* count); - const char* (*glfwGetJoystickName)(int jid); - void* (*glfwGetJoystickUserPointer)(int jid); - int (*glfwJoystickIsGamepad)(int jid); - GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback); - int (*glfwUpdateGamepadMappings)(const char* str); - const char* (*glfwGetGamepadName)(int jid); - int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state); - void (*glfwSetClipboardString)(GLFWwindow* window, const char* str); - const char* (*glfwGetClipboardString)(GLFWwindow* window); - double (*glfwGetTime)(void); - void (*glfwSetTime)(double time); - unsigned long long (*glfwGetTimerValue)(void); - unsigned long long (*glfwGetTimerFrequency)(void); - void (*glfwMakeContextCurrent)(GLFWwindow* window); - GLFWwindow* (*glfwGetCurrentContext)(void); - void (*glfwSwapBuffers)(GLFWwindow* window); - void (*glfwSwapInterval)(int interval); - int (*glfwExtensionSupported)(const char* extension); - GLFWglproc (*glfwGetProcAddress)(const char* procname); - int (*glfwVulkanSupported)(void); - const char** (*glfwGetRequiredInstanceExtensions)(unsigned int* count); -} GLFWFunctionTable; - -#ifdef __cplusplus -} -#endif - -#endif \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/DA129863943C0945B56B283FFCA2062C/0EA10068E39EB768E851DC5B0D53BFCF b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/DA129863943C0945B56B283FFCA2062C/0EA10068E39EB768E851DC5B0D53BFCF deleted file mode 100644 index dd4b0d59..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/DA129863943C0945B56B283FFCA2062C/0EA10068E39EB768E851DC5B0D53BFCF +++ /dev/null @@ -1,829 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; - -using System; -using System.Collections.Generic; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Text; - -namespace StgSharp.Internal -{ - internal unsafe partial class InternalIO - { - - private static readonly GLFWFunction _glfw = new GLFWFunction(); - - public static GLFWFunction glfwContext => _glfw; - - [LibraryImport(NativeLibName, EntryPoint = "load_glfw_functions")] - internal static unsafe partial void glfwLoadLibrary(GLFWFunction* context); - - internal static unsafe void LoadGlfw() - { - fixed (GLFWFunction* func = &_glfw) { - glfwLoadLibrary(func); - } - } - - #region api call - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe int glfwInit() - { - return _glfw.glfwInit(); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwTerminate() - { - _glfw.glfwTerminate(); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwInitHint(int hint, int value) - { - _glfw.glfwInitHint(hint, value); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwGetVersion(int* major, int* minor, int* rev) - { - _glfw.glfwGetVersion(major, minor, rev); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe byte* glfwGetVersionString() - { - return _glfw.glfwGetVersionString(); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe int glfwGetError(byte** description) - { - return _glfw.glfwGetError(description); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe delegate* unmanaged[Cdecl] glfwSetErrorCallback( - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetErrorCallback(callback); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe IntPtr* glfwGetMonitors(int* count) - { - return _glfw.glfwGetMonitors(count); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe IntPtr glfwGetPrimaryMonitor() - { - return _glfw.glfwGetPrimaryMonitor(); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos) - { - _glfw.glfwGetMonitorPos(monitor, xpos, ypos); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwGetMonitorWorkarea( - IntPtr monitor, - int* xpos, - int* ypos, - int* width, - int* height) - { - _glfw.glfwGetMonitorWorkarea(monitor, xpos, ypos, width, height); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM) - { - _glfw.glfwGetMonitorPhysicalSize(monitor, widthMM, heightMM); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale) - { - _glfw.glfwGetMonitorContentScale(monitor, xscale, yscale); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe byte* glfwGetMonitorName(IntPtr monitor) - { - return _glfw.glfwGetMonitorName(monitor); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer) - { - _glfw.glfwSetMonitorUserPointer(monitor, pointer); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void* glfwGetMonitorUserPointer(IntPtr monitor) - { - return _glfw.glfwGetMonitorUserPointer(monitor); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe delegate* unmanaged[Cdecl] glfwSetMonitorCallback( - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetMonitorCallback(callback); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count) - { - return (glfwVideomode*)_glfw.glfwGetVideoModes(monitor, count); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe glfwVideomode* glfwGetVideoMode(IntPtr monitor) - { - return (glfwVideomode*)_glfw.glfwGetVideoMode(monitor); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwSetGamma(IntPtr monitor, float gamma) - { - _glfw.glfwSetGamma(monitor, gamma); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe glfwGammaramp* glfwGetGammaRamp(IntPtr monitor) - { - return (glfwGammaramp*)_glfw.glfwGetGammaRamp(monitor); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp) - { - _glfw.glfwSetGammaRamp(monitor, (IntPtr)ramp); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwDefaultWindowHints() - { - _glfw.glfwDefaultWindowHints(); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwWindowHint(int hint, int value) - { - _glfw.glfwWindowHint(hint, value); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwWindowHintString(int hint, byte* value) - { - _glfw.glfwWindowHintString(hint, value); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe IntPtr glfwCreateWindow( - int width, - int height, - Span title, - IntPtr monitor, - IntPtr share) - { - fixed (byte* titlePtr = title) { - return _glfw.glfwCreateWindow(width, height, titlePtr, monitor, share); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwDestroyWindow(IntPtr window) - { - _glfw.glfwDestroyWindow(window); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe int glfwWindowShouldClose(IntPtr window) - { - return _glfw.glfwWindowShouldClose(window); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwSetWindowShouldClose(IntPtr window, int value) - { - _glfw.glfwSetWindowShouldClose(window, value); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwSetWindowTitle(IntPtr window, byte* title) - { - _glfw.glfwSetWindowTitle(window, title); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images) - { - _glfw.glfwSetWindowIcon(window, count, (IntPtr)images); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos) - { - _glfw.glfwGetWindowPos(window, xpos, ypos); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwSetWindowPos(IntPtr window, int xpos, int ypos) - { - _glfw.glfwSetWindowPos(window, xpos, ypos); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwGetWindowSize(IntPtr window, int* width, int* height) - { - _glfw.glfwGetWindowSize(window, width, height); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwSetWindowSizeLimits( - IntPtr window, - int minwidth, - int minheight, - int maxwidth, - int maxheight) - { - _glfw.glfwSetWindowSizeLimits(window, minwidth, minheight, maxwidth, maxheight); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom) - { - _glfw.glfwSetWindowAspectRatio(window, numer, denom); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwSetWindowSize(IntPtr window, int width, int height) - { - _glfw.glfwSetWindowSize(window, width, height); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwGetFramebufferSize(IntPtr window, int* width, int* height) - { - _glfw.glfwGetFrameBufferSize(window, width, height); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwGetWindowFrameSize(IntPtr window, int* left, int* top, int* right, int* bottom) - { - _glfw.glfwGetWindowFrameSize(window, left, top, right, bottom); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale) - { - _glfw.glfwGetWindowContentScale(window, xscale, yscale); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe float glfwGetWindowOpacity(IntPtr window) - { - return _glfw.glfwGetWindowOpacity(window); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwSetWindowOpacity(IntPtr window, float opacity) - { - _glfw.glfwSetWindowOpacity(window, opacity); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwIconifyWindow(IntPtr window) - { - _glfw.glfwIconifyWindow(window); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwRestoreWindow(IntPtr window) - { - _glfw.glfwRestoreWindow(window); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwMaximizeWindow(IntPtr window) - { - _glfw.glfwMaximizeWindow(window); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwShowWindow(IntPtr window) - { - _glfw.glfwShowWindow(window); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwHideWindow(IntPtr window) - { - _glfw.glfwHideWindow(window); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwFocusWindow(IntPtr window) - { - _glfw.glfwFocusWindow(window); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwRequestWindowAttention(IntPtr window) - { - _glfw.glfwRequestWindowAttention(window); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe IntPtr glfwGetWindowMonitor(IntPtr window) - { - return _glfw.glfwGetWindowMonitor(window); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwSetWindowMonitor( - IntPtr window, - IntPtr monitor, - int xpos, - int ypos, - int width, - int height, - int refreshRate) - { - _glfw.glfwSetWindowMonitor(window, monitor, xpos, ypos, width, height, refreshRate); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe int glfwGetWindowAttrib(IntPtr window, int attrib) - { - return _glfw.glfwGetWindowAttrib(window, attrib); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwSetWindowAttrib(IntPtr window, int attrib, int value) - { - _glfw.glfwSetWindowAttrib(window, attrib, value); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwSetWindowUserPointer(IntPtr window, void* pointer) - { - _glfw.glfwSetWindowUserPointer(window, pointer); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void* glfwGetWindowUserPointer(IntPtr window) - { - return _glfw.glfwGetWindowUserPointer(window); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowPosCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowPosCallback(window, callback); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowSizeCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowSizeCallback(window, callback); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowCloseCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowCloseCallback(window, callback); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowRefreshCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowRefreshCallback(window, callback); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowFocusCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowFocusCallback(window, callback); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowIconifyCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowIconifyCallback(window, callback); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowMaximizeCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowMaximizeCallback(window, callback); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe delegate* unmanaged[Cdecl] glfwSetFrameBufferSizeCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetFramebufferSizeCallback(window, callback); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowContentScaleCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowContentScaleCallback(window, callback); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwPollEvents() - { - _glfw.glfwPollEvents(); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwWaitEvents() - { - _glfw.glfwWaitEvents(); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwWaitEventsTimeout(double timeout) - { - _glfw.glfwWaitEventsTimeout(timeout); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwPostEmptyEvent() - { - _glfw.glfwPostEmptyEvent(); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe int glfwGetInputMode(IntPtr window, int mode) - { - return _glfw.glfwGetInputMode(window, mode); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwSetInputMode(IntPtr window, int mode, int value) - { - _glfw.glfwSetInputMode(window, mode, value); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe int glfwRawMouseMotionSupported() - { - return _glfw.glfwRawMouseMotionSupported(); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe byte* glfwGetKeyName(int key, int scancode) - { - return _glfw.glfwGetKeyName(key, scancode); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe int glfwGetKeyScancode(int key) - { - return _glfw.glfwGetKeyScancode(key); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe KeyStatus glfwGetKey(IntPtr window, int key) - { - return _glfw.glfwGetKey(window, key); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe int glfwGetMouseButton(IntPtr window, int button) - { - return _glfw.glfwGetMouseButton(window, button); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos) - { - _glfw.glfwGetCursorPos(window, xpos, ypos); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwSetCursorPos(IntPtr window, double xpos, double ypos) - { - _glfw.glfwSetCursorPos(window, xpos, ypos); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe IntPtr glfwCreateCursor(GLFWimage* image, int xhot, int yhot) - { - return _glfw.glfwCreateCursor((IntPtr)image, xhot, yhot); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe IntPtr glfwCreateStandardCursor(int shape) - { - return _glfw.glfwCreateStandardCursor(shape); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwDestroyCursor(IntPtr cursor) - { - _glfw.glfwDestroyCursor(cursor); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwSetCursor(IntPtr window, IntPtr cursor) - { - _glfw.glfwSetCursor(window, cursor); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe delegate* unmanaged[Cdecl] glfwSetKeyCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetKeyCallback(window, callback); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe delegate* unmanaged[Cdecl] glfwSetCharCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetCharCallback(window, callback); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe delegate* unmanaged[Cdecl] glfwSetCharModsCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetCharModsCallback(window, callback); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe delegate* unmanaged[Cdecl] glfwSetMouseButtonCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetMouseButtonCallback(window, callback); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe delegate* unmanaged[Cdecl] glfwSetCursorPosCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetCursorPosCallback(window, callback); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe delegate* unmanaged[Cdecl] glfwSetCursorEnterCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetCursorEnterCallback(window, callback); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe delegate* unmanaged[Cdecl] glfwSetScrollCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetScrollCallback(window, callback); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe delegate* unmanaged[Cdecl] glfwSetDropCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetDropCallback(window, callback); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe int glfwJoystickPresent(int jid) - { - return _glfw.glfwJoystickPresent(jid); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe float* glfwGetJoystickAxes(int jid, int* count) - { - return _glfw.glfwGetJoystickAxes(jid, count); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe byte* glfwGetJoystickButtons(int jid, int* count) - { - return _glfw.glfwGetJoystickButtons(jid, count); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe byte* glfwGetJoystickHats(int jid, int* count) - { - return _glfw.glfwGetJoystickHats(jid, count); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe byte* glfwGetJoystickName(int jid) - { - return _glfw.glfwGetJoystickName(jid); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe byte* glfwGetJoystickGUID(int jid) - { - return _glfw.glfwGetJoystickGUID(jid); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwSetJoystickUserPointer(int jid, void* pointer) - { - _glfw.glfwSetJoystickUserPointer(jid, pointer); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void* glfwGetJoystickUserPointer(int jid) - { - return _glfw.glfwGetJoystickUserPointer(jid); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe int glfwJoystickIsGamepad(int jid) - { - return _glfw.glfwJoystickIsGamePad(jid); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe delegate* unmanaged[Cdecl] glfwSetJoystickCallback( - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetJoystickCallback(callback); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe int glfwUpdateGamePadMappings(byte* str) - { - return _glfw.glfwUpdateGamePadMappings(str); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe byte* glfwGetGamePadName(int jid) - { - return _glfw.glfwGetGamepadName(jid); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe int glfwGetGamePadState(int jid, GLFWgamepadstate* state) - { - return _glfw.glfwGetGamepadState(jid, (IntPtr)state); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwSetClipboardString(IntPtr window, byte* str) - { - _glfw.glfwSetClipboardString(window, str); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe byte* glfwGetClipboardString(IntPtr window) - { - return _glfw.glfwGetClipboardString(window); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe double glfwGetTime() - { - return _glfw.glfwGetTime(); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwSetTime(double time) - { - _glfw.glfwSetTime(time); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe ulong glfwGetTimerValue() - { - return _glfw.glfwGetTimerValue(); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe ulong glfwGetTimerFrequency() - { - return _glfw.glfwGetTimerFrequency(); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwMakeContextCurrent(IntPtr window) - { - _glfw.glfwMakeContextCurrent(window); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe IntPtr glfwGetCurrentContext() - { - return _glfw.glfwGetCurrentContext(); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwSwapBuffers(IntPtr window) - { - _glfw.glfwSwapBuffers(window); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe void glfwSwapInterval(int interval) - { - _glfw.glfwSwapInterval(interval); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe int glfwExtensionSupported(byte* extension) - { - return _glfw.glfwExtensionSupported(extension); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe IntPtr glfwGetProcAddress(string procName) - { - return glfwGetProcAddress(Encoding.UTF8.GetBytes(procName)); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe IntPtr glfwGetProcAddress(Span procName) - { - fixed (byte* bPtr = procName) { - return _glfw.glfwGetProcAddress(bPtr); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe int glfwVulkanSupported() - { - return _glfw.glfwVulkanSupported(); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static unsafe byte** glfwGetRequiredInstanceExtensions(uint* count) - { - return _glfw.glfwGetRequiredInstanceExtensions(count); - } - - } -} - -#endregion - diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/DA129863943C0945B56B283FFCA2062C/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/DA129863943C0945B56B283FFCA2062C/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA deleted file mode 100644 index dae34e16..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/DA129863943C0945B56B283FFCA2062C/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA +++ /dev/null @@ -1,123 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="InternalIO.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; -using StgSharp.Graphics.OpenGL; - -using System; -using System.Collections.Generic; -using System.IO; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -using System.Text; -using System.Threading; - -namespace StgSharp.Internal -{ - internal static unsafe partial class InternalIO - { - - internal const string SS_errorLog = - "SS_errorlog.log"; - - internal const string NativeLibName = - "StgSharp.C"; - - internal static Dictionary GLtype = []; - - internal static readonly GCHandle ssc_logHandle = - GCHandle.Alloc(new byte[512], GCHandleType.Pinned); - - internal static IntPtr _nativeLibPtr = IntPtr.Zero; - - internal static SemaphoreSlim logSyncSemaphore = new SemaphoreSlim(1, 1); - - static InternalIO() - { - GLtype.Add(TypeCode.Single, glConst.FLOAT); - GLtype.Add(TypeCode.Int32, glConst.INT); - GLtype.Add(TypeCode.UInt32, glConst.UNSIGNED_INT); - GLtype.Add(TypeCode.Int16, glConst.SHORT); - GLtype.Add(TypeCode.UInt16, glConst.UNSIGNED_SHORT); - GLtype.Add(TypeCode.SByte, glConst.BYTE); - GLtype.Add(TypeCode.Byte, glConst.UNSIGNED_BYTE); - } - - internal static void InternalAppendLog(string log) - { - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) { - logStream.WriteLine(log); - } - } - - internal static void InternalWriteLog(string logLine, LogType logType) - { - logSyncSemaphore.Wait(); - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) - { - logStream.WriteLine($"{logType}\t{DateTime.Now.ToString("o")}"); - logStream.WriteLine(logLine); - } - _ = logSyncSemaphore.Release(); - } - - internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType) - { - logSyncSemaphore.Wait(); - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) - { - logStream.WriteLine(beforeTime); - logStream.WriteLine($"{logType}\t@\t{DateTime.Now.ToString("o")}"); - logStream.WriteLine(logLine); - } - _ = logSyncSemaphore.Release(1); - } - - } -} diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/DA129863943C0945B56B283FFCA2062C/BF682B06259E1DAC71F7644A79308571 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/DA129863943C0945B56B283FFCA2062C/BF682B06259E1DAC71F7644A79308571 deleted file mode 100644 index fd637f22..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/DA129863943C0945B56B283FFCA2062C/BF682B06259E1DAC71F7644A79308571 +++ /dev/null @@ -1,711 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; - -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; - -namespace StgSharp.Internal -{ - internal unsafe partial class InternalIO - { - - private static readonly GLFWFunction _glfw = new GLFWFunction(); - - public static GLFWFunction glfwContext => _glfw; - - [LibraryImport(NativeLibName, EntryPoint = "load_glfw_functions")] - internal static unsafe partial void glfwLoadLibrary(GLFWFunction* context); - - internal static unsafe void LoadGlfw() - { - fixed (GLFWFunction* func = &_glfw) { - glfwLoadLibrary(func); - } - } - - #region api call - - internal static unsafe int glfwInit() - { - return _glfw.glfwInit(); - } - - internal static unsafe void glfwTerminate() - { - _glfw.glfwTerminate(); - } - - internal static unsafe void glfwInitHint(int hint, int value) - { - _glfw.glfwInitHint(hint, value); - } - - internal static unsafe void glfwGetVersion(int* major, int* minor, int* rev) - { - _glfw.glfwGetVersion(major, minor, rev); - } - - internal static unsafe byte* glfwGetVersionString() - { - return _glfw.glfwGetVersionString(); - } - - internal static unsafe int glfwGetError(byte** description) - { - return _glfw.glfwGetError(description); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetErrorCallback( - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetErrorCallback(callback); - } - - internal static unsafe IntPtr* glfwGetMonitors(int* count) - { - return _glfw.glfwGetMonitors(count); - } - - internal static unsafe IntPtr glfwGetPrimaryMonitor() - { - return _glfw.glfwGetPrimaryMonitor(); - } - - internal static unsafe void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos) - { - _glfw.glfwGetMonitorPos(monitor, xpos, ypos); - } - - internal static unsafe void glfwGetMonitorWorkarea( - IntPtr monitor, - int* xpos, - int* ypos, - int* width, - int* height) - { - _glfw.glfwGetMonitorWorkarea(monitor, xpos, ypos, width, height); - } - - internal static unsafe void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM) - { - _glfw.glfwGetMonitorPhysicalSize(monitor, widthMM, heightMM); - } - - internal static unsafe void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale) - { - _glfw.glfwGetMonitorContentScale(monitor, xscale, yscale); - } - - internal static unsafe byte* glfwGetMonitorName(IntPtr monitor) - { - return _glfw.glfwGetMonitorName(monitor); - } - - internal static unsafe void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer) - { - _glfw.glfwSetMonitorUserPointer(monitor, pointer); - } - - internal static unsafe void* glfwGetMonitorUserPointer(IntPtr monitor) - { - return _glfw.glfwGetMonitorUserPointer(monitor); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetMonitorCallback( - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetMonitorCallback(callback); - } - - internal static unsafe glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count) - { - return (glfwVideomode*)_glfw.glfwGetVideoModes(monitor, count); - } - - internal static unsafe glfwVideomode* glfwGetVideoMode(IntPtr monitor) - { - return (glfwVideomode*)_glfw.glfwGetVideoMode(monitor); - } - - internal static unsafe void glfwSetGamma(IntPtr monitor, float gamma) - { - _glfw.glfwSetGamma(monitor, gamma); - } - - internal static unsafe glfwGammaramp* glfwGetGammaRamp(IntPtr monitor) - { - return (glfwGammaramp*)_glfw.glfwGetGammaRamp(monitor); - } - - internal static unsafe void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp) - { - _glfw.glfwSetGammaRamp(monitor, (IntPtr)ramp); - } - - internal static unsafe void glfwDefaultWindowHints() - { - _glfw.glfwDefaultWindowHints(); - } - - internal static unsafe void glfwWindowHint(int hint, int value) - { - _glfw.glfwWindowHint(hint, value); - } - - internal static unsafe void glfwWindowHintString(int hint, byte* value) - { - _glfw.glfwWindowHintString(hint, value); - } - - internal static unsafe IntPtr glfwCreateWindow( - int width, - int height, - Span title, - IntPtr monitor, - IntPtr share) - { - fixed (byte* titlePtr = title) { - return _glfw.glfwCreateWindow(width, height, titlePtr, monitor, share); - } - } - - internal static unsafe void glfwDestroyWindow(IntPtr window) - { - _glfw.glfwDestroyWindow(window); - } - - internal static unsafe int glfwWindowShouldClose(IntPtr window) - { - return _glfw.glfwWindowShouldClose(window); - } - - internal static unsafe void glfwSetWindowShouldClose(IntPtr window, int value) - { - _glfw.glfwSetWindowShouldClose(window, value); - } - - internal static unsafe void glfwSetWindowTitle(IntPtr window, byte* title) - { - _glfw.glfwSetWindowTitle(window, title); - } - - internal static unsafe void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images) - { - _glfw.glfwSetWindowIcon(window, count, (IntPtr)images); - } - - internal static unsafe void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos) - { - _glfw.glfwGetWindowPos(window, xpos, ypos); - } - - internal static unsafe void glfwSetWindowPos(IntPtr window, int xpos, int ypos) - { - _glfw.glfwSetWindowPos(window, xpos, ypos); - } - - internal static unsafe void glfwGetWindowSize(IntPtr window, int* width, int* height) - { - _glfw.glfwGetWindowSize(window, width, height); - } - - internal static unsafe void glfwSetWindowSizeLimits( - IntPtr window, - int minwidth, - int minheight, - int maxwidth, - int maxheight) - { - _glfw.glfwSetWindowSizeLimits(window, minwidth, minheight, maxwidth, maxheight); - } - - internal static unsafe void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom) - { - _glfw.glfwSetWindowAspectRatio(window, numer, denom); - } - - internal static unsafe void glfwSetWindowSize(IntPtr window, int width, int height) - { - _glfw.glfwSetWindowSize(window, width, height); - } - - internal static unsafe void glfwGetFramebufferSize(IntPtr window, int* width, int* height) - { - _glfw.glfwGetFrameBufferSize(window, width, height); - } - - internal static unsafe void glfwGetWindowFrameSize(IntPtr window, int* left, int* top, int* right, int* bottom) - { - _glfw.glfwGetWindowFrameSize(window, left, top, right, bottom); - } - - internal static unsafe void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale) - { - _glfw.glfwGetWindowContentScale(window, xscale, yscale); - } - - internal static unsafe float glfwGetWindowOpacity(IntPtr window) - { - return _glfw.glfwGetWindowOpacity(window); - } - - internal static unsafe void glfwSetWindowOpacity(IntPtr window, float opacity) - { - _glfw.glfwSetWindowOpacity(window, opacity); - } - - internal static unsafe void glfwIconifyWindow(IntPtr window) - { - _glfw.glfwIconifyWindow(window); - } - - internal static unsafe void glfwRestoreWindow(IntPtr window) - { - _glfw.glfwRestoreWindow(window); - } - - internal static unsafe void glfwMaximizeWindow(IntPtr window) - { - _glfw.glfwMaximizeWindow(window); - } - - internal static unsafe void glfwShowWindow(IntPtr window) - { - _glfw.glfwShowWindow(window); - } - - internal static unsafe void glfwHideWindow(IntPtr window) - { - _glfw.glfwHideWindow(window); - } - - internal static unsafe void glfwFocusWindow(IntPtr window) - { - _glfw.glfwFocusWindow(window); - } - - internal static unsafe void glfwRequestWindowAttention(IntPtr window) - { - _glfw.glfwRequestWindowAttention(window); - } - - internal static unsafe IntPtr glfwGetWindowMonitor(IntPtr window) - { - return _glfw.glfwGetWindowMonitor(window); - } - - internal static unsafe void glfwSetWindowMonitor( - IntPtr window, - IntPtr monitor, - int xpos, - int ypos, - int width, - int height, - int refreshRate) - { - _glfw.glfwSetWindowMonitor(window, monitor, xpos, ypos, width, height, refreshRate); - } - - internal static unsafe int glfwGetWindowAttrib(IntPtr window, int attrib) - { - return _glfw.glfwGetWindowAttrib(window, attrib); - } - - internal static unsafe void glfwSetWindowAttrib(IntPtr window, int attrib, int value) - { - _glfw.glfwSetWindowAttrib(window, attrib, value); - } - - internal static unsafe void glfwSetWindowUserPointer(IntPtr window, void* pointer) - { - _glfw.glfwSetWindowUserPointer(window, pointer); - } - - internal static unsafe void* glfwGetWindowUserPointer(IntPtr window) - { - return _glfw.glfwGetWindowUserPointer(window); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowPosCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowPosCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowSizeCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowSizeCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowCloseCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowCloseCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowRefreshCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowRefreshCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowFocusCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowFocusCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowIconifyCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowIconifyCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowMaximizeCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowMaximizeCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetFrameBufferSizeCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetFramebufferSizeCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowContentScaleCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowContentScaleCallback(window, callback); - } - - internal static unsafe void glfwPollEvents() - { - _glfw.glfwPollEvents(); - } - - internal static unsafe void glfwWaitEvents() - { - _glfw.glfwWaitEvents(); - } - - internal static unsafe void glfwWaitEventsTimeout(double timeout) - { - _glfw.glfwWaitEventsTimeout(timeout); - } - - internal static unsafe void glfwPostEmptyEvent() - { - _glfw.glfwPostEmptyEvent(); - } - - internal static unsafe int glfwGetInputMode(IntPtr window, int mode) - { - return _glfw.glfwGetInputMode(window, mode); - } - - internal static unsafe void glfwSetInputMode(IntPtr window, int mode, int value) - { - _glfw.glfwSetInputMode(window, mode, value); - } - - internal static unsafe int glfwRawMouseMotionSupported() - { - return _glfw.glfwRawMouseMotionSupported(); - } - - internal static unsafe byte* glfwGetKeyName(int key, int scancode) - { - return _glfw.glfwGetKeyName(key, scancode); - } - - internal static unsafe int glfwGetKeyScancode(int key) - { - return _glfw.glfwGetKeyScancode(key); - } - - internal static unsafe KeyStatus glfwGetKey(IntPtr window, int key) - { - return _glfw.glfwGetKey(window, key); - } - - internal static unsafe int glfwGetMouseButton(IntPtr window, int button) - { - return _glfw.glfwGetMouseButton(window, button); - } - - internal static unsafe void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos) - { - _glfw.glfwGetCursorPos(window, xpos, ypos); - } - - internal static unsafe void glfwSetCursorPos(IntPtr window, double xpos, double ypos) - { - _glfw.glfwSetCursorPos(window, xpos, ypos); - } - - internal static unsafe IntPtr glfwCreateCursor(GLFWimage* image, int xhot, int yhot) - { - return _glfw.glfwCreateCursor((IntPtr)image, xhot, yhot); - } - - internal static unsafe IntPtr glfwCreateStandardCursor(int shape) - { - return _glfw.glfwCreateStandardCursor(shape); - } - - internal static unsafe void glfwDestroyCursor(IntPtr cursor) - { - _glfw.glfwDestroyCursor(cursor); - } - - internal static unsafe void glfwSetCursor(IntPtr window, IntPtr cursor) - { - _glfw.glfwSetCursor(window, cursor); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetKeyCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetKeyCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetCharCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetCharCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetCharModsCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetCharModsCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetMouseButtonCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetMouseButtonCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetCursorPosCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetCursorPosCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetCursorEnterCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetCursorEnterCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetScrollCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetScrollCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetDropCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetDropCallback(window, callback); - } - - internal static unsafe int glfwJoystickPresent(int jid) - { - return _glfw.glfwJoystickPresent(jid); - } - - internal static unsafe float* glfwGetJoystickAxes(int jid, int* count) - { - return _glfw.glfwGetJoystickAxes(jid, count); - } - - internal static unsafe byte* glfwGetJoystickButtons(int jid, int* count) - { - return _glfw.glfwGetJoystickButtons(jid, count); - } - - internal static unsafe byte* glfwGetJoystickHats(int jid, int* count) - { - return _glfw.glfwGetJoystickHats(jid, count); - } - - internal static unsafe byte* glfwGetJoystickName(int jid) - { - return _glfw.glfwGetJoystickName(jid); - } - - internal static unsafe byte* glfwGetJoystickGUID(int jid) - { - return _glfw.glfwGetJoystickGUID(jid); - } - - internal static unsafe void glfwSetJoystickUserPointer(int jid, void* pointer) - { - _glfw.glfwSetJoystickUserPointer(jid, pointer); - } - - internal static unsafe void* glfwGetJoystickUserPointer(int jid) - { - return _glfw.glfwGetJoystickUserPointer(jid); - } - - internal static unsafe int glfwJoystickIsGamepad(int jid) - { - return _glfw.glfwJoystickIsGamePad(jid); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetJoystickCallback( - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetJoystickCallback(callback); - } - - internal static unsafe int glfwUpdateGamePadMappings(byte* str) - { - return _glfw.glfwUpdateGamePadMappings(str); - } - - internal static unsafe byte* glfwGetGamePadName(int jid) - { - return _glfw.glfwGetGamepadName(jid); - } - - internal static unsafe int glfwGetGamePadState(int jid, GLFWgamepadstate* state) - { - return _glfw.glfwGetGamepadState(jid, (IntPtr)state); - } - - internal static unsafe void glfwSetClipboardString(IntPtr window, byte* str) - { - _glfw.glfwSetClipboardString(window, str); - } - - internal static unsafe byte* glfwGetClipboardString(IntPtr window) - { - return _glfw.glfwGetClipboardString(window); - } - - internal static unsafe double glfwGetTime() - { - return _glfw.glfwGetTime(); - } - - internal static unsafe void glfwSetTime(double time) - { - _glfw.glfwSetTime(time); - } - - internal static unsafe ulong glfwGetTimerValue() - { - return _glfw.glfwGetTimerValue(); - } - - internal static unsafe ulong glfwGetTimerFrequency() - { - return _glfw.glfwGetTimerFrequency(); - } - - internal static unsafe void glfwMakeContextCurrent(IntPtr window) - { - _glfw.glfwMakeContextCurrent(window); - } - - internal static unsafe IntPtr glfwGetCurrentContext() - { - return _glfw.glfwGetCurrentContext(); - } - - internal static unsafe void glfwSwapBuffers(IntPtr window) - { - _glfw.glfwSwapBuffers(window); - } - - internal static unsafe void glfwSwapInterval(int interval) - { - _glfw.glfwSwapInterval(interval); - } - - internal static unsafe int glfwExtensionSupported(byte* extension) - { - return _glfw.glfwExtensionSupported(extension); - } - - internal static unsafe IntPtr glfwGetProcAddress(string procName) - { - return glfwGetProcAddress(Encoding.UTF8.GetBytes(procName)); - } - - internal static unsafe IntPtr glfwGetProcAddress(Span procName) - { - fixed (byte* bPtr = procName) { - return _glfw.glfwGetProcAddress(bPtr); - } - } - - internal static unsafe int glfwVulkanSupported() - { - return _glfw.glfwVulkanSupported(); - } - - internal static unsafe byte** glfwGetRequiredInstanceExtensions(uint* count) - { - return _glfw.glfwGetRequiredInstanceExtensions(count); - } - - } -} - -#endregion - diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/DA129863943C0945B56B283FFCA2062C/F5A52D445B3D096218D849F48A3E73AF b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/DA129863943C0945B56B283FFCA2062C/F5A52D445B3D096218D849F48A3E73AF deleted file mode 100644 index fd637f22..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/DA129863943C0945B56B283FFCA2062C/F5A52D445B3D096218D849F48A3E73AF +++ /dev/null @@ -1,711 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; - -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; - -namespace StgSharp.Internal -{ - internal unsafe partial class InternalIO - { - - private static readonly GLFWFunction _glfw = new GLFWFunction(); - - public static GLFWFunction glfwContext => _glfw; - - [LibraryImport(NativeLibName, EntryPoint = "load_glfw_functions")] - internal static unsafe partial void glfwLoadLibrary(GLFWFunction* context); - - internal static unsafe void LoadGlfw() - { - fixed (GLFWFunction* func = &_glfw) { - glfwLoadLibrary(func); - } - } - - #region api call - - internal static unsafe int glfwInit() - { - return _glfw.glfwInit(); - } - - internal static unsafe void glfwTerminate() - { - _glfw.glfwTerminate(); - } - - internal static unsafe void glfwInitHint(int hint, int value) - { - _glfw.glfwInitHint(hint, value); - } - - internal static unsafe void glfwGetVersion(int* major, int* minor, int* rev) - { - _glfw.glfwGetVersion(major, minor, rev); - } - - internal static unsafe byte* glfwGetVersionString() - { - return _glfw.glfwGetVersionString(); - } - - internal static unsafe int glfwGetError(byte** description) - { - return _glfw.glfwGetError(description); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetErrorCallback( - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetErrorCallback(callback); - } - - internal static unsafe IntPtr* glfwGetMonitors(int* count) - { - return _glfw.glfwGetMonitors(count); - } - - internal static unsafe IntPtr glfwGetPrimaryMonitor() - { - return _glfw.glfwGetPrimaryMonitor(); - } - - internal static unsafe void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos) - { - _glfw.glfwGetMonitorPos(monitor, xpos, ypos); - } - - internal static unsafe void glfwGetMonitorWorkarea( - IntPtr monitor, - int* xpos, - int* ypos, - int* width, - int* height) - { - _glfw.glfwGetMonitorWorkarea(monitor, xpos, ypos, width, height); - } - - internal static unsafe void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM) - { - _glfw.glfwGetMonitorPhysicalSize(monitor, widthMM, heightMM); - } - - internal static unsafe void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale) - { - _glfw.glfwGetMonitorContentScale(monitor, xscale, yscale); - } - - internal static unsafe byte* glfwGetMonitorName(IntPtr monitor) - { - return _glfw.glfwGetMonitorName(monitor); - } - - internal static unsafe void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer) - { - _glfw.glfwSetMonitorUserPointer(monitor, pointer); - } - - internal static unsafe void* glfwGetMonitorUserPointer(IntPtr monitor) - { - return _glfw.glfwGetMonitorUserPointer(monitor); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetMonitorCallback( - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetMonitorCallback(callback); - } - - internal static unsafe glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count) - { - return (glfwVideomode*)_glfw.glfwGetVideoModes(monitor, count); - } - - internal static unsafe glfwVideomode* glfwGetVideoMode(IntPtr monitor) - { - return (glfwVideomode*)_glfw.glfwGetVideoMode(monitor); - } - - internal static unsafe void glfwSetGamma(IntPtr monitor, float gamma) - { - _glfw.glfwSetGamma(monitor, gamma); - } - - internal static unsafe glfwGammaramp* glfwGetGammaRamp(IntPtr monitor) - { - return (glfwGammaramp*)_glfw.glfwGetGammaRamp(monitor); - } - - internal static unsafe void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp) - { - _glfw.glfwSetGammaRamp(monitor, (IntPtr)ramp); - } - - internal static unsafe void glfwDefaultWindowHints() - { - _glfw.glfwDefaultWindowHints(); - } - - internal static unsafe void glfwWindowHint(int hint, int value) - { - _glfw.glfwWindowHint(hint, value); - } - - internal static unsafe void glfwWindowHintString(int hint, byte* value) - { - _glfw.glfwWindowHintString(hint, value); - } - - internal static unsafe IntPtr glfwCreateWindow( - int width, - int height, - Span title, - IntPtr monitor, - IntPtr share) - { - fixed (byte* titlePtr = title) { - return _glfw.glfwCreateWindow(width, height, titlePtr, monitor, share); - } - } - - internal static unsafe void glfwDestroyWindow(IntPtr window) - { - _glfw.glfwDestroyWindow(window); - } - - internal static unsafe int glfwWindowShouldClose(IntPtr window) - { - return _glfw.glfwWindowShouldClose(window); - } - - internal static unsafe void glfwSetWindowShouldClose(IntPtr window, int value) - { - _glfw.glfwSetWindowShouldClose(window, value); - } - - internal static unsafe void glfwSetWindowTitle(IntPtr window, byte* title) - { - _glfw.glfwSetWindowTitle(window, title); - } - - internal static unsafe void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images) - { - _glfw.glfwSetWindowIcon(window, count, (IntPtr)images); - } - - internal static unsafe void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos) - { - _glfw.glfwGetWindowPos(window, xpos, ypos); - } - - internal static unsafe void glfwSetWindowPos(IntPtr window, int xpos, int ypos) - { - _glfw.glfwSetWindowPos(window, xpos, ypos); - } - - internal static unsafe void glfwGetWindowSize(IntPtr window, int* width, int* height) - { - _glfw.glfwGetWindowSize(window, width, height); - } - - internal static unsafe void glfwSetWindowSizeLimits( - IntPtr window, - int minwidth, - int minheight, - int maxwidth, - int maxheight) - { - _glfw.glfwSetWindowSizeLimits(window, minwidth, minheight, maxwidth, maxheight); - } - - internal static unsafe void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom) - { - _glfw.glfwSetWindowAspectRatio(window, numer, denom); - } - - internal static unsafe void glfwSetWindowSize(IntPtr window, int width, int height) - { - _glfw.glfwSetWindowSize(window, width, height); - } - - internal static unsafe void glfwGetFramebufferSize(IntPtr window, int* width, int* height) - { - _glfw.glfwGetFrameBufferSize(window, width, height); - } - - internal static unsafe void glfwGetWindowFrameSize(IntPtr window, int* left, int* top, int* right, int* bottom) - { - _glfw.glfwGetWindowFrameSize(window, left, top, right, bottom); - } - - internal static unsafe void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale) - { - _glfw.glfwGetWindowContentScale(window, xscale, yscale); - } - - internal static unsafe float glfwGetWindowOpacity(IntPtr window) - { - return _glfw.glfwGetWindowOpacity(window); - } - - internal static unsafe void glfwSetWindowOpacity(IntPtr window, float opacity) - { - _glfw.glfwSetWindowOpacity(window, opacity); - } - - internal static unsafe void glfwIconifyWindow(IntPtr window) - { - _glfw.glfwIconifyWindow(window); - } - - internal static unsafe void glfwRestoreWindow(IntPtr window) - { - _glfw.glfwRestoreWindow(window); - } - - internal static unsafe void glfwMaximizeWindow(IntPtr window) - { - _glfw.glfwMaximizeWindow(window); - } - - internal static unsafe void glfwShowWindow(IntPtr window) - { - _glfw.glfwShowWindow(window); - } - - internal static unsafe void glfwHideWindow(IntPtr window) - { - _glfw.glfwHideWindow(window); - } - - internal static unsafe void glfwFocusWindow(IntPtr window) - { - _glfw.glfwFocusWindow(window); - } - - internal static unsafe void glfwRequestWindowAttention(IntPtr window) - { - _glfw.glfwRequestWindowAttention(window); - } - - internal static unsafe IntPtr glfwGetWindowMonitor(IntPtr window) - { - return _glfw.glfwGetWindowMonitor(window); - } - - internal static unsafe void glfwSetWindowMonitor( - IntPtr window, - IntPtr monitor, - int xpos, - int ypos, - int width, - int height, - int refreshRate) - { - _glfw.glfwSetWindowMonitor(window, monitor, xpos, ypos, width, height, refreshRate); - } - - internal static unsafe int glfwGetWindowAttrib(IntPtr window, int attrib) - { - return _glfw.glfwGetWindowAttrib(window, attrib); - } - - internal static unsafe void glfwSetWindowAttrib(IntPtr window, int attrib, int value) - { - _glfw.glfwSetWindowAttrib(window, attrib, value); - } - - internal static unsafe void glfwSetWindowUserPointer(IntPtr window, void* pointer) - { - _glfw.glfwSetWindowUserPointer(window, pointer); - } - - internal static unsafe void* glfwGetWindowUserPointer(IntPtr window) - { - return _glfw.glfwGetWindowUserPointer(window); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowPosCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowPosCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowSizeCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowSizeCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowCloseCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowCloseCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowRefreshCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowRefreshCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowFocusCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowFocusCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowIconifyCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowIconifyCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowMaximizeCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowMaximizeCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetFrameBufferSizeCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetFramebufferSizeCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetWindowContentScaleCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetWindowContentScaleCallback(window, callback); - } - - internal static unsafe void glfwPollEvents() - { - _glfw.glfwPollEvents(); - } - - internal static unsafe void glfwWaitEvents() - { - _glfw.glfwWaitEvents(); - } - - internal static unsafe void glfwWaitEventsTimeout(double timeout) - { - _glfw.glfwWaitEventsTimeout(timeout); - } - - internal static unsafe void glfwPostEmptyEvent() - { - _glfw.glfwPostEmptyEvent(); - } - - internal static unsafe int glfwGetInputMode(IntPtr window, int mode) - { - return _glfw.glfwGetInputMode(window, mode); - } - - internal static unsafe void glfwSetInputMode(IntPtr window, int mode, int value) - { - _glfw.glfwSetInputMode(window, mode, value); - } - - internal static unsafe int glfwRawMouseMotionSupported() - { - return _glfw.glfwRawMouseMotionSupported(); - } - - internal static unsafe byte* glfwGetKeyName(int key, int scancode) - { - return _glfw.glfwGetKeyName(key, scancode); - } - - internal static unsafe int glfwGetKeyScancode(int key) - { - return _glfw.glfwGetKeyScancode(key); - } - - internal static unsafe KeyStatus glfwGetKey(IntPtr window, int key) - { - return _glfw.glfwGetKey(window, key); - } - - internal static unsafe int glfwGetMouseButton(IntPtr window, int button) - { - return _glfw.glfwGetMouseButton(window, button); - } - - internal static unsafe void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos) - { - _glfw.glfwGetCursorPos(window, xpos, ypos); - } - - internal static unsafe void glfwSetCursorPos(IntPtr window, double xpos, double ypos) - { - _glfw.glfwSetCursorPos(window, xpos, ypos); - } - - internal static unsafe IntPtr glfwCreateCursor(GLFWimage* image, int xhot, int yhot) - { - return _glfw.glfwCreateCursor((IntPtr)image, xhot, yhot); - } - - internal static unsafe IntPtr glfwCreateStandardCursor(int shape) - { - return _glfw.glfwCreateStandardCursor(shape); - } - - internal static unsafe void glfwDestroyCursor(IntPtr cursor) - { - _glfw.glfwDestroyCursor(cursor); - } - - internal static unsafe void glfwSetCursor(IntPtr window, IntPtr cursor) - { - _glfw.glfwSetCursor(window, cursor); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetKeyCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetKeyCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetCharCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetCharCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetCharModsCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetCharModsCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetMouseButtonCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetMouseButtonCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetCursorPosCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetCursorPosCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetCursorEnterCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetCursorEnterCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetScrollCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetScrollCallback(window, callback); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetDropCallback( - IntPtr window, - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetDropCallback(window, callback); - } - - internal static unsafe int glfwJoystickPresent(int jid) - { - return _glfw.glfwJoystickPresent(jid); - } - - internal static unsafe float* glfwGetJoystickAxes(int jid, int* count) - { - return _glfw.glfwGetJoystickAxes(jid, count); - } - - internal static unsafe byte* glfwGetJoystickButtons(int jid, int* count) - { - return _glfw.glfwGetJoystickButtons(jid, count); - } - - internal static unsafe byte* glfwGetJoystickHats(int jid, int* count) - { - return _glfw.glfwGetJoystickHats(jid, count); - } - - internal static unsafe byte* glfwGetJoystickName(int jid) - { - return _glfw.glfwGetJoystickName(jid); - } - - internal static unsafe byte* glfwGetJoystickGUID(int jid) - { - return _glfw.glfwGetJoystickGUID(jid); - } - - internal static unsafe void glfwSetJoystickUserPointer(int jid, void* pointer) - { - _glfw.glfwSetJoystickUserPointer(jid, pointer); - } - - internal static unsafe void* glfwGetJoystickUserPointer(int jid) - { - return _glfw.glfwGetJoystickUserPointer(jid); - } - - internal static unsafe int glfwJoystickIsGamepad(int jid) - { - return _glfw.glfwJoystickIsGamePad(jid); - } - - internal static unsafe delegate* unmanaged[Cdecl] glfwSetJoystickCallback( - delegate* unmanaged[Cdecl] callback) - { - return _glfw.glfwSetJoystickCallback(callback); - } - - internal static unsafe int glfwUpdateGamePadMappings(byte* str) - { - return _glfw.glfwUpdateGamePadMappings(str); - } - - internal static unsafe byte* glfwGetGamePadName(int jid) - { - return _glfw.glfwGetGamepadName(jid); - } - - internal static unsafe int glfwGetGamePadState(int jid, GLFWgamepadstate* state) - { - return _glfw.glfwGetGamepadState(jid, (IntPtr)state); - } - - internal static unsafe void glfwSetClipboardString(IntPtr window, byte* str) - { - _glfw.glfwSetClipboardString(window, str); - } - - internal static unsafe byte* glfwGetClipboardString(IntPtr window) - { - return _glfw.glfwGetClipboardString(window); - } - - internal static unsafe double glfwGetTime() - { - return _glfw.glfwGetTime(); - } - - internal static unsafe void glfwSetTime(double time) - { - _glfw.glfwSetTime(time); - } - - internal static unsafe ulong glfwGetTimerValue() - { - return _glfw.glfwGetTimerValue(); - } - - internal static unsafe ulong glfwGetTimerFrequency() - { - return _glfw.glfwGetTimerFrequency(); - } - - internal static unsafe void glfwMakeContextCurrent(IntPtr window) - { - _glfw.glfwMakeContextCurrent(window); - } - - internal static unsafe IntPtr glfwGetCurrentContext() - { - return _glfw.glfwGetCurrentContext(); - } - - internal static unsafe void glfwSwapBuffers(IntPtr window) - { - _glfw.glfwSwapBuffers(window); - } - - internal static unsafe void glfwSwapInterval(int interval) - { - _glfw.glfwSwapInterval(interval); - } - - internal static unsafe int glfwExtensionSupported(byte* extension) - { - return _glfw.glfwExtensionSupported(extension); - } - - internal static unsafe IntPtr glfwGetProcAddress(string procName) - { - return glfwGetProcAddress(Encoding.UTF8.GetBytes(procName)); - } - - internal static unsafe IntPtr glfwGetProcAddress(Span procName) - { - fixed (byte* bPtr = procName) { - return _glfw.glfwGetProcAddress(bPtr); - } - } - - internal static unsafe int glfwVulkanSupported() - { - return _glfw.glfwVulkanSupported(); - } - - internal static unsafe byte** glfwGetRequiredInstanceExtensions(uint* count) - { - return _glfw.glfwGetRequiredInstanceExtensions(count); - } - - } -} - -#endregion - diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/112BAB7381CB630D68FB45B979349177 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/112BAB7381CB630D68FB45B979349177 deleted file mode 100644 index b3fcb3d6..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/112BAB7381CB630D68FB45B979349177 +++ /dev/null @@ -1,20 +0,0 @@ -#include "glfw_function_table.h" -#include - -void LoadGLFWFunctions(GLFWFunctionTable* table) { - table->glfwInit = (int (*)(void))glfwGetProcAddress("glfwInit"); - table->glfwTerminate = (void (*)(void))glfwGetProcAddress("glfwTerminate"); - table->glfwInitHint = (void (*)(int, int))glfwGetProcAddress("glfwInitHint"); - table->glfwGetVersionString = (const char* (*)(void))glfwGetProcAddress("glfwGetVersionString"); - table->glfwGetError = (int (*)(const char**))glfwGetProcAddress("glfwGetError"); - table->glfwGetMonitors = (GLFWmonitor** (*)(int*))glfwGetProcAddress("glfwGetMonitors"); - table->glfwGetPrimaryMonitor = (GLFWmonitor* (*)(void))glfwGetProcAddress("glfwGetPrimaryMonitor"); - table->glfwGetMonitorPos = (void (*)(GLFWmonitor*, int*, int*))glfwGetProcAddress("glfwGetMonitorPos"); - table->glfwCreateWindow = (GLFWwindow* (*)(int, int, const char*, GLFWmonitor*, GLFWwindow*))glfwGetProcAddress("glfwCreateWindow"); - table->glfwDestroyWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwDestroyWindow"); - table->glfwWindowShouldClose = (int (*)(GLFWwindow*))glfwGetProcAddress("glfwWindowShouldClose"); - table->glfwSetWindowShouldClose = (void (*)(GLFWwindow*, int))glfwGetProcAddress("glfwSetWindowShouldClose"); - table->glfwPollEvents = (void (*)(void))glfwGetProcAddress("glfwPollEvents"); - table->glfwSwapBuffers = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwSwapBuffers"); - table->glfwGetProcAddress = (GLFWglproc (*)(const char*))glfwGetProcAddress("glfwGetProcAddress"); -} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/1870B19F4EA29B5DFFC6228E78C72ED8 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/1870B19F4EA29B5DFFC6228E78C72ED8 deleted file mode 100644 index 5c62bc49..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/1870B19F4EA29B5DFFC6228E78C72ED8 +++ /dev/null @@ -1,158 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw_function_table.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.InteropServices; - -namespace StgSharp.Internal -{ - [StructLayout(LayoutKind.Sequential)] - internal unsafe struct GLFWFunctionTable - { - - public delegate* unmanaged[Cdecl] glfwCreateCursor; - public delegate* unmanaged[Cdecl] glfwCreateStandardCursor; - public delegate* unmanaged[Cdecl] glfwCreateWindow; - public delegate* unmanaged[Cdecl] glfwDefaultWindowHints; - public delegate* unmanaged[Cdecl] glfwDestroyCursor; - public delegate* unmanaged[Cdecl] glfwDestroyWindow; - public delegate* unmanaged[Cdecl] glfwExtensionSupported; - public delegate* unmanaged[Cdecl] glfwFocusWindow; - public delegate* unmanaged[Cdecl] glfwGetClipboardString; - public delegate* unmanaged[Cdecl] glfwGetCurrentContext; - public delegate* unmanaged[Cdecl] glfwGetCursorPos; - public delegate* unmanaged[Cdecl] glfwGetError; - public delegate* unmanaged[Cdecl] glfwGetFramebufferSize; - public delegate* unmanaged[Cdecl] glfwGetGamepadName; - public delegate* unmanaged[Cdecl] glfwGetGamepadState; - public delegate* unmanaged[Cdecl] glfwGetGammaRamp; - public delegate* unmanaged[Cdecl] glfwGetInputMode; - public delegate* unmanaged[Cdecl] glfwGetJoystickAxes; - public delegate* unmanaged[Cdecl] glfwGetJoystickButtons; - public delegate* unmanaged[Cdecl] glfwGetJoystickGUID; - public delegate* unmanaged[Cdecl] glfwGetJoystickHats; - public delegate* unmanaged[Cdecl] glfwGetJoystickName; - public delegate* unmanaged[Cdecl] glfwGetJoystickUserPointer; - public delegate* unmanaged[Cdecl] glfwGetKey; - public delegate* unmanaged[Cdecl] glfwGetKeyName; - public delegate* unmanaged[Cdecl] glfwGetKeyScancode; - public delegate* unmanaged[Cdecl] glfwGetMonitorContentScale; - public delegate* unmanaged[Cdecl] glfwGetMonitorName; - public delegate* unmanaged[Cdecl] glfwGetMonitorPhysicalSize; - public delegate* unmanaged[Cdecl] glfwGetMonitorPos; - public delegate* unmanaged[Cdecl] glfwGetMonitors; - public delegate* unmanaged[Cdecl] glfwGetMonitorUserPointer; - public delegate* unmanaged[Cdecl] glfwGetMonitorWorkarea; - public delegate* unmanaged[Cdecl] glfwGetMouseButton; - public delegate* unmanaged[Cdecl] glfwGetPrimaryMonitor; - public delegate* unmanaged[Cdecl] glfwGetProcAddress; - public delegate* unmanaged[Cdecl] glfwGetRequiredInstanceExtensions; - public delegate* unmanaged[Cdecl] glfwGetTime; - public delegate* unmanaged[Cdecl] glfwGetTimerFrequency; - public delegate* unmanaged[Cdecl] glfwGetTimerValue; - public delegate* unmanaged[Cdecl] glfwGetVersionString; - public delegate* unmanaged[Cdecl] glfwGetVideoMode; - public delegate* unmanaged[Cdecl] glfwGetVideoModes; - public delegate* unmanaged[Cdecl] glfwGetWindowAttrib; - public delegate* unmanaged[Cdecl] glfwGetWindowContentScale; - public delegate* unmanaged[Cdecl] glfwGetWindowFrameSize; - public delegate* unmanaged[Cdecl] glfwGetWindowMonitor; - public delegate* unmanaged[Cdecl] glfwGetWindowOpacity; - public delegate* unmanaged[Cdecl] glfwGetWindowPos; - public delegate* unmanaged[Cdecl] glfwGetWindowSize; - public delegate* unmanaged[Cdecl] glfwGetWindowUserPointer; - public delegate* unmanaged[Cdecl] glfwHideWindow; - public delegate* unmanaged[Cdecl] glfwIconifyWindow; - public delegate* unmanaged[Cdecl] glfwInit; - public delegate* unmanaged[Cdecl] glfwInitHint; - public delegate* unmanaged[Cdecl] glfwJoystickIsGamepad; - public delegate* unmanaged[Cdecl] glfwJoystickPresent; - public delegate* unmanaged[Cdecl] glfwMakeContextCurrent; - public delegate* unmanaged[Cdecl] glfwMaximizeWindow; - public delegate* unmanaged[Cdecl] glfwPollEvents; - public delegate* unmanaged[Cdecl] glfwPostEmptyEvent; - public delegate* unmanaged[Cdecl] glfwRawMouseMotionSupported; - public delegate* unmanaged[Cdecl] glfwRequestWindowAttention; - public delegate* unmanaged[Cdecl] glfwRestoreWindow; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCharCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCharModsCallback; - public delegate* unmanaged[Cdecl] glfwSetClipboardString; - public delegate* unmanaged[Cdecl] glfwSetCursor; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCursorEnterCallback; - public delegate* unmanaged[Cdecl] glfwSetCursorPos; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCursorPosCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetFramebufferSizeCallback; - public delegate* unmanaged[Cdecl] glfwSetGamma; - public delegate* unmanaged[Cdecl] glfwSetGammaRamp; - public delegate* unmanaged[Cdecl] glfwSetInputMode; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetJoystickCallback; - public delegate* unmanaged[Cdecl] glfwSetJoystickUserPointer; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetKeyCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetMonitorCallback; - public delegate* unmanaged[Cdecl] glfwSetMonitorUserPointer; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetMouseButtonCallback; - public delegate* unmanaged[Cdecl] glfwSetTime; - public delegate* unmanaged[Cdecl] glfwSetWindowAspectRatio; - public delegate* unmanaged[Cdecl] glfwSetWindowAttrib; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowCloseCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowContentScaleCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowFocusCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowIcon; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowIconifyCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowMaximizeCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowMonitor; - public delegate* unmanaged[Cdecl] glfwSetWindowOpacity; - public delegate* unmanaged[Cdecl] glfwSetWindowPos; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowPosCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowRefreshCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowShouldClose; - public delegate* unmanaged[Cdecl] glfwSetWindowSize; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowSizeCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowSizeLimits; - public delegate* unmanaged[Cdecl] glfwSetWindowTitle; - public delegate* unmanaged[Cdecl] glfwSetWindowUserPointer; - public delegate* unmanaged[Cdecl] glfwShowWindow; - public delegate* unmanaged[Cdecl] glfwSwapBuffers; - public delegate* unmanaged[Cdecl] glfwSwapInterval; - public delegate* unmanaged[Cdecl] glfwTerminate; - public delegate* unmanaged[Cdecl] glfwUpdateGamepadMappings; - public delegate* unmanaged[Cdecl] glfwVulkanSupported; - public delegate* unmanaged[Cdecl] glfwWaitEvents; - public delegate* unmanaged[Cdecl] glfwWaitEventsTimeout; - public delegate* unmanaged[Cdecl] glfwWindowHint; - public delegate* unmanaged[Cdecl] glfwWindowHintString; - public delegate* unmanaged[Cdecl] glfwWindowShouldClose; - public delegate* unmanaged[Cdecl], delegate* unmanaged, delegate* unmanaged> glfwSetScrollCallback; -int, byte**, void>> glfwSetDropCallback; - - } -} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/2630A00D9FBA53957EDB47293DF0F31D b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/2630A00D9FBA53957EDB47293DF0F31D deleted file mode 100644 index d0f6156e..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/2630A00D9FBA53957EDB47293DF0F31D +++ /dev/null @@ -1,120 +0,0 @@ -#include "glfw_function_table.h" -#include - -void LoadGLFWFunctions(GLFWFunctionTable* table) { - memset(table, 0, sizeof(GLFWFunctionTable)); - table->glfwInit = (int (*)(void))glfwGetProcAddress("glfwInit"); - table->glfwTerminate = (void (*)(void))glfwGetProcAddress("glfwTerminate"); - table->glfwInitHint = (void (*)(int, int))glfwGetProcAddress("glfwInitHint"); - table->glfwGetVersionString = (const char* (*)(void))glfwGetProcAddress("glfwGetVersionString"); - table->glfwGetError = (int (*)(const char**))glfwGetProcAddress("glfwGetError"); - table->glfwGetMonitors = (GLFWmonitor** (*)(int*))glfwGetProcAddress("glfwGetMonitors"); - table->glfwGetPrimaryMonitor = (GLFWmonitor* (*)(void))glfwGetProcAddress("glfwGetPrimaryMonitor"); - table->glfwGetMonitorPos = (void (*)(GLFWmonitor*, int*, int*))glfwGetProcAddress("glfwGetMonitorPos"); - table->glfwGetMonitorWorkarea = (void (*)(GLFWmonitor*, int*, int*, int*, int*))glfwGetProcAddress("glfwGetMonitorWorkarea"); - table->glfwGetMonitorPhysicalSize = (void (*)(GLFWmonitor*, int*, int*))glfwGetProcAddress("glfwGetMonitorPhysicalSize"); - table->glfwGetMonitorContentScale = (void (*)(GLFWmonitor*, float*, float*))glfwGetProcAddress("glfwGetMonitorContentScale"); - table->glfwGetMonitorName = (const char* (*)(GLFWmonitor*))glfwGetProcAddress("glfwGetMonitorName"); - table->glfwSetMonitorUserPointer = (void (*)(GLFWmonitor*, void*))glfwGetProcAddress("glfwSetMonitorUserPointer"); - table->glfwGetMonitorUserPointer = (void* (*)(GLFWmonitor*))glfwGetProcAddress("glfwGetMonitorUserPointer"); - table->glfwSetMonitorCallback = (GLFWmonitorfun (*)(GLFWmonitorfun))glfwGetProcAddress("glfwSetMonitorCallback"); - table->glfwGetVideoModes = (const GLFWvidmode* (*)(GLFWmonitor*, int*))glfwGetProcAddress("glfwGetVideoModes"); - table->glfwGetVideoMode = (const GLFWvidmode* (*)(GLFWmonitor*))glfwGetProcAddress("glfwGetVideoMode"); - table->glfwSetGamma = (void (*)(GLFWmonitor*, float))glfwGetProcAddress("glfwSetGamma"); - table->glfwGetGammaRamp = (const GLFWgammaramp* (*)(GLFWmonitor*))glfwGetProcAddress("glfwGetGammaRamp"); - table->glfwSetGammaRamp = (void (*)(GLFWmonitor*, const GLFWgammaramp*))glfwGetProcAddress("glfwSetGammaRamp"); - table->glfwDefaultWindowHints = (void (*)(void))glfwGetProcAddress("glfwDefaultWindowHints"); - table->glfwWindowHint = (void (*)(int, int))glfwGetProcAddress("glfwWindowHint"); - table->glfwWindowHintString = (void (*)(int, const char*))glfwGetProcAddress("glfwWindowHintString"); - table->glfwCreateWindow = (GLFWwindow* (*)(int, int, const char*, GLFWmonitor*, GLFWwindow*))glfwGetProcAddress("glfwCreateWindow"); - table->glfwDestroyWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwDestroyWindow"); - table->glfwWindowShouldClose = (int (*)(GLFWwindow*))glfwGetProcAddress("glfwWindowShouldClose"); - table->glfwSetWindowShouldClose = (void (*)(GLFWwindow*, int))glfwGetProcAddress("glfwSetWindowShouldClose"); - table->glfwSetWindowTitle = (void (*)(GLFWwindow*, const char*))glfwGetProcAddress("glfwSetWindowTitle"); - table->glfwSetWindowIcon = (void (*)(GLFWwindow*, int, const GLFWimage*))glfwGetProcAddress("glfwSetWindowIcon"); - table->glfwGetWindowPos = (void (*)(GLFWwindow*, int*, int*))glfwGetProcAddress("glfwGetWindowPos"); - table->glfwSetWindowPos = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetWindowPos"); - table->glfwGetWindowSize = (void (*)(GLFWwindow*, int*, int*))glfwGetProcAddress("glfwGetWindowSize"); - table->glfwSetWindowSizeLimits = (void (*)(GLFWwindow*, int, int, int, int))glfwGetProcAddress("glfwSetWindowSizeLimits"); - table->glfwSetWindowAspectRatio = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetWindowAspectRatio"); - table->glfwSetWindowSize = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetWindowSize"); - table->glfwGetFramebufferSize = (void (*)(GLFWwindow*, int*, int*))glfwGetProcAddress("glfwGetFramebufferSize"); - table->glfwGetWindowFrameSize = (void (*)(GLFWwindow*, int*, int*, int*, int*))glfwGetProcAddress("glfwGetWindowFrameSize"); - table->glfwGetWindowContentScale = (void (*)(GLFWwindow*, float*, float*))glfwGetProcAddress("glfwGetWindowContentScale"); - table->glfwGetWindowOpacity = (float (*)(GLFWwindow*))glfwGetProcAddress("glfwGetWindowOpacity"); - table->glfwSetWindowOpacity = (void (*)(GLFWwindow*, float))glfwGetProcAddress("glfwSetWindowOpacity"); - table->glfwIconifyWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwIconifyWindow"); - table->glfwRestoreWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwRestoreWindow"); - table->glfwMaximizeWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwMaximizeWindow"); - table->glfwShowWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwShowWindow"); - table->glfwHideWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwHideWindow"); - table->glfwFocusWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwFocusWindow"); - table->glfwRequestWindowAttention = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwRequestWindowAttention"); - table->glfwGetWindowMonitor = (GLFWmonitor* (*)(GLFWwindow*))glfwGetProcAddress("glfwGetWindowMonitor"); - table->glfwSetWindowMonitor = (void (*)(GLFWwindow*, GLFWmonitor*, int, int, int, int, int))glfwGetProcAddress("glfwSetWindowMonitor"); - table->glfwGetWindowAttrib = (int (*)(GLFWwindow*, int))glfwGetProcAddress("glfwGetWindowAttrib"); - table->glfwSetWindowAttrib = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetWindowAttrib"); - table->glfwSetWindowUserPointer = (void (*)(GLFWwindow*, void*))glfwGetProcAddress("glfwSetWindowUserPointer"); - table->glfwGetWindowUserPointer = (void* (*)(GLFWwindow*))glfwGetProcAddress("glfwGetWindowUserPointer"); - table->glfwSetWindowPosCallback = (GLFWwindowposfun (*)(GLFWwindow*, GLFWwindowposfun))glfwGetProcAddress("glfwSetWindowPosCallback"); - table->glfwSetWindowSizeCallback = (GLFWwindowsizefun (*)(GLFWwindow*, GLFWwindowsizefun))glfwGetProcAddress("glfwSetWindowSizeCallback"); - table->glfwSetWindowCloseCallback = (GLFWwindowclosefun (*)(GLFWwindow*, GLFWwindowclosefun))glfwGetProcAddress("glfwSetWindowCloseCallback"); - table->glfwSetWindowRefreshCallback = (GLFWwindowrefreshfun (*)(GLFWwindow*, GLFWwindowrefreshfun))glfwGetProcAddress("glfwSetWindowRefreshCallback"); - table->glfwSetWindowFocusCallback = (GLFWwindowfocusfun (*)(GLFWwindow*, GLFWwindowfocusfun))glfwGetProcAddress("glfwSetWindowFocusCallback"); - table->glfwSetWindowIconifyCallback = (GLFWwindowiconifyfun (*)(GLFWwindow*, GLFWwindowiconifyfun))glfwGetProcAddress("glfwSetWindowIconifyCallback"); - table->glfwSetWindowMaximizeCallback = (GLFWwindowmaximizefun (*)(GLFWwindow*, GLFWwindowmaximizefun))glfwGetProcAddress("glfwSetWindowMaximizeCallback"); - table->glfwSetFramebufferSizeCallback = (GLFWframebuffersizefun (*)(GLFWwindow*, GLFWframebuffersizefun))glfwGetProcAddress("glfwSetFramebufferSizeCallback"); - table->glfwSetWindowContentScaleCallback = (GLFWwindowcontentscalefun (*)(GLFWwindow*, GLFWwindowcontentscalefun))glfwGetProcAddress("glfwSetWindowContentScaleCallback"); - table->glfwPollEvents = (void (*)(void))glfwGetProcAddress("glfwPollEvents"); - table->glfwWaitEvents = (void (*)(void))glfwGetProcAddress("glfwWaitEvents"); - table->glfwWaitEventsTimeout = (void (*)(double))glfwGetProcAddress("glfwWaitEventsTimeout"); - table->glfwPostEmptyEvent = (void (*)(void))glfwGetProcAddress("glfwPostEmptyEvent"); - table->glfwGetInputMode = (int (*)(GLFWwindow*, int))glfwGetProcAddress("glfwGetInputMode"); - table->glfwSetInputMode = (void (*)(GLFWwindow*, int, int))glfwGetProcAddress("glfwSetInputMode"); - table->glfwRawMouseMotionSupported = (int (*)(void))glfwGetProcAddress("glfwRawMouseMotionSupported"); - table->glfwGetKeyName = (const char* (*)(int, int))glfwGetProcAddress("glfwGetKeyName"); - table->glfwGetKeyScancode = (int (*)(int))glfwGetProcAddress("glfwGetKeyScancode"); - table->glfwGetKey = (int (*)(GLFWwindow*, int))glfwGetProcAddress("glfwGetKey"); - table->glfwGetMouseButton = (int (*)(GLFWwindow*, int))glfwGetProcAddress("glfwGetMouseButton"); - table->glfwGetCursorPos = (void (*)(GLFWwindow*, double*, double*))glfwGetProcAddress("glfwGetCursorPos"); - table->glfwSetCursorPos = (void (*)(GLFWwindow*, double, double))glfwGetProcAddress("glfwSetCursorPos"); - table->glfwCreateCursor = (GLFWcursor* (*)(const GLFWimage*, int, int))glfwGetProcAddress("glfwCreateCursor"); - table->glfwCreateStandardCursor = (GLFWcursor* (*)(int))glfwGetProcAddress("glfwCreateStandardCursor"); - table->glfwDestroyCursor = (void (*)(GLFWcursor*))glfwGetProcAddress("glfwDestroyCursor"); - table->glfwSetCursor = (void (*)(GLFWwindow*, GLFWcursor*))glfwGetProcAddress("glfwSetCursor"); - table->glfwSetKeyCallback = (GLFWkeyfun (*)(GLFWwindow*, GLFWkeyfun))glfwGetProcAddress("glfwSetKeyCallback"); - table->glfwSetCharCallback = (GLFWcharfun (*)(GLFWwindow*, GLFWcharfun))glfwGetProcAddress("glfwSetCharCallback"); - table->glfwSetCharModsCallback = (GLFWcharmodsfun (*)(GLFWwindow*, GLFWcharmodsfun))glfwGetProcAddress("glfwSetCharModsCallback"); - table->glfwSetMouseButtonCallback = (GLFWmousebuttonfun (*)(GLFWwindow*, GLFWmousebuttonfun))glfwGetProcAddress("glfwSetMouseButtonCallback"); - table->glfwSetCursorPosCallback = (GLFWcursorposfun (*)(GLFWwindow*, GLFWcursorposfun))glfwGetProcAddress("glfwSetCursorPosCallback"); - table->glfwSetCursorEnterCallback = (GLFWcursorenterfun (*)(GLFWwindow*, GLFWcursorenterfun))glfwGetProcAddress("glfwSetCursorEnterCallback"); - table->glfwSetScrollCallback = (GLFWscrollfun (*)(GLFWwindow*, GLFWscrollfun))glfwGetProcAddress("glfwSetScrollCallback"); - table->glfwSetDropCallback = (GLFWdropfun (*)(GLFWwindow*, GLFWdropfun))glfwGetProcAddress("glfwSetDropCallback"); - table->glfwJoystickPresent = (int (*)(int))glfwGetProcAddress("glfwJoystickPresent"); - table->glfwGetJoystickAxes = (const float* (*)(int, int*))glfwGetProcAddress("glfwGetJoystickAxes"); - table->glfwGetJoystickButtons = (const unsigned char* (*)(int, int*))glfwGetProcAddress("glfwGetJoystickButtons"); - table->glfwGetJoystickHats = (const unsigned char* (*)(int, int*))glfwGetProcAddress("glfwGetJoystickHats"); - table->glfwGetJoystickName = (const char* (*)(int))glfwGetProcAddress("glfwGetJoystickName"); - table->glfwGetJoystickGUID = (const char* (*)(int))glfwGetProcAddress("glfwGetJoystickGUID"); - table->glfwSetJoystickUserPointer = (void (*)(int, void*))glfwGetProcAddress("glfwSetJoystickUserPointer"); - table->glfwGetJoystickUserPointer = (void* (*)(int))glfwGetProcAddress("glfwGetJoystickUserPointer"); - table->glfwJoystickIsGamepad = (int (*)(int))glfwGetProcAddress("glfwJoystickIsGamepad"); - table->glfwSetJoystickCallback = (GLFWjoystickfun (*)(GLFWjoystickfun))glfwGetProcAddress("glfwSetJoystickCallback"); - table->glfwUpdateGamepadMappings = (int (*)(const char*))glfwGetProcAddress("glfwUpdateGamepadMappings"); - table->glfwGetGamepadName = (const char* (*)(int))glfwGetProcAddress("glfwGetGamepadName"); - table->glfwGetGamepadState = (int (*)(int, GLFWgamepadstate*))glfwGetProcAddress("glfwGetGamepadState"); - table->glfwSetClipboardString = (void (*)(GLFWwindow*, const char*))glfwGetProcAddress("glfwSetClipboardString"); - table->glfwGetClipboardString = (const char* (*)(GLFWwindow*))glfwGetProcAddress("glfwGetClipboardString"); - table->glfwGetTime = (double (*)(void))glfwGetProcAddress("glfwGetTime"); - table->glfwSetTime = (void (*)(double))glfwGetProcAddress("glfwSetTime"); - table->glfwGetTimerValue = (uint64_t (*)(void))glfwGetProcAddress("glfwGetTimerValue"); - table->glfwGetTimerFrequency = (uint64_t (*)(void))glfwGetProcAddress("glfwGetTimerFrequency"); - table->glfwMakeContextCurrent = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwMakeContextCurrent"); - table->glfwGetCurrentContext = (GLFWwindow* (*)(void))glfwGetProcAddress("glfwGetCurrentContext"); - table->glfwSwapBuffers = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwSwapBuffers"); - table->glfwSwapInterval = (void (*)(int))glfwGetProcAddress("glfwSwapInterval"); - table->glfwExtensionSupported = (int (*)(const char*))glfwGetProcAddress("glfwExtensionSupported"); - table->glfwGetProcAddress = (GLFWglproc (*)(const char*))glfwGetProcAddress("glfwGetProcAddress"); - table->glfwVulkanSupported = (int (*)(void))glfwGetProcAddress("glfwVulkanSupported"); - table->glfwGetRequiredInstanceExtensions = (const char** (*)(uint32_t*))glfwGetProcAddress("glfwGetRequiredInstanceExtensions"); -} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/49201C29D2374F89CB1D9981C87316A1 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/49201C29D2374F89CB1D9981C87316A1 deleted file mode 100644 index 9713e517..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/49201C29D2374F89CB1D9981C87316A1 +++ /dev/null @@ -1,133 +0,0 @@ -#ifndef GLFW_FUNCTION_TABLE_H -#define GLFW_FUNCTION_TABLE_H - -#include "glfw3_no_comments.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct GLFWFunctionTable { - int (*glfwInit)(void); - void (*glfwTerminate)(void); - void (*glfwInitHint)(int hint, int value); - const char* (*glfwGetVersionString)(void); - int (*glfwGetError)(const char** description); - GLFWmonitor** (*glfwGetMonitors)(int* count); - GLFWmonitor* (*glfwGetPrimaryMonitor)(void); - void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos); - void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height); - void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM); - void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale); - const char* (*glfwGetMonitorName)(GLFWmonitor* monitor); - void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer); - void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor); - GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback); - const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count); - const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor); - void (*glfwSetGamma)(GLFWmonitor* monitor, float gamma); - const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor); - void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp); - void (*glfwDefaultWindowHints)(void); - void (*glfwWindowHint)(int hint, int value); - void (*glfwWindowHintString)(int hint, const char* value); - GLFWwindow* (*glfwCreateWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share); - void (*glfwDestroyWindow)(GLFWwindow* window); - int (*glfwWindowShouldClose)(GLFWwindow* window); - void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value); - void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title); - void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images); - void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos); - void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos); - void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height); - void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); - void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom); - void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height); - void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height); - void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom); - void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale); - float (*glfwGetWindowOpacity)(GLFWwindow* window); - void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity); - void (*glfwIconifyWindow)(GLFWwindow* window); - void (*glfwRestoreWindow)(GLFWwindow* window); - void (*glfwMaximizeWindow)(GLFWwindow* window); - void (*glfwShowWindow)(GLFWwindow* window); - void (*glfwHideWindow)(GLFWwindow* window); - void (*glfwFocusWindow)(GLFWwindow* window); - void (*glfwRequestWindowAttention)(GLFWwindow* window); - GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window); - void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); - int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib); - void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value); - void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer); - void* (*glfwGetWindowUserPointer)(GLFWwindow* window); - GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback); - GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback); - GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback); - GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback); - GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback); - GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback); - GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback); - GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback); - GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback); - void (*glfwPollEvents)(void); - void (*glfwWaitEvents)(void); - void (*glfwWaitEventsTimeout)(double timeout); - void (*glfwPostEmptyEvent)(void); - int (*glfwGetInputMode)(GLFWwindow* window, int mode); - void (*glfwSetInputMode)(GLFWwindow* window, int mode, int value); - int (*glfwRawMouseMotionSupported)(void); - const char* (*glfwGetKeyName)(int key, int scancode); - int (*glfwGetKeyScancode)(int key); - int (*glfwGetKey)(GLFWwindow* window, int key); - int (*glfwGetMouseButton)(GLFWwindow* window, int button); - void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos); - void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos); - GLFWcursor* (*glfwCreateCursor)(const GLFWimage* image, int xhot, int yhot); - GLFWcursor* (*glfwCreateStandardCursor)(int shape); - void (*glfwDestroyCursor)(GLFWcursor* cursor); - void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor); - GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback); - GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback); - GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback); - GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback); - GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback); - GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback); - GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback); - GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback); - int (*glfwJoystickPresent)(int jid); - const float* (*glfwGetJoystickAxes)(int jid, int* count); - const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count); - const unsigned char* (*glfwGetJoystickHats)(int jid, int* count); - const char* (*glfwGetJoystickName)(int jid); - const char* (*glfwGetJoystickGUID)(int jid); - void (*glfwSetJoystickUserPointer)(int jid, void* pointer); - void* (*glfwGetJoystickUserPointer)(int jid); - int (*glfwJoystickIsGamepad)(int jid); - GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback); - int (*glfwUpdateGamepadMappings)(const char* string); - const char* (*glfwGetGamepadName)(int jid); - int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state); - void (*glfwSetClipboardString)(GLFWwindow* window, const char* string); - const char* (*glfwGetClipboardString)(GLFWwindow* window); - double (*glfwGetTime)(void); - void (*glfwSetTime)(double time); - uint64_t (*glfwGetTimerValue)(void); - uint64_t (*glfwGetTimerFrequency)(void); - void (*glfwMakeContextCurrent)(GLFWwindow* window); - GLFWwindow* (*glfwGetCurrentContext)(void); - void (*glfwSwapBuffers)(GLFWwindow* window); - void (*glfwSwapInterval)(int interval); - int (*glfwExtensionSupported)(const char* extension); - GLFWglproc (*glfwGetProcAddress)(const char* procname); - int (*glfwVulkanSupported)(void); - const char** (*glfwGetRequiredInstanceExtensions)(uint32_t* count); -} GLFWFunctionTable; - -void LoadGLFWFunctions(GLFWFunctionTable* table); - -#ifdef __cplusplus -} -#endif - -#endif \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/516E4750BFA070C15018A44BF13AD02C b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/516E4750BFA070C15018A44BF13AD02C deleted file mode 100644 index 5f282702..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/516E4750BFA070C15018A44BF13AD02C +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/6390DC8DC0302D69BAFF30DD8ED4B9C7 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/6390DC8DC0302D69BAFF30DD8ED4B9C7 deleted file mode 100644 index 9b7fc4d0..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/6390DC8DC0302D69BAFF30DD8ED4B9C7 +++ /dev/null @@ -1,57 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw_function_table.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.InteropServices; - -namespace StgSharp.Internal -{ - [StructLayout(LayoutKind.Sequential)] - internal unsafe struct GLFWFunctionTable - { - - public delegate* unmanaged[Cdecl] glfwCreateWindow; - public delegate* unmanaged[Cdecl] glfwDestroyWindow; - public delegate* unmanaged[Cdecl] glfwGetError; - public delegate* unmanaged[Cdecl] glfwGetMonitorPos; - public delegate* unmanaged[Cdecl] glfwGetMonitors; - public delegate* unmanaged[Cdecl] glfwGetPrimaryMonitor; - public delegate* unmanaged[Cdecl] glfwGetProcAddress; - public delegate* unmanaged[Cdecl] glfwGetVersionString; - public delegate* unmanaged[Cdecl] glfwInit; - public delegate* unmanaged[Cdecl] glfwInitHint; - public delegate* unmanaged[Cdecl] glfwPollEvents; - public delegate* unmanaged[Cdecl] glfwSetWindowShouldClose; - public delegate* unmanaged[Cdecl] glfwSwapBuffers; - public delegate* unmanaged[Cdecl] glfwTerminate; - public delegate* unmanaged[Cdecl] glfwWindowShouldClose; - - } -} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/85640CC1F60032566B378A1E4081FD35 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/85640CC1F60032566B378A1E4081FD35 deleted file mode 100644 index d6228b3a..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/85640CC1F60032566B378A1E4081FD35 +++ /dev/null @@ -1,3 +0,0 @@ -#include "StgSharpNative.h" -#include "glfw_function_table.h" -#include diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/885C0127350D5D9423F07D688925FD75 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/885C0127350D5D9423F07D688925FD75 deleted file mode 100644 index 9b7fc4d0..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/885C0127350D5D9423F07D688925FD75 +++ /dev/null @@ -1,57 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw_function_table.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.InteropServices; - -namespace StgSharp.Internal -{ - [StructLayout(LayoutKind.Sequential)] - internal unsafe struct GLFWFunctionTable - { - - public delegate* unmanaged[Cdecl] glfwCreateWindow; - public delegate* unmanaged[Cdecl] glfwDestroyWindow; - public delegate* unmanaged[Cdecl] glfwGetError; - public delegate* unmanaged[Cdecl] glfwGetMonitorPos; - public delegate* unmanaged[Cdecl] glfwGetMonitors; - public delegate* unmanaged[Cdecl] glfwGetPrimaryMonitor; - public delegate* unmanaged[Cdecl] glfwGetProcAddress; - public delegate* unmanaged[Cdecl] glfwGetVersionString; - public delegate* unmanaged[Cdecl] glfwInit; - public delegate* unmanaged[Cdecl] glfwInitHint; - public delegate* unmanaged[Cdecl] glfwPollEvents; - public delegate* unmanaged[Cdecl] glfwSetWindowShouldClose; - public delegate* unmanaged[Cdecl] glfwSwapBuffers; - public delegate* unmanaged[Cdecl] glfwTerminate; - public delegate* unmanaged[Cdecl] glfwWindowShouldClose; - - } -} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/9CEB679F37A612DD9C58389184427BED b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/9CEB679F37A612DD9C58389184427BED deleted file mode 100644 index 5f282702..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/9CEB679F37A612DD9C58389184427BED +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA deleted file mode 100644 index dae34e16..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA +++ /dev/null @@ -1,123 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="InternalIO.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; -using StgSharp.Graphics.OpenGL; - -using System; -using System.Collections.Generic; -using System.IO; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -using System.Text; -using System.Threading; - -namespace StgSharp.Internal -{ - internal static unsafe partial class InternalIO - { - - internal const string SS_errorLog = - "SS_errorlog.log"; - - internal const string NativeLibName = - "StgSharp.C"; - - internal static Dictionary GLtype = []; - - internal static readonly GCHandle ssc_logHandle = - GCHandle.Alloc(new byte[512], GCHandleType.Pinned); - - internal static IntPtr _nativeLibPtr = IntPtr.Zero; - - internal static SemaphoreSlim logSyncSemaphore = new SemaphoreSlim(1, 1); - - static InternalIO() - { - GLtype.Add(TypeCode.Single, glConst.FLOAT); - GLtype.Add(TypeCode.Int32, glConst.INT); - GLtype.Add(TypeCode.UInt32, glConst.UNSIGNED_INT); - GLtype.Add(TypeCode.Int16, glConst.SHORT); - GLtype.Add(TypeCode.UInt16, glConst.UNSIGNED_SHORT); - GLtype.Add(TypeCode.SByte, glConst.BYTE); - GLtype.Add(TypeCode.Byte, glConst.UNSIGNED_BYTE); - } - - internal static void InternalAppendLog(string log) - { - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) { - logStream.WriteLine(log); - } - } - - internal static void InternalWriteLog(string logLine, LogType logType) - { - logSyncSemaphore.Wait(); - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) - { - logStream.WriteLine($"{logType}\t{DateTime.Now.ToString("o")}"); - logStream.WriteLine(logLine); - } - _ = logSyncSemaphore.Release(); - } - - internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType) - { - logSyncSemaphore.Wait(); - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) - { - logStream.WriteLine(beforeTime); - logStream.WriteLine($"{logType}\t@\t{DateTime.Now.ToString("o")}"); - logStream.WriteLine(logLine); - } - _ = logSyncSemaphore.Release(1); - } - - } -} diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/A3919CCA57C33ABF0FE7102A8A97A697 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/A3919CCA57C33ABF0FE7102A8A97A697 deleted file mode 100644 index b3fcb3d6..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/A3919CCA57C33ABF0FE7102A8A97A697 +++ /dev/null @@ -1,20 +0,0 @@ -#include "glfw_function_table.h" -#include - -void LoadGLFWFunctions(GLFWFunctionTable* table) { - table->glfwInit = (int (*)(void))glfwGetProcAddress("glfwInit"); - table->glfwTerminate = (void (*)(void))glfwGetProcAddress("glfwTerminate"); - table->glfwInitHint = (void (*)(int, int))glfwGetProcAddress("glfwInitHint"); - table->glfwGetVersionString = (const char* (*)(void))glfwGetProcAddress("glfwGetVersionString"); - table->glfwGetError = (int (*)(const char**))glfwGetProcAddress("glfwGetError"); - table->glfwGetMonitors = (GLFWmonitor** (*)(int*))glfwGetProcAddress("glfwGetMonitors"); - table->glfwGetPrimaryMonitor = (GLFWmonitor* (*)(void))glfwGetProcAddress("glfwGetPrimaryMonitor"); - table->glfwGetMonitorPos = (void (*)(GLFWmonitor*, int*, int*))glfwGetProcAddress("glfwGetMonitorPos"); - table->glfwCreateWindow = (GLFWwindow* (*)(int, int, const char*, GLFWmonitor*, GLFWwindow*))glfwGetProcAddress("glfwCreateWindow"); - table->glfwDestroyWindow = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwDestroyWindow"); - table->glfwWindowShouldClose = (int (*)(GLFWwindow*))glfwGetProcAddress("glfwWindowShouldClose"); - table->glfwSetWindowShouldClose = (void (*)(GLFWwindow*, int))glfwGetProcAddress("glfwSetWindowShouldClose"); - table->glfwPollEvents = (void (*)(void))glfwGetProcAddress("glfwPollEvents"); - table->glfwSwapBuffers = (void (*)(GLFWwindow*))glfwGetProcAddress("glfwSwapBuffers"); - table->glfwGetProcAddress = (GLFWglproc (*)(const char*))glfwGetProcAddress("glfwGetProcAddress"); -} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/BF682B06259E1DAC71F7644A79308571 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/BF682B06259E1DAC71F7644A79308571 deleted file mode 100644 index 15eb20da..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/BF682B06259E1DAC71F7644A79308571 +++ /dev/null @@ -1,486 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; - -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; - -namespace StgSharp.Internal -{ - internal unsafe partial class InternalIO - { - - private static GLFWFunction _glfw; - - [LibraryImport(NativeLibName, EntryPoint = "load_glfw_functions")] - internal static unsafe partial void glfwLoadLibrary(GLFWFunction* context); - - internal static unsafe void LoadGlfw() - { - _glfw = new GLFWFunction(); - fixed (GLFWFunction* func = &_glfw) { } - } - - #region api call - - [LibraryImport(NativeLibName, EntryPoint = "glfwInit")] - internal static unsafe partial int glfwInit(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwTerminate")] - internal static unsafe partial void glfwTerminate(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwInitHint")] - internal static unsafe partial void glfwInitHint(int hint, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetVersion")] - internal static unsafe partial void glfwGetVersion(int* major, int* minor, int* rev); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetVersionString")] - internal static unsafe partial byte* glfwGetVersionString(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetError")] - internal static unsafe partial int glfwGetError(byte** description); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetErrorCallback")] - internal static unsafe partial delegate* glfwSetErrorCallback( - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitors")] - internal static unsafe partial IntPtr* glfwGetMonitors(int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetPrimaryMonitor")] - internal static unsafe partial IntPtr glfwGetPrimaryMonitor(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorPos")] - internal static unsafe partial void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorWorkarea")] - internal static unsafe partial void glfwGetMonitorWorkarea( - IntPtr monitor, - int* xpos, - int* ypos, - int* width, - int* height); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorPhysicalSize")] - internal static unsafe partial void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorContentScale")] - internal static unsafe partial void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorName")] - internal static unsafe partial byte* glfwGetMonitorName(IntPtr monitor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetMonitorUserPointer")] - internal static unsafe partial void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorUserPointer")] - internal static unsafe partial void* glfwGetMonitorUserPointer(IntPtr monitor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetMonitorCallback")] - internal static unsafe partial delegate* glfwSetMonitorCallback( - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetVideoModes")] - internal static unsafe partial glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetVideoMode")] - internal static unsafe partial glfwVideomode* glfwGetVideoMode(IntPtr monitor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetGamma")] - internal static unsafe partial void glfwSetGamma(IntPtr monitor, float gamma); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetGammaRamp")] - internal static unsafe partial glfwGammaramp* glfwGetGammaRamp(IntPtr monitor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetGammaRamp")] - internal static unsafe partial void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp); - - [LibraryImport(NativeLibName, EntryPoint = "glfwDefaultWindowHints")] - internal static unsafe partial void glfwDefaultWindowHints(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWindowHint")] - internal static unsafe partial void glfwWindowHint(int hint, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWindowHintString")] - internal static unsafe partial void glfwWindowHintString(int hint, byte* value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindow")] - internal static unsafe partial IntPtr glfwCreateWindow( - int width, - int height, - byte[] title, - IntPtr monitor, - IntPtr share); - - [LibraryImport(NativeLibName, EntryPoint = "glfwDestroyWindow")] - internal static unsafe partial void glfwDestroyWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWindowShouldClose")] - internal static unsafe partial int glfwWindowShouldClose(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowShouldClose")] - internal static unsafe partial void glfwSetWindowShouldClose(IntPtr window, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowTitle")] - internal static unsafe partial void glfwSetWindowTitle(IntPtr window, byte* title); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowIcon")] - internal static unsafe partial void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowPos")] - internal static unsafe partial void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowPos")] - internal static unsafe partial void glfwSetWindowPos(IntPtr window, int xpos, int ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowSize")] - internal static unsafe partial void glfwGetWindowSize(IntPtr window, int* width, int* height); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSizeLimits")] - internal static unsafe partial void glfwSetWindowSizeLimits( - IntPtr window, - int minwidth, - int minheight, - int maxwidth, - int maxheight); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowAspectRatio")] - internal static unsafe partial void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSize")] - internal static unsafe partial void glfwSetWindowSize(IntPtr window, int width, int height); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetFramebufferSize")] - internal static unsafe partial void glfwGetFramebufferSize(IntPtr window, int* width, int* height); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowFrameSize")] - internal static unsafe partial void glfwGetWindowFrameSize( - IntPtr window, - int* left, - int* top, - int* right, - int* bottom); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowContentScale")] - internal static unsafe partial void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowOpacity")] - internal static unsafe partial float glfwGetWindowOpacity(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowOpacity")] - internal static unsafe partial void glfwSetWindowOpacity(IntPtr window, float opacity); - - [LibraryImport(NativeLibName, EntryPoint = "glfwIconifyWindow")] - internal static unsafe partial void glfwIconifyWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwRestoreWindow")] - internal static unsafe partial void glfwRestoreWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwMaximizeWindow")] - internal static unsafe partial void glfwMaximizeWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwShowWindow")] - internal static unsafe partial void glfwShowWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwHideWindow")] - internal static unsafe partial void glfwHideWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwFocusWindow")] - internal static unsafe partial void glfwFocusWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwRequestWindowAttention")] - internal static unsafe partial void glfwRequestWindowAttention(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowMonitor")] - internal static unsafe partial IntPtr glfwGetWindowMonitor(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowMonitor")] - internal static unsafe partial void glfwSetWindowMonitor( - IntPtr window, - IntPtr monitor, - int xpos, - int ypos, - int width, - int height, - int refreshRate); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowAttrib")] - internal static unsafe partial int glfwGetWindowAttrib(IntPtr window, int attrib); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowAttrib")] - internal static unsafe partial void glfwSetWindowAttrib(IntPtr window, int attrib, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowUserPointer")] - internal static unsafe partial void glfwSetWindowUserPointer(IntPtr window, void* pointer); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowUserPointer")] - internal static unsafe partial void* glfwGetWindowUserPointer(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowPosCallback")] - internal static unsafe partial delegate* glfwSetWindowPosCallback( - IntPtr window, - IntPtr callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSizeCallback")] - internal static unsafe partial delegate* glfwSetWindowSizeCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowCloseCallback")] - internal static unsafe partial delegate* glfwSetWindowCloseCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowRefreshCallback")] - internal static unsafe partial delegate* glfwSetWindowRefreshCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowFocusCallback")] - internal static unsafe partial delegate* glfwSetWindowFocusCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowIconifyCallback")] - internal static unsafe partial delegate* glfwSetWindowIconifyCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowMaximizeCallback")] - internal static unsafe partial delegate* glfwSetWindowMaximizeCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetFramebufferSizeCallback")] - internal static unsafe partial FrameBufferSizeHandler glfwSetFramebufferSizeCallback( - IntPtr window, - IntPtr callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowContentScaleCallback")] - internal static unsafe partial delegate* glfwSetWindowContentScaleCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwPollEvents")] - internal static unsafe partial void glfwPollEvents(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWaitEvents")] - internal static unsafe partial void glfwWaitEvents(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWaitEventsTimeout")] - internal static unsafe partial void glfwWaitEventsTimeout(double timeout); - - [LibraryImport(NativeLibName, EntryPoint = "glfwPostEmptyEvent")] - internal static unsafe partial void glfwPostEmptyEvent(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetInputMode")] - internal static unsafe partial int glfwGetInputMode(IntPtr window, int mode); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetInputMode")] - internal static unsafe partial void glfwSetInputMode(IntPtr window, int mode, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwRawMouseMotionSupported")] - internal static unsafe partial int glfwRawMouseMotionSupported(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetKeyName")] - internal static unsafe partial byte* glfwGetKeyName(int key, int scancode); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetKeyScancode")] - internal static unsafe partial int glfwGetKeyScancode(int key); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetKey")] - internal static unsafe partial KeyStatus glfwGetKey(IntPtr window, int key); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMouseButton")] - internal static unsafe partial int glfwGetMouseButton(IntPtr window, int button); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetCursorPos")] - internal static unsafe partial void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorPos")] - internal static unsafe partial void glfwSetCursorPos(IntPtr window, double xpos, double ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateCursor")] - internal static unsafe partial GLFWcursor* glfwCreateCursor(GLFWimage* image, int xhot, int yhot); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateStandardCursor")] - internal static unsafe partial GLFWcursor* glfwCreateStandardCursor(int shape); - - [LibraryImport(NativeLibName, EntryPoint = "glfwDestroyCursor")] - internal static unsafe partial void glfwDestroyCursor(GLFWcursor* cursor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCursor")] - internal static unsafe partial void glfwSetCursor(IntPtr window, GLFWcursor* cursor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetKeyCallback")] - internal static unsafe partial delegate* glfwSetKeyCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCharCallback")] - internal static unsafe partial delegate* glfwSetCharCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCharModsCallback")] - internal static unsafe partial delegate* glfwSetCharModsCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetMouseButtonCallback")] - internal static unsafe partial delegate* glfwSetMouseButtonCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorPosCallback")] - internal static unsafe partial delegate* glfwSetCursorPosCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorEnterCallback")] - internal static unsafe partial delegate* glfwSetCursorEnterCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetScrollCallback")] - internal static unsafe partial delegate* glfwSetScrollCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetDropCallback")] - internal static unsafe partial delegate* glfwSetDropCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwJoystickPresent")] - internal static unsafe partial int glfwJoystickPresent(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickAxes")] - internal static unsafe partial float* glfwGetJoystickAxes(int jid, int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickButtons")] - internal static unsafe partial byte* glfwGetJoystickButtons(int jid, int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickHats")] - internal static unsafe partial byte* glfwGetJoystickHats(int jid, int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickName")] - internal static unsafe partial byte* glfwGetJoystickName(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickGUID")] - internal static unsafe partial byte* glfwGetJoystickGUID(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetJoystickUserPointer")] - internal static unsafe partial void glfwSetJoystickUserPointer(int jid, void* pointer); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickUserPointer")] - internal static unsafe partial void* glfwGetJoystickUserPointer(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwJoystickIsGamepad")] - internal static unsafe partial int glfwJoystickIsGamepad(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetJoystickCallback")] - internal static unsafe partial delegate* glfwSetJoystickCallback(delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwUpdateGamepadMappings")] - internal static unsafe partial int glfwUpdateGamepadMappings(byte* str); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetGamepadName")] - internal static unsafe partial byte* glfwGetGamepadName(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetGamepadState")] - internal static unsafe partial int glfwGetGamepadState(int jid, GLFWgamepadstate* state); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetClipboardString")] - internal static unsafe partial void glfwSetClipboardString(IntPtr window, byte* str); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetClipboardString")] - internal static unsafe partial byte* glfwGetClipboardString(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetTime")] - internal static unsafe partial double glfwGetTime(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetTime")] - internal static unsafe partial void glfwSetTime(double time); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetTimerValue")] - internal static unsafe partial ulong* glfwGetTimerValue(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetTimerFrequency")] - internal static unsafe partial ulong* glfwGetTimerFrequency(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwMakeContextCurrent")] - internal static unsafe partial void glfwMakeContextCurrent(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetCurrentContext")] - internal static unsafe partial IntPtr glfwGetCurrentContext(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSwapBuffers")] - internal static unsafe partial void glfwSwapBuffers(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSwapInterval")] - internal static unsafe partial void glfwSwapInterval(int interval); - - [LibraryImport(NativeLibName, EntryPoint = "glfwExtensionSupported")] - internal static unsafe partial int glfwExtensionSupported(byte* extension); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetProcAddress", StringMarshalling = StringMarshalling.Utf8)] - internal static unsafe partial IntPtr glfwGetProcAddress(string procname); - - [LibraryImport(NativeLibName, EntryPoint = "glfwVulkanSupported")] - internal static unsafe partial int glfwVulkanSupported(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetRequiredInstanceExtensions")] - internal static unsafe partial byte** glfwGetRequiredInstanceExtensions(uint* count); - - /* - [LibraryImport(NativeLibName, EntryPoint = "glfwGetInstanceProcAddress")] internal static unsafe partial delegate* glfwGetInstanceProcAddress( - VkInstance instance, - byte* procname); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetPhysicalDevicePresentationSupport")] internal static unsafe partial int glfwGetPhysicalDevicePresentationSupport( - VkInstance instance, - VkPhysicalDevice device, - uint* queuefamily); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindowSurface")] internal static unsafe partial VkResult glfwCreateWindowSurface( - VkInstance instance, - glfwWindow* window, - VkAllocationCallbacks* _allocator, - VkSurfaceKHR* surface); - /**/ - - #endregion api call - } -} diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/E85AA11F74CAA82F5E384A85CDBE0B61 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/E85AA11F74CAA82F5E384A85CDBE0B61 deleted file mode 100644 index 48081bd3..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/E47AD868D1B5AC4BBDC49A23756F9CB6/E85AA11F74CAA82F5E384A85CDBE0B61 +++ /dev/null @@ -1,156 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw_function_table.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.InteropServices; - -namespace StgSharp.Internal -{ - [StructLayout(LayoutKind.Sequential)] - internal unsafe struct GLFWFunction - { - - public delegate* unmanaged[Cdecl] glfwCreateCursor; - public delegate* unmanaged[Cdecl] glfwCreateStandardCursor; - public delegate* unmanaged[Cdecl] glfwCreateWindow; - public delegate* unmanaged[Cdecl] glfwDefaultWindowHints; - public delegate* unmanaged[Cdecl] glfwDestroyCursor; - public delegate* unmanaged[Cdecl] glfwDestroyWindow; - public delegate* unmanaged[Cdecl] glfwExtensionSupported; - public delegate* unmanaged[Cdecl] glfwFocusWindow; - public delegate* unmanaged[Cdecl] glfwGetClipboardString; - public delegate* unmanaged[Cdecl] glfwGetCurrentContext; - public delegate* unmanaged[Cdecl] glfwGetCursorPos; - public delegate* unmanaged[Cdecl] glfwGetError; - public delegate* unmanaged[Cdecl] glfwGetFramebufferSize; - public delegate* unmanaged[Cdecl] glfwGetGamepadName; - public delegate* unmanaged[Cdecl] glfwGetGamepadState; - public delegate* unmanaged[Cdecl] glfwGetGammaRamp; - public delegate* unmanaged[Cdecl] glfwGetInputMode; - public delegate* unmanaged[Cdecl] glfwGetJoystickAxes; - public delegate* unmanaged[Cdecl] glfwGetJoystickButtons; - public delegate* unmanaged[Cdecl] glfwGetJoystickGUID; - public delegate* unmanaged[Cdecl] glfwGetJoystickHats; - public delegate* unmanaged[Cdecl] glfwGetJoystickName; - public delegate* unmanaged[Cdecl] glfwGetJoystickUserPointer; - public delegate* unmanaged[Cdecl] glfwGetKey; - public delegate* unmanaged[Cdecl] glfwGetKeyName; - public delegate* unmanaged[Cdecl] glfwGetKeyScancode; - public delegate* unmanaged[Cdecl] glfwGetMonitorContentScale; - public delegate* unmanaged[Cdecl] glfwGetMonitorName; - public delegate* unmanaged[Cdecl] glfwGetMonitorPhysicalSize; - public delegate* unmanaged[Cdecl] glfwGetMonitorPos; - public delegate* unmanaged[Cdecl] glfwGetMonitors; - public delegate* unmanaged[Cdecl] glfwGetMonitorUserPointer; - public delegate* unmanaged[Cdecl] glfwGetMonitorWorkarea; - public delegate* unmanaged[Cdecl] glfwGetMouseButton; - public delegate* unmanaged[Cdecl] glfwGetPrimaryMonitor; - public delegate* unmanaged[Cdecl] glfwGetProcAddress; - public delegate* unmanaged[Cdecl] glfwGetRequiredInstanceExtensions; - public delegate* unmanaged[Cdecl] glfwGetTime; - public delegate* unmanaged[Cdecl] glfwGetTimerFrequency; - public delegate* unmanaged[Cdecl] glfwGetTimerValue; - public delegate* unmanaged[Cdecl] glfwGetVersionString; - public delegate* unmanaged[Cdecl] glfwGetVideoMode; - public delegate* unmanaged[Cdecl] glfwGetVideoModes; - public delegate* unmanaged[Cdecl] glfwGetWindowAttrib; - public delegate* unmanaged[Cdecl] glfwGetWindowContentScale; - public delegate* unmanaged[Cdecl] glfwGetWindowFrameSize; - public delegate* unmanaged[Cdecl] glfwGetWindowMonitor; - public delegate* unmanaged[Cdecl] glfwGetWindowOpacity; - public delegate* unmanaged[Cdecl] glfwGetWindowPos; - public delegate* unmanaged[Cdecl] glfwGetWindowSize; - public delegate* unmanaged[Cdecl] glfwGetWindowUserPointer; - public delegate* unmanaged[Cdecl] glfwHideWindow; - public delegate* unmanaged[Cdecl] glfwIconifyWindow; - public delegate* unmanaged[Cdecl] glfwInit; - public delegate* unmanaged[Cdecl] glfwInitHint; - public delegate* unmanaged[Cdecl] glfwJoystickIsGamepad; - public delegate* unmanaged[Cdecl] glfwJoystickPresent; - public delegate* unmanaged[Cdecl] glfwMakeContextCurrent; - public delegate* unmanaged[Cdecl] glfwMaximizeWindow; - public delegate* unmanaged[Cdecl] glfwPollEvents; - public delegate* unmanaged[Cdecl] glfwPostEmptyEvent; - public delegate* unmanaged[Cdecl] glfwRawMouseMotionSupported; - public delegate* unmanaged[Cdecl] glfwRequestWindowAttention; - public delegate* unmanaged[Cdecl] glfwRestoreWindow; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCharCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCharModsCallback; - public delegate* unmanaged[Cdecl] glfwSetClipboardString; - public delegate* unmanaged[Cdecl] glfwSetCursor; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCursorEnterCallback; - public delegate* unmanaged[Cdecl] glfwSetCursorPos; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCursorPosCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged [Cdecl]> glfwSetDropCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetFramebufferSizeCallback; - public delegate* unmanaged[Cdecl] glfwSetGamma; - public delegate* unmanaged[Cdecl] glfwSetGammaRamp; - public delegate* unmanaged[Cdecl] glfwSetInputMode; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetJoystickCallback; - public delegate* unmanaged[Cdecl] glfwSetJoystickUserPointer; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetKeyCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetMonitorCallback; - public delegate* unmanaged[Cdecl] glfwSetMonitorUserPointer; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetMouseButtonCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetScrollCallback; - public delegate* unmanaged[Cdecl] glfwSetTime; - public delegate* unmanaged[Cdecl] glfwSetWindowAspectRatio; - public delegate* unmanaged[Cdecl] glfwSetWindowAttrib; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowCloseCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowContentScaleCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowFocusCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowIcon; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowIconifyCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowMaximizeCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowMonitor; - public delegate* unmanaged[Cdecl] glfwSetWindowOpacity; - public delegate* unmanaged[Cdecl] glfwSetWindowPos; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowPosCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowRefreshCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowShouldClose; - public delegate* unmanaged[Cdecl] glfwSetWindowSize; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowSizeCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowSizeLimits; - public delegate* unmanaged[Cdecl] glfwSetWindowTitle; - public delegate* unmanaged[Cdecl] glfwSetWindowUserPointer; - public delegate* unmanaged[Cdecl] glfwShowWindow; - public delegate* unmanaged[Cdecl] glfwSwapBuffers; - public delegate* unmanaged[Cdecl] glfwSwapInterval; - public delegate* unmanaged[Cdecl] glfwTerminate; - public delegate* unmanaged[Cdecl] glfwUpdateGamepadMappings; - public delegate* unmanaged[Cdecl] glfwVulkanSupported; - public delegate* unmanaged[Cdecl] glfwWaitEvents; - public delegate* unmanaged[Cdecl] glfwWaitEventsTimeout; - public delegate* unmanaged[Cdecl] glfwWindowHint; - public delegate* unmanaged[Cdecl] glfwWindowHintString; - public delegate* unmanaged[Cdecl] glfwWindowShouldClose; - - } -} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/369A0229A5D88B04DB2D73651BF1693F b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/369A0229A5D88B04DB2D73651BF1693F deleted file mode 100644 index 0a681fd0..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/369A0229A5D88B04DB2D73651BF1693F +++ /dev/null @@ -1,156 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw_function_table.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.InteropServices; - -namespace StgSharp.Internal -{ - [StructLayout(LayoutKind.Sequential)] - internal unsafe struct GLFWFunctionTable - { - - public delegate* unmanaged[Cdecl] glfwCreateCursor; - public delegate* unmanaged[Cdecl] glfwCreateStandardCursor; - public delegate* unmanaged[Cdecl] glfwCreateWindow; - public delegate* unmanaged[Cdecl] glfwDefaultWindowHints; - public delegate* unmanaged[Cdecl] glfwDestroyCursor; - public delegate* unmanaged[Cdecl] glfwDestroyWindow; - public delegate* unmanaged[Cdecl] glfwExtensionSupported; - public delegate* unmanaged[Cdecl] glfwFocusWindow; - public delegate* unmanaged[Cdecl] glfwGetClipboardString; - public delegate* unmanaged[Cdecl] glfwGetCurrentContext; - public delegate* unmanaged[Cdecl] glfwGetCursorPos; - public delegate* unmanaged[Cdecl] glfwGetError; - public delegate* unmanaged[Cdecl] glfwGetFramebufferSize; - public delegate* unmanaged[Cdecl] glfwGetGamepadName; - public delegate* unmanaged[Cdecl] glfwGetGamepadState; - public delegate* unmanaged[Cdecl] glfwGetGammaRamp; - public delegate* unmanaged[Cdecl] glfwGetInputMode; - public delegate* unmanaged[Cdecl] glfwGetJoystickAxes; - public delegate* unmanaged[Cdecl] glfwGetJoystickButtons; - public delegate* unmanaged[Cdecl] glfwGetJoystickGUID; - public delegate* unmanaged[Cdecl] glfwGetJoystickHats; - public delegate* unmanaged[Cdecl] glfwGetJoystickName; - public delegate* unmanaged[Cdecl] glfwGetJoystickUserPointer; - public delegate* unmanaged[Cdecl] glfwGetKey; - public delegate* unmanaged[Cdecl] glfwGetKeyName; - public delegate* unmanaged[Cdecl] glfwGetKeyScancode; - public delegate* unmanaged[Cdecl] glfwGetMonitorContentScale; - public delegate* unmanaged[Cdecl] glfwGetMonitorName; - public delegate* unmanaged[Cdecl] glfwGetMonitorPhysicalSize; - public delegate* unmanaged[Cdecl] glfwGetMonitorPos; - public delegate* unmanaged[Cdecl] glfwGetMonitors; - public delegate* unmanaged[Cdecl] glfwGetMonitorUserPointer; - public delegate* unmanaged[Cdecl] glfwGetMonitorWorkarea; - public delegate* unmanaged[Cdecl] glfwGetMouseButton; - public delegate* unmanaged[Cdecl] glfwGetPrimaryMonitor; - public delegate* unmanaged[Cdecl] glfwGetProcAddress; - public delegate* unmanaged[Cdecl] glfwGetRequiredInstanceExtensions; - public delegate* unmanaged[Cdecl] glfwGetTime; - public delegate* unmanaged[Cdecl] glfwGetTimerFrequency; - public delegate* unmanaged[Cdecl] glfwGetTimerValue; - public delegate* unmanaged[Cdecl] glfwGetVersionString; - public delegate* unmanaged[Cdecl] glfwGetVideoMode; - public delegate* unmanaged[Cdecl] glfwGetVideoModes; - public delegate* unmanaged[Cdecl] glfwGetWindowAttrib; - public delegate* unmanaged[Cdecl] glfwGetWindowContentScale; - public delegate* unmanaged[Cdecl] glfwGetWindowFrameSize; - public delegate* unmanaged[Cdecl] glfwGetWindowMonitor; - public delegate* unmanaged[Cdecl] glfwGetWindowOpacity; - public delegate* unmanaged[Cdecl] glfwGetWindowPos; - public delegate* unmanaged[Cdecl] glfwGetWindowSize; - public delegate* unmanaged[Cdecl] glfwGetWindowUserPointer; - public delegate* unmanaged[Cdecl] glfwHideWindow; - public delegate* unmanaged[Cdecl] glfwIconifyWindow; - public delegate* unmanaged[Cdecl] glfwInit; - public delegate* unmanaged[Cdecl] glfwInitHint; - public delegate* unmanaged[Cdecl] glfwJoystickIsGamepad; - public delegate* unmanaged[Cdecl] glfwJoystickPresent; - public delegate* unmanaged[Cdecl] glfwMakeContextCurrent; - public delegate* unmanaged[Cdecl] glfwMaximizeWindow; - public delegate* unmanaged[Cdecl] glfwPollEvents; - public delegate* unmanaged[Cdecl] glfwPostEmptyEvent; - public delegate* unmanaged[Cdecl] glfwRawMouseMotionSupported; - public delegate* unmanaged[Cdecl] glfwRequestWindowAttention; - public delegate* unmanaged[Cdecl] glfwRestoreWindow; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCharCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCharModsCallback; - public delegate* unmanaged[Cdecl] glfwSetClipboardString; - public delegate* unmanaged[Cdecl] glfwSetCursor; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCursorEnterCallback; - public delegate* unmanaged[Cdecl] glfwSetCursorPos; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCursorPosCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetFramebufferSizeCallback; - public delegate* unmanaged[Cdecl] glfwSetGamma; - public delegate* unmanaged[Cdecl] glfwSetGammaRamp; - public delegate* unmanaged[Cdecl] glfwSetInputMode; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetJoystickCallback; - public delegate* unmanaged[Cdecl] glfwSetJoystickUserPointer; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetKeyCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetMonitorCallback; - public delegate* unmanaged[Cdecl] glfwSetMonitorUserPointer; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetMouseButtonCallback; - public delegate* unmanaged[Cdecl] glfwSetTime; - public delegate* unmanaged[Cdecl] glfwSetWindowAspectRatio; - public delegate* unmanaged[Cdecl] glfwSetWindowAttrib; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowCloseCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowContentScaleCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowFocusCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowIcon; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowIconifyCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowMaximizeCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowMonitor; - public delegate* unmanaged[Cdecl] glfwSetWindowOpacity; - public delegate* unmanaged[Cdecl] glfwSetWindowPos; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowRefreshCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowShouldClose; - public delegate* unmanaged[Cdecl] glfwSetWindowSize; - public delegate* unmanaged[Cdecl] glfwSetWindowSizeLimits; - public delegate* unmanaged[Cdecl] glfwSetWindowTitle; - public delegate* unmanaged[Cdecl] glfwSetWindowUserPointer; - public delegate* unmanaged[Cdecl] glfwShowWindow; - public delegate* unmanaged[Cdecl] glfwSwapBuffers; - public delegate* unmanaged[Cdecl] glfwSwapInterval; - public delegate* unmanaged[Cdecl] glfwTerminate; - public delegate* unmanaged[Cdecl] glfwUpdateGamepadMappings; - public delegate* unmanaged[Cdecl] glfwVulkanSupported; - public delegate* unmanaged[Cdecl] glfwWaitEvents; - public delegate* unmanaged[Cdecl] glfwWaitEventsTimeout; - public delegate* unmanaged[Cdecl] glfwWindowHint; - public delegate* unmanaged[Cdecl] glfwWindowHintString; - public delegate* unmanaged[Cdecl] glfwWindowShouldClose; - public delegate* unmanaged[Cdecl], delegate* unmanaged, delegate* unmanaged> glfwSetWindowPosCallback; -int, int, void>> glfwSetWindowSizeCallback; - - } -} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/516E4750BFA070C15018A44BF13AD02C b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/516E4750BFA070C15018A44BF13AD02C deleted file mode 100644 index 44f6599f..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/516E4750BFA070C15018A44BF13AD02C +++ /dev/null @@ -1,120 +0,0 @@ -#ifndef GLFW_FUNCTION_TABLE_H -#define GLFW_FUNCTION_TABLE_H - -#include "glfw3_no_comments.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct GLFWFunctionTable { - void (*glfwDefaultWindowHints)(void); - void (*glfwDestroyCursor)(GLFWcursor* cursor); - void (*glfwDestroyWindow)(GLFWwindow* window); - void (*glfwFocusWindow)(GLFWwindow* window); - const char* (*glfwGetClipboardString)(GLFWwindow* window); - GLFWwindow* (*glfwGetCurrentContext)(void); - void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos); - int (*glfwGetError)(const char** description); - void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height); - const char* (*glfwGetGamepadName)(int jid); - int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state); - const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor); - int (*glfwGetInputMode)(GLFWwindow* window, int mode); - const float* (*glfwGetJoystickAxes)(int jid, int* count); - const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count); - const char* (*glfwGetJoystickGUID)(int jid); - const unsigned char* (*glfwGetJoystickHats)(int jid, int* count); - const char* (*glfwGetJoystickName)(int jid); - void* (*glfwGetJoystickUserPointer)(int jid); - int (*glfwGetKey)(GLFWwindow* window, int key); - const char* (*glfwGetKeyName)(int key, int scancode); - int (*glfwGetKeyScancode)(int key); - void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale); - const char* (*glfwGetMonitorName)(GLFWmonitor* monitor); - void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM); - void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos); - GLFWmonitor** (*glfwGetMonitors)(int* count); - void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor); - void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height); - int (*glfwGetMouseButton)(GLFWwindow* window, int button); - GLFWmonitor* (*glfwGetPrimaryMonitor)(void); - double (*glfwGetTime)(void); - uint64_t (*glfwGetTimerFrequency)(void); - uint64_t (*glfwGetTimerValue)(void); - const char* (*glfwGetVersionString)(void); - const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor); - const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count); - int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib); - void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale); - void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom); - GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window); - float (*glfwGetWindowOpacity)(GLFWwindow* window); - void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos); - void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height); - void* (*glfwGetWindowUserPointer)(GLFWwindow* window); - void (*glfwHideWindow)(GLFWwindow* window); - void (*glfwIconifyWindow)(GLFWwindow* window); - int (*glfwInit)(void); - void (*glfwInitHint)(int hint, int value); - void (*glfwMakeContextCurrent)(GLFWwindow* window); - void (*glfwMaximizeWindow)(GLFWwindow* window); - void (*glfwPollEvents)(void); - void (*glfwPostEmptyEvent)(void); - void (*glfwRequestWindowAttention)(GLFWwindow* window); - int (*glfwRawMouseMotionSupported)(void); - void (*glfwRestoreWindow)(GLFWwindow* window); - void (*glfwSetClipboardString)(GLFWwindow* window, const char* string); - GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback); - GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback); - void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor); - GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback); - void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos); - GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback); - GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback); - void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp); - GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback); - void (*glfwSetJoystickUserPointer)(int jid, void* pointer); - GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback); - void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer); - GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback); - void (*glfwSetTime)(double time); - void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom); - void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value); - GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback); - void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images); - GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback); - GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback); - GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback); - GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback); - void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); - GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback); - void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity); - GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback); - void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos); - GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback); - void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value); - void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); - GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback); - void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height); - void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title); - void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer); - GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback); - GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback); - void (*glfwSwapBuffers)(GLFWwindow* window); - void (*glfwSwapInterval)(int interval); - void (*glfwTerminate)(void); - int (*glfwUpdateGamepadMappings)(const char* string); - void (*glfwWaitEvents)(void); - void (*glfwWaitEventsTimeout)(double timeout); - int (*glfwVulkanSupported)(void); - int (*glfwWindowShouldClose)(GLFWwindow* window); -} GLFWFunctionTable; - -void LoadGLFWFunctions(GLFWFunctionTable* table); - -#ifdef __cplusplus -} -#endif - -#endif \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/57C1EB7929232CED7F1DC82A592B5B52 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/57C1EB7929232CED7F1DC82A592B5B52 deleted file mode 100644 index 7bb11412..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/57C1EB7929232CED7F1DC82A592B5B52 +++ /dev/null @@ -1,123 +0,0 @@ -#ifndef GLFW_FUNCTION_TABLE_H -#define GLFW_FUNCTION_TABLE_H - -#include "glfw3_no_comments.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct GLFWFunctionTable { - void (*glfwCreateCursor)(GLFWimage* image, int xhot, int yhot); - GLFWcursor* (*glfwCreateStandardCursor)(int shape); - GLFWwindow* (*glfwCreateWindow)(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share); - void (*glfwDefaultWindowHints)(void); - void (*glfwDestroyCursor)(GLFWcursor* cursor); - void (*glfwDestroyWindow)(GLFWwindow* window); - void (*glfwFocusWindow)(GLFWwindow* window); - const char* (*glfwGetClipboardString)(GLFWwindow* window); - GLFWwindow* (*glfwGetCurrentContext)(void); - void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos); - int (*glfwGetError)(const char** description); - void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height); - const char* (*glfwGetGamepadName)(int jid); - int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state); - const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor); - int (*glfwGetInputMode)(GLFWwindow* window, int mode); - const float* (*glfwGetJoystickAxes)(int jid, int* count); - const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count); - const char* (*glfwGetJoystickGUID)(int jid); - const unsigned char* (*glfwGetJoystickHats)(int jid, int* count); - const char* (*glfwGetJoystickName)(int jid); - void* (*glfwGetJoystickUserPointer)(int jid); - int (*glfwGetKey)(GLFWwindow* window, int key); - const char* (*glfwGetKeyName)(int key, int scancode); - int (*glfwGetKeyScancode)(int key); - void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale); - const char* (*glfwGetMonitorName)(GLFWmonitor* monitor); - void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM); - void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos); - GLFWmonitor** (*glfwGetMonitors)(int* count); - void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor); - void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height); - int (*glfwGetMouseButton)(GLFWwindow* window, int button); - GLFWmonitor* (*glfwGetPrimaryMonitor)(void); - double (*glfwGetTime)(void); - uint64_t (*glfwGetTimerFrequency)(void); - uint64_t (*glfwGetTimerValue)(void); - const char* (*glfwGetVersionString)(void); - const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor); - const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count); - int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib); - void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale); - void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom); - GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window); - float (*glfwGetWindowOpacity)(GLFWwindow* window); - void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos); - void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height); - void* (*glfwGetWindowUserPointer)(GLFWwindow* window); - void (*glfwHideWindow)(GLFWwindow* window); - void (*glfwIconifyWindow)(GLFWwindow* window); - int (*glfwInit)(void); - void (*glfwInitHint)(int hint, int value); - void (*glfwMakeContextCurrent)(GLFWwindow* window); - void (*glfwMaximizeWindow)(GLFWwindow* window); - void (*glfwPollEvents)(void); - void (*glfwPostEmptyEvent)(void); - void (*glfwRequestWindowAttention)(GLFWwindow* window); - int (*glfwRawMouseMotionSupported)(void); - void (*glfwRestoreWindow)(GLFWwindow* window); - void (*glfwSetClipboardString)(GLFWwindow* window, const char* string); - GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback); - GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback); - void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor); - GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback); - void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos); - GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback); - GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback); - void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp); - GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback); - void (*glfwSetJoystickUserPointer)(int jid, void* pointer); - GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback); - void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer); - GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback); - void (*glfwSetTime)(double time); - void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom); - void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value); - GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback); - void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images); - GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback); - GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback); - GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback); - GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback); - void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); - GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback); - void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity); - GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback); - void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos); - GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback); - void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value); - void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); - GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback); - void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height); - void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title); - void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer); - GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback); - GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback); - void (*glfwSwapBuffers)(GLFWwindow* window); - void (*glfwSwapInterval)(int interval); - void (*glfwTerminate)(void); - int (*glfwUpdateGamepadMappings)(const char* string); - void (*glfwWaitEvents)(void); - void (*glfwWaitEventsTimeout)(double timeout); - int (*glfwVulkanSupported)(void); - int (*glfwWindowShouldClose)(GLFWwindow* window); -} GLFWFunctionTable; - -void LoadGLFWFunctions(GLFWFunctionTable* table); - -#ifdef __cplusplus -} -#endif - -#endif \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/5E04C4647D3817A221578E2BDDDAD89B b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/5E04C4647D3817A221578E2BDDDAD89B deleted file mode 100644 index 5c62bc49..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/5E04C4647D3817A221578E2BDDDAD89B +++ /dev/null @@ -1,158 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw_function_table.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.InteropServices; - -namespace StgSharp.Internal -{ - [StructLayout(LayoutKind.Sequential)] - internal unsafe struct GLFWFunctionTable - { - - public delegate* unmanaged[Cdecl] glfwCreateCursor; - public delegate* unmanaged[Cdecl] glfwCreateStandardCursor; - public delegate* unmanaged[Cdecl] glfwCreateWindow; - public delegate* unmanaged[Cdecl] glfwDefaultWindowHints; - public delegate* unmanaged[Cdecl] glfwDestroyCursor; - public delegate* unmanaged[Cdecl] glfwDestroyWindow; - public delegate* unmanaged[Cdecl] glfwExtensionSupported; - public delegate* unmanaged[Cdecl] glfwFocusWindow; - public delegate* unmanaged[Cdecl] glfwGetClipboardString; - public delegate* unmanaged[Cdecl] glfwGetCurrentContext; - public delegate* unmanaged[Cdecl] glfwGetCursorPos; - public delegate* unmanaged[Cdecl] glfwGetError; - public delegate* unmanaged[Cdecl] glfwGetFramebufferSize; - public delegate* unmanaged[Cdecl] glfwGetGamepadName; - public delegate* unmanaged[Cdecl] glfwGetGamepadState; - public delegate* unmanaged[Cdecl] glfwGetGammaRamp; - public delegate* unmanaged[Cdecl] glfwGetInputMode; - public delegate* unmanaged[Cdecl] glfwGetJoystickAxes; - public delegate* unmanaged[Cdecl] glfwGetJoystickButtons; - public delegate* unmanaged[Cdecl] glfwGetJoystickGUID; - public delegate* unmanaged[Cdecl] glfwGetJoystickHats; - public delegate* unmanaged[Cdecl] glfwGetJoystickName; - public delegate* unmanaged[Cdecl] glfwGetJoystickUserPointer; - public delegate* unmanaged[Cdecl] glfwGetKey; - public delegate* unmanaged[Cdecl] glfwGetKeyName; - public delegate* unmanaged[Cdecl] glfwGetKeyScancode; - public delegate* unmanaged[Cdecl] glfwGetMonitorContentScale; - public delegate* unmanaged[Cdecl] glfwGetMonitorName; - public delegate* unmanaged[Cdecl] glfwGetMonitorPhysicalSize; - public delegate* unmanaged[Cdecl] glfwGetMonitorPos; - public delegate* unmanaged[Cdecl] glfwGetMonitors; - public delegate* unmanaged[Cdecl] glfwGetMonitorUserPointer; - public delegate* unmanaged[Cdecl] glfwGetMonitorWorkarea; - public delegate* unmanaged[Cdecl] glfwGetMouseButton; - public delegate* unmanaged[Cdecl] glfwGetPrimaryMonitor; - public delegate* unmanaged[Cdecl] glfwGetProcAddress; - public delegate* unmanaged[Cdecl] glfwGetRequiredInstanceExtensions; - public delegate* unmanaged[Cdecl] glfwGetTime; - public delegate* unmanaged[Cdecl] glfwGetTimerFrequency; - public delegate* unmanaged[Cdecl] glfwGetTimerValue; - public delegate* unmanaged[Cdecl] glfwGetVersionString; - public delegate* unmanaged[Cdecl] glfwGetVideoMode; - public delegate* unmanaged[Cdecl] glfwGetVideoModes; - public delegate* unmanaged[Cdecl] glfwGetWindowAttrib; - public delegate* unmanaged[Cdecl] glfwGetWindowContentScale; - public delegate* unmanaged[Cdecl] glfwGetWindowFrameSize; - public delegate* unmanaged[Cdecl] glfwGetWindowMonitor; - public delegate* unmanaged[Cdecl] glfwGetWindowOpacity; - public delegate* unmanaged[Cdecl] glfwGetWindowPos; - public delegate* unmanaged[Cdecl] glfwGetWindowSize; - public delegate* unmanaged[Cdecl] glfwGetWindowUserPointer; - public delegate* unmanaged[Cdecl] glfwHideWindow; - public delegate* unmanaged[Cdecl] glfwIconifyWindow; - public delegate* unmanaged[Cdecl] glfwInit; - public delegate* unmanaged[Cdecl] glfwInitHint; - public delegate* unmanaged[Cdecl] glfwJoystickIsGamepad; - public delegate* unmanaged[Cdecl] glfwJoystickPresent; - public delegate* unmanaged[Cdecl] glfwMakeContextCurrent; - public delegate* unmanaged[Cdecl] glfwMaximizeWindow; - public delegate* unmanaged[Cdecl] glfwPollEvents; - public delegate* unmanaged[Cdecl] glfwPostEmptyEvent; - public delegate* unmanaged[Cdecl] glfwRawMouseMotionSupported; - public delegate* unmanaged[Cdecl] glfwRequestWindowAttention; - public delegate* unmanaged[Cdecl] glfwRestoreWindow; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCharCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCharModsCallback; - public delegate* unmanaged[Cdecl] glfwSetClipboardString; - public delegate* unmanaged[Cdecl] glfwSetCursor; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCursorEnterCallback; - public delegate* unmanaged[Cdecl] glfwSetCursorPos; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCursorPosCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetFramebufferSizeCallback; - public delegate* unmanaged[Cdecl] glfwSetGamma; - public delegate* unmanaged[Cdecl] glfwSetGammaRamp; - public delegate* unmanaged[Cdecl] glfwSetInputMode; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetJoystickCallback; - public delegate* unmanaged[Cdecl] glfwSetJoystickUserPointer; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetKeyCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetMonitorCallback; - public delegate* unmanaged[Cdecl] glfwSetMonitorUserPointer; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetMouseButtonCallback; - public delegate* unmanaged[Cdecl] glfwSetTime; - public delegate* unmanaged[Cdecl] glfwSetWindowAspectRatio; - public delegate* unmanaged[Cdecl] glfwSetWindowAttrib; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowCloseCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowContentScaleCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowFocusCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowIcon; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowIconifyCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowMaximizeCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowMonitor; - public delegate* unmanaged[Cdecl] glfwSetWindowOpacity; - public delegate* unmanaged[Cdecl] glfwSetWindowPos; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowPosCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowRefreshCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowShouldClose; - public delegate* unmanaged[Cdecl] glfwSetWindowSize; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowSizeCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowSizeLimits; - public delegate* unmanaged[Cdecl] glfwSetWindowTitle; - public delegate* unmanaged[Cdecl] glfwSetWindowUserPointer; - public delegate* unmanaged[Cdecl] glfwShowWindow; - public delegate* unmanaged[Cdecl] glfwSwapBuffers; - public delegate* unmanaged[Cdecl] glfwSwapInterval; - public delegate* unmanaged[Cdecl] glfwTerminate; - public delegate* unmanaged[Cdecl] glfwUpdateGamepadMappings; - public delegate* unmanaged[Cdecl] glfwVulkanSupported; - public delegate* unmanaged[Cdecl] glfwWaitEvents; - public delegate* unmanaged[Cdecl] glfwWaitEventsTimeout; - public delegate* unmanaged[Cdecl] glfwWindowHint; - public delegate* unmanaged[Cdecl] glfwWindowHintString; - public delegate* unmanaged[Cdecl] glfwWindowShouldClose; - public delegate* unmanaged[Cdecl], delegate* unmanaged, delegate* unmanaged> glfwSetScrollCallback; -int, byte**, void>> glfwSetDropCallback; - - } -} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/7D8AE1BFE90344A3AB652A6B2BA75558 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/7D8AE1BFE90344A3AB652A6B2BA75558 deleted file mode 100644 index 22f6e571..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/7D8AE1BFE90344A3AB652A6B2BA75558 +++ /dev/null @@ -1,107 +0,0 @@ -#include "glfw_function_table.h" -#include - -void LoadGLFWFunctions(GLFWFunctionTable* table) { - memset(table, 0, sizeof(GLFWFunctionTable)); - table->glfwDefaultWindowHints = glfwDefaultWindowHints; - table->glfwDestroyCursor = glfwDestroyCursor; - table->glfwDestroyWindow = glfwDestroyWindow; - table->glfwFocusWindow = glfwFocusWindow; - table->glfwGetClipboardString = glfwGetClipboardString; - table->glfwGetCurrentContext = glfwGetCurrentContext; - table->glfwGetCursorPos = glfwGetCursorPos; - table->glfwGetError = glfwGetError; - table->glfwGetFramebufferSize = glfwGetFramebufferSize; - table->glfwGetGamepadName = glfwGetGamepadName; - table->glfwGetGamepadState = glfwGetGamepadState; - table->glfwGetGammaRamp = glfwGetGammaRamp; - table->glfwGetInputMode = glfwGetInputMode; - table->glfwGetJoystickAxes = glfwGetJoystickAxes; - table->glfwGetJoystickButtons = glfwGetJoystickButtons; - table->glfwGetJoystickGUID = glfwGetJoystickGUID; - table->glfwGetJoystickHats = glfwGetJoystickHats; - table->glfwGetJoystickName = glfwGetJoystickName; - table->glfwGetJoystickUserPointer = glfwGetJoystickUserPointer; - table->glfwGetKey = glfwGetKey; - table->glfwGetKeyName = glfwGetKeyName; - table->glfwGetKeyScancode = glfwGetKeyScancode; - table->glfwGetMonitorContentScale = glfwGetMonitorContentScale; - table->glfwGetMonitorName = glfwGetMonitorName; - table->glfwGetMonitorPhysicalSize = glfwGetMonitorPhysicalSize; - table->glfwGetMonitorPos = glfwGetMonitorPos; - table->glfwGetMonitors = glfwGetMonitors; - table->glfwGetMonitorUserPointer = glfwGetMonitorUserPointer; - table->glfwGetMonitorWorkarea = glfwGetMonitorWorkarea; - table->glfwGetMouseButton = glfwGetMouseButton; - table->glfwGetPrimaryMonitor = glfwGetPrimaryMonitor; - table->glfwGetTime = glfwGetTime; - table->glfwGetTimerFrequency = glfwGetTimerFrequency; - table->glfwGetTimerValue = glfwGetTimerValue; - table->glfwGetVersionString = glfwGetVersionString; - table->glfwGetVideoMode = glfwGetVideoMode; - table->glfwGetVideoModes = glfwGetVideoModes; - table->glfwGetWindowAttrib = glfwGetWindowAttrib; - table->glfwGetWindowContentScale = glfwGetWindowContentScale; - table->glfwGetWindowFrameSize = glfwGetWindowFrameSize; - table->glfwGetWindowMonitor = glfwGetWindowMonitor; - table->glfwGetWindowOpacity = glfwGetWindowOpacity; - table->glfwGetWindowPos = glfwGetWindowPos; - table->glfwGetWindowSize = glfwGetWindowSize; - table->glfwGetWindowUserPointer = glfwGetWindowUserPointer; - table->glfwHideWindow = glfwHideWindow; - table->glfwIconifyWindow = glfwIconifyWindow; - table->glfwInit = glfwInit; - table->glfwInitHint = glfwInitHint; - table->glfwMakeContextCurrent = glfwMakeContextCurrent; - table->glfwMaximizeWindow = glfwMaximizeWindow; - table->glfwPollEvents = glfwPollEvents; - table->glfwPostEmptyEvent = glfwPostEmptyEvent; - table->glfwRequestWindowAttention = glfwRequestWindowAttention; - table->glfwRawMouseMotionSupported = glfwRawMouseMotionSupported; - table->glfwRestoreWindow = glfwRestoreWindow; - table->glfwSetClipboardString = glfwSetClipboardString; - table->glfwSetCharCallback = glfwSetCharCallback; - table->glfwSetCharModsCallback = glfwSetCharModsCallback; - table->glfwSetCursor = glfwSetCursor; - table->glfwSetCursorEnterCallback = glfwSetCursorEnterCallback; - table->glfwSetCursorPos = glfwSetCursorPos; - table->glfwSetCursorPosCallback = glfwSetCursorPosCallback; - table->glfwSetDropCallback = glfwSetDropCallback; - table->glfwSetGammaRamp = glfwSetGammaRamp; - table->glfwSetJoystickCallback = glfwSetJoystickCallback; - table->glfwSetJoystickUserPointer = glfwSetJoystickUserPointer; - table->glfwSetKeyCallback = glfwSetKeyCallback; - table->glfwSetMonitorUserPointer = glfwSetMonitorUserPointer; - table->glfwSetMonitorCallback = glfwSetMonitorCallback; - table->glfwSetTime = glfwSetTime; - table->glfwSetWindowAspectRatio = glfwSetWindowAspectRatio; - table->glfwSetWindowAttrib = glfwSetWindowAttrib; - table->glfwSetWindowCloseCallback = glfwSetWindowCloseCallback; - table->glfwSetWindowIcon = glfwSetWindowIcon; - table->glfwSetWindowIconifyCallback = glfwSetWindowIconifyCallback; - table->glfwSetWindowFocusCallback = glfwSetWindowFocusCallback; - table->glfwSetFramebufferSizeCallback = glfwSetFramebufferSizeCallback; - table->glfwSetWindowMaximizeCallback = glfwSetWindowMaximizeCallback; - table->glfwSetWindowMonitor = glfwSetWindowMonitor; - table->glfwSetMouseButtonCallback = glfwSetMouseButtonCallback; - table->glfwSetWindowOpacity = glfwSetWindowOpacity; - table->glfwSetWindowPosCallback = glfwSetWindowPosCallback; - table->glfwSetWindowPos = glfwSetWindowPos; - table->glfwSetScrollCallback = glfwSetScrollCallback; - table->glfwSetWindowShouldClose = glfwSetWindowShouldClose; - table->glfwSetWindowSizeLimits = glfwSetWindowSizeLimits; - table->glfwSetWindowSizeCallback = glfwSetWindowSizeCallback; - table->glfwSetWindowSize = glfwSetWindowSize; - table->glfwSetWindowTitle = glfwSetWindowTitle; - table->glfwSetWindowUserPointer = glfwSetWindowUserPointer; - table->glfwSetWindowRefreshCallback = glfwSetWindowRefreshCallback; - table->glfwSetWindowContentScaleCallback = glfwSetWindowContentScaleCallback; - table->glfwSwapBuffers = glfwSwapBuffers; - table->glfwSwapInterval = glfwSwapInterval; - table->glfwTerminate = glfwTerminate; - table->glfwUpdateGamepadMappings = glfwUpdateGamepadMappings; - table->glfwWaitEvents = glfwWaitEvents; - table->glfwWaitEventsTimeout = glfwWaitEventsTimeout; - table->glfwVulkanSupported = glfwVulkanSupported; - table->glfwWindowShouldClose = glfwWindowShouldClose; -} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/85640CC1F60032566B378A1E4081FD35 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/85640CC1F60032566B378A1E4081FD35 deleted file mode 100644 index d6228b3a..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/85640CC1F60032566B378A1E4081FD35 +++ /dev/null @@ -1,3 +0,0 @@ -#include "StgSharpNative.h" -#include "glfw_function_table.h" -#include diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/885C0127350D5D9423F07D688925FD75 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/885C0127350D5D9423F07D688925FD75 deleted file mode 100644 index 5c62bc49..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/885C0127350D5D9423F07D688925FD75 +++ /dev/null @@ -1,158 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw_function_table.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.InteropServices; - -namespace StgSharp.Internal -{ - [StructLayout(LayoutKind.Sequential)] - internal unsafe struct GLFWFunctionTable - { - - public delegate* unmanaged[Cdecl] glfwCreateCursor; - public delegate* unmanaged[Cdecl] glfwCreateStandardCursor; - public delegate* unmanaged[Cdecl] glfwCreateWindow; - public delegate* unmanaged[Cdecl] glfwDefaultWindowHints; - public delegate* unmanaged[Cdecl] glfwDestroyCursor; - public delegate* unmanaged[Cdecl] glfwDestroyWindow; - public delegate* unmanaged[Cdecl] glfwExtensionSupported; - public delegate* unmanaged[Cdecl] glfwFocusWindow; - public delegate* unmanaged[Cdecl] glfwGetClipboardString; - public delegate* unmanaged[Cdecl] glfwGetCurrentContext; - public delegate* unmanaged[Cdecl] glfwGetCursorPos; - public delegate* unmanaged[Cdecl] glfwGetError; - public delegate* unmanaged[Cdecl] glfwGetFramebufferSize; - public delegate* unmanaged[Cdecl] glfwGetGamepadName; - public delegate* unmanaged[Cdecl] glfwGetGamepadState; - public delegate* unmanaged[Cdecl] glfwGetGammaRamp; - public delegate* unmanaged[Cdecl] glfwGetInputMode; - public delegate* unmanaged[Cdecl] glfwGetJoystickAxes; - public delegate* unmanaged[Cdecl] glfwGetJoystickButtons; - public delegate* unmanaged[Cdecl] glfwGetJoystickGUID; - public delegate* unmanaged[Cdecl] glfwGetJoystickHats; - public delegate* unmanaged[Cdecl] glfwGetJoystickName; - public delegate* unmanaged[Cdecl] glfwGetJoystickUserPointer; - public delegate* unmanaged[Cdecl] glfwGetKey; - public delegate* unmanaged[Cdecl] glfwGetKeyName; - public delegate* unmanaged[Cdecl] glfwGetKeyScancode; - public delegate* unmanaged[Cdecl] glfwGetMonitorContentScale; - public delegate* unmanaged[Cdecl] glfwGetMonitorName; - public delegate* unmanaged[Cdecl] glfwGetMonitorPhysicalSize; - public delegate* unmanaged[Cdecl] glfwGetMonitorPos; - public delegate* unmanaged[Cdecl] glfwGetMonitors; - public delegate* unmanaged[Cdecl] glfwGetMonitorUserPointer; - public delegate* unmanaged[Cdecl] glfwGetMonitorWorkarea; - public delegate* unmanaged[Cdecl] glfwGetMouseButton; - public delegate* unmanaged[Cdecl] glfwGetPrimaryMonitor; - public delegate* unmanaged[Cdecl] glfwGetProcAddress; - public delegate* unmanaged[Cdecl] glfwGetRequiredInstanceExtensions; - public delegate* unmanaged[Cdecl] glfwGetTime; - public delegate* unmanaged[Cdecl] glfwGetTimerFrequency; - public delegate* unmanaged[Cdecl] glfwGetTimerValue; - public delegate* unmanaged[Cdecl] glfwGetVersionString; - public delegate* unmanaged[Cdecl] glfwGetVideoMode; - public delegate* unmanaged[Cdecl] glfwGetVideoModes; - public delegate* unmanaged[Cdecl] glfwGetWindowAttrib; - public delegate* unmanaged[Cdecl] glfwGetWindowContentScale; - public delegate* unmanaged[Cdecl] glfwGetWindowFrameSize; - public delegate* unmanaged[Cdecl] glfwGetWindowMonitor; - public delegate* unmanaged[Cdecl] glfwGetWindowOpacity; - public delegate* unmanaged[Cdecl] glfwGetWindowPos; - public delegate* unmanaged[Cdecl] glfwGetWindowSize; - public delegate* unmanaged[Cdecl] glfwGetWindowUserPointer; - public delegate* unmanaged[Cdecl] glfwHideWindow; - public delegate* unmanaged[Cdecl] glfwIconifyWindow; - public delegate* unmanaged[Cdecl] glfwInit; - public delegate* unmanaged[Cdecl] glfwInitHint; - public delegate* unmanaged[Cdecl] glfwJoystickIsGamepad; - public delegate* unmanaged[Cdecl] glfwJoystickPresent; - public delegate* unmanaged[Cdecl] glfwMakeContextCurrent; - public delegate* unmanaged[Cdecl] glfwMaximizeWindow; - public delegate* unmanaged[Cdecl] glfwPollEvents; - public delegate* unmanaged[Cdecl] glfwPostEmptyEvent; - public delegate* unmanaged[Cdecl] glfwRawMouseMotionSupported; - public delegate* unmanaged[Cdecl] glfwRequestWindowAttention; - public delegate* unmanaged[Cdecl] glfwRestoreWindow; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCharCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCharModsCallback; - public delegate* unmanaged[Cdecl] glfwSetClipboardString; - public delegate* unmanaged[Cdecl] glfwSetCursor; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCursorEnterCallback; - public delegate* unmanaged[Cdecl] glfwSetCursorPos; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCursorPosCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetFramebufferSizeCallback; - public delegate* unmanaged[Cdecl] glfwSetGamma; - public delegate* unmanaged[Cdecl] glfwSetGammaRamp; - public delegate* unmanaged[Cdecl] glfwSetInputMode; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetJoystickCallback; - public delegate* unmanaged[Cdecl] glfwSetJoystickUserPointer; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetKeyCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetMonitorCallback; - public delegate* unmanaged[Cdecl] glfwSetMonitorUserPointer; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetMouseButtonCallback; - public delegate* unmanaged[Cdecl] glfwSetTime; - public delegate* unmanaged[Cdecl] glfwSetWindowAspectRatio; - public delegate* unmanaged[Cdecl] glfwSetWindowAttrib; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowCloseCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowContentScaleCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowFocusCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowIcon; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowIconifyCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowMaximizeCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowMonitor; - public delegate* unmanaged[Cdecl] glfwSetWindowOpacity; - public delegate* unmanaged[Cdecl] glfwSetWindowPos; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowPosCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowRefreshCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowShouldClose; - public delegate* unmanaged[Cdecl] glfwSetWindowSize; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowSizeCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowSizeLimits; - public delegate* unmanaged[Cdecl] glfwSetWindowTitle; - public delegate* unmanaged[Cdecl] glfwSetWindowUserPointer; - public delegate* unmanaged[Cdecl] glfwShowWindow; - public delegate* unmanaged[Cdecl] glfwSwapBuffers; - public delegate* unmanaged[Cdecl] glfwSwapInterval; - public delegate* unmanaged[Cdecl] glfwTerminate; - public delegate* unmanaged[Cdecl] glfwUpdateGamepadMappings; - public delegate* unmanaged[Cdecl] glfwVulkanSupported; - public delegate* unmanaged[Cdecl] glfwWaitEvents; - public delegate* unmanaged[Cdecl] glfwWaitEventsTimeout; - public delegate* unmanaged[Cdecl] glfwWindowHint; - public delegate* unmanaged[Cdecl] glfwWindowHintString; - public delegate* unmanaged[Cdecl] glfwWindowShouldClose; - public delegate* unmanaged[Cdecl], delegate* unmanaged, delegate* unmanaged> glfwSetScrollCallback; -int, byte**, void>> glfwSetDropCallback; - - } -} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/8DC9A45AE1EB7BD4873A593898AABA72 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/8DC9A45AE1EB7BD4873A593898AABA72 deleted file mode 100644 index 44f6599f..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/8DC9A45AE1EB7BD4873A593898AABA72 +++ /dev/null @@ -1,120 +0,0 @@ -#ifndef GLFW_FUNCTION_TABLE_H -#define GLFW_FUNCTION_TABLE_H - -#include "glfw3_no_comments.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct GLFWFunctionTable { - void (*glfwDefaultWindowHints)(void); - void (*glfwDestroyCursor)(GLFWcursor* cursor); - void (*glfwDestroyWindow)(GLFWwindow* window); - void (*glfwFocusWindow)(GLFWwindow* window); - const char* (*glfwGetClipboardString)(GLFWwindow* window); - GLFWwindow* (*glfwGetCurrentContext)(void); - void (*glfwGetCursorPos)(GLFWwindow* window, double* xpos, double* ypos); - int (*glfwGetError)(const char** description); - void (*glfwGetFramebufferSize)(GLFWwindow* window, int* width, int* height); - const char* (*glfwGetGamepadName)(int jid); - int (*glfwGetGamepadState)(int jid, GLFWgamepadstate* state); - const GLFWgammaramp* (*glfwGetGammaRamp)(GLFWmonitor* monitor); - int (*glfwGetInputMode)(GLFWwindow* window, int mode); - const float* (*glfwGetJoystickAxes)(int jid, int* count); - const unsigned char* (*glfwGetJoystickButtons)(int jid, int* count); - const char* (*glfwGetJoystickGUID)(int jid); - const unsigned char* (*glfwGetJoystickHats)(int jid, int* count); - const char* (*glfwGetJoystickName)(int jid); - void* (*glfwGetJoystickUserPointer)(int jid); - int (*glfwGetKey)(GLFWwindow* window, int key); - const char* (*glfwGetKeyName)(int key, int scancode); - int (*glfwGetKeyScancode)(int key); - void (*glfwGetMonitorContentScale)(GLFWmonitor* monitor, float* xscale, float* yscale); - const char* (*glfwGetMonitorName)(GLFWmonitor* monitor); - void (*glfwGetMonitorPhysicalSize)(GLFWmonitor* monitor, int* widthMM, int* heightMM); - void (*glfwGetMonitorPos)(GLFWmonitor* monitor, int* xpos, int* ypos); - GLFWmonitor** (*glfwGetMonitors)(int* count); - void* (*glfwGetMonitorUserPointer)(GLFWmonitor* monitor); - void (*glfwGetMonitorWorkarea)(GLFWmonitor* monitor, int* xpos, int* ypos, int* width, int* height); - int (*glfwGetMouseButton)(GLFWwindow* window, int button); - GLFWmonitor* (*glfwGetPrimaryMonitor)(void); - double (*glfwGetTime)(void); - uint64_t (*glfwGetTimerFrequency)(void); - uint64_t (*glfwGetTimerValue)(void); - const char* (*glfwGetVersionString)(void); - const GLFWvidmode* (*glfwGetVideoMode)(GLFWmonitor* monitor); - const GLFWvidmode* (*glfwGetVideoModes)(GLFWmonitor* monitor, int* count); - int (*glfwGetWindowAttrib)(GLFWwindow* window, int attrib); - void (*glfwGetWindowContentScale)(GLFWwindow* window, float* xscale, float* yscale); - void (*glfwGetWindowFrameSize)(GLFWwindow* window, int* left, int* top, int* right, int* bottom); - GLFWmonitor* (*glfwGetWindowMonitor)(GLFWwindow* window); - float (*glfwGetWindowOpacity)(GLFWwindow* window); - void (*glfwGetWindowPos)(GLFWwindow* window, int* xpos, int* ypos); - void (*glfwGetWindowSize)(GLFWwindow* window, int* width, int* height); - void* (*glfwGetWindowUserPointer)(GLFWwindow* window); - void (*glfwHideWindow)(GLFWwindow* window); - void (*glfwIconifyWindow)(GLFWwindow* window); - int (*glfwInit)(void); - void (*glfwInitHint)(int hint, int value); - void (*glfwMakeContextCurrent)(GLFWwindow* window); - void (*glfwMaximizeWindow)(GLFWwindow* window); - void (*glfwPollEvents)(void); - void (*glfwPostEmptyEvent)(void); - void (*glfwRequestWindowAttention)(GLFWwindow* window); - int (*glfwRawMouseMotionSupported)(void); - void (*glfwRestoreWindow)(GLFWwindow* window); - void (*glfwSetClipboardString)(GLFWwindow* window, const char* string); - GLFWcharfun (*glfwSetCharCallback)(GLFWwindow* window, GLFWcharfun callback); - GLFWcharmodsfun (*glfwSetCharModsCallback)(GLFWwindow* window, GLFWcharmodsfun callback); - void (*glfwSetCursor)(GLFWwindow* window, GLFWcursor* cursor); - GLFWcursorenterfun (*glfwSetCursorEnterCallback)(GLFWwindow* window, GLFWcursorenterfun callback); - void (*glfwSetCursorPos)(GLFWwindow* window, double xpos, double ypos); - GLFWcursorposfun (*glfwSetCursorPosCallback)(GLFWwindow* window, GLFWcursorposfun callback); - GLFWdropfun (*glfwSetDropCallback)(GLFWwindow* window, GLFWdropfun callback); - void (*glfwSetGammaRamp)(GLFWmonitor* monitor, const GLFWgammaramp* ramp); - GLFWjoystickfun (*glfwSetJoystickCallback)(GLFWjoystickfun callback); - void (*glfwSetJoystickUserPointer)(int jid, void* pointer); - GLFWkeyfun (*glfwSetKeyCallback)(GLFWwindow* window, GLFWkeyfun callback); - void (*glfwSetMonitorUserPointer)(GLFWmonitor* monitor, void* pointer); - GLFWmonitorfun (*glfwSetMonitorCallback)(GLFWmonitorfun callback); - void (*glfwSetTime)(double time); - void (*glfwSetWindowAspectRatio)(GLFWwindow* window, int numer, int denom); - void (*glfwSetWindowAttrib)(GLFWwindow* window, int attrib, int value); - GLFWwindowclosefun (*glfwSetWindowCloseCallback)(GLFWwindow* window, GLFWwindowclosefun callback); - void (*glfwSetWindowIcon)(GLFWwindow* window, int count, const GLFWimage* images); - GLFWwindowiconifyfun (*glfwSetWindowIconifyCallback)(GLFWwindow* window, GLFWwindowiconifyfun callback); - GLFWwindowfocusfun (*glfwSetWindowFocusCallback)(GLFWwindow* window, GLFWwindowfocusfun callback); - GLFWframebuffersizefun (*glfwSetFramebufferSizeCallback)(GLFWwindow* window, GLFWframebuffersizefun callback); - GLFWwindowmaximizefun (*glfwSetWindowMaximizeCallback)(GLFWwindow* window, GLFWwindowmaximizefun callback); - void (*glfwSetWindowMonitor)(GLFWwindow* window, GLFWmonitor* monitor, int xpos, int ypos, int width, int height, int refreshRate); - GLFWmousebuttonfun (*glfwSetMouseButtonCallback)(GLFWwindow* window, GLFWmousebuttonfun callback); - void (*glfwSetWindowOpacity)(GLFWwindow* window, float opacity); - GLFWwindowposfun (*glfwSetWindowPosCallback)(GLFWwindow* window, GLFWwindowposfun callback); - void (*glfwSetWindowPos)(GLFWwindow* window, int xpos, int ypos); - GLFWscrollfun (*glfwSetScrollCallback)(GLFWwindow* window, GLFWscrollfun callback); - void (*glfwSetWindowShouldClose)(GLFWwindow* window, int value); - void (*glfwSetWindowSizeLimits)(GLFWwindow* window, int minwidth, int minheight, int maxwidth, int maxheight); - GLFWwindowsizefun (*glfwSetWindowSizeCallback)(GLFWwindow* window, GLFWwindowsizefun callback); - void (*glfwSetWindowSize)(GLFWwindow* window, int width, int height); - void (*glfwSetWindowTitle)(GLFWwindow* window, const char* title); - void (*glfwSetWindowUserPointer)(GLFWwindow* window, void* pointer); - GLFWwindowrefreshfun (*glfwSetWindowRefreshCallback)(GLFWwindow* window, GLFWwindowrefreshfun callback); - GLFWwindowcontentscalefun (*glfwSetWindowContentScaleCallback)(GLFWwindow* window, GLFWwindowcontentscalefun callback); - void (*glfwSwapBuffers)(GLFWwindow* window); - void (*glfwSwapInterval)(int interval); - void (*glfwTerminate)(void); - int (*glfwUpdateGamepadMappings)(const char* string); - void (*glfwWaitEvents)(void); - void (*glfwWaitEventsTimeout)(double timeout); - int (*glfwVulkanSupported)(void); - int (*glfwWindowShouldClose)(GLFWwindow* window); -} GLFWFunctionTable; - -void LoadGLFWFunctions(GLFWFunctionTable* table); - -#ifdef __cplusplus -} -#endif - -#endif \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA deleted file mode 100644 index dae34e16..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA +++ /dev/null @@ -1,123 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="InternalIO.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; -using StgSharp.Graphics.OpenGL; - -using System; -using System.Collections.Generic; -using System.IO; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -using System.Text; -using System.Threading; - -namespace StgSharp.Internal -{ - internal static unsafe partial class InternalIO - { - - internal const string SS_errorLog = - "SS_errorlog.log"; - - internal const string NativeLibName = - "StgSharp.C"; - - internal static Dictionary GLtype = []; - - internal static readonly GCHandle ssc_logHandle = - GCHandle.Alloc(new byte[512], GCHandleType.Pinned); - - internal static IntPtr _nativeLibPtr = IntPtr.Zero; - - internal static SemaphoreSlim logSyncSemaphore = new SemaphoreSlim(1, 1); - - static InternalIO() - { - GLtype.Add(TypeCode.Single, glConst.FLOAT); - GLtype.Add(TypeCode.Int32, glConst.INT); - GLtype.Add(TypeCode.UInt32, glConst.UNSIGNED_INT); - GLtype.Add(TypeCode.Int16, glConst.SHORT); - GLtype.Add(TypeCode.UInt16, glConst.UNSIGNED_SHORT); - GLtype.Add(TypeCode.SByte, glConst.BYTE); - GLtype.Add(TypeCode.Byte, glConst.UNSIGNED_BYTE); - } - - internal static void InternalAppendLog(string log) - { - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) { - logStream.WriteLine(log); - } - } - - internal static void InternalWriteLog(string logLine, LogType logType) - { - logSyncSemaphore.Wait(); - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) - { - logStream.WriteLine($"{logType}\t{DateTime.Now.ToString("o")}"); - logStream.WriteLine(logLine); - } - _ = logSyncSemaphore.Release(); - } - - internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType) - { - logSyncSemaphore.Wait(); - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) - { - logStream.WriteLine(beforeTime); - logStream.WriteLine($"{logType}\t@\t{DateTime.Now.ToString("o")}"); - logStream.WriteLine(logLine); - } - _ = logSyncSemaphore.Release(1); - } - - } -} diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/A3919CCA57C33ABF0FE7102A8A97A697 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/A3919CCA57C33ABF0FE7102A8A97A697 deleted file mode 100644 index 22f6e571..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/A3919CCA57C33ABF0FE7102A8A97A697 +++ /dev/null @@ -1,107 +0,0 @@ -#include "glfw_function_table.h" -#include - -void LoadGLFWFunctions(GLFWFunctionTable* table) { - memset(table, 0, sizeof(GLFWFunctionTable)); - table->glfwDefaultWindowHints = glfwDefaultWindowHints; - table->glfwDestroyCursor = glfwDestroyCursor; - table->glfwDestroyWindow = glfwDestroyWindow; - table->glfwFocusWindow = glfwFocusWindow; - table->glfwGetClipboardString = glfwGetClipboardString; - table->glfwGetCurrentContext = glfwGetCurrentContext; - table->glfwGetCursorPos = glfwGetCursorPos; - table->glfwGetError = glfwGetError; - table->glfwGetFramebufferSize = glfwGetFramebufferSize; - table->glfwGetGamepadName = glfwGetGamepadName; - table->glfwGetGamepadState = glfwGetGamepadState; - table->glfwGetGammaRamp = glfwGetGammaRamp; - table->glfwGetInputMode = glfwGetInputMode; - table->glfwGetJoystickAxes = glfwGetJoystickAxes; - table->glfwGetJoystickButtons = glfwGetJoystickButtons; - table->glfwGetJoystickGUID = glfwGetJoystickGUID; - table->glfwGetJoystickHats = glfwGetJoystickHats; - table->glfwGetJoystickName = glfwGetJoystickName; - table->glfwGetJoystickUserPointer = glfwGetJoystickUserPointer; - table->glfwGetKey = glfwGetKey; - table->glfwGetKeyName = glfwGetKeyName; - table->glfwGetKeyScancode = glfwGetKeyScancode; - table->glfwGetMonitorContentScale = glfwGetMonitorContentScale; - table->glfwGetMonitorName = glfwGetMonitorName; - table->glfwGetMonitorPhysicalSize = glfwGetMonitorPhysicalSize; - table->glfwGetMonitorPos = glfwGetMonitorPos; - table->glfwGetMonitors = glfwGetMonitors; - table->glfwGetMonitorUserPointer = glfwGetMonitorUserPointer; - table->glfwGetMonitorWorkarea = glfwGetMonitorWorkarea; - table->glfwGetMouseButton = glfwGetMouseButton; - table->glfwGetPrimaryMonitor = glfwGetPrimaryMonitor; - table->glfwGetTime = glfwGetTime; - table->glfwGetTimerFrequency = glfwGetTimerFrequency; - table->glfwGetTimerValue = glfwGetTimerValue; - table->glfwGetVersionString = glfwGetVersionString; - table->glfwGetVideoMode = glfwGetVideoMode; - table->glfwGetVideoModes = glfwGetVideoModes; - table->glfwGetWindowAttrib = glfwGetWindowAttrib; - table->glfwGetWindowContentScale = glfwGetWindowContentScale; - table->glfwGetWindowFrameSize = glfwGetWindowFrameSize; - table->glfwGetWindowMonitor = glfwGetWindowMonitor; - table->glfwGetWindowOpacity = glfwGetWindowOpacity; - table->glfwGetWindowPos = glfwGetWindowPos; - table->glfwGetWindowSize = glfwGetWindowSize; - table->glfwGetWindowUserPointer = glfwGetWindowUserPointer; - table->glfwHideWindow = glfwHideWindow; - table->glfwIconifyWindow = glfwIconifyWindow; - table->glfwInit = glfwInit; - table->glfwInitHint = glfwInitHint; - table->glfwMakeContextCurrent = glfwMakeContextCurrent; - table->glfwMaximizeWindow = glfwMaximizeWindow; - table->glfwPollEvents = glfwPollEvents; - table->glfwPostEmptyEvent = glfwPostEmptyEvent; - table->glfwRequestWindowAttention = glfwRequestWindowAttention; - table->glfwRawMouseMotionSupported = glfwRawMouseMotionSupported; - table->glfwRestoreWindow = glfwRestoreWindow; - table->glfwSetClipboardString = glfwSetClipboardString; - table->glfwSetCharCallback = glfwSetCharCallback; - table->glfwSetCharModsCallback = glfwSetCharModsCallback; - table->glfwSetCursor = glfwSetCursor; - table->glfwSetCursorEnterCallback = glfwSetCursorEnterCallback; - table->glfwSetCursorPos = glfwSetCursorPos; - table->glfwSetCursorPosCallback = glfwSetCursorPosCallback; - table->glfwSetDropCallback = glfwSetDropCallback; - table->glfwSetGammaRamp = glfwSetGammaRamp; - table->glfwSetJoystickCallback = glfwSetJoystickCallback; - table->glfwSetJoystickUserPointer = glfwSetJoystickUserPointer; - table->glfwSetKeyCallback = glfwSetKeyCallback; - table->glfwSetMonitorUserPointer = glfwSetMonitorUserPointer; - table->glfwSetMonitorCallback = glfwSetMonitorCallback; - table->glfwSetTime = glfwSetTime; - table->glfwSetWindowAspectRatio = glfwSetWindowAspectRatio; - table->glfwSetWindowAttrib = glfwSetWindowAttrib; - table->glfwSetWindowCloseCallback = glfwSetWindowCloseCallback; - table->glfwSetWindowIcon = glfwSetWindowIcon; - table->glfwSetWindowIconifyCallback = glfwSetWindowIconifyCallback; - table->glfwSetWindowFocusCallback = glfwSetWindowFocusCallback; - table->glfwSetFramebufferSizeCallback = glfwSetFramebufferSizeCallback; - table->glfwSetWindowMaximizeCallback = glfwSetWindowMaximizeCallback; - table->glfwSetWindowMonitor = glfwSetWindowMonitor; - table->glfwSetMouseButtonCallback = glfwSetMouseButtonCallback; - table->glfwSetWindowOpacity = glfwSetWindowOpacity; - table->glfwSetWindowPosCallback = glfwSetWindowPosCallback; - table->glfwSetWindowPos = glfwSetWindowPos; - table->glfwSetScrollCallback = glfwSetScrollCallback; - table->glfwSetWindowShouldClose = glfwSetWindowShouldClose; - table->glfwSetWindowSizeLimits = glfwSetWindowSizeLimits; - table->glfwSetWindowSizeCallback = glfwSetWindowSizeCallback; - table->glfwSetWindowSize = glfwSetWindowSize; - table->glfwSetWindowTitle = glfwSetWindowTitle; - table->glfwSetWindowUserPointer = glfwSetWindowUserPointer; - table->glfwSetWindowRefreshCallback = glfwSetWindowRefreshCallback; - table->glfwSetWindowContentScaleCallback = glfwSetWindowContentScaleCallback; - table->glfwSwapBuffers = glfwSwapBuffers; - table->glfwSwapInterval = glfwSwapInterval; - table->glfwTerminate = glfwTerminate; - table->glfwUpdateGamepadMappings = glfwUpdateGamepadMappings; - table->glfwWaitEvents = glfwWaitEvents; - table->glfwWaitEventsTimeout = glfwWaitEventsTimeout; - table->glfwVulkanSupported = glfwVulkanSupported; - table->glfwWindowShouldClose = glfwWindowShouldClose; -} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/BF682B06259E1DAC71F7644A79308571 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/BF682B06259E1DAC71F7644A79308571 deleted file mode 100644 index 15eb20da..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/BF682B06259E1DAC71F7644A79308571 +++ /dev/null @@ -1,486 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; - -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; - -namespace StgSharp.Internal -{ - internal unsafe partial class InternalIO - { - - private static GLFWFunction _glfw; - - [LibraryImport(NativeLibName, EntryPoint = "load_glfw_functions")] - internal static unsafe partial void glfwLoadLibrary(GLFWFunction* context); - - internal static unsafe void LoadGlfw() - { - _glfw = new GLFWFunction(); - fixed (GLFWFunction* func = &_glfw) { } - } - - #region api call - - [LibraryImport(NativeLibName, EntryPoint = "glfwInit")] - internal static unsafe partial int glfwInit(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwTerminate")] - internal static unsafe partial void glfwTerminate(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwInitHint")] - internal static unsafe partial void glfwInitHint(int hint, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetVersion")] - internal static unsafe partial void glfwGetVersion(int* major, int* minor, int* rev); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetVersionString")] - internal static unsafe partial byte* glfwGetVersionString(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetError")] - internal static unsafe partial int glfwGetError(byte** description); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetErrorCallback")] - internal static unsafe partial delegate* glfwSetErrorCallback( - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitors")] - internal static unsafe partial IntPtr* glfwGetMonitors(int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetPrimaryMonitor")] - internal static unsafe partial IntPtr glfwGetPrimaryMonitor(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorPos")] - internal static unsafe partial void glfwGetMonitorPos(IntPtr monitor, int* xpos, int* ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorWorkarea")] - internal static unsafe partial void glfwGetMonitorWorkarea( - IntPtr monitor, - int* xpos, - int* ypos, - int* width, - int* height); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorPhysicalSize")] - internal static unsafe partial void glfwGetMonitorPhysicalSize(IntPtr monitor, int* widthMM, int* heightMM); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorContentScale")] - internal static unsafe partial void glfwGetMonitorContentScale(IntPtr monitor, float* xscale, float* yscale); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorName")] - internal static unsafe partial byte* glfwGetMonitorName(IntPtr monitor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetMonitorUserPointer")] - internal static unsafe partial void glfwSetMonitorUserPointer(IntPtr monitor, void* pointer); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMonitorUserPointer")] - internal static unsafe partial void* glfwGetMonitorUserPointer(IntPtr monitor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetMonitorCallback")] - internal static unsafe partial delegate* glfwSetMonitorCallback( - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetVideoModes")] - internal static unsafe partial glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetVideoMode")] - internal static unsafe partial glfwVideomode* glfwGetVideoMode(IntPtr monitor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetGamma")] - internal static unsafe partial void glfwSetGamma(IntPtr monitor, float gamma); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetGammaRamp")] - internal static unsafe partial glfwGammaramp* glfwGetGammaRamp(IntPtr monitor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetGammaRamp")] - internal static unsafe partial void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp); - - [LibraryImport(NativeLibName, EntryPoint = "glfwDefaultWindowHints")] - internal static unsafe partial void glfwDefaultWindowHints(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWindowHint")] - internal static unsafe partial void glfwWindowHint(int hint, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWindowHintString")] - internal static unsafe partial void glfwWindowHintString(int hint, byte* value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindow")] - internal static unsafe partial IntPtr glfwCreateWindow( - int width, - int height, - byte[] title, - IntPtr monitor, - IntPtr share); - - [LibraryImport(NativeLibName, EntryPoint = "glfwDestroyWindow")] - internal static unsafe partial void glfwDestroyWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWindowShouldClose")] - internal static unsafe partial int glfwWindowShouldClose(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowShouldClose")] - internal static unsafe partial void glfwSetWindowShouldClose(IntPtr window, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowTitle")] - internal static unsafe partial void glfwSetWindowTitle(IntPtr window, byte* title); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowIcon")] - internal static unsafe partial void glfwSetWindowIcon(IntPtr window, int count, GLFWimage* images); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowPos")] - internal static unsafe partial void glfwGetWindowPos(IntPtr window, int* xpos, int* ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowPos")] - internal static unsafe partial void glfwSetWindowPos(IntPtr window, int xpos, int ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowSize")] - internal static unsafe partial void glfwGetWindowSize(IntPtr window, int* width, int* height); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSizeLimits")] - internal static unsafe partial void glfwSetWindowSizeLimits( - IntPtr window, - int minwidth, - int minheight, - int maxwidth, - int maxheight); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowAspectRatio")] - internal static unsafe partial void glfwSetWindowAspectRatio(IntPtr window, int numer, int denom); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSize")] - internal static unsafe partial void glfwSetWindowSize(IntPtr window, int width, int height); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetFramebufferSize")] - internal static unsafe partial void glfwGetFramebufferSize(IntPtr window, int* width, int* height); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowFrameSize")] - internal static unsafe partial void glfwGetWindowFrameSize( - IntPtr window, - int* left, - int* top, - int* right, - int* bottom); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowContentScale")] - internal static unsafe partial void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowOpacity")] - internal static unsafe partial float glfwGetWindowOpacity(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowOpacity")] - internal static unsafe partial void glfwSetWindowOpacity(IntPtr window, float opacity); - - [LibraryImport(NativeLibName, EntryPoint = "glfwIconifyWindow")] - internal static unsafe partial void glfwIconifyWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwRestoreWindow")] - internal static unsafe partial void glfwRestoreWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwMaximizeWindow")] - internal static unsafe partial void glfwMaximizeWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwShowWindow")] - internal static unsafe partial void glfwShowWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwHideWindow")] - internal static unsafe partial void glfwHideWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwFocusWindow")] - internal static unsafe partial void glfwFocusWindow(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwRequestWindowAttention")] - internal static unsafe partial void glfwRequestWindowAttention(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowMonitor")] - internal static unsafe partial IntPtr glfwGetWindowMonitor(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowMonitor")] - internal static unsafe partial void glfwSetWindowMonitor( - IntPtr window, - IntPtr monitor, - int xpos, - int ypos, - int width, - int height, - int refreshRate); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowAttrib")] - internal static unsafe partial int glfwGetWindowAttrib(IntPtr window, int attrib); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowAttrib")] - internal static unsafe partial void glfwSetWindowAttrib(IntPtr window, int attrib, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowUserPointer")] - internal static unsafe partial void glfwSetWindowUserPointer(IntPtr window, void* pointer); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetWindowUserPointer")] - internal static unsafe partial void* glfwGetWindowUserPointer(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowPosCallback")] - internal static unsafe partial delegate* glfwSetWindowPosCallback( - IntPtr window, - IntPtr callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowSizeCallback")] - internal static unsafe partial delegate* glfwSetWindowSizeCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowCloseCallback")] - internal static unsafe partial delegate* glfwSetWindowCloseCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowRefreshCallback")] - internal static unsafe partial delegate* glfwSetWindowRefreshCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowFocusCallback")] - internal static unsafe partial delegate* glfwSetWindowFocusCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowIconifyCallback")] - internal static unsafe partial delegate* glfwSetWindowIconifyCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowMaximizeCallback")] - internal static unsafe partial delegate* glfwSetWindowMaximizeCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetFramebufferSizeCallback")] - internal static unsafe partial FrameBufferSizeHandler glfwSetFramebufferSizeCallback( - IntPtr window, - IntPtr callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetWindowContentScaleCallback")] - internal static unsafe partial delegate* glfwSetWindowContentScaleCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwPollEvents")] - internal static unsafe partial void glfwPollEvents(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWaitEvents")] - internal static unsafe partial void glfwWaitEvents(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwWaitEventsTimeout")] - internal static unsafe partial void glfwWaitEventsTimeout(double timeout); - - [LibraryImport(NativeLibName, EntryPoint = "glfwPostEmptyEvent")] - internal static unsafe partial void glfwPostEmptyEvent(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetInputMode")] - internal static unsafe partial int glfwGetInputMode(IntPtr window, int mode); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetInputMode")] - internal static unsafe partial void glfwSetInputMode(IntPtr window, int mode, int value); - - [LibraryImport(NativeLibName, EntryPoint = "glfwRawMouseMotionSupported")] - internal static unsafe partial int glfwRawMouseMotionSupported(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetKeyName")] - internal static unsafe partial byte* glfwGetKeyName(int key, int scancode); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetKeyScancode")] - internal static unsafe partial int glfwGetKeyScancode(int key); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetKey")] - internal static unsafe partial KeyStatus glfwGetKey(IntPtr window, int key); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetMouseButton")] - internal static unsafe partial int glfwGetMouseButton(IntPtr window, int button); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetCursorPos")] - internal static unsafe partial void glfwGetCursorPos(IntPtr window, double* xpos, double* ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorPos")] - internal static unsafe partial void glfwSetCursorPos(IntPtr window, double xpos, double ypos); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateCursor")] - internal static unsafe partial GLFWcursor* glfwCreateCursor(GLFWimage* image, int xhot, int yhot); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateStandardCursor")] - internal static unsafe partial GLFWcursor* glfwCreateStandardCursor(int shape); - - [LibraryImport(NativeLibName, EntryPoint = "glfwDestroyCursor")] - internal static unsafe partial void glfwDestroyCursor(GLFWcursor* cursor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCursor")] - internal static unsafe partial void glfwSetCursor(IntPtr window, GLFWcursor* cursor); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetKeyCallback")] - internal static unsafe partial delegate* glfwSetKeyCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCharCallback")] - internal static unsafe partial delegate* glfwSetCharCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCharModsCallback")] - internal static unsafe partial delegate* glfwSetCharModsCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetMouseButtonCallback")] - internal static unsafe partial delegate* glfwSetMouseButtonCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorPosCallback")] - internal static unsafe partial delegate* glfwSetCursorPosCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetCursorEnterCallback")] - internal static unsafe partial delegate* glfwSetCursorEnterCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetScrollCallback")] - internal static unsafe partial delegate* glfwSetScrollCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetDropCallback")] - internal static unsafe partial delegate* glfwSetDropCallback( - IntPtr window, - delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwJoystickPresent")] - internal static unsafe partial int glfwJoystickPresent(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickAxes")] - internal static unsafe partial float* glfwGetJoystickAxes(int jid, int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickButtons")] - internal static unsafe partial byte* glfwGetJoystickButtons(int jid, int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickHats")] - internal static unsafe partial byte* glfwGetJoystickHats(int jid, int* count); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickName")] - internal static unsafe partial byte* glfwGetJoystickName(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickGUID")] - internal static unsafe partial byte* glfwGetJoystickGUID(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetJoystickUserPointer")] - internal static unsafe partial void glfwSetJoystickUserPointer(int jid, void* pointer); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetJoystickUserPointer")] - internal static unsafe partial void* glfwGetJoystickUserPointer(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwJoystickIsGamepad")] - internal static unsafe partial int glfwJoystickIsGamepad(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetJoystickCallback")] - internal static unsafe partial delegate* glfwSetJoystickCallback(delegate* callback); - - [LibraryImport(NativeLibName, EntryPoint = "glfwUpdateGamepadMappings")] - internal static unsafe partial int glfwUpdateGamepadMappings(byte* str); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetGamepadName")] - internal static unsafe partial byte* glfwGetGamepadName(int jid); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetGamepadState")] - internal static unsafe partial int glfwGetGamepadState(int jid, GLFWgamepadstate* state); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetClipboardString")] - internal static unsafe partial void glfwSetClipboardString(IntPtr window, byte* str); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetClipboardString")] - internal static unsafe partial byte* glfwGetClipboardString(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetTime")] - internal static unsafe partial double glfwGetTime(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSetTime")] - internal static unsafe partial void glfwSetTime(double time); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetTimerValue")] - internal static unsafe partial ulong* glfwGetTimerValue(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetTimerFrequency")] - internal static unsafe partial ulong* glfwGetTimerFrequency(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwMakeContextCurrent")] - internal static unsafe partial void glfwMakeContextCurrent(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetCurrentContext")] - internal static unsafe partial IntPtr glfwGetCurrentContext(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSwapBuffers")] - internal static unsafe partial void glfwSwapBuffers(IntPtr window); - - [LibraryImport(NativeLibName, EntryPoint = "glfwSwapInterval")] - internal static unsafe partial void glfwSwapInterval(int interval); - - [LibraryImport(NativeLibName, EntryPoint = "glfwExtensionSupported")] - internal static unsafe partial int glfwExtensionSupported(byte* extension); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetProcAddress", StringMarshalling = StringMarshalling.Utf8)] - internal static unsafe partial IntPtr glfwGetProcAddress(string procname); - - [LibraryImport(NativeLibName, EntryPoint = "glfwVulkanSupported")] - internal static unsafe partial int glfwVulkanSupported(); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetRequiredInstanceExtensions")] - internal static unsafe partial byte** glfwGetRequiredInstanceExtensions(uint* count); - - /* - [LibraryImport(NativeLibName, EntryPoint = "glfwGetInstanceProcAddress")] internal static unsafe partial delegate* glfwGetInstanceProcAddress( - VkInstance instance, - byte* procname); - - [LibraryImport(NativeLibName, EntryPoint = "glfwGetPhysicalDevicePresentationSupport")] internal static unsafe partial int glfwGetPhysicalDevicePresentationSupport( - VkInstance instance, - VkPhysicalDevice device, - uint* queuefamily); - - [LibraryImport(NativeLibName, EntryPoint = "glfwCreateWindowSurface")] internal static unsafe partial VkResult glfwCreateWindowSurface( - VkInstance instance, - glfwWindow* window, - VkAllocationCallbacks* _allocator, - VkSurfaceKHR* surface); - /**/ - - #endregion api call - } -} diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/DB69498DC45A11BE0782A3B3267F560A b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/DB69498DC45A11BE0782A3B3267F560A deleted file mode 100644 index 4caef95a..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/DB69498DC45A11BE0782A3B3267F560A +++ /dev/null @@ -1,110 +0,0 @@ -#include "glfw_function_table.h" -#include - -void LoadGLFWFunctions(GLFWFunctionTable* table) { - memset(table, 0, sizeof(GLFWFunctionTable)); - table->glfwCreateCursor = glfwCreateCursor; - table->glfwCreateStandardCursor = glfwCreateStandardCursor; - table->glfwCreateWindow = glfwCreateWindow; - table->glfwDefaultWindowHints = glfwDefaultWindowHints; - table->glfwDestroyCursor = glfwDestroyCursor; - table->glfwDestroyWindow = glfwDestroyWindow; - table->glfwFocusWindow = glfwFocusWindow; - table->glfwGetClipboardString = glfwGetClipboardString; - table->glfwGetCurrentContext = glfwGetCurrentContext; - table->glfwGetCursorPos = glfwGetCursorPos; - table->glfwGetError = glfwGetError; - table->glfwGetFramebufferSize = glfwGetFramebufferSize; - table->glfwGetGamepadName = glfwGetGamepadName; - table->glfwGetGamepadState = glfwGetGamepadState; - table->glfwGetGammaRamp = glfwGetGammaRamp; - table->glfwGetInputMode = glfwGetInputMode; - table->glfwGetJoystickAxes = glfwGetJoystickAxes; - table->glfwGetJoystickButtons = glfwGetJoystickButtons; - table->glfwGetJoystickGUID = glfwGetJoystickGUID; - table->glfwGetJoystickHats = glfwGetJoystickHats; - table->glfwGetJoystickName = glfwGetJoystickName; - table->glfwGetJoystickUserPointer = glfwGetJoystickUserPointer; - table->glfwGetKey = glfwGetKey; - table->glfwGetKeyName = glfwGetKeyName; - table->glfwGetKeyScancode = glfwGetKeyScancode; - table->glfwGetMonitorContentScale = glfwGetMonitorContentScale; - table->glfwGetMonitorName = glfwGetMonitorName; - table->glfwGetMonitorPhysicalSize = glfwGetMonitorPhysicalSize; - table->glfwGetMonitorPos = glfwGetMonitorPos; - table->glfwGetMonitors = glfwGetMonitors; - table->glfwGetMonitorUserPointer = glfwGetMonitorUserPointer; - table->glfwGetMonitorWorkarea = glfwGetMonitorWorkarea; - table->glfwGetMouseButton = glfwGetMouseButton; - table->glfwGetPrimaryMonitor = glfwGetPrimaryMonitor; - table->glfwGetTime = glfwGetTime; - table->glfwGetTimerFrequency = glfwGetTimerFrequency; - table->glfwGetTimerValue = glfwGetTimerValue; - table->glfwGetVersionString = glfwGetVersionString; - table->glfwGetVideoMode = glfwGetVideoMode; - table->glfwGetVideoModes = glfwGetVideoModes; - table->glfwGetWindowAttrib = glfwGetWindowAttrib; - table->glfwGetWindowContentScale = glfwGetWindowContentScale; - table->glfwGetWindowFrameSize = glfwGetWindowFrameSize; - table->glfwGetWindowMonitor = glfwGetWindowMonitor; - table->glfwGetWindowOpacity = glfwGetWindowOpacity; - table->glfwGetWindowPos = glfwGetWindowPos; - table->glfwGetWindowSize = glfwGetWindowSize; - table->glfwGetWindowUserPointer = glfwGetWindowUserPointer; - table->glfwHideWindow = glfwHideWindow; - table->glfwIconifyWindow = glfwIconifyWindow; - table->glfwInit = glfwInit; - table->glfwInitHint = glfwInitHint; - table->glfwMakeContextCurrent = glfwMakeContextCurrent; - table->glfwMaximizeWindow = glfwMaximizeWindow; - table->glfwPollEvents = glfwPollEvents; - table->glfwPostEmptyEvent = glfwPostEmptyEvent; - table->glfwRequestWindowAttention = glfwRequestWindowAttention; - table->glfwRawMouseMotionSupported = glfwRawMouseMotionSupported; - table->glfwRestoreWindow = glfwRestoreWindow; - table->glfwSetClipboardString = glfwSetClipboardString; - table->glfwSetCharCallback = glfwSetCharCallback; - table->glfwSetCharModsCallback = glfwSetCharModsCallback; - table->glfwSetCursor = glfwSetCursor; - table->glfwSetCursorEnterCallback = glfwSetCursorEnterCallback; - table->glfwSetCursorPos = glfwSetCursorPos; - table->glfwSetCursorPosCallback = glfwSetCursorPosCallback; - table->glfwSetDropCallback = glfwSetDropCallback; - table->glfwSetGammaRamp = glfwSetGammaRamp; - table->glfwSetJoystickCallback = glfwSetJoystickCallback; - table->glfwSetJoystickUserPointer = glfwSetJoystickUserPointer; - table->glfwSetKeyCallback = glfwSetKeyCallback; - table->glfwSetMonitorUserPointer = glfwSetMonitorUserPointer; - table->glfwSetMonitorCallback = glfwSetMonitorCallback; - table->glfwSetTime = glfwSetTime; - table->glfwSetWindowAspectRatio = glfwSetWindowAspectRatio; - table->glfwSetWindowAttrib = glfwSetWindowAttrib; - table->glfwSetWindowCloseCallback = glfwSetWindowCloseCallback; - table->glfwSetWindowIcon = glfwSetWindowIcon; - table->glfwSetWindowIconifyCallback = glfwSetWindowIconifyCallback; - table->glfwSetWindowFocusCallback = glfwSetWindowFocusCallback; - table->glfwSetFramebufferSizeCallback = glfwSetFramebufferSizeCallback; - table->glfwSetWindowMaximizeCallback = glfwSetWindowMaximizeCallback; - table->glfwSetWindowMonitor = glfwSetWindowMonitor; - table->glfwSetMouseButtonCallback = glfwSetMouseButtonCallback; - table->glfwSetWindowOpacity = glfwSetWindowOpacity; - table->glfwSetWindowPosCallback = glfwSetWindowPosCallback; - table->glfwSetWindowPos = glfwSetWindowPos; - table->glfwSetScrollCallback = glfwSetScrollCallback; - table->glfwSetWindowShouldClose = glfwSetWindowShouldClose; - table->glfwSetWindowSizeLimits = glfwSetWindowSizeLimits; - table->glfwSetWindowSizeCallback = glfwSetWindowSizeCallback; - table->glfwSetWindowSize = glfwSetWindowSize; - table->glfwSetWindowTitle = glfwSetWindowTitle; - table->glfwSetWindowUserPointer = glfwSetWindowUserPointer; - table->glfwSetWindowRefreshCallback = glfwSetWindowRefreshCallback; - table->glfwSetWindowContentScaleCallback = glfwSetWindowContentScaleCallback; - table->glfwSwapBuffers = glfwSwapBuffers; - table->glfwSwapInterval = glfwSwapInterval; - table->glfwTerminate = glfwTerminate; - table->glfwUpdateGamepadMappings = glfwUpdateGamepadMappings; - table->glfwWaitEvents = glfwWaitEvents; - table->glfwWaitEventsTimeout = glfwWaitEventsTimeout; - table->glfwVulkanSupported = glfwVulkanSupported; - table->glfwWindowShouldClose = glfwWindowShouldClose; -} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/E85AA11F74CAA82F5E384A85CDBE0B61 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/E85AA11F74CAA82F5E384A85CDBE0B61 deleted file mode 100644 index 48081bd3..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F0F383FDE262FB4DAA37EDFAD50F1ED7/E85AA11F74CAA82F5E384A85CDBE0B61 +++ /dev/null @@ -1,156 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="glfw_function_table.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.InteropServices; - -namespace StgSharp.Internal -{ - [StructLayout(LayoutKind.Sequential)] - internal unsafe struct GLFWFunction - { - - public delegate* unmanaged[Cdecl] glfwCreateCursor; - public delegate* unmanaged[Cdecl] glfwCreateStandardCursor; - public delegate* unmanaged[Cdecl] glfwCreateWindow; - public delegate* unmanaged[Cdecl] glfwDefaultWindowHints; - public delegate* unmanaged[Cdecl] glfwDestroyCursor; - public delegate* unmanaged[Cdecl] glfwDestroyWindow; - public delegate* unmanaged[Cdecl] glfwExtensionSupported; - public delegate* unmanaged[Cdecl] glfwFocusWindow; - public delegate* unmanaged[Cdecl] glfwGetClipboardString; - public delegate* unmanaged[Cdecl] glfwGetCurrentContext; - public delegate* unmanaged[Cdecl] glfwGetCursorPos; - public delegate* unmanaged[Cdecl] glfwGetError; - public delegate* unmanaged[Cdecl] glfwGetFramebufferSize; - public delegate* unmanaged[Cdecl] glfwGetGamepadName; - public delegate* unmanaged[Cdecl] glfwGetGamepadState; - public delegate* unmanaged[Cdecl] glfwGetGammaRamp; - public delegate* unmanaged[Cdecl] glfwGetInputMode; - public delegate* unmanaged[Cdecl] glfwGetJoystickAxes; - public delegate* unmanaged[Cdecl] glfwGetJoystickButtons; - public delegate* unmanaged[Cdecl] glfwGetJoystickGUID; - public delegate* unmanaged[Cdecl] glfwGetJoystickHats; - public delegate* unmanaged[Cdecl] glfwGetJoystickName; - public delegate* unmanaged[Cdecl] glfwGetJoystickUserPointer; - public delegate* unmanaged[Cdecl] glfwGetKey; - public delegate* unmanaged[Cdecl] glfwGetKeyName; - public delegate* unmanaged[Cdecl] glfwGetKeyScancode; - public delegate* unmanaged[Cdecl] glfwGetMonitorContentScale; - public delegate* unmanaged[Cdecl] glfwGetMonitorName; - public delegate* unmanaged[Cdecl] glfwGetMonitorPhysicalSize; - public delegate* unmanaged[Cdecl] glfwGetMonitorPos; - public delegate* unmanaged[Cdecl] glfwGetMonitors; - public delegate* unmanaged[Cdecl] glfwGetMonitorUserPointer; - public delegate* unmanaged[Cdecl] glfwGetMonitorWorkarea; - public delegate* unmanaged[Cdecl] glfwGetMouseButton; - public delegate* unmanaged[Cdecl] glfwGetPrimaryMonitor; - public delegate* unmanaged[Cdecl] glfwGetProcAddress; - public delegate* unmanaged[Cdecl] glfwGetRequiredInstanceExtensions; - public delegate* unmanaged[Cdecl] glfwGetTime; - public delegate* unmanaged[Cdecl] glfwGetTimerFrequency; - public delegate* unmanaged[Cdecl] glfwGetTimerValue; - public delegate* unmanaged[Cdecl] glfwGetVersionString; - public delegate* unmanaged[Cdecl] glfwGetVideoMode; - public delegate* unmanaged[Cdecl] glfwGetVideoModes; - public delegate* unmanaged[Cdecl] glfwGetWindowAttrib; - public delegate* unmanaged[Cdecl] glfwGetWindowContentScale; - public delegate* unmanaged[Cdecl] glfwGetWindowFrameSize; - public delegate* unmanaged[Cdecl] glfwGetWindowMonitor; - public delegate* unmanaged[Cdecl] glfwGetWindowOpacity; - public delegate* unmanaged[Cdecl] glfwGetWindowPos; - public delegate* unmanaged[Cdecl] glfwGetWindowSize; - public delegate* unmanaged[Cdecl] glfwGetWindowUserPointer; - public delegate* unmanaged[Cdecl] glfwHideWindow; - public delegate* unmanaged[Cdecl] glfwIconifyWindow; - public delegate* unmanaged[Cdecl] glfwInit; - public delegate* unmanaged[Cdecl] glfwInitHint; - public delegate* unmanaged[Cdecl] glfwJoystickIsGamepad; - public delegate* unmanaged[Cdecl] glfwJoystickPresent; - public delegate* unmanaged[Cdecl] glfwMakeContextCurrent; - public delegate* unmanaged[Cdecl] glfwMaximizeWindow; - public delegate* unmanaged[Cdecl] glfwPollEvents; - public delegate* unmanaged[Cdecl] glfwPostEmptyEvent; - public delegate* unmanaged[Cdecl] glfwRawMouseMotionSupported; - public delegate* unmanaged[Cdecl] glfwRequestWindowAttention; - public delegate* unmanaged[Cdecl] glfwRestoreWindow; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCharCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCharModsCallback; - public delegate* unmanaged[Cdecl] glfwSetClipboardString; - public delegate* unmanaged[Cdecl] glfwSetCursor; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCursorEnterCallback; - public delegate* unmanaged[Cdecl] glfwSetCursorPos; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetCursorPosCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged [Cdecl]> glfwSetDropCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetFramebufferSizeCallback; - public delegate* unmanaged[Cdecl] glfwSetGamma; - public delegate* unmanaged[Cdecl] glfwSetGammaRamp; - public delegate* unmanaged[Cdecl] glfwSetInputMode; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetJoystickCallback; - public delegate* unmanaged[Cdecl] glfwSetJoystickUserPointer; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetKeyCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetMonitorCallback; - public delegate* unmanaged[Cdecl] glfwSetMonitorUserPointer; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetMouseButtonCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetScrollCallback; - public delegate* unmanaged[Cdecl] glfwSetTime; - public delegate* unmanaged[Cdecl] glfwSetWindowAspectRatio; - public delegate* unmanaged[Cdecl] glfwSetWindowAttrib; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowCloseCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowContentScaleCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowFocusCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowIcon; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowIconifyCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowMaximizeCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowMonitor; - public delegate* unmanaged[Cdecl] glfwSetWindowOpacity; - public delegate* unmanaged[Cdecl] glfwSetWindowPos; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowPosCallback; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowRefreshCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowShouldClose; - public delegate* unmanaged[Cdecl] glfwSetWindowSize; - public delegate* unmanaged[Cdecl], delegate* unmanaged[Cdecl]> glfwSetWindowSizeCallback; - public delegate* unmanaged[Cdecl] glfwSetWindowSizeLimits; - public delegate* unmanaged[Cdecl] glfwSetWindowTitle; - public delegate* unmanaged[Cdecl] glfwSetWindowUserPointer; - public delegate* unmanaged[Cdecl] glfwShowWindow; - public delegate* unmanaged[Cdecl] glfwSwapBuffers; - public delegate* unmanaged[Cdecl] glfwSwapInterval; - public delegate* unmanaged[Cdecl] glfwTerminate; - public delegate* unmanaged[Cdecl] glfwUpdateGamepadMappings; - public delegate* unmanaged[Cdecl] glfwVulkanSupported; - public delegate* unmanaged[Cdecl] glfwWaitEvents; - public delegate* unmanaged[Cdecl] glfwWaitEventsTimeout; - public delegate* unmanaged[Cdecl] glfwWindowHint; - public delegate* unmanaged[Cdecl] glfwWindowHintString; - public delegate* unmanaged[Cdecl] glfwWindowShouldClose; - - } -} \ No newline at end of file diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F464D1945A80DD45A78C650CEBE79B81/000664137FE633A4ED3F0106F6901204 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F464D1945A80DD45A78C650CEBE79B81/000664137FE633A4ED3F0106F6901204 deleted file mode 100644 index 0a6c35f7..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F464D1945A80DD45A78C650CEBE79B81/000664137FE633A4ED3F0106F6901204 +++ /dev/null @@ -1,202 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="InternalIO.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using Microsoft.Extensions.Logging; -using StgSharp.Graphics; -using StgSharp.Graphics.OpenGL; - -using System; -using System.Collections.Generic; -using System.IO; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -using System.Text; -using System.Threading; - -namespace StgSharp.Internal -{ - internal static unsafe partial class InternalIO - { - - private const long MaxLogFileSize = 10 * 1024 * 1024; // 10 MB - - internal const string NativeLibName = - "StgSharp.C"; - - internal const string SS_errorLog = - "SS_errorlog.log"; - - private static ILogger? _logger; - - private static LogType _currentLogLevel = LogType.Info; - - internal static Dictionary GLtype = []; - - internal static readonly GCHandle ssc_logHandle = - GCHandle.Alloc(new byte[512], GCHandleType.Pinned); - - internal static IntPtr _nativeLibPtr = IntPtr.Zero; - - internal static SemaphoreSlim logSyncSemaphore = new SemaphoreSlim(1, 1); - - static InternalIO() - { - GLtype.Add(TypeCode.Single, glConst.FLOAT); - GLtype.Add(TypeCode.Int32, glConst.INT); - GLtype.Add(TypeCode.UInt32, glConst.UNSIGNED_INT); - GLtype.Add(TypeCode.Int16, glConst.SHORT); - GLtype.Add(TypeCode.UInt16, glConst.UNSIGNED_SHORT); - GLtype.Add(TypeCode.SByte, glConst.BYTE); - GLtype.Add(TypeCode.Byte, glConst.UNSIGNED_BYTE); - } - - /// - /// Sets an external logger for logging purposes. - /// - /// - /// The logger to use. - /// - public static void SetLogger(ILogger logger) - { - _logger = logger; - } - - internal static void InternalAppendLog(string log) - { - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) { - logStream.WriteLine(log); - } - } - - internal static void InternalWriteLog(string logLine, LogType logType) - { - if (logType < _currentLogLevel) { - return; - } - - logSyncSemaphore.Wait(); - try - { - RotateLogFile(); - - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) { - logStream.WriteLine($"[{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff}] [{logType}] {logLine}"); - } - } - finally - { - logSyncSemaphore.Release(); - } - } - - internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType) - { - logSyncSemaphore.Wait(); - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) - { - logStream.WriteLine(beforeTime); - logStream.WriteLine($"[{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff}] [{logType}] {logLine}"); - } - _ = logSyncSemaphore.Release(1); - } - - /// - /// Logs a message using the external logger if available, otherwise falls back to the - /// internal logging system. - /// - /// - /// The log message. - /// - /// - /// The type of the log. - /// - internal static void Log(string logLine, LogType logType) - { - if (_logger != null) - { - switch (logType) - { - case LogType.Error: - _logger.LogError(logLine); - break; - case LogType.Warning: - _logger.LogWarning(logLine); - break; - case LogType.Info: - _logger.LogInformation(logLine); - break; - default: - _logger.LogDebug(logLine); - break; - } - } else - { - InternalWriteLog(logLine, logType); - } - } - - internal static void SetLogLevel(LogType logLevel) - { - _currentLogLevel = logLevel; - } - - private static void RotateLogFile() - { - if (File.Exists(SS_errorLog) && new FileInfo(SS_errorLog).Length > MaxLogFileSize) - { - string backupFile = SS_errorLog + ".backup"; - if (File.Exists(backupFile)) { - File.Delete(backupFile); - } - File.Move(SS_errorLog, backupFile); - } - } - - } -} diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F464D1945A80DD45A78C650CEBE79B81/3130A51369715163C2CC98D8D56782E3 b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F464D1945A80DD45A78C650CEBE79B81/3130A51369715163C2CC98D8D56782E3 deleted file mode 100644 index 0938abe3..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F464D1945A80DD45A78C650CEBE79B81/3130A51369715163C2CC98D8D56782E3 +++ /dev/null @@ -1,153 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="InternalIO.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; -using StgSharp.Graphics.OpenGL; - -using System; -using System.Collections.Generic; -using System.IO; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -using System.Text; -using System.Threading; - -namespace StgSharp.Internal -{ - internal static unsafe partial class InternalIO - { - - private const long MaxLogFileSize = 10 * 1024 * 1024; // 10 MB - - internal const string NativeLibName = - "StgSharp.C"; - - internal const string SS_errorLog = - "SS_errorlog.log"; - - private static LogType _currentLogLevel = LogType.Info; - - internal static Dictionary GLtype = []; - - internal static readonly GCHandle ssc_logHandle = - GCHandle.Alloc(new byte[512], GCHandleType.Pinned); - - internal static IntPtr _nativeLibPtr = IntPtr.Zero; - - internal static SemaphoreSlim logSyncSemaphore = new SemaphoreSlim(1, 1); - - static InternalIO() - { - GLtype.Add(TypeCode.Single, glConst.FLOAT); - GLtype.Add(TypeCode.Int32, glConst.INT); - GLtype.Add(TypeCode.UInt32, glConst.UNSIGNED_INT); - GLtype.Add(TypeCode.Int16, glConst.SHORT); - GLtype.Add(TypeCode.UInt16, glConst.UNSIGNED_SHORT); - GLtype.Add(TypeCode.SByte, glConst.BYTE); - GLtype.Add(TypeCode.Byte, glConst.UNSIGNED_BYTE); - } - - internal static void InternalAppendLog(string log) - { - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) { - logStream.WriteLine(log); - } - } - - internal static void InternalWriteLog(string logLine, LogType logType) - { - if (logType < _currentLogLevel) { - return; - } - - logSyncSemaphore.Wait(); - try - { - RotateLogFile(); - - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) { - logStream.WriteLine($"[{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff}] [{logType}] {logLine}"); - } - } - finally - { - logSyncSemaphore.Release(); - } - } - - internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType) - { - logSyncSemaphore.Wait(); - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) - { - logStream.WriteLine(beforeTime); - logStream.WriteLine($"[{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff}] [{logType}] {logLine}"); - } - _ = logSyncSemaphore.Release(1); - } - - internal static void SetLogLevel(LogType logLevel) - { - _currentLogLevel = logLevel; - } - - private static void RotateLogFile() - { - if (File.Exists(SS_errorLog) && new FileInfo(SS_errorLog).Length > MaxLogFileSize) - { - string backupFile = SS_errorLog + ".backup"; - if (File.Exists(backupFile)) { - File.Delete(backupFile); - } - File.Move(SS_errorLog, backupFile); - } - } - - } -} diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F464D1945A80DD45A78C650CEBE79B81/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F464D1945A80DD45A78C650CEBE79B81/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA deleted file mode 100644 index 0938abe3..00000000 --- a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/F464D1945A80DD45A78C650CEBE79B81/9FFAA2175E5CE1A79DB8EF4B3DA7C5DA +++ /dev/null @@ -1,153 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="InternalIO.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Graphics; -using StgSharp.Graphics.OpenGL; - -using System; -using System.Collections.Generic; -using System.IO; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -using System.Text; -using System.Threading; - -namespace StgSharp.Internal -{ - internal static unsafe partial class InternalIO - { - - private const long MaxLogFileSize = 10 * 1024 * 1024; // 10 MB - - internal const string NativeLibName = - "StgSharp.C"; - - internal const string SS_errorLog = - "SS_errorlog.log"; - - private static LogType _currentLogLevel = LogType.Info; - - internal static Dictionary GLtype = []; - - internal static readonly GCHandle ssc_logHandle = - GCHandle.Alloc(new byte[512], GCHandleType.Pinned); - - internal static IntPtr _nativeLibPtr = IntPtr.Zero; - - internal static SemaphoreSlim logSyncSemaphore = new SemaphoreSlim(1, 1); - - static InternalIO() - { - GLtype.Add(TypeCode.Single, glConst.FLOAT); - GLtype.Add(TypeCode.Int32, glConst.INT); - GLtype.Add(TypeCode.UInt32, glConst.UNSIGNED_INT); - GLtype.Add(TypeCode.Int16, glConst.SHORT); - GLtype.Add(TypeCode.UInt16, glConst.UNSIGNED_SHORT); - GLtype.Add(TypeCode.SByte, glConst.BYTE); - GLtype.Add(TypeCode.Byte, glConst.UNSIGNED_BYTE); - } - - internal static void InternalAppendLog(string log) - { - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) { - logStream.WriteLine(log); - } - } - - internal static void InternalWriteLog(string logLine, LogType logType) - { - if (logType < _currentLogLevel) { - return; - } - - logSyncSemaphore.Wait(); - try - { - RotateLogFile(); - - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) { - logStream.WriteLine($"[{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff}] [{logType}] {logLine}"); - } - } - finally - { - logSyncSemaphore.Release(); - } - } - - internal static void InternalWriteLog(string beforeTime, string logLine, LogType logType) - { - logSyncSemaphore.Wait(); - if (!File.Exists(SS_errorLog)) - { - FileStream stream = File.Create(SS_errorLog); - stream.Close(); - } - - using (StreamWriter logStream = File.AppendText(SS_errorLog)) - { - logStream.WriteLine(beforeTime); - logStream.WriteLine($"[{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff}] [{logType}] {logLine}"); - } - _ = logSyncSemaphore.Release(1); - } - - internal static void SetLogLevel(LogType logLevel) - { - _currentLogLevel = logLevel; - } - - private static void RotateLogFile() - { - if (File.Exists(SS_errorLog) && new FileInfo(SS_errorLog).Length > MaxLogFileSize) - { - string backupFile = SS_errorLog + ".backup"; - if (File.Exists(backupFile)) { - File.Delete(backupFile); - } - File.Move(SS_errorLog, backupFile); - } - } - - } -} diff --git a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/state.mpack b/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/state.mpack deleted file mode 100644 index 55023f0f..00000000 Binary files a/.vs/CopilotSnapshots/35034FC10B7A0D42B2D3A964032675D5/state.mpack and /dev/null differ diff --git a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/15ECA87E3A6524336A306184CCF4359E b/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/15ECA87E3A6524336A306184CCF4359E deleted file mode 100644 index b9754395..00000000 --- a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/15ECA87E3A6524336A306184CCF4359E +++ /dev/null @@ -1,143 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Alloc.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Threading; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private BufferExpansionLock _spareLock = new(); - - public hlsfHandle Alloc(uint size) - { - ArgumentOutOfRangeException.ThrowIfGreaterThan(size, (nuint)levelSize[^1] * 2); - int level = GetLevelFromSize(size); - int segmentIndex = DetermineSegmentIndex(size, level); - - int i = level, s = segmentIndex; - if (TryPopLevel(i, s, out Entry* handle)) - { - handle->State = EntryState.Allocated; - return new hlsfHandle(handle, size); - } - - fallback: - i = level; - s = segmentIndex; - while (!TryPopLevel(i, s, out handle)) - { - if (++s >= 3) - { - s = 0; - i++; - } - if (i >= levelSize.Length) - { - if (TryAllocateNew16MBBlock(out handle)) - { - break; - } - Thread.Sleep(0); - goto fallback; - } - } - - if (handle != null) - { - SliceMemory(handle, (segmentIndex + 1) * levelSize[level]); - handle->State = EntryState.Allocated; - } - - return new hlsfHandle(handle, size); - } - - private void SliceMemory(Entry* e, int offset) { } - - /// - /// Try to allocate a new 16MB block when all buckets are empty - /// - /// - /// Output handle to the allocated Entry - /// - /// - /// True if allocation succeeded - /// - private bool TryAllocateNew16MBBlock(out Entry* handle) - { - nuint pos = Volatile.Read(ref _spareMemory->Position); - nuint blockSize = (nuint)levelSize[^1]; // Use last level size (16MB) - nuint newPos = pos + blockSize; - - - // Check if we have enough space - if (newPos > ((nuint)m_Buffer) + _size) - { - handle = null; - return false; // Out of memory - } - - // Try to allocate new Entry from slab allocator - try - { - handle = (Entry*)_nodes.Allocate(); - handle->Position = pos; - handle->BlockSize = (uint)blockSize; - handle->State = EntryState.ThreadOccupied; - handle->NextNear = EmptyHandle; - handle->PreviousNear = EmptyHandle; - handle->SpinLock = 0; - - - // Update spare memory position - _spareMemory->Position = newPos; - - return true; - } - catch - { - handle = null; - return false; - } - } - - } -} diff --git a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/52BC175EEAAC2C32B24A00B932C33119 b/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/52BC175EEAAC2C32B24A00B932C33119 deleted file mode 100644 index b9754395..00000000 --- a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/52BC175EEAAC2C32B24A00B932C33119 +++ /dev/null @@ -1,143 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Alloc.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Threading; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private BufferExpansionLock _spareLock = new(); - - public hlsfHandle Alloc(uint size) - { - ArgumentOutOfRangeException.ThrowIfGreaterThan(size, (nuint)levelSize[^1] * 2); - int level = GetLevelFromSize(size); - int segmentIndex = DetermineSegmentIndex(size, level); - - int i = level, s = segmentIndex; - if (TryPopLevel(i, s, out Entry* handle)) - { - handle->State = EntryState.Allocated; - return new hlsfHandle(handle, size); - } - - fallback: - i = level; - s = segmentIndex; - while (!TryPopLevel(i, s, out handle)) - { - if (++s >= 3) - { - s = 0; - i++; - } - if (i >= levelSize.Length) - { - if (TryAllocateNew16MBBlock(out handle)) - { - break; - } - Thread.Sleep(0); - goto fallback; - } - } - - if (handle != null) - { - SliceMemory(handle, (segmentIndex + 1) * levelSize[level]); - handle->State = EntryState.Allocated; - } - - return new hlsfHandle(handle, size); - } - - private void SliceMemory(Entry* e, int offset) { } - - /// - /// Try to allocate a new 16MB block when all buckets are empty - /// - /// - /// Output handle to the allocated Entry - /// - /// - /// True if allocation succeeded - /// - private bool TryAllocateNew16MBBlock(out Entry* handle) - { - nuint pos = Volatile.Read(ref _spareMemory->Position); - nuint blockSize = (nuint)levelSize[^1]; // Use last level size (16MB) - nuint newPos = pos + blockSize; - - - // Check if we have enough space - if (newPos > ((nuint)m_Buffer) + _size) - { - handle = null; - return false; // Out of memory - } - - // Try to allocate new Entry from slab allocator - try - { - handle = (Entry*)_nodes.Allocate(); - handle->Position = pos; - handle->BlockSize = (uint)blockSize; - handle->State = EntryState.ThreadOccupied; - handle->NextNear = EmptyHandle; - handle->PreviousNear = EmptyHandle; - handle->SpinLock = 0; - - - // Update spare memory position - _spareMemory->Position = newPos; - - return true; - } - catch - { - handle = null; - return false; - } - } - - } -} diff --git a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/77DA1642FF8B0DC1F1DA13D99169CF30 b/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/77DA1642FF8B0DC1F1DA13D99169CF30 deleted file mode 100644 index 6111e69e..00000000 --- a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/77DA1642FF8B0DC1F1DA13D99169CF30 +++ /dev/null @@ -1,307 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void AcquireEntrySpinLock(Entry* entry) - { - if (entry == null) { - return; - } - - while (Interlocked.CompareExchange(ref entry->SpinLock, Environment.CurrentManagedThreadId, 0) != 0) { - Thread.Sleep(0); - } - } - - /// - /// Determine segment index based on size and level - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - if (level < 0 || level >= levelSize.Length) { - return 0; - } - - int segmentIndex = (int)size / levelSize[level]; - return Math.Min(2, segmentIndex); // Ensure not exceeding maximum segment index - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->BlockSize + other->BlockSize; - - // Update current Entry - remain->Position = newPosition; - remain->BlockSize = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private void ReleaseEntrySpinLock(Entry* entry) - { - if (entry == null) { - return; - } - _ = Interlocked.CompareExchange(ref entry->SpinLock, 0, Environment.CurrentManagedThreadId); - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private bool TryAcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - return entry != null && - (Volatile.Read(ref entry->SpinLock) == thread || - Interlocked.CompareExchange(ref entry->SpinLock, thread, 0) == 0); - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks - /// - private Entry* TryMergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return null; - } - - Entry* result = entry; - uint originalSize = entry->BlockSize; - int originalLevel = GetLevelFromSize(originalSize); - int originalSegment = DetermineSegmentIndex(originalSize, originalLevel); - - // Forward merge: check predecessor nodes in position linked list - Entry* prev = (Entry*)entry->PreviousNear; - while (prev != null && prev != _spareMemory && prev->State == EntryState.Empty && result->IsAdjacentTo(prev)) - { - // Try acquire spin lock for prev entry - if (!TryAcquireEntrySpinLock(prev)) - { - break; // Cannot acquire lock, might be operated by other thread - } - - try - { - // Double-check state after acquiring lock - if (prev->State != EntryState.Empty || !result->IsAdjacentTo(prev)) - { - break; - } - - // Calculate prev's bucket position - uint prevSize = prev->BlockSize; - int prevLevel = GetLevelFromSize(prevSize); - int prevSegment = DetermineSegmentIndex(prevSize, prevLevel); - - // Remove prev node from bucket (O(1) operation!) - BucketNode* prevBucketNode = ValidateOrRepairBucketNode(prev); - if (prevBucketNode != null && RemoveFromBucket(prevLevel, prevSegment, prevBucketNode)) - { - // Merge into result - result->MergeWith(prev); - - // Remove prev from position linked list - RemoveFromPositionChain(prev); - - // Free prev's Entry node - _nodes.Free((nuint)prev); - - // Continue searching forward - prev = (Entry*)result->PreviousNear; - continue; - } - } - finally - { - ReleaseEntrySpinLock(prev); - } - - break; // Cannot remove, might be operated by other thread - } - - // Backward merge: check successor nodes in position linked list - Entry* next = (Entry*)entry->NextNear; - while (next != null && next->State == EntryState.Empty && result->IsAdjacentTo(next)) - { - // Try acquire spin lock for next entry - if (!TryAcquireEntrySpinLock(next)) - { - break; // Cannot acquire lock, might be operated by other thread - } - - try - { - // Double-check state after acquiring lock - if (next->State != EntryState.Empty || !result->IsAdjacentTo(next)) - { - break; - } - - // Calculate next's bucket position - uint nextSize = next->BlockSize; - int nextLevel = GetLevelFromSize(nextSize); - int nextSegment = DetermineSegmentIndex(nextSize, nextLevel); - - // Remove next node from bucket (O(1) operation!) - BucketNode* nextBucketNode = ValidateOrRepairBucketNode(next); - if (nextBucketNode != null && RemoveFromBucket(nextLevel, nextSegment, nextBucketNode)) - { - // Merge into result - result->MergeWith(next); - - // Remove next from position linked list - RemoveFromPositionChain(next); - - // Free next's Entry node - _nodes.Free((nuint)next); - - // Continue searching backward - next = (Entry*)result->NextNear; - continue; - } - } - finally - { - ReleaseEntrySpinLock(next); - } - - break; // Cannot remove, might be operated by other thread - } - - return result; - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(24)] internal int SpinLock; // Spin lock for thread safety protection - [FieldOffset(28)] internal int State; // Node state - [FieldOffset(32)] internal uint BlockSize; // Block size information - [FieldOffset(36)] internal uint Reverse; - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public readonly bool IsAdjacentTo(Entry* other) - { - if (other == null) { - return false; - } - - // Check if this immediately follows other - return other->Position + other->BlockSize == this.Position || - this.Position + this.BlockSize == other->Position; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - } - - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/BA33779672F63494302EF1C48E414F30 b/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/BA33779672F63494302EF1C48E414F30 deleted file mode 100644 index a79957ff..00000000 --- a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/BA33779672F63494302EF1C48E414F30 +++ /dev/null @@ -1,94 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Level.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private const int MaxLevel = 9; - - private static readonly int[] levelSize = [ - 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216 - ]; - - public int AlignOfLevel(int bucketLevel) - { - int blockSize = levelSize[bucketLevel]; - return int.Min(blockSize, _align); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int GetLevelFromSize(uint size) - { - /* - rebuild by using binary operations - */ - - - // Ensure minimum size - if (size <= 64) - { - return 0; - } - - // Find the appropriate level for the given size - for (int i = 0; i < levelSize.Length - 1; i++) - { - if (size <= levelSize[i]) { - return i; - } - } - - - // If size is larger than all predefined levels, use the last level - return levelSize.Length - 1; - } - - } - - public enum CommonMemoryAlign : int - { - - XMMLevel = 16, - YMMLevel = 32, - ZMMLevel = 64, - - ArmNEONLevel = 16, - - } -} diff --git a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/CC235A83D4E985193DA24C8988682349 b/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/CC235A83D4E985193DA24C8988682349 deleted file mode 100644 index b3bd6a2d..00000000 --- a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/CC235A83D4E985193DA24C8988682349 +++ /dev/null @@ -1,157 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Alloc.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Threading; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private BufferExpansionLock _spareLock = new(); - - public hlsfHandle Alloc(uint size) - { - ArgumentOutOfRangeException.ThrowIfGreaterThan(size, (nuint)levelSize[^1] * 2); - int level = GetLevelFromSize(size); - int segmentIndex = DetermineSegmentIndex(size, level); - - int i = level, s = segmentIndex; - if (TryPopLevelForAllocation(i, s, out Entry* handle)) - { - handle->State = EntryState.Allocated; - return new hlsfHandle(handle, size); - } - - fallback: - i = level; - s = segmentIndex; - while (!TryPopLevelForAllocation(i, s, out handle)) - { - if (++s >= 3) - { - s = 0; - i++; - } - if (i >= levelSize.Length) - { - if (TryAllocateNew16MBBlock(out handle)) - { - break; - } - Thread.Sleep(0); - goto fallback; - } - } - - if (handle != null) - { - SliceMemory(handle, (segmentIndex + 1) * levelSize[level]); - handle->State = EntryState.Allocated; - } - - return new hlsfHandle(handle, size); - } - - private void SliceMemory(Entry* e, int offset) { } - - /// - /// Try to allocate a new 16MB block when all buckets are empty - /// - /// - /// Output handle to the allocated Entry - /// - /// - /// True if allocation succeeded - /// - private bool TryAllocateNew16MBBlock(out Entry* handle) - { - nuint pos = Volatile.Read(ref _spareMemory->Position); - nuint blockSize = (nuint)levelSize[^1]; // Use last level size (16MB) - nuint newPos = pos + blockSize; - - - // Check if we have enough space - if (newPos > ((nuint)m_Buffer) + _size) - { - handle = null; - return false; // Out of memory - } - - // Try to allocate new Entry from slab allocator - try - { - handle = (Entry*)_nodes.Allocate(); - handle->Position = pos; - handle->BlockSize = (uint)blockSize; - handle->State = EntryState.ThreadOccupied; - handle->NextNear = EmptyHandle; - handle->PreviousNear = EmptyHandle; - handle->SpinLock = 0; - - - // Update spare memory position - _spareMemory->Position = newPos; - - return true; - } - catch - { - handle = null; - return false; - } - } - - /// - /// Helper method for allocation - converts BucketNode to Entry - /// - private bool TryPopLevelForAllocation(int levelIndex, int sizeIndex, out Entry* entry) - { - if (TryPopLevel(levelIndex, sizeIndex, out BucketNode* bucketNode)) - { - entry = bucketNode->EntryRef; - return entry != null; - } - entry = null; - return false; - } - - } -} diff --git a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/CD30AB0D2ADCE1F5EAA4778179A9601E b/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/CD30AB0D2ADCE1F5EAA4778179A9601E deleted file mode 100644 index 0d6231fe..00000000 --- a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/CD30AB0D2ADCE1F5EAA4778179A9601E +++ /dev/null @@ -1,307 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - if (entry != null && Volatile.Read(ref entry->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref entry->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Determine segment index based on size and level - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - if (level < 0 || level >= levelSize.Length) { - return 0; - } - - int segmentIndex = (int)size / levelSize[level]; - return Math.Min(2, segmentIndex); // Ensure not exceeding maximum segment index - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->BlockSize + other->BlockSize; - - // Update current Entry - remain->Position = newPosition; - remain->BlockSize = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - if (entry != null && Volatile.Read(ref entry->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref entry->SpinLock, 0, thread); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - return entry == null || - (Interlocked.CompareExchange(ref entry->SpinLock, thread, - 0) == 0 || - Volatile.Read(ref entry->SpinLock) == thread); - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks - /// - private Entry* TryMergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return null; - } - - Entry* result = entry; - uint originalSize = entry->BlockSize; - int originalLevel = GetLevelFromSize(originalSize); - int originalSegment = DetermineSegmentIndex(originalSize, originalLevel); - - // Forward merge: check predecessor nodes in position linked list - Entry* prev = (Entry*)entry->PreviousNear; - while (prev != null && prev != _spareMemory && prev->State == EntryState.Empty && result->IsAdjacentTo(prev)) - { - // Try acquire spin lock for prev entry - if (!TryAcquireEntrySpinLock(prev)) - { - break; // Cannot acquire lock, might be operated by other thread - } - - try - { - // Double-check state after acquiring lock - if (prev->State != EntryState.Empty || !result->IsAdjacentTo(prev)) - { - break; - } - - // Calculate prev's bucket position - uint prevSize = prev->BlockSize; - int prevLevel = GetLevelFromSize(prevSize); - int prevSegment = DetermineSegmentIndex(prevSize, prevLevel); - - // Remove prev node from bucket (O(1) operation!) - BucketNode* prevBucketNode = ValidateOrRepairBucketNode(prev); - if (prevBucketNode != null && RemoveFromBucket(prevLevel, prevSegment, prevBucketNode)) - { - // Merge into result - result->MergeWith(prev); - - // Remove prev from position linked list - RemoveFromPositionChain(prev); - - // Free prev's Entry node - _nodes.Free((nuint)prev); - - // Continue searching forward - prev = (Entry*)result->PreviousNear; - continue; - } - } - finally - { - ReleaseEntrySpinLock(prev); - } - - break; // Cannot remove, might be operated by other thread - } - - // Backward merge: check successor nodes in position linked list - Entry* next = (Entry*)entry->NextNear; - while (next != null && next->State == EntryState.Empty && result->IsAdjacentTo(next)) - { - // Try acquire spin lock for next entry - if (!TryAcquireEntrySpinLock(next)) - { - break; // Cannot acquire lock, might be operated by other thread - } - - try - { - // Double-check state after acquiring lock - if (next->State != EntryState.Empty || !result->IsAdjacentTo(next)) - { - break; - } - - // Calculate next's bucket position - uint nextSize = next->BlockSize; - int nextLevel = GetLevelFromSize(nextSize); - int nextSegment = DetermineSegmentIndex(nextSize, nextLevel); - - // Remove next node from bucket (O(1) operation!) - BucketNode* nextBucketNode = ValidateOrRepairBucketNode(next); - if (nextBucketNode != null && RemoveFromBucket(nextLevel, nextSegment, nextBucketNode)) - { - // Merge into result - result->MergeWith(next); - - // Remove next from position linked list - RemoveFromPositionChain(next); - - // Free next's Entry node - _nodes.Free((nuint)next); - - // Continue searching backward - next = (Entry*)result->NextNear; - continue; - } - } - finally - { - ReleaseEntrySpinLock(next); - } - - break; // Cannot remove, might be operated by other thread - } - - return result; - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(24)] internal int SpinLock; // Spin lock for thread safety protection - [FieldOffset(28)] internal int State; // Node state - [FieldOffset(32)] internal uint BlockSize; // Block size information - [FieldOffset(36)] internal uint Reverse; - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public readonly bool IsAdjacentTo(Entry* other) - { - if (other == null) { - return false; - } - - // Check if this immediately follows other - return other->Position + other->BlockSize == this.Position || - this.Position + this.BlockSize == other->Position; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - } - - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/E6395BDE1C50709B8EEDE77331A50396 b/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/E6395BDE1C50709B8EEDE77331A50396 deleted file mode 100644 index 6f86ac8e..00000000 --- a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/E6395BDE1C50709B8EEDE77331A50396 +++ /dev/null @@ -1,257 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref node->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref node->SpinLock, 0, thread); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - return node == null || - (Interlocked.CompareExchange(ref node->SpinLock, thread, - 0) == 0 || - Volatile.Read(ref node->SpinLock) == thread); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(32)] internal int SpinLock; // Spin lock for bucket head operation - [FieldOffset(24)] internal uint Magic; // Magic number verification - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - } - - } -} diff --git a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/E782A09FC4760B22FA1A124D72B2E78F b/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/E782A09FC4760B22FA1A124D72B2E78F deleted file mode 100644 index 6111e69e..00000000 --- a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/E782A09FC4760B22FA1A124D72B2E78F +++ /dev/null @@ -1,307 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private void AcquireEntrySpinLock(Entry* entry) - { - if (entry == null) { - return; - } - - while (Interlocked.CompareExchange(ref entry->SpinLock, Environment.CurrentManagedThreadId, 0) != 0) { - Thread.Sleep(0); - } - } - - /// - /// Determine segment index based on size and level - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - if (level < 0 || level >= levelSize.Length) { - return 0; - } - - int segmentIndex = (int)size / levelSize[level]; - return Math.Min(2, segmentIndex); // Ensure not exceeding maximum segment index - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->BlockSize + other->BlockSize; - - // Update current Entry - remain->Position = newPosition; - remain->BlockSize = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private void ReleaseEntrySpinLock(Entry* entry) - { - if (entry == null) { - return; - } - _ = Interlocked.CompareExchange(ref entry->SpinLock, 0, Environment.CurrentManagedThreadId); - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private bool TryAcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - return entry != null && - (Volatile.Read(ref entry->SpinLock) == thread || - Interlocked.CompareExchange(ref entry->SpinLock, thread, 0) == 0); - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks - /// - private Entry* TryMergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return null; - } - - Entry* result = entry; - uint originalSize = entry->BlockSize; - int originalLevel = GetLevelFromSize(originalSize); - int originalSegment = DetermineSegmentIndex(originalSize, originalLevel); - - // Forward merge: check predecessor nodes in position linked list - Entry* prev = (Entry*)entry->PreviousNear; - while (prev != null && prev != _spareMemory && prev->State == EntryState.Empty && result->IsAdjacentTo(prev)) - { - // Try acquire spin lock for prev entry - if (!TryAcquireEntrySpinLock(prev)) - { - break; // Cannot acquire lock, might be operated by other thread - } - - try - { - // Double-check state after acquiring lock - if (prev->State != EntryState.Empty || !result->IsAdjacentTo(prev)) - { - break; - } - - // Calculate prev's bucket position - uint prevSize = prev->BlockSize; - int prevLevel = GetLevelFromSize(prevSize); - int prevSegment = DetermineSegmentIndex(prevSize, prevLevel); - - // Remove prev node from bucket (O(1) operation!) - BucketNode* prevBucketNode = ValidateOrRepairBucketNode(prev); - if (prevBucketNode != null && RemoveFromBucket(prevLevel, prevSegment, prevBucketNode)) - { - // Merge into result - result->MergeWith(prev); - - // Remove prev from position linked list - RemoveFromPositionChain(prev); - - // Free prev's Entry node - _nodes.Free((nuint)prev); - - // Continue searching forward - prev = (Entry*)result->PreviousNear; - continue; - } - } - finally - { - ReleaseEntrySpinLock(prev); - } - - break; // Cannot remove, might be operated by other thread - } - - // Backward merge: check successor nodes in position linked list - Entry* next = (Entry*)entry->NextNear; - while (next != null && next->State == EntryState.Empty && result->IsAdjacentTo(next)) - { - // Try acquire spin lock for next entry - if (!TryAcquireEntrySpinLock(next)) - { - break; // Cannot acquire lock, might be operated by other thread - } - - try - { - // Double-check state after acquiring lock - if (next->State != EntryState.Empty || !result->IsAdjacentTo(next)) - { - break; - } - - // Calculate next's bucket position - uint nextSize = next->BlockSize; - int nextLevel = GetLevelFromSize(nextSize); - int nextSegment = DetermineSegmentIndex(nextSize, nextLevel); - - // Remove next node from bucket (O(1) operation!) - BucketNode* nextBucketNode = ValidateOrRepairBucketNode(next); - if (nextBucketNode != null && RemoveFromBucket(nextLevel, nextSegment, nextBucketNode)) - { - // Merge into result - result->MergeWith(next); - - // Remove next from position linked list - RemoveFromPositionChain(next); - - // Free next's Entry node - _nodes.Free((nuint)next); - - // Continue searching backward - next = (Entry*)result->NextNear; - continue; - } - } - finally - { - ReleaseEntrySpinLock(next); - } - - break; // Cannot remove, might be operated by other thread - } - - return result; - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(24)] internal int SpinLock; // Spin lock for thread safety protection - [FieldOffset(28)] internal int State; // Node state - [FieldOffset(32)] internal uint BlockSize; // Block size information - [FieldOffset(36)] internal uint Reverse; - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public readonly bool IsAdjacentTo(Entry* other) - { - if (other == null) { - return false; - } - - // Check if this immediately follows other - return other->Position + other->BlockSize == this.Position || - this.Position + this.BlockSize == other->Position; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - } - - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/EE25551DF1FF89BD08A8D9A521B86DF5 b/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/EE25551DF1FF89BD08A8D9A521B86DF5 deleted file mode 100644 index 6fb85b93..00000000 --- a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/EE25551DF1FF89BD08A8D9A521B86DF5 +++ /dev/null @@ -1,256 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref node->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref node->SpinLock, 0, thread); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - return node != null && - (Volatile.Read(ref node->SpinLock) == thread || - Interlocked.CompareExchange(ref node->SpinLock, thread, 0) == 0); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(32)] internal int SpinLock; // Spin lock for bucket head operation - [FieldOffset(24)] internal uint Magic; // Magic number verification - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - } - - } -} diff --git a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/F1481D5666E0266F32099AD751F704AB b/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/F1481D5666E0266F32099AD751F704AB deleted file mode 100644 index 6fb85b93..00000000 --- a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/5E2C4966BFACBD46B5E99633875FE0B3/F1481D5666E0266F32099AD751F704AB +++ /dev/null @@ -1,256 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref node->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref node->SpinLock, 0, thread); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - return node != null && - (Volatile.Read(ref node->SpinLock) == thread || - Interlocked.CompareExchange(ref node->SpinLock, thread, 0) == 0); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(32)] internal int SpinLock; // Spin lock for bucket head operation - [FieldOffset(24)] internal uint Magic; // Magic number verification - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - } - - } -} diff --git a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/74C9971260C5AA4E8C06D765734B1DF5/9A9DCC23E4BED6C2F3D9BE8BE7C0F16D b/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/74C9971260C5AA4E8C06D765734B1DF5/9A9DCC23E4BED6C2F3D9BE8BE7C0F16D deleted file mode 100644 index bbc85f04..00000000 --- a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/74C9971260C5AA4E8C06D765734B1DF5/9A9DCC23E4BED6C2F3D9BE8BE7C0F16D +++ /dev/null @@ -1,105 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Level.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using System.Numerics; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private const int MaxLevel = 9; - - private static readonly int[] levelSize = [ - 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216 - ]; - - public int AlignOfLevel(int bucketLevel) - { - int blockSize = levelSize[bucketLevel]; - return int.Min(blockSize, _align); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int GetLevelFromSize(uint size) - { - // Ensure minimum size - if (size <= 64) - { - return 0; - } - - /* - * Level sizes: [64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216] - * Pattern: 64 * 4^level for levels 0,1,2,3... - * So: level = Log4(size/64) = (Log2(size/64))/2 = (Log2(size) - 6)/2 - * We can implement Log2 by counting right shifts needed to reach 0 - */ - - uint temp = size; - int shifts = 0; - - - // Count how many times we can divide by 2 (equivalent to log2) - while (temp > 1) - { - temp >>= 1; - shifts++; - } - - - // Convert log2 to level: level = (shifts - 6) / 2 - // But we need to handle the mapping properly for the specific level sizes - int level = Math.Max(0, (shifts - 6) / 2); - - - // Clamp to valid range - return Math.Min(level, levelSize.Length - 1); - } - - } - - public enum CommonMemoryAlign : int - { - - XMMLevel = 16, - YMMLevel = 32, - ZMMLevel = 64, - - ArmNEONLevel = 16, - - } -} diff --git a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/74C9971260C5AA4E8C06D765734B1DF5/A726AF686B954D254643DE66AC4AB3C6 b/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/74C9971260C5AA4E8C06D765734B1DF5/A726AF686B954D254643DE66AC4AB3C6 deleted file mode 100644 index b29f607e..00000000 --- a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/74C9971260C5AA4E8C06D765734B1DF5/A726AF686B954D254643DE66AC4AB3C6 +++ /dev/null @@ -1,105 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Level.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using System.Numerics; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private const int MaxLevel = 9; - - private static readonly int[] levelSize = [ - 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216 - ]; - - public int AlignOfLevel(int bucketLevel) - { - int blockSize = levelSize[bucketLevel]; - return int.Min(blockSize, _align); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int GetLevelFromSize(uint size) - { - // Ensure minimum size - if (size <= 64) - { - return 0; - } - - /* - * size = 64 * 4 ^ level - * level = Log4(size/64) - * level = Log4(size) - Log4(64) - * level = Log4(size) - 3 - * Log4 is the same as count of >>=2 or /= 4; - */ - int level = -3; - while (size > 0) - { - level++; - size >>= 2; - } - return level; - - // Find the position of the highest set bit (equivalent to floor(log2(size))) - int msb = 31 - System.Numerics.BitOperations.LeadingZeroCount(size); - - // Convert MSB position to level index using bit manipulation - // MSB: 6->0, 7->0, 8->1, 9->1, 10->2, 11->2, 12->3, 13->3, etc. - // Pattern: level = max(0, (msb - 6) >> 1) - int level = Math.Max(0, (msb - 6) >> 1); - - - // Clamp to valid range - return Math.Min(level, levelSize.Length - 1); - } - - } - - public enum CommonMemoryAlign : int - { - - XMMLevel = 16, - YMMLevel = 32, - ZMMLevel = 64, - - ArmNEONLevel = 16, - - } -} diff --git a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/74C9971260C5AA4E8C06D765734B1DF5/BA33779672F63494302EF1C48E414F30 b/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/74C9971260C5AA4E8C06D765734B1DF5/BA33779672F63494302EF1C48E414F30 deleted file mode 100644 index b29f607e..00000000 --- a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/74C9971260C5AA4E8C06D765734B1DF5/BA33779672F63494302EF1C48E414F30 +++ /dev/null @@ -1,105 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Level.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using System.Numerics; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private const int MaxLevel = 9; - - private static readonly int[] levelSize = [ - 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216 - ]; - - public int AlignOfLevel(int bucketLevel) - { - int blockSize = levelSize[bucketLevel]; - return int.Min(blockSize, _align); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int GetLevelFromSize(uint size) - { - // Ensure minimum size - if (size <= 64) - { - return 0; - } - - /* - * size = 64 * 4 ^ level - * level = Log4(size/64) - * level = Log4(size) - Log4(64) - * level = Log4(size) - 3 - * Log4 is the same as count of >>=2 or /= 4; - */ - int level = -3; - while (size > 0) - { - level++; - size >>= 2; - } - return level; - - // Find the position of the highest set bit (equivalent to floor(log2(size))) - int msb = 31 - System.Numerics.BitOperations.LeadingZeroCount(size); - - // Convert MSB position to level index using bit manipulation - // MSB: 6->0, 7->0, 8->1, 9->1, 10->2, 11->2, 12->3, 13->3, etc. - // Pattern: level = max(0, (msb - 6) >> 1) - int level = Math.Max(0, (msb - 6) >> 1); - - - // Clamp to valid range - return Math.Min(level, levelSize.Length - 1); - } - - } - - public enum CommonMemoryAlign : int - { - - XMMLevel = 16, - YMMLevel = 32, - ZMMLevel = 64, - - ArmNEONLevel = 16, - - } -} diff --git a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/D2E60338869153428EB06AD08B66FA96/204BA385182B8AC6A7336CDB3A742205 b/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/D2E60338869153428EB06AD08B66FA96/204BA385182B8AC6A7336CDB3A742205 deleted file mode 100644 index bbc85f04..00000000 --- a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/D2E60338869153428EB06AD08B66FA96/204BA385182B8AC6A7336CDB3A742205 +++ /dev/null @@ -1,105 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Level.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using System.Numerics; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private const int MaxLevel = 9; - - private static readonly int[] levelSize = [ - 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216 - ]; - - public int AlignOfLevel(int bucketLevel) - { - int blockSize = levelSize[bucketLevel]; - return int.Min(blockSize, _align); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int GetLevelFromSize(uint size) - { - // Ensure minimum size - if (size <= 64) - { - return 0; - } - - /* - * Level sizes: [64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216] - * Pattern: 64 * 4^level for levels 0,1,2,3... - * So: level = Log4(size/64) = (Log2(size/64))/2 = (Log2(size) - 6)/2 - * We can implement Log2 by counting right shifts needed to reach 0 - */ - - uint temp = size; - int shifts = 0; - - - // Count how many times we can divide by 2 (equivalent to log2) - while (temp > 1) - { - temp >>= 1; - shifts++; - } - - - // Convert log2 to level: level = (shifts - 6) / 2 - // But we need to handle the mapping properly for the specific level sizes - int level = Math.Max(0, (shifts - 6) / 2); - - - // Clamp to valid range - return Math.Min(level, levelSize.Length - 1); - } - - } - - public enum CommonMemoryAlign : int - { - - XMMLevel = 16, - YMMLevel = 32, - ZMMLevel = 64, - - ArmNEONLevel = 16, - - } -} diff --git a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/D2E60338869153428EB06AD08B66FA96/9942F82E888309215B9489B88CD0587C b/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/D2E60338869153428EB06AD08B66FA96/9942F82E888309215B9489B88CD0587C deleted file mode 100644 index 40159f3b..00000000 --- a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/D2E60338869153428EB06AD08B66FA96/9942F82E888309215B9489B88CD0587C +++ /dev/null @@ -1,103 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Level.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using System.Numerics; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private const int MaxLevel = 9; - - private static readonly int[] levelSize = [ - 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216 - ]; - - public int AlignOfLevel(int bucketLevel) - { - int blockSize = levelSize[bucketLevel]; - return int.Min(blockSize, _align); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int GetLevelFromSize(uint size) - { - // Ensure minimum size - if (size <= 64) - { - return 0; - } - - /* - * Level sizes: [64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216] - * Pattern: 64 * 4^level = 2^6 * 2^(2*level) = 2^(6+2*level) - * - * For size S, we need: 2^(6+2*level) >= S - * So: 6+2*level >= log2(S) - * Therefore: level >= (log2(S) - 6) / 2 - * - * We use hardware LZCNT instruction via BitOperations.LeadingZeroCount - * log2(S) = 31 - LeadingZeroCount(S) for 32-bit values - */ - - - // Use hardware LZCNT instruction (available on Intel Haswell+ and AMD Barcelona+) - // This compiles to a single LZCNT instruction on supporting CPUs - int log2Size = 31 - BitOperations.LeadingZeroCount(size); - - - // Calculate level: level = max(0, (log2Size - 6) / 2) - int level = Math.Max(0, (log2Size - 6) / 2); - - - // Clamp to valid range to prevent array bounds issues - return Math.Min(level, levelSize.Length - 1); - } - - } - - public enum CommonMemoryAlign : int - { - - XMMLevel = 16, - YMMLevel = 32, - ZMMLevel = 64, - - ArmNEONLevel = 16, - - } -} diff --git a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/D2E60338869153428EB06AD08B66FA96/BA33779672F63494302EF1C48E414F30 b/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/D2E60338869153428EB06AD08B66FA96/BA33779672F63494302EF1C48E414F30 deleted file mode 100644 index bbc85f04..00000000 --- a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/D2E60338869153428EB06AD08B66FA96/BA33779672F63494302EF1C48E414F30 +++ /dev/null @@ -1,105 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Level.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using System.Numerics; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private const int MaxLevel = 9; - - private static readonly int[] levelSize = [ - 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216 - ]; - - public int AlignOfLevel(int bucketLevel) - { - int blockSize = levelSize[bucketLevel]; - return int.Min(blockSize, _align); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int GetLevelFromSize(uint size) - { - // Ensure minimum size - if (size <= 64) - { - return 0; - } - - /* - * Level sizes: [64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216] - * Pattern: 64 * 4^level for levels 0,1,2,3... - * So: level = Log4(size/64) = (Log2(size/64))/2 = (Log2(size) - 6)/2 - * We can implement Log2 by counting right shifts needed to reach 0 - */ - - uint temp = size; - int shifts = 0; - - - // Count how many times we can divide by 2 (equivalent to log2) - while (temp > 1) - { - temp >>= 1; - shifts++; - } - - - // Convert log2 to level: level = (shifts - 6) / 2 - // But we need to handle the mapping properly for the specific level sizes - int level = Math.Max(0, (shifts - 6) / 2); - - - // Clamp to valid range - return Math.Min(level, levelSize.Length - 1); - } - - } - - public enum CommonMemoryAlign : int - { - - XMMLevel = 16, - YMMLevel = 32, - ZMMLevel = 64, - - ArmNEONLevel = 16, - - } -} diff --git a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/E495A6AEE9C2AD408C1782616E92CB4E/824554993253182192F9FC3EA6212052 b/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/E495A6AEE9C2AD408C1782616E92CB4E/824554993253182192F9FC3EA6212052 deleted file mode 100644 index 0c43a7ec..00000000 --- a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/E495A6AEE9C2AD408C1782616E92CB4E/824554993253182192F9FC3EA6212052 +++ /dev/null @@ -1,95 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Level.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private const int MaxLevel = 9; - - private static readonly int[] levelSize = [ - 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216 - ]; - - public int AlignOfLevel(int bucketLevel) - { - int blockSize = levelSize[bucketLevel]; - return int.Min(blockSize, _align); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int GetLevelFromSize(uint size) - { - // Ensure minimum size - if (size <= 64) - { - return 0; - } - - // Use binary operations to find the appropriate level - // Level sizes follow pattern: 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216 - // These correspond to: 2^6, 2^8, 2^10, 2^12, 2^14, 2^16, 2^18, 2^20, 2^22, 2^24 - - - // Find the position of the highest set bit (equivalent to floor(log2(size))) - int msb = 31 - System.Numerics.BitOperations.LeadingZeroCount(size); - - - // Convert MSB position to level index using bit manipulation - // MSB: 6->0, 7->0, 8->1, 9->1, 10->2, 11->2, 12->3, 13->3, etc. - // Pattern: level = max(0, (msb - 6) >> 1) - int level = Math.Max(0, (msb - 6) >> 1); - - - // Clamp to valid range - return Math.Min(level, levelSize.Length - 1); - } - - } - - public enum CommonMemoryAlign : int - { - - XMMLevel = 16, - YMMLevel = 32, - ZMMLevel = 64, - - ArmNEONLevel = 16, - - } -} diff --git a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/E495A6AEE9C2AD408C1782616E92CB4E/954EBDC2FEAB07F497506A52718927D4 b/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/E495A6AEE9C2AD408C1782616E92CB4E/954EBDC2FEAB07F497506A52718927D4 deleted file mode 100644 index 0c43a7ec..00000000 --- a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/E495A6AEE9C2AD408C1782616E92CB4E/954EBDC2FEAB07F497506A52718927D4 +++ /dev/null @@ -1,95 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Level.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private const int MaxLevel = 9; - - private static readonly int[] levelSize = [ - 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216 - ]; - - public int AlignOfLevel(int bucketLevel) - { - int blockSize = levelSize[bucketLevel]; - return int.Min(blockSize, _align); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int GetLevelFromSize(uint size) - { - // Ensure minimum size - if (size <= 64) - { - return 0; - } - - // Use binary operations to find the appropriate level - // Level sizes follow pattern: 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216 - // These correspond to: 2^6, 2^8, 2^10, 2^12, 2^14, 2^16, 2^18, 2^20, 2^22, 2^24 - - - // Find the position of the highest set bit (equivalent to floor(log2(size))) - int msb = 31 - System.Numerics.BitOperations.LeadingZeroCount(size); - - - // Convert MSB position to level index using bit manipulation - // MSB: 6->0, 7->0, 8->1, 9->1, 10->2, 11->2, 12->3, 13->3, etc. - // Pattern: level = max(0, (msb - 6) >> 1) - int level = Math.Max(0, (msb - 6) >> 1); - - - // Clamp to valid range - return Math.Min(level, levelSize.Length - 1); - } - - } - - public enum CommonMemoryAlign : int - { - - XMMLevel = 16, - YMMLevel = 32, - ZMMLevel = 64, - - ArmNEONLevel = 16, - - } -} diff --git a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/E495A6AEE9C2AD408C1782616E92CB4E/9B426B200587B35E662E551C35153B5E b/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/E495A6AEE9C2AD408C1782616E92CB4E/9B426B200587B35E662E551C35153B5E deleted file mode 100644 index a79957ff..00000000 --- a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/E495A6AEE9C2AD408C1782616E92CB4E/9B426B200587B35E662E551C35153B5E +++ /dev/null @@ -1,94 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Level.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private const int MaxLevel = 9; - - private static readonly int[] levelSize = [ - 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216 - ]; - - public int AlignOfLevel(int bucketLevel) - { - int blockSize = levelSize[bucketLevel]; - return int.Min(blockSize, _align); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int GetLevelFromSize(uint size) - { - /* - rebuild by using binary operations - */ - - - // Ensure minimum size - if (size <= 64) - { - return 0; - } - - // Find the appropriate level for the given size - for (int i = 0; i < levelSize.Length - 1; i++) - { - if (size <= levelSize[i]) { - return i; - } - } - - - // If size is larger than all predefined levels, use the last level - return levelSize.Length - 1; - } - - } - - public enum CommonMemoryAlign : int - { - - XMMLevel = 16, - YMMLevel = 32, - ZMMLevel = 64, - - ArmNEONLevel = 16, - - } -} diff --git a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/E495A6AEE9C2AD408C1782616E92CB4E/A74D8A4487C885B30AE73AC39AAC9803 b/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/E495A6AEE9C2AD408C1782616E92CB4E/A74D8A4487C885B30AE73AC39AAC9803 deleted file mode 100644 index 5294aa4e..00000000 --- a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/E495A6AEE9C2AD408C1782616E92CB4E/A74D8A4487C885B30AE73AC39AAC9803 +++ /dev/null @@ -1,185 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Level.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private const int MaxLevel = 9; - - private static readonly int[] levelSize = [ - 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216 - ]; - - public int AlignOfLevel(int bucketLevel) - { - int blockSize = levelSize[bucketLevel]; - return int.Min(blockSize, _align); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int GetLevelFromSize(uint size) - { - // Ensure minimum size - if (size <= 64) - { - return 0; - } - - // Use binary operations to find the appropriate level - // Level sizes are powers of 2: 64(2^6), 256(2^8), 1024(2^10), etc. - // We can use bit operations to efficiently determine the level - - - // Find the position of the highest set bit (equivalent to log2) - int msb = 31 - System.Numerics.BitOperations.LeadingZeroCount(size); - - - // Map bit position to level index - // Level 0: 64 (2^6) -> msb = 6 - // Level 1: 256 (2^8) -> msb = 8 - // Level 2: 1024 (2^10) -> msb = 10 - // Pattern: level = (msb - 6) / 2, but we need to handle boundaries - - if (msb <= 6) - { - return 0; // size <= 64 - } - - if (msb <= 7) - { - return 0; // size <= 128, still fits in level 0 (64-256) - } - - if (msb <= 8) - { - return 1; // size <= 256 - } - - if (msb <= 9) - { - return 1; // size <= 512, still fits in level 1 (256-1024) - } - - if (msb <= 10) - { - return 2; // size <= 1024 - } - - if (msb <= 11) - { - return 2; // size <= 2048, still fits in level 2 (1024-4096) - } - - if (msb <= 12) - { - return 3; // size <= 4096 - } - - if (msb <= 13) - { - return 3; // size <= 8192, still fits in level 3 (4096-16384) - } - - if (msb <= 14) - { - return 4; // size <= 16384 - } - - if (msb <= 15) - { - return 4; // size <= 32768, still fits in level 4 (16384-65536) - } - - if (msb <= 16) - { - return 5; // size <= 65536 - } - - if (msb <= 17) - { - return 5; // size <= 131072, still fits in level 5 (65536-262144) - } - - if (msb <= 18) - { - return 6; // size <= 262144 - } - - if (msb <= 19) - { - return 6; // size <= 524288, still fits in level 6 (262144-1048576) - } - - if (msb <= 20) - { - return 7; // size <= 1048576 - } - - if (msb <= 21) - { - return 7; // size <= 2097152, still fits in level 7 (1048576-4194304) - } - - if (msb <= 22) - { - return 8; // size <= 4194304 - } - - if (msb <= 23) - { - return 8; // size <= 8388608, still fits in level 8 (4194304-16777216) - } - - // If size is larger than all predefined levels, use the last level - return levelSize.Length - 1; - } - - } - - public enum CommonMemoryAlign : int - { - - XMMLevel = 16, - YMMLevel = 32, - ZMMLevel = 64, - - ArmNEONLevel = 16, - - } -} diff --git a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/E495A6AEE9C2AD408C1782616E92CB4E/ADDA6C2F849AB70C1E1D33E9EA739FE1 b/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/E495A6AEE9C2AD408C1782616E92CB4E/ADDA6C2F849AB70C1E1D33E9EA739FE1 deleted file mode 100644 index 5294aa4e..00000000 --- a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/E495A6AEE9C2AD408C1782616E92CB4E/ADDA6C2F849AB70C1E1D33E9EA739FE1 +++ /dev/null @@ -1,185 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Level.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private const int MaxLevel = 9; - - private static readonly int[] levelSize = [ - 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216 - ]; - - public int AlignOfLevel(int bucketLevel) - { - int blockSize = levelSize[bucketLevel]; - return int.Min(blockSize, _align); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int GetLevelFromSize(uint size) - { - // Ensure minimum size - if (size <= 64) - { - return 0; - } - - // Use binary operations to find the appropriate level - // Level sizes are powers of 2: 64(2^6), 256(2^8), 1024(2^10), etc. - // We can use bit operations to efficiently determine the level - - - // Find the position of the highest set bit (equivalent to log2) - int msb = 31 - System.Numerics.BitOperations.LeadingZeroCount(size); - - - // Map bit position to level index - // Level 0: 64 (2^6) -> msb = 6 - // Level 1: 256 (2^8) -> msb = 8 - // Level 2: 1024 (2^10) -> msb = 10 - // Pattern: level = (msb - 6) / 2, but we need to handle boundaries - - if (msb <= 6) - { - return 0; // size <= 64 - } - - if (msb <= 7) - { - return 0; // size <= 128, still fits in level 0 (64-256) - } - - if (msb <= 8) - { - return 1; // size <= 256 - } - - if (msb <= 9) - { - return 1; // size <= 512, still fits in level 1 (256-1024) - } - - if (msb <= 10) - { - return 2; // size <= 1024 - } - - if (msb <= 11) - { - return 2; // size <= 2048, still fits in level 2 (1024-4096) - } - - if (msb <= 12) - { - return 3; // size <= 4096 - } - - if (msb <= 13) - { - return 3; // size <= 8192, still fits in level 3 (4096-16384) - } - - if (msb <= 14) - { - return 4; // size <= 16384 - } - - if (msb <= 15) - { - return 4; // size <= 32768, still fits in level 4 (16384-65536) - } - - if (msb <= 16) - { - return 5; // size <= 65536 - } - - if (msb <= 17) - { - return 5; // size <= 131072, still fits in level 5 (65536-262144) - } - - if (msb <= 18) - { - return 6; // size <= 262144 - } - - if (msb <= 19) - { - return 6; // size <= 524288, still fits in level 6 (262144-1048576) - } - - if (msb <= 20) - { - return 7; // size <= 1048576 - } - - if (msb <= 21) - { - return 7; // size <= 2097152, still fits in level 7 (1048576-4194304) - } - - if (msb <= 22) - { - return 8; // size <= 4194304 - } - - if (msb <= 23) - { - return 8; // size <= 8388608, still fits in level 8 (4194304-16777216) - } - - // If size is larger than all predefined levels, use the last level - return levelSize.Length - 1; - } - - } - - public enum CommonMemoryAlign : int - { - - XMMLevel = 16, - YMMLevel = 32, - ZMMLevel = 64, - - ArmNEONLevel = 16, - - } -} diff --git a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/E495A6AEE9C2AD408C1782616E92CB4E/BA33779672F63494302EF1C48E414F30 b/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/E495A6AEE9C2AD408C1782616E92CB4E/BA33779672F63494302EF1C48E414F30 deleted file mode 100644 index a79957ff..00000000 --- a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/E495A6AEE9C2AD408C1782616E92CB4E/BA33779672F63494302EF1C48E414F30 +++ /dev/null @@ -1,94 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Level.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private const int MaxLevel = 9; - - private static readonly int[] levelSize = [ - 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216 - ]; - - public int AlignOfLevel(int bucketLevel) - { - int blockSize = levelSize[bucketLevel]; - return int.Min(blockSize, _align); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int GetLevelFromSize(uint size) - { - /* - rebuild by using binary operations - */ - - - // Ensure minimum size - if (size <= 64) - { - return 0; - } - - // Find the appropriate level for the given size - for (int i = 0; i < levelSize.Length - 1; i++) - { - if (size <= levelSize[i]) { - return i; - } - } - - - // If size is larger than all predefined levels, use the last level - return levelSize.Length - 1; - } - - } - - public enum CommonMemoryAlign : int - { - - XMMLevel = 16, - YMMLevel = 32, - ZMMLevel = 64, - - ArmNEONLevel = 16, - - } -} diff --git a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/E495A6AEE9C2AD408C1782616E92CB4E/FD56A93ACB74ECBD9D8CE1E350D3D444 b/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/E495A6AEE9C2AD408C1782616E92CB4E/FD56A93ACB74ECBD9D8CE1E350D3D444 deleted file mode 100644 index b0b26eb3..00000000 --- a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/E495A6AEE9C2AD408C1782616E92CB4E/FD56A93ACB74ECBD9D8CE1E350D3D444 +++ /dev/null @@ -1,96 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Level.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Collections.Generic; -using System.Linq; -using System.Numerics; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private const int MaxLevel = 9; - - private static readonly int[] levelSize = [ - 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216 - ]; - - public int AlignOfLevel(int bucketLevel) - { - int blockSize = levelSize[bucketLevel]; - return int.Min(blockSize, _align); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int GetLevelFromSize(uint size) - { - // Ensure minimum size - if (size <= 64) - { - return 0; - } - - // Use binary operations to find the appropriate level - // Level sizes follow pattern: 64, 256, 1024, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216 - // These correspond to: 2^6, 2^8, 2^10, 2^12, 2^14, 2^16, 2^18, 2^20, 2^22, 2^24 - - - // Find the position of the highest set bit (equivalent to floor(log2(size))) - int msb = 31 - System.Numerics.BitOperations.LeadingZeroCount(size); - - - // Convert MSB position to level index using bit manipulation - // MSB: 6->0, 7->0, 8->1, 9->1, 10->2, 11->2, 12->3, 13->3, etc. - // Pattern: level = max(0, (msb - 6) >> 1) - int level = Math.Max(0, (msb - 6) >> 1); - - - // Clamp to valid range - return Math.Min(level, levelSize.Length - 1); - } - - } - - public enum CommonMemoryAlign : int - { - - XMMLevel = 16, - YMMLevel = 32, - ZMMLevel = 64, - - ArmNEONLevel = 16, - - } -} diff --git a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/state.mpack b/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/state.mpack deleted file mode 100644 index fc089b9e..00000000 Binary files a/.vs/CopilotSnapshots/A161F096D827134994BA9E58738BECBF/state.mpack and /dev/null differ diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/0C3D99E3DB30FB4583D72042C41D3E7E b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/0C3D99E3DB30FB4583D72042C41D3E7E deleted file mode 100644 index 5b8e6a6b..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/0C3D99E3DB30FB4583D72042C41D3E7E +++ /dev/null @@ -1,572 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用新的静态方法 - BucketNodeOperations.AcquireBothLocks(node); - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - node->AcquireNextLock(); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !headNode->TryAcquirePrevLock()) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - headNode->ReleasePrevLock(); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - node->ReleaseNextLock(); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 使用新的静态方法 - BucketNodeOperations.ReleaseBothLocks(node); - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(只读操作,暂时不加锁) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - - // 按照地址顺序获取锁,避免死锁 - BucketNode* firstLock = null, secondLock = null, thirdLock = null; - bool needPrevNextLock = false, needNodeBothLocks = false, needNextPrevLock = false; - - if (previous != null && next != null) - { - // 中间节点:需要修改前驱的next和后继的prev - if ((ulong)previous < (ulong)node && (ulong)node < (ulong)next) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - thirdLock = next; - needNextPrevLock = true; - } else if ((ulong)previous < (ulong)next && (ulong)next < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = next; - needNextPrevLock = true; - thirdLock = node; - needNodeBothLocks = true; - } else // other cases - { - firstLock = next; - needNextPrevLock = true; - secondLock = previous; - needPrevNextLock = true; - thirdLock = node; - needNodeBothLocks = true; - } - } else if (previous != null) - { - // 尾节点:只需要修改前驱的next - if ((ulong)previous < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - } else - { - firstLock = node; - needNodeBothLocks = true; - secondLock = previous; - needPrevNextLock = true; - } - } else - { - // 应该不会到这里,因为头节点已经在上面处理了 - Thread.Sleep(0); - continue; - } - - - // 按顺序获取锁 - bool acquired = false; - try - { - if (firstLock != null) - { - if (firstLock == previous && needPrevNextLock) - { - if (!firstLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == next && needNextPrevLock) - { - if (!firstLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == node && needNodeBothLocks) - { - if (!firstLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (secondLock != null) - { - if (secondLock == previous && needPrevNextLock) - { - if (!secondLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == next && needNextPrevLock) - { - if (!secondLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == node && needNodeBothLocks) - { - if (!secondLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (thirdLock != null) - { - if (thirdLock == previous && needPrevNextLock) - { - if (!thirdLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == next && needNextPrevLock) - { - if (!thirdLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == node && needNodeBothLocks) - { - if (!thirdLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - acquired = true; - - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - if (acquired) - { - // 释放锁 - if (thirdLock == previous && needPrevNextLock) - { - thirdLock->ReleaseNextLock(); - } else if (thirdLock == next && needNextPrevLock) - { - thirdLock->ReleasePrevLock(); - } else if (thirdLock == node && needNodeBothLocks) { - thirdLock->ReleaseBothLocks(); - } - - if (secondLock == previous && needPrevNextLock) - { - secondLock->ReleaseNextLock(); - } else if (secondLock == next && needNextPrevLock) - { - secondLock->ReleasePrevLock(); - } else if (secondLock == node && needNodeBothLocks) { - secondLock->ReleaseBothLocks(); - } - - if (firstLock == previous && needPrevNextLock) - { - firstLock->ReleaseNextLock(); - } else if (firstLock == next && needNextPrevLock) - { - firstLock->ReleasePrevLock(); - } else if (firstLock == node && needNodeBothLocks) { - firstLock->ReleaseBothLocks(); - } - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用新的静态方法 - return BucketNodeOperations.TryAcquireBothLocks(node); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!head->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !next->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - next->ReleasePrevLock(); - } - } - } - finally - { - head->ReleaseNextLock(); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - } - - #region BucketNode Operations - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != BucketNode.MAGIC_NUMBER; - } - - // BucketNode 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref node->PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) == thread) { - Volatile.Write(ref node->PrevLock, 0); - } - } - - // BucketNode 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) != thread) - { - while (Interlocked.CompareExchange(ref node->NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) == thread) { - Volatile.Write(ref node->NextLock, 0); - } - } - - // BucketNode 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return true; - } - - if (TryAcquireBucketNodePrevLock(node)) - { - if (TryAcquireBucketNodeNextLock(node)) - { - return true; - } else - { - ReleaseBucketNodePrevLock(node); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - ReleaseBucketNodePrevLock(node); - ReleaseBucketNodeNextLock(node); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - AcquireBucketNodePrevLock(node); - AcquireBucketNodeNextLock(node); - } - - #endregion - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/1577821B1CC9DDA7C09D6A7F6752D4EB b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/1577821B1CC9DDA7C09D6A7F6752D4EB deleted file mode 100644 index 937763cf..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/1577821B1CC9DDA7C09D6A7F6752D4EB +++ /dev/null @@ -1,572 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - AcquireBucketNodeBothLocks(node); - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - AcquireBucketNodeNextLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !TryAcquireBucketNodePrevLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - ReleaseBucketNodePrevLock(headNode); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeNextLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - ReleaseBucketNodeBothLocks(node); - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(只读操作,暂时不加锁) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - - // 按照地址顺序获取锁,避免死锁 - BucketNode* firstLock = null, secondLock = null, thirdLock = null; - bool needPrevNextLock = false, needNodeBothLocks = false, needNextPrevLock = false; - - if (previous != null && next != null) - { - // 中间节点:需要修改前驱的next和后继的prev - if ((ulong)previous < (ulong)node && (ulong)node < (ulong)next) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - thirdLock = next; - needNextPrevLock = true; - } else if ((ulong)previous < (ulong)next && (ulong)next < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = next; - needNextPrevLock = true; - thirdLock = node; - needNodeBothLocks = true; - } else // other cases - { - firstLock = next; - needNextPrevLock = true; - secondLock = previous; - needPrevNextLock = true; - thirdLock = node; - needNodeBothLocks = true; - } - } else if (previous != null) - { - // 尾节点:只需要修改前驱的next - if ((ulong)previous < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - } else - { - firstLock = node; - needNodeBothLocks = true; - secondLock = previous; - needPrevNextLock = true; - } - } else - { - // 应该不会到这里,因为头节点已经在上面处理了 - Thread.Sleep(0); - continue; - } - - - // 按顺序获取锁 - bool acquired = false; - try - { - if (firstLock != null) - { - if (firstLock == previous && needPrevNextLock) - { - if (!firstLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == next && needNextPrevLock) - { - if (!firstLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == node && needNodeBothLocks) - { - if (!firstLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (secondLock != null) - { - if (secondLock == previous && needPrevNextLock) - { - if (!secondLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == next && needNextPrevLock) - { - if (!secondLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == node && needNodeBothLocks) - { - if (!secondLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (thirdLock != null) - { - if (thirdLock == previous && needPrevNextLock) - { - if (!thirdLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == next && needNextPrevLock) - { - if (!thirdLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == node && needNodeBothLocks) - { - if (!thirdLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - acquired = true; - - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - if (acquired) - { - // 释放锁 - if (thirdLock == previous && needPrevNextLock) - { - thirdLock->ReleaseNextLock(); - } else if (thirdLock == next && needNextPrevLock) - { - thirdLock->ReleasePrevLock(); - } else if (thirdLock == node && needNodeBothLocks) { - thirdLock->ReleaseBothLocks(); - } - - if (secondLock == previous && needPrevNextLock) - { - secondLock->ReleaseNextLock(); - } else if (secondLock == next && needNextPrevLock) - { - secondLock->ReleasePrevLock(); - } else if (secondLock == node && needNodeBothLocks) { - secondLock->ReleaseBothLocks(); - } - - if (firstLock == previous && needPrevNextLock) - { - firstLock->ReleaseNextLock(); - } else if (firstLock == next && needNextPrevLock) - { - firstLock->ReleasePrevLock(); - } else if (firstLock == node && needNodeBothLocks) { - firstLock->ReleaseBothLocks(); - } - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - return TryAcquireBucketNodeBothLocks(node); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!head->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !next->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - next->ReleasePrevLock(); - } - } - } - finally - { - head->ReleaseNextLock(); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - } - - #region BucketNode Operations - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != BucketNode.MAGIC_NUMBER; - } - - // BucketNode 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref node->PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) == thread) { - Volatile.Write(ref node->PrevLock, 0); - } - } - - // BucketNode 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) != thread) - { - while (Interlocked.CompareExchange(ref node->NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) == thread) { - Volatile.Write(ref node->NextLock, 0); - } - } - - // BucketNode 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return true; - } - - if (TryAcquireBucketNodePrevLock(node)) - { - if (TryAcquireBucketNodeNextLock(node)) - { - return true; - } else - { - ReleaseBucketNodePrevLock(node); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - ReleaseBucketNodePrevLock(node); - ReleaseBucketNodeNextLock(node); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - AcquireBucketNodePrevLock(node); - AcquireBucketNodeNextLock(node); - } - - #endregion - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/15ECA87E3A6524336A306184CCF4359E b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/15ECA87E3A6524336A306184CCF4359E deleted file mode 100644 index 88556cfa..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/15ECA87E3A6524336A306184CCF4359E +++ /dev/null @@ -1,160 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Alloc.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Threading; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private BufferExpansionLock _spareLock = new(); - - public hlsfHandle Alloc(uint size) - { - ArgumentOutOfRangeException.ThrowIfGreaterThan(size, (nuint)levelSize[^1] * 2); - int level = GetLevelFromSize(size); - int segmentIndex = DetermineSegmentIndex(size, level); - - int i = level, s = segmentIndex; - if (TryPopLevelForAllocation(i, s, out Entry* handle)) - { - handle->SetState(EntryState.Allocated); - return new hlsfHandle(handle, size); - } - - fallback: - i = level; - s = segmentIndex; - while (!TryPopLevelForAllocation(i, s, out handle)) - { - if (++s >= 3) - { - s = 0; - i++; - } - if (i >= levelSize.Length) - { - if (TryAllocateNew16MBBlock(out handle)) - { - break; - } - Thread.Sleep(0); - goto fallback; - } - } - - if (handle != null) - { - SliceMemory(handle, (segmentIndex + 1) * levelSize[level]); - handle->SetState(EntryState.Allocated); - } - - return new hlsfHandle(handle, size); - } - - private void SliceMemory(Entry* e, int offset) { } - - /// - /// Try to allocate a new 16MB block when all buckets are empty - /// - /// - /// Output handle to the allocated Entry - /// - /// - /// True if allocation succeeded - /// - private bool TryAllocateNew16MBBlock(out Entry* handle) - { - nuint pos = Volatile.Read(ref _spareMemory->Position); - nuint blockSize = (nuint)levelSize[^1] * 2; // Use last level size (16MB) - nuint newPos = pos + blockSize; - - // Check if we have enough space - if (newPos > ((nuint)m_Buffer) + _size) - { - handle = null; - return false; // Out of memory - } - - // Try to allocate new Entry from slab allocator - try - { - handle = (Entry*)_nodes.Allocate(); - handle->Position = pos; - handle->Size = (uint)blockSize; - handle->SetState(EntryState.ThreadOccupied); - handle->NextNear = EmptyHandle; - handle->PreviousNear = EmptyHandle; - handle->Level = GetLevelFromSize((uint)blockSize); - - - // 初始化双锁为未锁定状态 - handle->PrevLock = 0; - handle->NextLock = 0; - - // Update spare memory position - _spareMemory->Position = newPos; - - return true; - } - catch - { - handle = null; - return false; - } - } - - /// - /// Helper method for allocation - converts BucketNode to Entry - /// - private bool TryPopLevelForAllocation(int levelIndex, int sizeIndex, out Entry* entry) - { - if (TryPopLevel(levelIndex, sizeIndex, out BucketNode* bucketNode)) - { - entry = bucketNode->EntryRef; - return entry != null; - } - entry = null; - return false; - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/2C04942E9F51ED6685805646349A97A8 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/2C04942E9F51ED6685805646349A97A8 deleted file mode 100644 index c2e194ce..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/2C04942E9F51ED6685805646349A97A8 +++ /dev/null @@ -1,286 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用新的静态方法 - if (entry != null) - { - EntryOperations.AcquireBothLocks(entry); - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private Entry* MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return null; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = GetLevelFromSize(size); - int segment = DetermineSegmentIndex(size, originLevel); - - if (!TryAcquireEntrySpinLock(entry)) - { - return entry; // 无法获取锁,返回原Entry - } - - try - { - // 设置状态为合并中 - EntryOperations.TrySetState(entry, EntryState.Empty, EntryState.Merging); - - // current Level merge - while (originLevel <= entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - - // backward merging - 向前合并 - while (true) - { - ulong p = entry->PreviousNear; - Entry* prev = (Entry*)p; - if (prev == null || - EntryOperations.GetState(prev) != EntryState.Empty || - !IsAdjacentTo(entry, prev) || - entry->Level != prev->Level || - !AssertAlignBoundry(offset, prev, entry->Level) || - !TryAcquireEntrySpinLock(prev)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)prev->Position); - MergeEntry(entry, prev); - RecycleEntry(prev); - } - finally - { - ReleaseEntrySpinLock(prev); - } - } - - // forward merging - 向后合并 - while (true) - { - ulong n = entry->NextNear; - Entry* next = (Entry*)n; - if (next == null || - EntryOperations.GetState(next) != EntryState.Empty || - !IsAdjacentTo(entry, next) || - entry->Level != next->Level || - !AssertAlignBoundry(offset, next, entry->Level) || - !TryAcquireEntrySpinLock(next)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)next->Position); - MergeEntry(entry, next); - RecycleEntry(next); - } - finally - { - ReleaseEntrySpinLock(next); - } - } - - // 更新level信息 - originLevel++; - if (originLevel > entry->Level) - { - break; - } - } - - // 恢复状态为空 - EntryOperations.TrySetState(entry, EntryState.Merging, EntryState.Empty); - return entry; - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用新的静态方法 - if (entry != null) - { - EntryOperations.ReleaseBothLocks(entry); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用新的静态方法 - return EntryOperations.TryAcquireBothLocks(entry); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 44)] - internal struct Entry - { - - [FieldOffset(28)] internal int Level; // Level of the block in the allocator - [FieldOffset(40)] internal int NextLock; // 后继指针锁(控制NextNear指针操作) - - // 双锁设计:分离前后指针操作(和BucketNode保持一致) - [FieldOffset(36)] internal int PrevLock; // 前驱指针锁(控制PreviousNear指针操作) - [FieldOffset(32)] internal int State; // Node state (using int for atomic operations) - [FieldOffset(24)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - } - - // 更新后的EntryState常量类 - 使用int类型 - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int Merging = 3; // Currently being merged - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/30B1BFBB21CC03D40D9D51952C46395D b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/30B1BFBB21CC03D40D9D51952C46395D deleted file mode 100644 index cdba2cd3..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/30B1BFBB21CC03D40D9D51952C46395D +++ /dev/null @@ -1,459 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用新的静态方法 - if (entry != null) - { - EntryOperations.AcquireBothLocks(entry); - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private Entry* MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return null; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = GetLevelFromSize(size); - int segment = DetermineSegmentIndex(size, originLevel); - - if (!TryAcquireEntrySpinLock(entry)) - { - return entry; // 无法获取锁,返回原Entry - } - - try - { - // 设置状态为合并中 - EntryOperations.TrySetState(entry, EntryState.Empty, EntryState.Merging); - - // current Level merge - while (originLevel <= entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - - // backward merging - 向前合并 - while (true) - { - ulong p = entry->PreviousNear; - Entry* prev = (Entry*)p; - if (prev == null || - EntryOperations.GetState(prev) != EntryState.Empty || - !IsAdjacentTo(entry, prev) || - entry->Level != prev->Level || - !AssertAlignBoundry(offset, prev, entry->Level) || - !TryAcquireEntrySpinLock(prev)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)prev->Position); - MergeEntry(entry, prev); - RecycleEntry(prev); - } - finally - { - ReleaseEntrySpinLock(prev); - } - } - - // forward merging - 向后合并 - while (true) - { - ulong n = entry->NextNear; - Entry* next = (Entry*)n; - if (next == null || - EntryOperations.GetState(next) != EntryState.Empty || - !IsAdjacentTo(entry, next) || - entry->Level != next->Level || - !AssertAlignBoundry(offset, next, entry->Level) || - !TryAcquireEntrySpinLock(next)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)next->Position); - MergeEntry(entry, next); - RecycleEntry(next); - } - finally - { - ReleaseEntrySpinLock(next); - } - } - - // 更新level信息 - originLevel++; - if (originLevel > entry->Level) - { - break; - } - } - - // 恢复状态为空 - EntryOperations.TrySetState(entry, EntryState.Merging, EntryState.Empty); - return entry; - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用新的静态方法 - if (entry != null) - { - EntryOperations.ReleaseBothLocks(entry); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用新的静态方法 - return EntryOperations.TryAcquireBothLocks(entry); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 44)] - internal struct Entry - { - - [FieldOffset(28)] internal int Level; // Level of the block in the allocator - [FieldOffset(40)] internal int NextLock; // 后继指针锁(控制NextNear指针操作) - - // 双锁设计:分离前后指针操作(和BucketNode保持一致) - [FieldOffset(36)] internal int PrevLock; // 前驱指针锁(控制PreviousNear指针操作) - [FieldOffset(32)] internal int State; // Node state (using int for atomic operations) - [FieldOffset(24)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - } - - // 更新后的EntryState常量类 - 使用int类型 - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int Merging = 3; // Currently being merged - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - #region Entry Operations - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsNullOrEmptyEntryIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsNullOrEmptyEntryIndex(Entry* entry) - { - return entry == null; - } - - // Entry 状态操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TrySetEntryState(Entry* entry, int expectedState, int newState) - { - return entry != null && - Interlocked.CompareExchange(ref entry->State, newState, expectedState) == expectedState; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static int GetEntryState(Entry* entry) => entry != null ? Volatile.Read(ref entry->State) : 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void SetEntryState(Entry* entry, int newState) - { - if (entry != null) { - Volatile.Write(ref entry->State, newState); - } - } - - // Entry 状态便利方法 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsEntryEmpty(Entry* entry) => GetEntryState(entry) == EntryState.Empty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsEntryAllocated(Entry* entry) => GetEntryState(entry) == EntryState.Allocated; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsEntryThreadOccupied(Entry* entry) => GetEntryState(entry) == EntryState.ThreadOccupied; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsEntryMerging(Entry* entry) => GetEntryState(entry) == EntryState.Merging; - - // Entry 前驱锁操作(控制PreviousNear字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntryPrevLock(Entry* entry) - { - if (entry == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref entry->PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireEntryPrevLock(Entry* entry) - { - if (entry == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref entry->PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref entry->PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseEntryPrevLock(Entry* entry) - { - if (entry == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref entry->PrevLock) == thread) { - Volatile.Write(ref entry->PrevLock, 0); - } - } - - // Entry 后继锁操作(控制NextNear字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntryNextLock(Entry* entry) - { - if (entry == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref entry->NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireEntryNextLock(Entry* entry) - { - if (entry == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref entry->NextLock) != thread) - { - while (Interlocked.CompareExchange(ref entry->NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseEntryNextLock(Entry* entry) - { - if (entry == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref entry->NextLock) == thread) { - Volatile.Write(ref entry->NextLock, 0); - } - } - - // Entry 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntryBothLocks(Entry* entry) - { - if (entry == null) { - return true; - } - - if (TryAcquireEntryPrevLock(entry)) - { - if (TryAcquireEntryNextLock(entry)) - { - return true; - } else - { - ReleaseEntryPrevLock(entry); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseEntryBothLocks(Entry* entry) - { - if (entry == null) { - return; - } - - ReleaseEntryPrevLock(entry); - ReleaseEntryNextLock(entry); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireEntryBothLocks(Entry* entry) - { - if (entry == null) { - return; - } - - AcquireEntryPrevLock(entry); - AcquireEntryNextLock(entry); - } - - #endregion - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/3AEE92B5587FC82D1FCB2EC4530D007B b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/3AEE92B5587FC82D1FCB2EC4530D007B deleted file mode 100644 index 5ffe6f9c..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/3AEE92B5587FC82D1FCB2EC4530D007B +++ /dev/null @@ -1,160 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Alloc.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Threading; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private BufferExpansionLock _spareLock = new(); - - public hlsfHandle Alloc(uint size) - { - ArgumentOutOfRangeException.ThrowIfGreaterThan(size, (nuint)levelSize[^1] * 2); - int level = GetLevelFromSize(size); - int segmentIndex = DetermineSegmentIndex(size, level); - - int i = level, s = segmentIndex; - if (TryPopLevelForAllocation(i, s, out Entry* handle)) - { - SetEntryState(handle, EntryState.Allocated); - return new hlsfHandle(handle, size); - } - - fallback: - i = level; - s = segmentIndex; - while (!TryPopLevelForAllocation(i, s, out handle)) - { - if (++s >= 3) - { - s = 0; - i++; - } - if (i >= levelSize.Length) - { - if (TryAllocateNew16MBBlock(out handle)) - { - break; - } - Thread.Sleep(0); - goto fallback; - } - } - - if (handle != null) - { - SliceMemory(handle, (segmentIndex + 1) * levelSize[level]); - SetEntryState(handle, EntryState.Allocated); - } - - return new hlsfHandle(handle, size); - } - - private void SliceMemory(Entry* e, int offset) { } - - /// - /// Try to allocate a new 16MB block when all buckets are empty - /// - /// - /// Output handle to the allocated Entry - /// - /// - /// True if allocation succeeded - /// - private bool TryAllocateNew16MBBlock(out Entry* handle) - { - nuint pos = Volatile.Read(ref _spareMemory->Position); - nuint blockSize = (nuint)levelSize[^1] * 2; // Use last level size (16MB) - nuint newPos = pos + blockSize; - - // Check if we have enough space - if (newPos > ((nuint)m_Buffer) + _size) - { - handle = null; - return false; // Out of memory - } - - // Try to allocate new Entry from slab allocator - try - { - handle = (Entry*)_nodes.Allocate(); - handle->Position = pos; - handle->Size = (uint)blockSize; - handle->SetState(EntryState.ThreadOccupied); - handle->NextNear = EmptyHandle; - handle->PreviousNear = EmptyHandle; - handle->Level = GetLevelFromSize((uint)blockSize); - - - // 初始化双锁为未锁定状态 - handle->PrevLock = 0; - handle->NextLock = 0; - - // Update spare memory position - _spareMemory->Position = newPos; - - return true; - } - catch - { - handle = null; - return false; - } - } - - /// - /// Helper method for allocation - converts BucketNode to Entry - /// - private bool TryPopLevelForAllocation(int levelIndex, int sizeIndex, out Entry* entry) - { - if (TryPopLevel(levelIndex, sizeIndex, out BucketNode* bucketNode)) - { - entry = bucketNode->EntryRef; - return entry != null; - } - entry = null; - return false; - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/41FF955DA0491A7DC2A33E0CCE6D3477 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/41FF955DA0491A7DC2A33E0CCE6D3477 deleted file mode 100644 index 67fb7f9b..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/41FF955DA0491A7DC2A33E0CCE6D3477 +++ /dev/null @@ -1,596 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用新的静态方法 - BucketNodeOperations.AcquireBothLocks(node); - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - node->AcquireNextLock(); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !headNode->TryAcquirePrevLock()) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - headNode->ReleasePrevLock(); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - node->ReleaseNextLock(); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 使用新的静态方法 - BucketNodeOperations.ReleaseBothLocks(node); - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(只读操作,暂时不加锁) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - - // 按照地址顺序获取锁,避免死锁 - BucketNode* firstLock = null, secondLock = null, thirdLock = null; - bool needPrevNextLock = false, needNodeBothLocks = false, needNextPrevLock = false; - - if (previous != null && next != null) - { - // 中间节点:需要修改前驱的next和后继的prev - if ((ulong)previous < (ulong)node && (ulong)node < (ulong)next) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - thirdLock = next; - needNextPrevLock = true; - } else if ((ulong)previous < (ulong)next && (ulong)next < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = next; - needNextPrevLock = true; - thirdLock = node; - needNodeBothLocks = true; - } else // other cases - { - firstLock = next; - needNextPrevLock = true; - secondLock = previous; - needPrevNextLock = true; - thirdLock = node; - needNodeBothLocks = true; - } - } else if (previous != null) - { - // 尾节点:只需要修改前驱的next - if ((ulong)previous < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - } else - { - firstLock = node; - needNodeBothLocks = true; - secondLock = previous; - needPrevNextLock = true; - } - } else - { - // 应该不会到这里,因为头节点已经在上面处理了 - Thread.Sleep(0); - continue; - } - - - // 按顺序获取锁 - bool acquired = false; - try - { - if (firstLock != null) - { - if (firstLock == previous && needPrevNextLock) - { - if (!firstLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == next && needNextPrevLock) - { - if (!firstLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == node && needNodeBothLocks) - { - if (!firstLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (secondLock != null) - { - if (secondLock == previous && needPrevNextLock) - { - if (!secondLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == next && needNextPrevLock) - { - if (!secondLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == node && needNodeBothLocks) - { - if (!secondLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (thirdLock != null) - { - if (thirdLock == previous && needPrevNextLock) - { - if (!thirdLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == next && needNextPrevLock) - { - if (!thirdLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == node && needNodeBothLocks) - { - if (!thirdLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - acquired = true; - - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - if (acquired) - { - // 释放锁 - if (thirdLock == previous && needPrevNextLock) - { - thirdLock->ReleaseNextLock(); - } else if (thirdLock == next && needNextPrevLock) - { - thirdLock->ReleasePrevLock(); - } else if (thirdLock == node && needNodeBothLocks) { - thirdLock->ReleaseBothLocks(); - } - - if (secondLock == previous && needPrevNextLock) - { - secondLock->ReleaseNextLock(); - } else if (secondLock == next && needNextPrevLock) - { - secondLock->ReleasePrevLock(); - } else if (secondLock == node && needNodeBothLocks) { - secondLock->ReleaseBothLocks(); - } - - if (firstLock == previous && needPrevNextLock) - { - firstLock->ReleaseNextLock(); - } else if (firstLock == next && needNextPrevLock) - { - firstLock->ReleasePrevLock(); - } else if (firstLock == node && needNodeBothLocks) { - firstLock->ReleaseBothLocks(); - } - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用新的静态方法 - return BucketNodeOperations.TryAcquireBothLocks(node); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!head->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !next->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - next->ReleasePrevLock(); - } - } - } - finally - { - head->ReleaseNextLock(); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - } - - /// - /// BucketNode操作的静态方法集合 - /// - private static class BucketNodeOperations - { - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != BucketNode.MAGIC_NUMBER; - } - - #region Lock Operations - - // 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool TryAcquirePrevLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void AcquirePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref node->PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void ReleasePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) == thread) { - Volatile.Write(ref node->PrevLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsPrevLockHeld(BucketNode* node) => node != null && - Volatile.Read(ref node->PrevLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsPrevLockHeldByCurrentThread(BucketNode* node) => node != null && - Volatile.Read(ref node->PrevLock) == Environment.CurrentManagedThreadId; - - // 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool TryAcquireNextLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void AcquireNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) != thread) - { - while (Interlocked.CompareExchange(ref node->NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void ReleaseNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) == thread) { - Volatile.Write(ref node->NextLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNextLockHeld(BucketNode* node) => node != null && - Volatile.Read(ref node->NextLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNextLockHeldByCurrentThread(BucketNode* node) => node != null && - Volatile.Read(ref node->NextLock) == Environment.CurrentManagedThreadId; - - // 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool TryAcquireBothLocks(BucketNode* node) - { - if (node == null) { - return true; - } - - if (TryAcquirePrevLock(node)) - { - if (TryAcquireNextLock(node)) - { - return true; - } else - { - ReleasePrevLock(node); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void ReleaseBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - ReleasePrevLock(node); - ReleaseNextLock(node); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void AcquireBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - AcquirePrevLock(node); - AcquireNextLock(node); - } - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/4B6BC7DC9C5BD9BEDD7BE3BE64B0EFD4 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/4B6BC7DC9C5BD9BEDD7BE3BE64B0EFD4 deleted file mode 100644 index 29394b24..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/4B6BC7DC9C5BD9BEDD7BE3BE64B0EFD4 +++ /dev/null @@ -1,453 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用HLSFAllocator的private static方法 - AcquireEntryBothLocks(entry); - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private Entry* MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return null; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = GetLevelFromSize(size); - int segment = DetermineSegmentIndex(size, originLevel); - - if (!TryAcquireEntrySpinLock(entry)) - { - return entry; // 无法获取锁,返回原Entry - } - - try - { - // 设置状态为合并中 - EntryOperations.TrySetState(entry, EntryState.Empty, EntryState.Merging); - - // current Level merge - while (originLevel <= entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - - // backward merging - 向前合并 - while (true) - { - ulong p = entry->PreviousNear; - Entry* prev = (Entry*)p; - if (prev == null || - EntryOperations.GetState(prev) != EntryState.Empty || - !IsAdjacentTo(entry, prev) || - entry->Level != prev->Level || - !AssertAlignBoundry(offset, prev, entry->Level) || - !TryAcquireEntrySpinLock(prev)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)prev->Position); - MergeEntry(entry, prev); - RecycleEntry(prev); - } - finally - { - ReleaseEntrySpinLock(prev); - } - } - - // forward merging - 向后合并 - while (true) - { - ulong n = entry->NextNear; - Entry* next = (Entry*)n; - if (next == null || - EntryOperations.GetState(next) != EntryState.Empty || - !IsAdjacentTo(entry, next) || - entry->Level != next->Level || - !AssertAlignBoundry(offset, next, entry->Level) || - !TryAcquireEntrySpinLock(next)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)next->Position); - MergeEntry(entry, next); - RecycleEntry(next); - } - finally - { - ReleaseEntrySpinLock(next); - } - } - - // 更新level信息 - originLevel++; - if (originLevel > entry->Level) - { - break; - } - } - - // 恢复状态为空 - EntryOperations.TrySetState(entry, EntryState.Merging, EntryState.Empty); - return entry; - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用HLSFAllocator的private static方法 - ReleaseEntryBothLocks(entry); - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用HLSFAllocator的private static方法 - return TryAcquireEntryBothLocks(entry); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 44)] - internal struct Entry - { - - [FieldOffset(28)] internal int Level; // Level of the block in the allocator - [FieldOffset(40)] internal int NextLock; // 后继指针锁(控制NextNear指针操作) - - // 双锁设计:分离前后指针操作(和BucketNode保持一致) - [FieldOffset(36)] internal int PrevLock; // 前驱指针锁(控制PreviousNear指针操作) - [FieldOffset(32)] internal int State; // Node state (using int for atomic operations) - [FieldOffset(24)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - } - - // 更新后的EntryState常量类 - 使用int类型 - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int Merging = 3; // Currently being merged - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - #region Entry Operations - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsNullOrEmptyEntryIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsNullOrEmptyEntryIndex(Entry* entry) - { - return entry == null; - } - - // Entry 状态操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TrySetEntryState(Entry* entry, int expectedState, int newState) - { - return entry != null && - Interlocked.CompareExchange(ref entry->State, newState, expectedState) == expectedState; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static int GetEntryState(Entry* entry) => entry != null ? Volatile.Read(ref entry->State) : 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void SetEntryState(Entry* entry, int newState) - { - if (entry != null) { - Volatile.Write(ref entry->State, newState); - } - } - - // Entry 状态便利方法 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsEntryEmpty(Entry* entry) => GetEntryState(entry) == EntryState.Empty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsEntryAllocated(Entry* entry) => GetEntryState(entry) == EntryState.Allocated; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsEntryThreadOccupied(Entry* entry) => GetEntryState(entry) == EntryState.ThreadOccupied; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsEntryMerging(Entry* entry) => GetEntryState(entry) == EntryState.Merging; - - // Entry 前驱锁操作(控制PreviousNear字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntryPrevLock(Entry* entry) - { - if (entry == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref entry->PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireEntryPrevLock(Entry* entry) - { - if (entry == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref entry->PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref entry->PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseEntryPrevLock(Entry* entry) - { - if (entry == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref entry->PrevLock) == thread) { - Volatile.Write(ref entry->PrevLock, 0); - } - } - - // Entry 后继锁操作(控制NextNear字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntryNextLock(Entry* entry) - { - if (entry == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref entry->NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireEntryNextLock(Entry* entry) - { - if (entry == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref entry->NextLock) != thread) - { - while (Interlocked.CompareExchange(ref entry->NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseEntryNextLock(Entry* entry) - { - if (entry == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref entry->NextLock) == thread) { - Volatile.Write(ref entry->NextLock, 0); - } - } - - // Entry 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntryBothLocks(Entry* entry) - { - if (entry == null) { - return true; - } - - if (TryAcquireEntryPrevLock(entry)) - { - if (TryAcquireEntryNextLock(entry)) - { - return true; - } else - { - ReleaseEntryPrevLock(entry); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseEntryBothLocks(Entry* entry) - { - if (entry == null) { - return; - } - - ReleaseEntryPrevLock(entry); - ReleaseEntryNextLock(entry); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireEntryBothLocks(Entry* entry) - { - if (entry == null) { - return; - } - - AcquireEntryPrevLock(entry); - AcquireEntryNextLock(entry); - } - - #endregion - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/546462C1873C1C209F326C3BE457F681 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/546462C1873C1C209F326C3BE457F681 deleted file mode 100644 index 254e77d2..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/546462C1873C1C209F326C3BE457F681 +++ /dev/null @@ -1,90 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Free.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Buffers; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - /// - /// Free allocated memory block and perform adjacent block merging - /// - /// - /// Handle to the allocated memory block - /// - public void Free(hlsfHandle handle) - { - Entry* e = handle.EntryHandle; - if (e == null) { - return; - } - AcquireEntrySpinLock(e); - try - { - if (GetEntryState(e) != EntryState.Allocated) { - return; - } - SetEntryState(e, EntryState.ThreadOccupied); - - // Step 4: Try merge with adjacent free blocks and remove them from buckets - Entry* mergedEntry = MergeAndRemoveFromBuckets(e); - - // Step 5: Calculate final level and segment for the merged block - uint finalSize = mergedEntry->Size; - int finalLevel = GetLevelFromSize(finalSize); - int finalSegment = DetermineSegmentIndex(finalSize, finalLevel); - - // Step 6: Set the merged entry state to Empty (ready to be reused) - SetEntryState(mergedEntry, EntryState.Empty); - - // Step 7: Push the merged entry back to appropriate bucket - PushLevel(finalLevel, finalSegment, (BucketNode*)mergedEntry->Position); - - // Note: If mergedEntry is different from original e, the original e - // and any merged entries have already been freed to _nodes by MergeAndRemoveFromBuckets - } - finally - { - // Step 8: Always release the spin lock - ReleaseEntrySpinLock(e); - } - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/5E67BCBB06AEBAE791E1697C510465DA b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/5E67BCBB06AEBAE791E1697C510465DA deleted file mode 100644 index 0c7ef8b9..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/5E67BCBB06AEBAE791E1697C510465DA +++ /dev/null @@ -1,123 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Buffers; -using System.Runtime.InteropServices; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator : IDisposable - { - - private static readonly nuint EmptyHandle = (nuint)(void*)null; - - // Bucket system field - directly in main allocator class - private ulong[] _bucketHeads; - - private Entry* _spareMemory; - private readonly byte* m_Buffer; - private bool disposedValue; - private readonly int _align; - private readonly nuint _size; - private readonly SlabAllocator _nodes; - - public HybridLayerSegregatedFitAllocator(nuint byteSize) - { - if (byteSize < 64) { - throw new InvalidOperationException(); - } - _nodes = SlabAllocator.Create(64, BufferLayout.Chunked); - _size = byteSize; - m_Buffer = (byte*)NativeMemory.AlignedAlloc(byteSize, 16); - _align = 16; - - - // 初始化桶系统 - InitializeBucketSystem(); - - - // 初始化spareMemory - _spareMemory = (Entry*)_nodes.Allocate(); - _spareMemory->SetState(EntryState.ThreadOccupied); - _spareMemory->NextNear = EmptyHandle; - _spareMemory->Position = (nuint)m_Buffer; - _spareMemory->PrevLock = 0; - _spareMemory->NextLock = 0; - } - - public HybridLayerSegregatedFitAllocator(nuint byteSize, int align) - { - if (align < 16 || (align & (align - 1)) != 0) { - throw new ArgumentException( - "Alignment must be a power of two and at least 8 bytes."); - } - _nodes = SlabAllocator.Create(64, BufferLayout.Chunked); - m_Buffer = (byte*)NativeMemory.AlignedAlloc(byteSize, (nuint)align); - _align = align; - _size = byteSize; - - InitializeBucketSystem(); - - - // 初始化spareMemory - _spareMemory = (Entry*)_nodes.Allocate(); - _spareMemory->SetState(EntryState.ThreadOccupied); - _spareMemory->NextNear = EmptyHandle; - _spareMemory->Position = (nuint)m_Buffer; - _spareMemory->PrevLock = 0; - _spareMemory->NextLock = 0; - } - - public void Dispose() - { - Dispose(disposing:true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - if (!disposedValue) - { - if (disposing) { - _nodes.Dispose(); - } - NativeMemory.AlignedFree(m_Buffer); - disposedValue = true; - } - } - - ~HybridLayerSegregatedFitAllocator() - { - Dispose(disposing:false); - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/77DA1642FF8B0DC1F1DA13D99169CF30 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/77DA1642FF8B0DC1F1DA13D99169CF30 deleted file mode 100644 index c2e194ce..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/77DA1642FF8B0DC1F1DA13D99169CF30 +++ /dev/null @@ -1,286 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用新的静态方法 - if (entry != null) - { - EntryOperations.AcquireBothLocks(entry); - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private Entry* MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return null; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = GetLevelFromSize(size); - int segment = DetermineSegmentIndex(size, originLevel); - - if (!TryAcquireEntrySpinLock(entry)) - { - return entry; // 无法获取锁,返回原Entry - } - - try - { - // 设置状态为合并中 - EntryOperations.TrySetState(entry, EntryState.Empty, EntryState.Merging); - - // current Level merge - while (originLevel <= entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - - // backward merging - 向前合并 - while (true) - { - ulong p = entry->PreviousNear; - Entry* prev = (Entry*)p; - if (prev == null || - EntryOperations.GetState(prev) != EntryState.Empty || - !IsAdjacentTo(entry, prev) || - entry->Level != prev->Level || - !AssertAlignBoundry(offset, prev, entry->Level) || - !TryAcquireEntrySpinLock(prev)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)prev->Position); - MergeEntry(entry, prev); - RecycleEntry(prev); - } - finally - { - ReleaseEntrySpinLock(prev); - } - } - - // forward merging - 向后合并 - while (true) - { - ulong n = entry->NextNear; - Entry* next = (Entry*)n; - if (next == null || - EntryOperations.GetState(next) != EntryState.Empty || - !IsAdjacentTo(entry, next) || - entry->Level != next->Level || - !AssertAlignBoundry(offset, next, entry->Level) || - !TryAcquireEntrySpinLock(next)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)next->Position); - MergeEntry(entry, next); - RecycleEntry(next); - } - finally - { - ReleaseEntrySpinLock(next); - } - } - - // 更新level信息 - originLevel++; - if (originLevel > entry->Level) - { - break; - } - } - - // 恢复状态为空 - EntryOperations.TrySetState(entry, EntryState.Merging, EntryState.Empty); - return entry; - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用新的静态方法 - if (entry != null) - { - EntryOperations.ReleaseBothLocks(entry); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用新的静态方法 - return EntryOperations.TryAcquireBothLocks(entry); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 44)] - internal struct Entry - { - - [FieldOffset(28)] internal int Level; // Level of the block in the allocator - [FieldOffset(40)] internal int NextLock; // 后继指针锁(控制NextNear指针操作) - - // 双锁设计:分离前后指针操作(和BucketNode保持一致) - [FieldOffset(36)] internal int PrevLock; // 前驱指针锁(控制PreviousNear指针操作) - [FieldOffset(32)] internal int State; // Node state (using int for atomic operations) - [FieldOffset(24)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - } - - // 更新后的EntryState常量类 - 使用int类型 - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int Merging = 3; // Currently being merged - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/877C0DD5689FFE8C3A434A3FEE26D963 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/877C0DD5689FFE8C3A434A3FEE26D963 deleted file mode 100644 index 5b8e6a6b..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/877C0DD5689FFE8C3A434A3FEE26D963 +++ /dev/null @@ -1,572 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用新的静态方法 - BucketNodeOperations.AcquireBothLocks(node); - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - node->AcquireNextLock(); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !headNode->TryAcquirePrevLock()) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - headNode->ReleasePrevLock(); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - node->ReleaseNextLock(); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 使用新的静态方法 - BucketNodeOperations.ReleaseBothLocks(node); - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(只读操作,暂时不加锁) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - - // 按照地址顺序获取锁,避免死锁 - BucketNode* firstLock = null, secondLock = null, thirdLock = null; - bool needPrevNextLock = false, needNodeBothLocks = false, needNextPrevLock = false; - - if (previous != null && next != null) - { - // 中间节点:需要修改前驱的next和后继的prev - if ((ulong)previous < (ulong)node && (ulong)node < (ulong)next) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - thirdLock = next; - needNextPrevLock = true; - } else if ((ulong)previous < (ulong)next && (ulong)next < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = next; - needNextPrevLock = true; - thirdLock = node; - needNodeBothLocks = true; - } else // other cases - { - firstLock = next; - needNextPrevLock = true; - secondLock = previous; - needPrevNextLock = true; - thirdLock = node; - needNodeBothLocks = true; - } - } else if (previous != null) - { - // 尾节点:只需要修改前驱的next - if ((ulong)previous < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - } else - { - firstLock = node; - needNodeBothLocks = true; - secondLock = previous; - needPrevNextLock = true; - } - } else - { - // 应该不会到这里,因为头节点已经在上面处理了 - Thread.Sleep(0); - continue; - } - - - // 按顺序获取锁 - bool acquired = false; - try - { - if (firstLock != null) - { - if (firstLock == previous && needPrevNextLock) - { - if (!firstLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == next && needNextPrevLock) - { - if (!firstLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == node && needNodeBothLocks) - { - if (!firstLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (secondLock != null) - { - if (secondLock == previous && needPrevNextLock) - { - if (!secondLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == next && needNextPrevLock) - { - if (!secondLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == node && needNodeBothLocks) - { - if (!secondLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (thirdLock != null) - { - if (thirdLock == previous && needPrevNextLock) - { - if (!thirdLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == next && needNextPrevLock) - { - if (!thirdLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == node && needNodeBothLocks) - { - if (!thirdLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - acquired = true; - - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - if (acquired) - { - // 释放锁 - if (thirdLock == previous && needPrevNextLock) - { - thirdLock->ReleaseNextLock(); - } else if (thirdLock == next && needNextPrevLock) - { - thirdLock->ReleasePrevLock(); - } else if (thirdLock == node && needNodeBothLocks) { - thirdLock->ReleaseBothLocks(); - } - - if (secondLock == previous && needPrevNextLock) - { - secondLock->ReleaseNextLock(); - } else if (secondLock == next && needNextPrevLock) - { - secondLock->ReleasePrevLock(); - } else if (secondLock == node && needNodeBothLocks) { - secondLock->ReleaseBothLocks(); - } - - if (firstLock == previous && needPrevNextLock) - { - firstLock->ReleaseNextLock(); - } else if (firstLock == next && needNextPrevLock) - { - firstLock->ReleasePrevLock(); - } else if (firstLock == node && needNodeBothLocks) { - firstLock->ReleaseBothLocks(); - } - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用新的静态方法 - return BucketNodeOperations.TryAcquireBothLocks(node); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!head->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !next->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - next->ReleasePrevLock(); - } - } - } - finally - { - head->ReleaseNextLock(); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - } - - #region BucketNode Operations - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != BucketNode.MAGIC_NUMBER; - } - - // BucketNode 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref node->PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) == thread) { - Volatile.Write(ref node->PrevLock, 0); - } - } - - // BucketNode 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) != thread) - { - while (Interlocked.CompareExchange(ref node->NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) == thread) { - Volatile.Write(ref node->NextLock, 0); - } - } - - // BucketNode 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return true; - } - - if (TryAcquireBucketNodePrevLock(node)) - { - if (TryAcquireBucketNodeNextLock(node)) - { - return true; - } else - { - ReleaseBucketNodePrevLock(node); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - ReleaseBucketNodePrevLock(node); - ReleaseBucketNodeNextLock(node); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - AcquireBucketNodePrevLock(node); - AcquireBucketNodeNextLock(node); - } - - #endregion - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/8DDDA5E67C400BD315889C73F1B1C7FF b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/8DDDA5E67C400BD315889C73F1B1C7FF deleted file mode 100644 index f8955e9f..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/8DDDA5E67C400BD315889C73F1B1C7FF +++ /dev/null @@ -1,570 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - AcquireBucketNodeBothLocks(node); - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - AcquireBucketNodeNextLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !TryAcquireBucketNodePrevLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - ReleaseBucketNodePrevLock(headNode); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeNextLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - ReleaseBucketNodeBothLocks(node); - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(只读操作,暂时不加锁) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - - // 按照地址顺序获取锁,避免死锁 - BucketNode* firstLock = null, secondLock = null, thirdLock = null; - bool needPrevNextLock = false, needNodeBothLocks = false, needNextPrevLock = false; - - if (previous != null && next != null) - { - // 中间节点:需要修改前驱的next和后继的prev - if ((ulong)previous < (ulong)node && (ulong)node < (ulong)next) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - thirdLock = next; - needNextPrevLock = true; - } else if ((ulong)previous < (ulong)next && (ulong)next < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = next; - needNextPrevLock = true; - thirdLock = node; - needNodeBothLocks = true; - } else // other cases - { - firstLock = next; - needNextPrevLock = true; - secondLock = previous; - needPrevNextLock = true; - thirdLock = node; - needNodeBothLocks = true; - } - } else if (previous != null) - { - // 尾节点:只需要修改前驱的next - if ((ulong)previous < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - } else - { - firstLock = node; - needNodeBothLocks = true; - secondLock = previous; - needPrevNextLock = true; - } - } else - { - // 应该不会到这里,因为头节点已经在上面处理了 - Thread.Sleep(0); - continue; - } - - // 按顺序获取锁 - bool acquired = false; - try - { - if (firstLock != null) - { - if (firstLock == previous && needPrevNextLock) - { - if (!TryAcquireBucketNodeNextLock(firstLock)) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == next && needNextPrevLock) - { - if (!TryAcquireBucketNodePrevLock(firstLock)) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == node && needNodeBothLocks) - { - if (!TryAcquireBucketNodeBothLocks(firstLock)) - { - Thread.Sleep(0); - continue; - } - } - } - - if (secondLock != null) - { - if (secondLock == previous && needPrevNextLock) - { - if (!TryAcquireBucketNodeNextLock(secondLock)) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == next && needNextPrevLock) - { - if (!TryAcquireBucketNodePrevLock(secondLock)) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == node && needNodeBothLocks) - { - if (!TryAcquireBucketNodeBothLocks(secondLock)) - { - Thread.Sleep(0); - continue; - } - } - } - - if (thirdLock != null) - { - if (thirdLock == previous && needPrevNextLock) - { - if (!TryAcquireBucketNodeNextLock(thirdLock)) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == next && needNextPrevLock) - { - if (!TryAcquireBucketNodePrevLock(thirdLock)) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == node && needNodeBothLocks) - { - if (!TryAcquireBucketNodeBothLocks(thirdLock)) - { - Thread.Sleep(0); - continue; - } - } - } - - acquired = true; - - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - if (acquired) - { - // 释放锁 - if (thirdLock == previous && needPrevNextLock) - { - ReleaseBucketNodeNextLock(thirdLock); - } else if (thirdLock == next && needNextPrevLock) - { - ReleaseBucketNodePrevLock(thirdLock); - } else if (thirdLock == node && needNodeBothLocks) { - ReleaseBucketNodeBothLocks(thirdLock); - } - - if (secondLock == previous && needPrevNextLock) - { - ReleaseBucketNodeNextLock(secondLock); - } else if (secondLock == next && needNextPrevLock) - { - ReleaseBucketNodePrevLock(secondLock); - } else if (secondLock == node && needNodeBothLocks) { - ReleaseBucketNodeBothLocks(secondLock); - } - - if (firstLock == previous && needPrevNextLock) - { - ReleaseBucketNodeNextLock(firstLock); - } else if (firstLock == next && needNextPrevLock) - { - ReleaseBucketNodePrevLock(firstLock); - } else if (firstLock == node && needNodeBothLocks) { - ReleaseBucketNodeBothLocks(firstLock); - } - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - return TryAcquireBucketNodeBothLocks(node); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!head->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !next->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - next->ReleasePrevLock(); - } - } - } - finally - { - head->ReleaseNextLock(); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - } - - #region BucketNode Operations - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != BucketNode.MAGIC_NUMBER; - } - - // BucketNode 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref node->PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) == thread) { - Volatile.Write(ref node->PrevLock, 0); - } - } - - // BucketNode 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) != thread) - { - while (Interlocked.CompareExchange(ref node->NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) == thread) { - Volatile.Write(ref node->NextLock, 0); - } - } - - // BucketNode 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return true; - } - - if (TryAcquireBucketNodePrevLock(node)) - { - if (TryAcquireBucketNodeNextLock(node)) - { - return true; - } else - { - ReleaseBucketNodePrevLock(node); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - ReleaseBucketNodePrevLock(node); - ReleaseBucketNodeNextLock(node); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - AcquireBucketNodePrevLock(node); - AcquireBucketNodeNextLock(node); - } - - #endregion - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/8E8AC1D9360AFA35A0CF0C201F99C62F b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/8E8AC1D9360AFA35A0CF0C201F99C62F deleted file mode 100644 index 72f83d8b..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/8E8AC1D9360AFA35A0CF0C201F99C62F +++ /dev/null @@ -1,123 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Buffers; -using System.Runtime.InteropServices; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator : IDisposable - { - - private static readonly nuint EmptyHandle = (nuint)(void*)null; - - // Bucket system field - directly in main allocator class - private ulong[] _bucketHeads; - - private Entry* _spareMemory; - private readonly byte* m_Buffer; - private bool disposedValue; - private readonly int _align; - private readonly nuint _size; - private readonly SlabAllocator _nodes; - - public HybridLayerSegregatedFitAllocator(nuint byteSize) - { - if (byteSize < 64) { - throw new InvalidOperationException(); - } - _nodes = SlabAllocator.Create(64, BufferLayout.Chunked); - _size = byteSize; - m_Buffer = (byte*)NativeMemory.AlignedAlloc(byteSize, 16); - _align = 16; - - - // 初始化桶系统 - InitializeBucketSystem(); - - - // 初始化spareMemory - _spareMemory = (Entry*)_nodes.Allocate(); - SetEntryState(_spareMemory, EntryState.ThreadOccupied); - _spareMemory->NextNear = EmptyHandle; - _spareMemory->Position = (nuint)m_Buffer; - _spareMemory->PrevLock = 0; - _spareMemory->NextLock = 0; - } - - public HybridLayerSegregatedFitAllocator(nuint byteSize, int align) - { - if (align < 16 || (align & (align - 1)) != 0) { - throw new ArgumentException( - "Alignment must be a power of two and at least 8 bytes."); - } - _nodes = SlabAllocator.Create(64, BufferLayout.Chunked); - m_Buffer = (byte*)NativeMemory.AlignedAlloc(byteSize, (nuint)align); - _align = align; - _size = byteSize; - - InitializeBucketSystem(); - - - // 初始化spareMemory - _spareMemory = (Entry*)_nodes.Allocate(); - SetEntryState(_spareMemory, EntryState.ThreadOccupied); - _spareMemory->NextNear = EmptyHandle; - _spareMemory->Position = (nuint)m_Buffer; - _spareMemory->PrevLock = 0; - _spareMemory->NextLock = 0; - } - - public void Dispose() - { - Dispose(disposing:true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - if (!disposedValue) - { - if (disposing) { - _nodes.Dispose(); - } - NativeMemory.AlignedFree(m_Buffer); - disposedValue = true; - } - } - - ~HybridLayerSegregatedFitAllocator() - { - Dispose(disposing:false); - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/8F74FA17D40638F84598D1D12562DE76 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/8F74FA17D40638F84598D1D12562DE76 deleted file mode 100644 index f8955e9f..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/8F74FA17D40638F84598D1D12562DE76 +++ /dev/null @@ -1,570 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - AcquireBucketNodeBothLocks(node); - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - AcquireBucketNodeNextLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !TryAcquireBucketNodePrevLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - ReleaseBucketNodePrevLock(headNode); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeNextLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - ReleaseBucketNodeBothLocks(node); - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(只读操作,暂时不加锁) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - - // 按照地址顺序获取锁,避免死锁 - BucketNode* firstLock = null, secondLock = null, thirdLock = null; - bool needPrevNextLock = false, needNodeBothLocks = false, needNextPrevLock = false; - - if (previous != null && next != null) - { - // 中间节点:需要修改前驱的next和后继的prev - if ((ulong)previous < (ulong)node && (ulong)node < (ulong)next) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - thirdLock = next; - needNextPrevLock = true; - } else if ((ulong)previous < (ulong)next && (ulong)next < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = next; - needNextPrevLock = true; - thirdLock = node; - needNodeBothLocks = true; - } else // other cases - { - firstLock = next; - needNextPrevLock = true; - secondLock = previous; - needPrevNextLock = true; - thirdLock = node; - needNodeBothLocks = true; - } - } else if (previous != null) - { - // 尾节点:只需要修改前驱的next - if ((ulong)previous < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - } else - { - firstLock = node; - needNodeBothLocks = true; - secondLock = previous; - needPrevNextLock = true; - } - } else - { - // 应该不会到这里,因为头节点已经在上面处理了 - Thread.Sleep(0); - continue; - } - - // 按顺序获取锁 - bool acquired = false; - try - { - if (firstLock != null) - { - if (firstLock == previous && needPrevNextLock) - { - if (!TryAcquireBucketNodeNextLock(firstLock)) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == next && needNextPrevLock) - { - if (!TryAcquireBucketNodePrevLock(firstLock)) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == node && needNodeBothLocks) - { - if (!TryAcquireBucketNodeBothLocks(firstLock)) - { - Thread.Sleep(0); - continue; - } - } - } - - if (secondLock != null) - { - if (secondLock == previous && needPrevNextLock) - { - if (!TryAcquireBucketNodeNextLock(secondLock)) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == next && needNextPrevLock) - { - if (!TryAcquireBucketNodePrevLock(secondLock)) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == node && needNodeBothLocks) - { - if (!TryAcquireBucketNodeBothLocks(secondLock)) - { - Thread.Sleep(0); - continue; - } - } - } - - if (thirdLock != null) - { - if (thirdLock == previous && needPrevNextLock) - { - if (!TryAcquireBucketNodeNextLock(thirdLock)) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == next && needNextPrevLock) - { - if (!TryAcquireBucketNodePrevLock(thirdLock)) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == node && needNodeBothLocks) - { - if (!TryAcquireBucketNodeBothLocks(thirdLock)) - { - Thread.Sleep(0); - continue; - } - } - } - - acquired = true; - - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - if (acquired) - { - // 释放锁 - if (thirdLock == previous && needPrevNextLock) - { - ReleaseBucketNodeNextLock(thirdLock); - } else if (thirdLock == next && needNextPrevLock) - { - ReleaseBucketNodePrevLock(thirdLock); - } else if (thirdLock == node && needNodeBothLocks) { - ReleaseBucketNodeBothLocks(thirdLock); - } - - if (secondLock == previous && needPrevNextLock) - { - ReleaseBucketNodeNextLock(secondLock); - } else if (secondLock == next && needNextPrevLock) - { - ReleaseBucketNodePrevLock(secondLock); - } else if (secondLock == node && needNodeBothLocks) { - ReleaseBucketNodeBothLocks(secondLock); - } - - if (firstLock == previous && needPrevNextLock) - { - ReleaseBucketNodeNextLock(firstLock); - } else if (firstLock == next && needNextPrevLock) - { - ReleaseBucketNodePrevLock(firstLock); - } else if (firstLock == node && needNodeBothLocks) { - ReleaseBucketNodeBothLocks(firstLock); - } - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - return TryAcquireBucketNodeBothLocks(node); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!head->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !next->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - next->ReleasePrevLock(); - } - } - } - finally - { - head->ReleaseNextLock(); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - } - - #region BucketNode Operations - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != BucketNode.MAGIC_NUMBER; - } - - // BucketNode 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref node->PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) == thread) { - Volatile.Write(ref node->PrevLock, 0); - } - } - - // BucketNode 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) != thread) - { - while (Interlocked.CompareExchange(ref node->NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) == thread) { - Volatile.Write(ref node->NextLock, 0); - } - } - - // BucketNode 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return true; - } - - if (TryAcquireBucketNodePrevLock(node)) - { - if (TryAcquireBucketNodeNextLock(node)) - { - return true; - } else - { - ReleaseBucketNodePrevLock(node); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - ReleaseBucketNodePrevLock(node); - ReleaseBucketNodeNextLock(node); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - AcquireBucketNodePrevLock(node); - AcquireBucketNodeNextLock(node); - } - - #endregion - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/903A878BE8C96654EF1853DCA929391D b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/903A878BE8C96654EF1853DCA929391D deleted file mode 100644 index 1a085844..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/903A878BE8C96654EF1853DCA929391D +++ /dev/null @@ -1,569 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - AcquireBucketNodeBothLocks(node); - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - AcquireBucketNodeNextLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !TryAcquireBucketNodePrevLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - ReleaseBucketNodePrevLock(headNode); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeNextLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - ReleaseBucketNodeBothLocks(node); - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(只读操作,暂时不加锁) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - - // 按照地址顺序获取锁,避免死锁 - BucketNode* firstLock = null, secondLock = null, thirdLock = null; - bool needPrevNextLock = false, needNodeBothLocks = false, needNextPrevLock = false; - - if (previous != null && next != null) - { - // 中间节点:需要修改前驱的next和后继的prev - if ((ulong)previous < (ulong)node && (ulong)node < (ulong)next) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - thirdLock = next; - needNextPrevLock = true; - } else if ((ulong)previous < (ulong)next && (ulong)next < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = next; - needNextPrevLock = true; - thirdLock = node; - needNodeBothLocks = true; - } else // other cases - { - firstLock = next; - needNextPrevLock = true; - secondLock = previous; - needPrevNextLock = true; - thirdLock = node; - needNodeBothLocks = true; - } - } else if (previous != null) - { - // 尾节点:只需要修改前驱的next - if ((ulong)previous < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - } else - { - firstLock = node; - needNodeBothLocks = true; - secondLock = previous; - needPrevNextLock = true; - } - } else - { - // 应该不会到这里,因为头节点已经在上面处理了 - Thread.Sleep(0); - continue; - } - - // 按顺序获取锁 - bool acquired = false; - try - { - if (firstLock != null) - { - if (firstLock == previous && needPrevNextLock) - { - if (!TryAcquireBucketNodeNextLock(firstLock)) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == next && needNextPrevLock) - { - if (!TryAcquireBucketNodePrevLock(firstLock)) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == node && needNodeBothLocks) - { - if (!TryAcquireBucketNodeBothLocks(firstLock)) - { - Thread.Sleep(0); - continue; - } - } - } - - if (secondLock != null) - { - if (secondLock == previous && needPrevNextLock) - { - if (!TryAcquireBucketNodeNextLock(secondLock)) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == next && needNextPrevLock) - { - if (!TryAcquireBucketNodePrevLock(secondLock)) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == node && needNodeBothLocks) - { - if (!TryAcquireBucketNodeBothLocks(secondLock)) - { - Thread.Sleep(0); - continue; - } - } - } - - if (thirdLock != null) - { - if (thirdLock == previous && needPrevNextLock) - { - if (!TryAcquireBucketNodeNextLock(thirdLock)) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == next && needNextPrevLock) - { - if (!TryAcquireBucketNodePrevLock(thirdLock)) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == node && needNodeBothLocks) - { - if (!TryAcquireBucketNodeBothLocks(thirdLock)) - { - Thread.Sleep(0); - continue; - } - } - } - - acquired = true; - - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - if (acquired) - { - // 释放锁 - if (thirdLock == previous && needPrevNextLock) - { - ReleaseBucketNodeNextLock(thirdLock); - } else if (thirdLock == next && needNextPrevLock) - { - ReleaseBucketNodePrevLock(thirdLock); - } else if (thirdLock == node && needNodeBothLocks) { - ReleaseBucketNodeBothLocks(thirdLock); - } - - if (secondLock == previous && needPrevNextLock) - { - ReleaseBucketNodeNextLock(secondLock); - } else if (secondLock == next && needNextPrevLock) - { - ReleaseBucketNodePrevLock(secondLock); - } else if (secondLock == node && needNodeBothLocks) { - ReleaseBucketNodeBothLocks(secondLock); - } - - if (firstLock == previous && needPrevNextLock) - { - ReleaseBucketNodeNextLock(firstLock); - } else if (firstLock == next && needNextPrevLock) - { - ReleaseBucketNodePrevLock(firstLock); - } else if (firstLock == node && needNodeBothLocks) { - ReleaseBucketNodeBothLocks(firstLock); - } - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - return TryAcquireBucketNodeBothLocks(node); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!TryAcquireBucketNodeNextLock(head)) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !TryAcquireBucketNodePrevLock(next)) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - ReleaseBucketNodePrevLock(next); - } - } - } - finally - { - ReleaseBucketNodeNextLock(head); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - } - - #region BucketNode Operations - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != BucketNode.MAGIC_NUMBER; - } - - // BucketNode 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref node->PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) == thread) { - Volatile.Write(ref node->PrevLock, 0); - } - } - - // BucketNode 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) != thread) - { - while (Interlocked.CompareExchange(ref node->NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) == thread) { - Volatile.Write(ref node->NextLock, 0); - } - } - - // BucketNode 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return true; - } - - if (TryAcquireBucketNodePrevLock(node)) - { - if (TryAcquireBucketNodeNextLock(node)) - { - return true; - } else - { - ReleaseBucketNodePrevLock(node); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - ReleaseBucketNodePrevLock(node); - ReleaseBucketNodeNextLock(node); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - AcquireBucketNodePrevLock(node); - AcquireBucketNodeNextLock(node); - } - - #endregion - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/9977D88E9E1D38FAF1B94EFC02609A12 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/9977D88E9E1D38FAF1B94EFC02609A12 deleted file mode 100644 index 4457088d..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/9977D88E9E1D38FAF1B94EFC02609A12 +++ /dev/null @@ -1,90 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Free.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Buffers; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - /// - /// Free allocated memory block and perform adjacent block merging - /// - /// - /// Handle to the allocated memory block - /// - public void Free(hlsfHandle handle) - { - Entry* e = handle.EntryHandle; - if (e == null) { - return; - } - AcquireEntrySpinLock(e); - try - { - if (e->GetState() != EntryState.Allocated) { - return; - } - e->SetState(EntryState.ThreadOccupied); - - // Step 4: Try merge with adjacent free blocks and remove them from buckets - Entry* mergedEntry = MergeAndRemoveFromBuckets(e); - - // Step 5: Calculate final level and segment for the merged block - uint finalSize = mergedEntry->Size; - int finalLevel = GetLevelFromSize(finalSize); - int finalSegment = DetermineSegmentIndex(finalSize, finalLevel); - - // Step 6: Set the merged entry state to Empty (ready to be reused) - mergedEntry->SetState(EntryState.Empty); - - // Step 7: Push the merged entry back to appropriate bucket - PushLevel(finalLevel, finalSegment, (BucketNode*)mergedEntry->Position); - - // Note: If mergedEntry is different from original e, the original e - // and any merged entries have already been freed to _nodes by MergeAndRemoveFromBuckets - } - finally - { - // Step 8: Always release the spin lock - ReleaseEntrySpinLock(e); - } - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/AB8A1918C3B68030A61DEDE4C5B14848 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/AB8A1918C3B68030A61DEDE4C5B14848 deleted file mode 100644 index cdba2cd3..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/AB8A1918C3B68030A61DEDE4C5B14848 +++ /dev/null @@ -1,459 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用新的静态方法 - if (entry != null) - { - EntryOperations.AcquireBothLocks(entry); - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private Entry* MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return null; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = GetLevelFromSize(size); - int segment = DetermineSegmentIndex(size, originLevel); - - if (!TryAcquireEntrySpinLock(entry)) - { - return entry; // 无法获取锁,返回原Entry - } - - try - { - // 设置状态为合并中 - EntryOperations.TrySetState(entry, EntryState.Empty, EntryState.Merging); - - // current Level merge - while (originLevel <= entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - - // backward merging - 向前合并 - while (true) - { - ulong p = entry->PreviousNear; - Entry* prev = (Entry*)p; - if (prev == null || - EntryOperations.GetState(prev) != EntryState.Empty || - !IsAdjacentTo(entry, prev) || - entry->Level != prev->Level || - !AssertAlignBoundry(offset, prev, entry->Level) || - !TryAcquireEntrySpinLock(prev)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)prev->Position); - MergeEntry(entry, prev); - RecycleEntry(prev); - } - finally - { - ReleaseEntrySpinLock(prev); - } - } - - // forward merging - 向后合并 - while (true) - { - ulong n = entry->NextNear; - Entry* next = (Entry*)n; - if (next == null || - EntryOperations.GetState(next) != EntryState.Empty || - !IsAdjacentTo(entry, next) || - entry->Level != next->Level || - !AssertAlignBoundry(offset, next, entry->Level) || - !TryAcquireEntrySpinLock(next)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)next->Position); - MergeEntry(entry, next); - RecycleEntry(next); - } - finally - { - ReleaseEntrySpinLock(next); - } - } - - // 更新level信息 - originLevel++; - if (originLevel > entry->Level) - { - break; - } - } - - // 恢复状态为空 - EntryOperations.TrySetState(entry, EntryState.Merging, EntryState.Empty); - return entry; - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用新的静态方法 - if (entry != null) - { - EntryOperations.ReleaseBothLocks(entry); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用新的静态方法 - return EntryOperations.TryAcquireBothLocks(entry); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 44)] - internal struct Entry - { - - [FieldOffset(28)] internal int Level; // Level of the block in the allocator - [FieldOffset(40)] internal int NextLock; // 后继指针锁(控制NextNear指针操作) - - // 双锁设计:分离前后指针操作(和BucketNode保持一致) - [FieldOffset(36)] internal int PrevLock; // 前驱指针锁(控制PreviousNear指针操作) - [FieldOffset(32)] internal int State; // Node state (using int for atomic operations) - [FieldOffset(24)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - } - - // 更新后的EntryState常量类 - 使用int类型 - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int Merging = 3; // Currently being merged - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - #region Entry Operations - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsNullOrEmptyEntryIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsNullOrEmptyEntryIndex(Entry* entry) - { - return entry == null; - } - - // Entry 状态操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TrySetEntryState(Entry* entry, int expectedState, int newState) - { - return entry != null && - Interlocked.CompareExchange(ref entry->State, newState, expectedState) == expectedState; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static int GetEntryState(Entry* entry) => entry != null ? Volatile.Read(ref entry->State) : 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void SetEntryState(Entry* entry, int newState) - { - if (entry != null) { - Volatile.Write(ref entry->State, newState); - } - } - - // Entry 状态便利方法 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsEntryEmpty(Entry* entry) => GetEntryState(entry) == EntryState.Empty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsEntryAllocated(Entry* entry) => GetEntryState(entry) == EntryState.Allocated; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsEntryThreadOccupied(Entry* entry) => GetEntryState(entry) == EntryState.ThreadOccupied; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsEntryMerging(Entry* entry) => GetEntryState(entry) == EntryState.Merging; - - // Entry 前驱锁操作(控制PreviousNear字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntryPrevLock(Entry* entry) - { - if (entry == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref entry->PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireEntryPrevLock(Entry* entry) - { - if (entry == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref entry->PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref entry->PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseEntryPrevLock(Entry* entry) - { - if (entry == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref entry->PrevLock) == thread) { - Volatile.Write(ref entry->PrevLock, 0); - } - } - - // Entry 后继锁操作(控制NextNear字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntryNextLock(Entry* entry) - { - if (entry == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref entry->NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireEntryNextLock(Entry* entry) - { - if (entry == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref entry->NextLock) != thread) - { - while (Interlocked.CompareExchange(ref entry->NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseEntryNextLock(Entry* entry) - { - if (entry == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref entry->NextLock) == thread) { - Volatile.Write(ref entry->NextLock, 0); - } - } - - // Entry 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntryBothLocks(Entry* entry) - { - if (entry == null) { - return true; - } - - if (TryAcquireEntryPrevLock(entry)) - { - if (TryAcquireEntryNextLock(entry)) - { - return true; - } else - { - ReleaseEntryPrevLock(entry); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseEntryBothLocks(Entry* entry) - { - if (entry == null) { - return; - } - - ReleaseEntryPrevLock(entry); - ReleaseEntryNextLock(entry); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireEntryBothLocks(Entry* entry) - { - if (entry == null) { - return; - } - - AcquireEntryPrevLock(entry); - AcquireEntryNextLock(entry); - } - - #endregion - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/ABD425D7B73AD8F9E2CECDCBF70789D6 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/ABD425D7B73AD8F9E2CECDCBF70789D6 deleted file mode 100644 index 426b7eec..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/ABD425D7B73AD8F9E2CECDCBF70789D6 +++ /dev/null @@ -1,160 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Alloc.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Threading; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private BufferExpansionLock _spareLock = new(); - - public hlsfHandle Alloc(uint size) - { - ArgumentOutOfRangeException.ThrowIfGreaterThan(size, (nuint)levelSize[^1] * 2); - int level = GetLevelFromSize(size); - int segmentIndex = DetermineSegmentIndex(size, level); - - int i = level, s = segmentIndex; - if (TryPopLevelForAllocation(i, s, out Entry* handle)) - { - SetEntryState(handle, EntryState.Allocated); - return new hlsfHandle(handle, size); - } - - fallback: - i = level; - s = segmentIndex; - while (!TryPopLevelForAllocation(i, s, out handle)) - { - if (++s >= 3) - { - s = 0; - i++; - } - if (i >= levelSize.Length) - { - if (TryAllocateNew16MBBlock(out handle)) - { - break; - } - Thread.Sleep(0); - goto fallback; - } - } - - if (handle != null) - { - SliceMemory(handle, (segmentIndex + 1) * levelSize[level]); - SetEntryState(handle, EntryState.Allocated); - } - - return new hlsfHandle(handle, size); - } - - private void SliceMemory(Entry* e, int offset) { } - - /// - /// Try to allocate a new 16MB block when all buckets are empty - /// - /// - /// Output handle to the allocated Entry - /// - /// - /// True if allocation succeeded - /// - private bool TryAllocateNew16MBBlock(out Entry* handle) - { - nuint pos = Volatile.Read(ref _spareMemory->Position); - nuint blockSize = (nuint)levelSize[^1] * 2; // Use last level size (16MB) - nuint newPos = pos + blockSize; - - // Check if we have enough space - if (newPos > ((nuint)m_Buffer) + _size) - { - handle = null; - return false; // Out of memory - } - - // Try to allocate new Entry from slab allocator - try - { - handle = (Entry*)_nodes.Allocate(); - handle->Position = pos; - handle->Size = (uint)blockSize; - SetEntryState(handle, EntryState.ThreadOccupied); - handle->NextNear = EmptyHandle; - handle->PreviousNear = EmptyHandle; - handle->Level = GetLevelFromSize((uint)blockSize); - - - // 初始化双锁为未锁定状态 - handle->PrevLock = 0; - handle->NextLock = 0; - - // Update spare memory position - _spareMemory->Position = newPos; - - return true; - } - catch - { - handle = null; - return false; - } - } - - /// - /// Helper method for allocation - converts BucketNode to Entry - /// - private bool TryPopLevelForAllocation(int levelIndex, int sizeIndex, out Entry* entry) - { - if (TryPopLevel(levelIndex, sizeIndex, out BucketNode* bucketNode)) - { - entry = bucketNode->EntryRef; - return entry != null; - } - entry = null; - return false; - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/AD27E425F8F9E37009574D893F3E72DC b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/AD27E425F8F9E37009574D893F3E72DC deleted file mode 100644 index 29394b24..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/AD27E425F8F9E37009574D893F3E72DC +++ /dev/null @@ -1,453 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用HLSFAllocator的private static方法 - AcquireEntryBothLocks(entry); - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private Entry* MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return null; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = GetLevelFromSize(size); - int segment = DetermineSegmentIndex(size, originLevel); - - if (!TryAcquireEntrySpinLock(entry)) - { - return entry; // 无法获取锁,返回原Entry - } - - try - { - // 设置状态为合并中 - EntryOperations.TrySetState(entry, EntryState.Empty, EntryState.Merging); - - // current Level merge - while (originLevel <= entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - - // backward merging - 向前合并 - while (true) - { - ulong p = entry->PreviousNear; - Entry* prev = (Entry*)p; - if (prev == null || - EntryOperations.GetState(prev) != EntryState.Empty || - !IsAdjacentTo(entry, prev) || - entry->Level != prev->Level || - !AssertAlignBoundry(offset, prev, entry->Level) || - !TryAcquireEntrySpinLock(prev)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)prev->Position); - MergeEntry(entry, prev); - RecycleEntry(prev); - } - finally - { - ReleaseEntrySpinLock(prev); - } - } - - // forward merging - 向后合并 - while (true) - { - ulong n = entry->NextNear; - Entry* next = (Entry*)n; - if (next == null || - EntryOperations.GetState(next) != EntryState.Empty || - !IsAdjacentTo(entry, next) || - entry->Level != next->Level || - !AssertAlignBoundry(offset, next, entry->Level) || - !TryAcquireEntrySpinLock(next)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)next->Position); - MergeEntry(entry, next); - RecycleEntry(next); - } - finally - { - ReleaseEntrySpinLock(next); - } - } - - // 更新level信息 - originLevel++; - if (originLevel > entry->Level) - { - break; - } - } - - // 恢复状态为空 - EntryOperations.TrySetState(entry, EntryState.Merging, EntryState.Empty); - return entry; - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用HLSFAllocator的private static方法 - ReleaseEntryBothLocks(entry); - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用HLSFAllocator的private static方法 - return TryAcquireEntryBothLocks(entry); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 44)] - internal struct Entry - { - - [FieldOffset(28)] internal int Level; // Level of the block in the allocator - [FieldOffset(40)] internal int NextLock; // 后继指针锁(控制NextNear指针操作) - - // 双锁设计:分离前后指针操作(和BucketNode保持一致) - [FieldOffset(36)] internal int PrevLock; // 前驱指针锁(控制PreviousNear指针操作) - [FieldOffset(32)] internal int State; // Node state (using int for atomic operations) - [FieldOffset(24)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - } - - // 更新后的EntryState常量类 - 使用int类型 - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int Merging = 3; // Currently being merged - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - #region Entry Operations - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsNullOrEmptyEntryIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsNullOrEmptyEntryIndex(Entry* entry) - { - return entry == null; - } - - // Entry 状态操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TrySetEntryState(Entry* entry, int expectedState, int newState) - { - return entry != null && - Interlocked.CompareExchange(ref entry->State, newState, expectedState) == expectedState; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static int GetEntryState(Entry* entry) => entry != null ? Volatile.Read(ref entry->State) : 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void SetEntryState(Entry* entry, int newState) - { - if (entry != null) { - Volatile.Write(ref entry->State, newState); - } - } - - // Entry 状态便利方法 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsEntryEmpty(Entry* entry) => GetEntryState(entry) == EntryState.Empty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsEntryAllocated(Entry* entry) => GetEntryState(entry) == EntryState.Allocated; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsEntryThreadOccupied(Entry* entry) => GetEntryState(entry) == EntryState.ThreadOccupied; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsEntryMerging(Entry* entry) => GetEntryState(entry) == EntryState.Merging; - - // Entry 前驱锁操作(控制PreviousNear字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntryPrevLock(Entry* entry) - { - if (entry == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref entry->PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireEntryPrevLock(Entry* entry) - { - if (entry == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref entry->PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref entry->PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseEntryPrevLock(Entry* entry) - { - if (entry == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref entry->PrevLock) == thread) { - Volatile.Write(ref entry->PrevLock, 0); - } - } - - // Entry 后继锁操作(控制NextNear字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntryNextLock(Entry* entry) - { - if (entry == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref entry->NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireEntryNextLock(Entry* entry) - { - if (entry == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref entry->NextLock) != thread) - { - while (Interlocked.CompareExchange(ref entry->NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseEntryNextLock(Entry* entry) - { - if (entry == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref entry->NextLock) == thread) { - Volatile.Write(ref entry->NextLock, 0); - } - } - - // Entry 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntryBothLocks(Entry* entry) - { - if (entry == null) { - return true; - } - - if (TryAcquireEntryPrevLock(entry)) - { - if (TryAcquireEntryNextLock(entry)) - { - return true; - } else - { - ReleaseEntryPrevLock(entry); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseEntryBothLocks(Entry* entry) - { - if (entry == null) { - return; - } - - ReleaseEntryPrevLock(entry); - ReleaseEntryNextLock(entry); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireEntryBothLocks(Entry* entry) - { - if (entry == null) { - return; - } - - AcquireEntryPrevLock(entry); - AcquireEntryNextLock(entry); - } - - #endregion - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/B5126D29D08B2553CC28B846B92EB369 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/B5126D29D08B2553CC28B846B92EB369 deleted file mode 100644 index 4457088d..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/B5126D29D08B2553CC28B846B92EB369 +++ /dev/null @@ -1,90 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Free.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Buffers; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - /// - /// Free allocated memory block and perform adjacent block merging - /// - /// - /// Handle to the allocated memory block - /// - public void Free(hlsfHandle handle) - { - Entry* e = handle.EntryHandle; - if (e == null) { - return; - } - AcquireEntrySpinLock(e); - try - { - if (e->GetState() != EntryState.Allocated) { - return; - } - e->SetState(EntryState.ThreadOccupied); - - // Step 4: Try merge with adjacent free blocks and remove them from buckets - Entry* mergedEntry = MergeAndRemoveFromBuckets(e); - - // Step 5: Calculate final level and segment for the merged block - uint finalSize = mergedEntry->Size; - int finalLevel = GetLevelFromSize(finalSize); - int finalSegment = DetermineSegmentIndex(finalSize, finalLevel); - - // Step 6: Set the merged entry state to Empty (ready to be reused) - mergedEntry->SetState(EntryState.Empty); - - // Step 7: Push the merged entry back to appropriate bucket - PushLevel(finalLevel, finalSegment, (BucketNode*)mergedEntry->Position); - - // Note: If mergedEntry is different from original e, the original e - // and any merged entries have already been freed to _nodes by MergeAndRemoveFromBuckets - } - finally - { - // Step 8: Always release the spin lock - ReleaseEntrySpinLock(e); - } - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/B5FE3A570623B680F1D44EE761564D23 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/B5FE3A570623B680F1D44EE761564D23 deleted file mode 100644 index 937763cf..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/B5FE3A570623B680F1D44EE761564D23 +++ /dev/null @@ -1,572 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - AcquireBucketNodeBothLocks(node); - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - AcquireBucketNodeNextLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !TryAcquireBucketNodePrevLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - ReleaseBucketNodePrevLock(headNode); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeNextLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - ReleaseBucketNodeBothLocks(node); - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(只读操作,暂时不加锁) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - - // 按照地址顺序获取锁,避免死锁 - BucketNode* firstLock = null, secondLock = null, thirdLock = null; - bool needPrevNextLock = false, needNodeBothLocks = false, needNextPrevLock = false; - - if (previous != null && next != null) - { - // 中间节点:需要修改前驱的next和后继的prev - if ((ulong)previous < (ulong)node && (ulong)node < (ulong)next) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - thirdLock = next; - needNextPrevLock = true; - } else if ((ulong)previous < (ulong)next && (ulong)next < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = next; - needNextPrevLock = true; - thirdLock = node; - needNodeBothLocks = true; - } else // other cases - { - firstLock = next; - needNextPrevLock = true; - secondLock = previous; - needPrevNextLock = true; - thirdLock = node; - needNodeBothLocks = true; - } - } else if (previous != null) - { - // 尾节点:只需要修改前驱的next - if ((ulong)previous < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - } else - { - firstLock = node; - needNodeBothLocks = true; - secondLock = previous; - needPrevNextLock = true; - } - } else - { - // 应该不会到这里,因为头节点已经在上面处理了 - Thread.Sleep(0); - continue; - } - - - // 按顺序获取锁 - bool acquired = false; - try - { - if (firstLock != null) - { - if (firstLock == previous && needPrevNextLock) - { - if (!firstLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == next && needNextPrevLock) - { - if (!firstLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == node && needNodeBothLocks) - { - if (!firstLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (secondLock != null) - { - if (secondLock == previous && needPrevNextLock) - { - if (!secondLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == next && needNextPrevLock) - { - if (!secondLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == node && needNodeBothLocks) - { - if (!secondLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (thirdLock != null) - { - if (thirdLock == previous && needPrevNextLock) - { - if (!thirdLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == next && needNextPrevLock) - { - if (!thirdLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == node && needNodeBothLocks) - { - if (!thirdLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - acquired = true; - - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - if (acquired) - { - // 释放锁 - if (thirdLock == previous && needPrevNextLock) - { - thirdLock->ReleaseNextLock(); - } else if (thirdLock == next && needNextPrevLock) - { - thirdLock->ReleasePrevLock(); - } else if (thirdLock == node && needNodeBothLocks) { - thirdLock->ReleaseBothLocks(); - } - - if (secondLock == previous && needPrevNextLock) - { - secondLock->ReleaseNextLock(); - } else if (secondLock == next && needNextPrevLock) - { - secondLock->ReleasePrevLock(); - } else if (secondLock == node && needNodeBothLocks) { - secondLock->ReleaseBothLocks(); - } - - if (firstLock == previous && needPrevNextLock) - { - firstLock->ReleaseNextLock(); - } else if (firstLock == next && needNextPrevLock) - { - firstLock->ReleasePrevLock(); - } else if (firstLock == node && needNodeBothLocks) { - firstLock->ReleaseBothLocks(); - } - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - return TryAcquireBucketNodeBothLocks(node); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!head->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !next->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - next->ReleasePrevLock(); - } - } - } - finally - { - head->ReleaseNextLock(); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - } - - #region BucketNode Operations - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != BucketNode.MAGIC_NUMBER; - } - - // BucketNode 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref node->PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) == thread) { - Volatile.Write(ref node->PrevLock, 0); - } - } - - // BucketNode 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) != thread) - { - while (Interlocked.CompareExchange(ref node->NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) == thread) { - Volatile.Write(ref node->NextLock, 0); - } - } - - // BucketNode 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return true; - } - - if (TryAcquireBucketNodePrevLock(node)) - { - if (TryAcquireBucketNodeNextLock(node)) - { - return true; - } else - { - ReleaseBucketNodePrevLock(node); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - ReleaseBucketNodePrevLock(node); - ReleaseBucketNodeNextLock(node); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - AcquireBucketNodePrevLock(node); - AcquireBucketNodeNextLock(node); - } - - #endregion - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/B94512BB1DB7681AEE0753DD0E6DEB1D b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/B94512BB1DB7681AEE0753DD0E6DEB1D deleted file mode 100644 index 5ffe6f9c..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/B94512BB1DB7681AEE0753DD0E6DEB1D +++ /dev/null @@ -1,160 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Alloc.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Threading; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private BufferExpansionLock _spareLock = new(); - - public hlsfHandle Alloc(uint size) - { - ArgumentOutOfRangeException.ThrowIfGreaterThan(size, (nuint)levelSize[^1] * 2); - int level = GetLevelFromSize(size); - int segmentIndex = DetermineSegmentIndex(size, level); - - int i = level, s = segmentIndex; - if (TryPopLevelForAllocation(i, s, out Entry* handle)) - { - SetEntryState(handle, EntryState.Allocated); - return new hlsfHandle(handle, size); - } - - fallback: - i = level; - s = segmentIndex; - while (!TryPopLevelForAllocation(i, s, out handle)) - { - if (++s >= 3) - { - s = 0; - i++; - } - if (i >= levelSize.Length) - { - if (TryAllocateNew16MBBlock(out handle)) - { - break; - } - Thread.Sleep(0); - goto fallback; - } - } - - if (handle != null) - { - SliceMemory(handle, (segmentIndex + 1) * levelSize[level]); - SetEntryState(handle, EntryState.Allocated); - } - - return new hlsfHandle(handle, size); - } - - private void SliceMemory(Entry* e, int offset) { } - - /// - /// Try to allocate a new 16MB block when all buckets are empty - /// - /// - /// Output handle to the allocated Entry - /// - /// - /// True if allocation succeeded - /// - private bool TryAllocateNew16MBBlock(out Entry* handle) - { - nuint pos = Volatile.Read(ref _spareMemory->Position); - nuint blockSize = (nuint)levelSize[^1] * 2; // Use last level size (16MB) - nuint newPos = pos + blockSize; - - // Check if we have enough space - if (newPos > ((nuint)m_Buffer) + _size) - { - handle = null; - return false; // Out of memory - } - - // Try to allocate new Entry from slab allocator - try - { - handle = (Entry*)_nodes.Allocate(); - handle->Position = pos; - handle->Size = (uint)blockSize; - handle->SetState(EntryState.ThreadOccupied); - handle->NextNear = EmptyHandle; - handle->PreviousNear = EmptyHandle; - handle->Level = GetLevelFromSize((uint)blockSize); - - - // 初始化双锁为未锁定状态 - handle->PrevLock = 0; - handle->NextLock = 0; - - // Update spare memory position - _spareMemory->Position = newPos; - - return true; - } - catch - { - handle = null; - return false; - } - } - - /// - /// Helper method for allocation - converts BucketNode to Entry - /// - private bool TryPopLevelForAllocation(int levelIndex, int sizeIndex, out Entry* entry) - { - if (TryPopLevel(levelIndex, sizeIndex, out BucketNode* bucketNode)) - { - entry = bucketNode->EntryRef; - return entry != null; - } - entry = null; - return false; - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/BA289D34E85B88FF18470022E94E8C41 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/BA289D34E85B88FF18470022E94E8C41 deleted file mode 100644 index 88556cfa..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/BA289D34E85B88FF18470022E94E8C41 +++ /dev/null @@ -1,160 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Alloc.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Threading; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private BufferExpansionLock _spareLock = new(); - - public hlsfHandle Alloc(uint size) - { - ArgumentOutOfRangeException.ThrowIfGreaterThan(size, (nuint)levelSize[^1] * 2); - int level = GetLevelFromSize(size); - int segmentIndex = DetermineSegmentIndex(size, level); - - int i = level, s = segmentIndex; - if (TryPopLevelForAllocation(i, s, out Entry* handle)) - { - handle->SetState(EntryState.Allocated); - return new hlsfHandle(handle, size); - } - - fallback: - i = level; - s = segmentIndex; - while (!TryPopLevelForAllocation(i, s, out handle)) - { - if (++s >= 3) - { - s = 0; - i++; - } - if (i >= levelSize.Length) - { - if (TryAllocateNew16MBBlock(out handle)) - { - break; - } - Thread.Sleep(0); - goto fallback; - } - } - - if (handle != null) - { - SliceMemory(handle, (segmentIndex + 1) * levelSize[level]); - handle->SetState(EntryState.Allocated); - } - - return new hlsfHandle(handle, size); - } - - private void SliceMemory(Entry* e, int offset) { } - - /// - /// Try to allocate a new 16MB block when all buckets are empty - /// - /// - /// Output handle to the allocated Entry - /// - /// - /// True if allocation succeeded - /// - private bool TryAllocateNew16MBBlock(out Entry* handle) - { - nuint pos = Volatile.Read(ref _spareMemory->Position); - nuint blockSize = (nuint)levelSize[^1] * 2; // Use last level size (16MB) - nuint newPos = pos + blockSize; - - // Check if we have enough space - if (newPos > ((nuint)m_Buffer) + _size) - { - handle = null; - return false; // Out of memory - } - - // Try to allocate new Entry from slab allocator - try - { - handle = (Entry*)_nodes.Allocate(); - handle->Position = pos; - handle->Size = (uint)blockSize; - handle->SetState(EntryState.ThreadOccupied); - handle->NextNear = EmptyHandle; - handle->PreviousNear = EmptyHandle; - handle->Level = GetLevelFromSize((uint)blockSize); - - - // 初始化双锁为未锁定状态 - handle->PrevLock = 0; - handle->NextLock = 0; - - // Update spare memory position - _spareMemory->Position = newPos; - - return true; - } - catch - { - handle = null; - return false; - } - } - - /// - /// Helper method for allocation - converts BucketNode to Entry - /// - private bool TryPopLevelForAllocation(int levelIndex, int sizeIndex, out Entry* entry) - { - if (TryPopLevel(levelIndex, sizeIndex, out BucketNode* bucketNode)) - { - entry = bucketNode->EntryRef; - return entry != null; - } - entry = null; - return false; - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/C39B4C802AAB6841D3858428B27ECB0D b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/C39B4C802AAB6841D3858428B27ECB0D deleted file mode 100644 index 19824d71..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/C39B4C802AAB6841D3858428B27ECB0D +++ /dev/null @@ -1,572 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - AcquireBucketNodeBothLocks(node); - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - node->AcquireNextLock(); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !headNode->TryAcquirePrevLock()) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - headNode->ReleasePrevLock(); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - node->ReleaseNextLock(); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - ReleaseBucketNodeBothLocks(node); - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(只读操作,暂时不加锁) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - - // 按照地址顺序获取锁,避免死锁 - BucketNode* firstLock = null, secondLock = null, thirdLock = null; - bool needPrevNextLock = false, needNodeBothLocks = false, needNextPrevLock = false; - - if (previous != null && next != null) - { - // 中间节点:需要修改前驱的next和后继的prev - if ((ulong)previous < (ulong)node && (ulong)node < (ulong)next) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - thirdLock = next; - needNextPrevLock = true; - } else if ((ulong)previous < (ulong)next && (ulong)next < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = next; - needNextPrevLock = true; - thirdLock = node; - needNodeBothLocks = true; - } else // other cases - { - firstLock = next; - needNextPrevLock = true; - secondLock = previous; - needPrevNextLock = true; - thirdLock = node; - needNodeBothLocks = true; - } - } else if (previous != null) - { - // 尾节点:只需要修改前驱的next - if ((ulong)previous < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - } else - { - firstLock = node; - needNodeBothLocks = true; - secondLock = previous; - needPrevNextLock = true; - } - } else - { - // 应该不会到这里,因为头节点已经在上面处理了 - Thread.Sleep(0); - continue; - } - - - // 按顺序获取锁 - bool acquired = false; - try - { - if (firstLock != null) - { - if (firstLock == previous && needPrevNextLock) - { - if (!firstLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == next && needNextPrevLock) - { - if (!firstLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == node && needNodeBothLocks) - { - if (!firstLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (secondLock != null) - { - if (secondLock == previous && needPrevNextLock) - { - if (!secondLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == next && needNextPrevLock) - { - if (!secondLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == node && needNodeBothLocks) - { - if (!secondLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (thirdLock != null) - { - if (thirdLock == previous && needPrevNextLock) - { - if (!thirdLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == next && needNextPrevLock) - { - if (!thirdLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == node && needNodeBothLocks) - { - if (!thirdLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - acquired = true; - - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - if (acquired) - { - // 释放锁 - if (thirdLock == previous && needPrevNextLock) - { - thirdLock->ReleaseNextLock(); - } else if (thirdLock == next && needNextPrevLock) - { - thirdLock->ReleasePrevLock(); - } else if (thirdLock == node && needNodeBothLocks) { - thirdLock->ReleaseBothLocks(); - } - - if (secondLock == previous && needPrevNextLock) - { - secondLock->ReleaseNextLock(); - } else if (secondLock == next && needNextPrevLock) - { - secondLock->ReleasePrevLock(); - } else if (secondLock == node && needNodeBothLocks) { - secondLock->ReleaseBothLocks(); - } - - if (firstLock == previous && needPrevNextLock) - { - firstLock->ReleaseNextLock(); - } else if (firstLock == next && needNextPrevLock) - { - firstLock->ReleasePrevLock(); - } else if (firstLock == node && needNodeBothLocks) { - firstLock->ReleaseBothLocks(); - } - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - return TryAcquireBucketNodeBothLocks(node); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!head->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !next->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - next->ReleasePrevLock(); - } - } - } - finally - { - head->ReleaseNextLock(); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - } - - #region BucketNode Operations - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != BucketNode.MAGIC_NUMBER; - } - - // BucketNode 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref node->PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) == thread) { - Volatile.Write(ref node->PrevLock, 0); - } - } - - // BucketNode 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) != thread) - { - while (Interlocked.CompareExchange(ref node->NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) == thread) { - Volatile.Write(ref node->NextLock, 0); - } - } - - // BucketNode 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return true; - } - - if (TryAcquireBucketNodePrevLock(node)) - { - if (TryAcquireBucketNodeNextLock(node)) - { - return true; - } else - { - ReleaseBucketNodePrevLock(node); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - ReleaseBucketNodePrevLock(node); - ReleaseBucketNodeNextLock(node); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - AcquireBucketNodePrevLock(node); - AcquireBucketNodeNextLock(node); - } - - #endregion - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/C459D66C3077846C4BABCFB732EA7F5B b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/C459D66C3077846C4BABCFB732EA7F5B deleted file mode 100644 index 19824d71..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/C459D66C3077846C4BABCFB732EA7F5B +++ /dev/null @@ -1,572 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - AcquireBucketNodeBothLocks(node); - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - node->AcquireNextLock(); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !headNode->TryAcquirePrevLock()) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - headNode->ReleasePrevLock(); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - node->ReleaseNextLock(); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - ReleaseBucketNodeBothLocks(node); - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(只读操作,暂时不加锁) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - - // 按照地址顺序获取锁,避免死锁 - BucketNode* firstLock = null, secondLock = null, thirdLock = null; - bool needPrevNextLock = false, needNodeBothLocks = false, needNextPrevLock = false; - - if (previous != null && next != null) - { - // 中间节点:需要修改前驱的next和后继的prev - if ((ulong)previous < (ulong)node && (ulong)node < (ulong)next) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - thirdLock = next; - needNextPrevLock = true; - } else if ((ulong)previous < (ulong)next && (ulong)next < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = next; - needNextPrevLock = true; - thirdLock = node; - needNodeBothLocks = true; - } else // other cases - { - firstLock = next; - needNextPrevLock = true; - secondLock = previous; - needPrevNextLock = true; - thirdLock = node; - needNodeBothLocks = true; - } - } else if (previous != null) - { - // 尾节点:只需要修改前驱的next - if ((ulong)previous < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - } else - { - firstLock = node; - needNodeBothLocks = true; - secondLock = previous; - needPrevNextLock = true; - } - } else - { - // 应该不会到这里,因为头节点已经在上面处理了 - Thread.Sleep(0); - continue; - } - - - // 按顺序获取锁 - bool acquired = false; - try - { - if (firstLock != null) - { - if (firstLock == previous && needPrevNextLock) - { - if (!firstLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == next && needNextPrevLock) - { - if (!firstLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == node && needNodeBothLocks) - { - if (!firstLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (secondLock != null) - { - if (secondLock == previous && needPrevNextLock) - { - if (!secondLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == next && needNextPrevLock) - { - if (!secondLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == node && needNodeBothLocks) - { - if (!secondLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (thirdLock != null) - { - if (thirdLock == previous && needPrevNextLock) - { - if (!thirdLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == next && needNextPrevLock) - { - if (!thirdLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == node && needNodeBothLocks) - { - if (!thirdLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - acquired = true; - - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - if (acquired) - { - // 释放锁 - if (thirdLock == previous && needPrevNextLock) - { - thirdLock->ReleaseNextLock(); - } else if (thirdLock == next && needNextPrevLock) - { - thirdLock->ReleasePrevLock(); - } else if (thirdLock == node && needNodeBothLocks) { - thirdLock->ReleaseBothLocks(); - } - - if (secondLock == previous && needPrevNextLock) - { - secondLock->ReleaseNextLock(); - } else if (secondLock == next && needNextPrevLock) - { - secondLock->ReleasePrevLock(); - } else if (secondLock == node && needNodeBothLocks) { - secondLock->ReleaseBothLocks(); - } - - if (firstLock == previous && needPrevNextLock) - { - firstLock->ReleaseNextLock(); - } else if (firstLock == next && needNextPrevLock) - { - firstLock->ReleasePrevLock(); - } else if (firstLock == node && needNodeBothLocks) { - firstLock->ReleaseBothLocks(); - } - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - return TryAcquireBucketNodeBothLocks(node); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!head->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !next->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - next->ReleasePrevLock(); - } - } - } - finally - { - head->ReleaseNextLock(); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - } - - #region BucketNode Operations - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != BucketNode.MAGIC_NUMBER; - } - - // BucketNode 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref node->PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) == thread) { - Volatile.Write(ref node->PrevLock, 0); - } - } - - // BucketNode 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) != thread) - { - while (Interlocked.CompareExchange(ref node->NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) == thread) { - Volatile.Write(ref node->NextLock, 0); - } - } - - // BucketNode 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return true; - } - - if (TryAcquireBucketNodePrevLock(node)) - { - if (TryAcquireBucketNodeNextLock(node)) - { - return true; - } else - { - ReleaseBucketNodePrevLock(node); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - ReleaseBucketNodePrevLock(node); - ReleaseBucketNodeNextLock(node); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - AcquireBucketNodePrevLock(node); - AcquireBucketNodeNextLock(node); - } - - #endregion - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/DD33CFD2FDC59A9C6D38F3D26986324C b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/DD33CFD2FDC59A9C6D38F3D26986324C deleted file mode 100644 index 0c7ef8b9..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/DD33CFD2FDC59A9C6D38F3D26986324C +++ /dev/null @@ -1,123 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Buffers; -using System.Runtime.InteropServices; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator : IDisposable - { - - private static readonly nuint EmptyHandle = (nuint)(void*)null; - - // Bucket system field - directly in main allocator class - private ulong[] _bucketHeads; - - private Entry* _spareMemory; - private readonly byte* m_Buffer; - private bool disposedValue; - private readonly int _align; - private readonly nuint _size; - private readonly SlabAllocator _nodes; - - public HybridLayerSegregatedFitAllocator(nuint byteSize) - { - if (byteSize < 64) { - throw new InvalidOperationException(); - } - _nodes = SlabAllocator.Create(64, BufferLayout.Chunked); - _size = byteSize; - m_Buffer = (byte*)NativeMemory.AlignedAlloc(byteSize, 16); - _align = 16; - - - // 初始化桶系统 - InitializeBucketSystem(); - - - // 初始化spareMemory - _spareMemory = (Entry*)_nodes.Allocate(); - _spareMemory->SetState(EntryState.ThreadOccupied); - _spareMemory->NextNear = EmptyHandle; - _spareMemory->Position = (nuint)m_Buffer; - _spareMemory->PrevLock = 0; - _spareMemory->NextLock = 0; - } - - public HybridLayerSegregatedFitAllocator(nuint byteSize, int align) - { - if (align < 16 || (align & (align - 1)) != 0) { - throw new ArgumentException( - "Alignment must be a power of two and at least 8 bytes."); - } - _nodes = SlabAllocator.Create(64, BufferLayout.Chunked); - m_Buffer = (byte*)NativeMemory.AlignedAlloc(byteSize, (nuint)align); - _align = align; - _size = byteSize; - - InitializeBucketSystem(); - - - // 初始化spareMemory - _spareMemory = (Entry*)_nodes.Allocate(); - _spareMemory->SetState(EntryState.ThreadOccupied); - _spareMemory->NextNear = EmptyHandle; - _spareMemory->Position = (nuint)m_Buffer; - _spareMemory->PrevLock = 0; - _spareMemory->NextLock = 0; - } - - public void Dispose() - { - Dispose(disposing:true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - if (!disposedValue) - { - if (disposing) { - _nodes.Dispose(); - } - NativeMemory.AlignedFree(m_Buffer); - disposedValue = true; - } - } - - ~HybridLayerSegregatedFitAllocator() - { - Dispose(disposing:false); - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/F1481D5666E0266F32099AD751F704AB b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/F1481D5666E0266F32099AD751F704AB deleted file mode 100644 index 67fb7f9b..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/F1481D5666E0266F32099AD751F704AB +++ /dev/null @@ -1,596 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用新的静态方法 - BucketNodeOperations.AcquireBothLocks(node); - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - node->AcquireNextLock(); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !headNode->TryAcquirePrevLock()) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - headNode->ReleasePrevLock(); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - node->ReleaseNextLock(); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 使用新的静态方法 - BucketNodeOperations.ReleaseBothLocks(node); - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(只读操作,暂时不加锁) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - - // 按照地址顺序获取锁,避免死锁 - BucketNode* firstLock = null, secondLock = null, thirdLock = null; - bool needPrevNextLock = false, needNodeBothLocks = false, needNextPrevLock = false; - - if (previous != null && next != null) - { - // 中间节点:需要修改前驱的next和后继的prev - if ((ulong)previous < (ulong)node && (ulong)node < (ulong)next) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - thirdLock = next; - needNextPrevLock = true; - } else if ((ulong)previous < (ulong)next && (ulong)next < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = next; - needNextPrevLock = true; - thirdLock = node; - needNodeBothLocks = true; - } else // other cases - { - firstLock = next; - needNextPrevLock = true; - secondLock = previous; - needPrevNextLock = true; - thirdLock = node; - needNodeBothLocks = true; - } - } else if (previous != null) - { - // 尾节点:只需要修改前驱的next - if ((ulong)previous < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - } else - { - firstLock = node; - needNodeBothLocks = true; - secondLock = previous; - needPrevNextLock = true; - } - } else - { - // 应该不会到这里,因为头节点已经在上面处理了 - Thread.Sleep(0); - continue; - } - - - // 按顺序获取锁 - bool acquired = false; - try - { - if (firstLock != null) - { - if (firstLock == previous && needPrevNextLock) - { - if (!firstLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == next && needNextPrevLock) - { - if (!firstLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == node && needNodeBothLocks) - { - if (!firstLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (secondLock != null) - { - if (secondLock == previous && needPrevNextLock) - { - if (!secondLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == next && needNextPrevLock) - { - if (!secondLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == node && needNodeBothLocks) - { - if (!secondLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (thirdLock != null) - { - if (thirdLock == previous && needPrevNextLock) - { - if (!thirdLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == next && needNextPrevLock) - { - if (!thirdLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == node && needNodeBothLocks) - { - if (!thirdLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - acquired = true; - - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - if (acquired) - { - // 释放锁 - if (thirdLock == previous && needPrevNextLock) - { - thirdLock->ReleaseNextLock(); - } else if (thirdLock == next && needNextPrevLock) - { - thirdLock->ReleasePrevLock(); - } else if (thirdLock == node && needNodeBothLocks) { - thirdLock->ReleaseBothLocks(); - } - - if (secondLock == previous && needPrevNextLock) - { - secondLock->ReleaseNextLock(); - } else if (secondLock == next && needNextPrevLock) - { - secondLock->ReleasePrevLock(); - } else if (secondLock == node && needNodeBothLocks) { - secondLock->ReleaseBothLocks(); - } - - if (firstLock == previous && needPrevNextLock) - { - firstLock->ReleaseNextLock(); - } else if (firstLock == next && needNextPrevLock) - { - firstLock->ReleasePrevLock(); - } else if (firstLock == node && needNodeBothLocks) { - firstLock->ReleaseBothLocks(); - } - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用新的静态方法 - return BucketNodeOperations.TryAcquireBothLocks(node); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!head->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !next->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - next->ReleasePrevLock(); - } - } - } - finally - { - head->ReleaseNextLock(); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - } - - /// - /// BucketNode操作的静态方法集合 - /// - private static class BucketNodeOperations - { - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != BucketNode.MAGIC_NUMBER; - } - - #region Lock Operations - - // 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool TryAcquirePrevLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void AcquirePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref node->PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void ReleasePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) == thread) { - Volatile.Write(ref node->PrevLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsPrevLockHeld(BucketNode* node) => node != null && - Volatile.Read(ref node->PrevLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsPrevLockHeldByCurrentThread(BucketNode* node) => node != null && - Volatile.Read(ref node->PrevLock) == Environment.CurrentManagedThreadId; - - // 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool TryAcquireNextLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void AcquireNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) != thread) - { - while (Interlocked.CompareExchange(ref node->NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void ReleaseNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) == thread) { - Volatile.Write(ref node->NextLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNextLockHeld(BucketNode* node) => node != null && - Volatile.Read(ref node->NextLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNextLockHeldByCurrentThread(BucketNode* node) => node != null && - Volatile.Read(ref node->NextLock) == Environment.CurrentManagedThreadId; - - // 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool TryAcquireBothLocks(BucketNode* node) - { - if (node == null) { - return true; - } - - if (TryAcquirePrevLock(node)) - { - if (TryAcquireNextLock(node)) - { - return true; - } else - { - ReleasePrevLock(node); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void ReleaseBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - ReleasePrevLock(node); - ReleaseNextLock(node); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void AcquireBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - AcquirePrevLock(node); - AcquireNextLock(node); - } - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/FC412F02F085927EA5420B57B479047E b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/FC412F02F085927EA5420B57B479047E deleted file mode 100644 index 17601894..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/361BC42FCAC6324C961DFAB445AE41E3/FC412F02F085927EA5420B57B479047E +++ /dev/null @@ -1,453 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用HLSFAllocator的private static方法 - AcquireEntryBothLocks(entry); - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private Entry* MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return null; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = GetLevelFromSize(size); - int segment = DetermineSegmentIndex(size, originLevel); - - if (!TryAcquireEntrySpinLock(entry)) - { - return entry; // 无法获取锁,返回原Entry - } - - try - { - // 设置状态为合并中 - TrySetEntryState(entry, EntryState.Empty, EntryState.Merging); - - // current Level merge - while (originLevel <= entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - - // backward merging - 向前合并 - while (true) - { - ulong p = entry->PreviousNear; - Entry* prev = (Entry*)p; - if (prev == null || - GetEntryState(prev) != EntryState.Empty || - !IsAdjacentTo(entry, prev) || - entry->Level != prev->Level || - !AssertAlignBoundry(offset, prev, entry->Level) || - !TryAcquireEntrySpinLock(prev)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)prev->Position); - MergeEntry(entry, prev); - RecycleEntry(prev); - } - finally - { - ReleaseEntrySpinLock(prev); - } - } - - // forward merging - 向后合并 - while (true) - { - ulong n = entry->NextNear; - Entry* next = (Entry*)n; - if (next == null || - GetEntryState(next) != EntryState.Empty || - !IsAdjacentTo(entry, next) || - entry->Level != next->Level || - !AssertAlignBoundry(offset, next, entry->Level) || - !TryAcquireEntrySpinLock(next)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)next->Position); - MergeEntry(entry, next); - RecycleEntry(next); - } - finally - { - ReleaseEntrySpinLock(next); - } - } - - // 更新level信息 - originLevel++; - if (originLevel > entry->Level) - { - break; - } - } - - // 恢复状态为空 - TrySetEntryState(entry, EntryState.Merging, EntryState.Empty); - return entry; - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用HLSFAllocator的private static方法 - ReleaseEntryBothLocks(entry); - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用HLSFAllocator的private static方法 - return TryAcquireEntryBothLocks(entry); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 44)] - internal struct Entry - { - - [FieldOffset(28)] internal int Level; // Level of the block in the allocator - [FieldOffset(40)] internal int NextLock; // 后继指针锁(控制NextNear指针操作) - - // 双锁设计:分离前后指针操作(和BucketNode保持一致) - [FieldOffset(36)] internal int PrevLock; // 前驱指针锁(控制PreviousNear指针操作) - [FieldOffset(32)] internal int State; // Node state (using int for atomic operations) - [FieldOffset(24)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - } - - // 更新后的EntryState常量类 - 使用int类型 - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int Merging = 3; // Currently being merged - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - #region Entry Operations - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsNullOrEmptyEntryIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsNullOrEmptyEntryIndex(Entry* entry) - { - return entry == null; - } - - // Entry 状态操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TrySetEntryState(Entry* entry, int expectedState, int newState) - { - return entry != null && - Interlocked.CompareExchange(ref entry->State, newState, expectedState) == expectedState; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static int GetEntryState(Entry* entry) => entry != null ? Volatile.Read(ref entry->State) : 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void SetEntryState(Entry* entry, int newState) - { - if (entry != null) { - Volatile.Write(ref entry->State, newState); - } - } - - // Entry 状态便利方法 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsEntryEmpty(Entry* entry) => GetEntryState(entry) == EntryState.Empty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsEntryAllocated(Entry* entry) => GetEntryState(entry) == EntryState.Allocated; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsEntryThreadOccupied(Entry* entry) => GetEntryState(entry) == EntryState.ThreadOccupied; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsEntryMerging(Entry* entry) => GetEntryState(entry) == EntryState.Merging; - - // Entry 前驱锁操作(控制PreviousNear字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntryPrevLock(Entry* entry) - { - if (entry == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref entry->PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireEntryPrevLock(Entry* entry) - { - if (entry == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref entry->PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref entry->PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseEntryPrevLock(Entry* entry) - { - if (entry == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref entry->PrevLock) == thread) { - Volatile.Write(ref entry->PrevLock, 0); - } - } - - // Entry 后继锁操作(控制NextNear字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntryNextLock(Entry* entry) - { - if (entry == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref entry->NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireEntryNextLock(Entry* entry) - { - if (entry == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref entry->NextLock) != thread) - { - while (Interlocked.CompareExchange(ref entry->NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseEntryNextLock(Entry* entry) - { - if (entry == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref entry->NextLock) == thread) { - Volatile.Write(ref entry->NextLock, 0); - } - } - - // Entry 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntryBothLocks(Entry* entry) - { - if (entry == null) { - return true; - } - - if (TryAcquireEntryPrevLock(entry)) - { - if (TryAcquireEntryNextLock(entry)) - { - return true; - } else - { - ReleaseEntryPrevLock(entry); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseEntryBothLocks(Entry* entry) - { - if (entry == null) { - return; - } - - ReleaseEntryPrevLock(entry); - ReleaseEntryNextLock(entry); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireEntryBothLocks(Entry* entry) - { - if (entry == null) { - return; - } - - AcquireEntryPrevLock(entry); - AcquireEntryNextLock(entry); - } - - #endregion - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/15ECA87E3A6524336A306184CCF4359E b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/15ECA87E3A6524336A306184CCF4359E deleted file mode 100644 index cdcdb990..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/15ECA87E3A6524336A306184CCF4359E +++ /dev/null @@ -1,157 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Alloc.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Threading; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private BufferExpansionLock _spareLock = new(); - - public hlsfHandle Alloc(uint size) - { - ArgumentOutOfRangeException.ThrowIfGreaterThan(size, (nuint)levelSize[^1] * 2); - int level = GetLevelFromSize(size); - int segmentIndex = DetermineSegmentIndex(size, level); - - int i = level, s = segmentIndex; - if (TryPopLevelForAllocation(i, s, out Entry* handle)) - { - handle->State = EntryState.Allocated; - return new hlsfHandle(handle, size); - } - - fallback: - i = level; - s = segmentIndex; - while (!TryPopLevelForAllocation(i, s, out handle)) - { - if (++s >= 3) - { - s = 0; - i++; - } - if (i >= levelSize.Length) - { - if (TryAllocateNew16MBBlock(out handle)) - { - break; - } - Thread.Sleep(0); - goto fallback; - } - } - - if (handle != null) - { - SliceMemory(handle, (segmentIndex + 1) * levelSize[level]); - handle->State = EntryState.Allocated; - } - - return new hlsfHandle(handle, size); - } - - private void SliceMemory(Entry* e, int offset) { } - - /// - /// Try to allocate a new 16MB block when all buckets are empty - /// - /// - /// Output handle to the allocated Entry - /// - /// - /// True if allocation succeeded - /// - private bool TryAllocateNew16MBBlock(out Entry* handle) - { - nuint pos = Volatile.Read(ref _spareMemory->Position); - nuint blockSize = (nuint)levelSize[^1] * 2; // Use last level size (16MB) - nuint newPos = pos + blockSize; - - - // Check if we have enough space - if (newPos > ((nuint)m_Buffer) + _size) - { - handle = null; - return false; // Out of memory - } - - // Try to allocate new Entry from slab allocator - try - { - handle = (Entry*)_nodes.Allocate(); - handle->Position = pos; - handle->Size = (uint)blockSize; - handle->State = EntryState.ThreadOccupied; - handle->NextNear = EmptyHandle; - handle->PreviousNear = EmptyHandle; - handle->SpinLock = 0; - - - // Update spare memory position - _spareMemory->Position = newPos; - - return true; - } - catch - { - handle = null; - return false; - } - } - - /// - /// Helper method for allocation - converts BucketNode to Entry - /// - private bool TryPopLevelForAllocation(int levelIndex, int sizeIndex, out Entry* entry) - { - if (TryPopLevel(levelIndex, sizeIndex, out BucketNode* bucketNode)) - { - entry = bucketNode->EntryRef; - return entry != null; - } - entry = null; - return false; - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/5BCFABEBC8D573FCB13622704B773A33 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/5BCFABEBC8D573FCB13622704B773A33 deleted file mode 100644 index c5956a59..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/5BCFABEBC8D573FCB13622704B773A33 +++ /dev/null @@ -1,347 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref node->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->TrySetState(BucketNode.StateEmpty, BucketNode.StateInBucket); - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->TrySetState(BucketNode.StateEmpty, BucketNode.StateInBucket); - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref node->SpinLock, 0, thread); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - return (node == null) || - (Interlocked.CompareExchange(ref node->SpinLock, thread, - 0) == 0) || - (Volatile.Read(ref node->SpinLock) == thread); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->TrySetState(BucketNode.StateInBucket, BucketNode.StateEmpty); - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(29)] internal byte LeftOpMask; // Left pointer operation (Free=0, Occupied=1) - [FieldOffset(30)] internal byte RightOpMask; // Right pointer operation (Free=0, Occupied=1) - [FieldOffset(31)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations - [FieldOffset(28)] internal byte StateMask; // Usage state (Empty=0, InBucket=1, MarkedForRemoval=2) - [FieldOffset(32)] internal int SpinLock; // Spin lock for bucket head operation - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Four Independent Byte Masks - - // State constants - public const byte StateEmpty = 0; - public const byte StateInBucket = 1; - public const byte StateMarkedForRemoval = 2; - public const byte StateReserved = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // Atomic state operations - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - return Interlocked.CompareExchange(ref Unsafe.As(ref StateMask), newState, expectedState) == expectedState; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Left operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireLeftOp() - { - return Interlocked.CompareExchange(ref Unsafe.As(ref LeftOpMask), OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseLeftOp() - { - Volatile.Write(ref LeftOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsLeftOpOccupied() => Volatile.Read(ref LeftOpMask) == OpOccupied; - - // Right operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireRightOp() - { - return Interlocked.CompareExchange(ref Unsafe.As(ref RightOpMask), OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseRightOp() - { - Volatile.Write(ref RightOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsRightOpOccupied() => Volatile.Read(ref RightOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - return Interlocked.CompareExchange(ref Unsafe.As(ref SelfOpMask), OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsInBucket() => GetState() == StateInBucket; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMarkedForRemoval() => GetState() == StateMarkedForRemoval; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsLeftOpOccupied() || IsRightOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/65CD294DF0EA55FFA811BEC012820647 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/65CD294DF0EA55FFA811BEC012820647 deleted file mode 100644 index dbe55be8..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/65CD294DF0EA55FFA811BEC012820647 +++ /dev/null @@ -1,356 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref node->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->TrySetState(BucketNode.StateEmpty, BucketNode.StateInBucket); - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->TrySetState(BucketNode.StateEmpty, BucketNode.StateInBucket); - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref node->SpinLock, 0, thread); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - return (node == null) || - (Interlocked.CompareExchange(ref node->SpinLock, thread, - 0) == 0) || - (Volatile.Read(ref node->SpinLock) == thread); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->TrySetState(BucketNode.StateInBucket, BucketNode.StateEmpty); - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(29)] internal byte LeftOpMask; // Left pointer operation (Free=0, Occupied=1) - [FieldOffset(30)] internal byte RightOpMask; // Right pointer operation (Free=0, Occupied=1) - [FieldOffset(31)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations - [FieldOffset(28)] internal byte StateMask; // Usage state (Empty=0, InBucket=1, MarkedForRemoval=2) - [FieldOffset(32)] internal int SpinLock; // Spin lock for bucket head operation (保留用于兼容) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Four Independent Byte Masks - - // State constants - public const byte StateEmpty = 0; - public const byte StateInBucket = 1; - public const byte StateMarkedForRemoval = 2; - public const byte StateReserved = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // 字节级原子操作 - 使用lock-free的自旋方式 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - byte current; - do - { - current = Volatile.Read(ref StateMask); - if (current != expectedState) { - return false; - } - } while (Interlocked.CompareExchange(ref StateMask, newState, expectedState) != expectedState); - - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Left operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireLeftOp() - { - return Interlocked.CompareExchange(ref LeftOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseLeftOp() - { - Volatile.Write(ref LeftOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsLeftOpOccupied() => Volatile.Read(ref LeftOpMask) == OpOccupied; - - // Right operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireRightOp() - { - return Interlocked.CompareExchange(ref RightOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseRightOp() - { - Volatile.Write(ref RightOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsRightOpOccupied() => Volatile.Read(ref RightOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - return Interlocked.CompareExchange(ref SelfOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsInBucket() => GetState() == StateInBucket; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMarkedForRemoval() => GetState() == StateMarkedForRemoval; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsLeftOpOccupied() || IsRightOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/77DA1642FF8B0DC1F1DA13D99169CF30 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/77DA1642FF8B0DC1F1DA13D99169CF30 deleted file mode 100644 index 29fad368..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/77DA1642FF8B0DC1F1DA13D99169CF30 +++ /dev/null @@ -1,261 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - if (entry != null && Volatile.Read(ref entry->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref entry->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private void MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = -1; - int segment = DetermineSegmentIndex(size, originLevel); - if (TryAcquireEntrySpinLock(entry)) { - return; - } - - // current Level merge - while (originLevel != entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - AcquireBucketNodeSpinLock((BucketNode*)entry->Position); - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - RemoveFromBucket(originLevel, , (BucketNode*)near->Position); - } - - // forward merging - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - } - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - if (entry != null && Volatile.Read(ref entry->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref entry->SpinLock, 0, thread); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - return entry == null || - (Interlocked.CompareExchange(ref entry->SpinLock, thread, - 0) == 0) || - Volatile.Read(ref entry->SpinLock) == thread; - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(36)] internal int Level; // Level of the block in the allocator - [FieldOffset(24)] internal int SpinLock; // Spin lock for thread safety protection - [FieldOffset(28)] internal int State; // Node state - [FieldOffset(32)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - } - - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/ACB504B50685A90306EACB6DFEC375B8 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/ACB504B50685A90306EACB6DFEC375B8 deleted file mode 100644 index dbe55be8..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/ACB504B50685A90306EACB6DFEC375B8 +++ /dev/null @@ -1,356 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref node->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->TrySetState(BucketNode.StateEmpty, BucketNode.StateInBucket); - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->TrySetState(BucketNode.StateEmpty, BucketNode.StateInBucket); - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref node->SpinLock, 0, thread); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - return (node == null) || - (Interlocked.CompareExchange(ref node->SpinLock, thread, - 0) == 0) || - (Volatile.Read(ref node->SpinLock) == thread); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->TrySetState(BucketNode.StateInBucket, BucketNode.StateEmpty); - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(29)] internal byte LeftOpMask; // Left pointer operation (Free=0, Occupied=1) - [FieldOffset(30)] internal byte RightOpMask; // Right pointer operation (Free=0, Occupied=1) - [FieldOffset(31)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations - [FieldOffset(28)] internal byte StateMask; // Usage state (Empty=0, InBucket=1, MarkedForRemoval=2) - [FieldOffset(32)] internal int SpinLock; // Spin lock for bucket head operation (保留用于兼容) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Four Independent Byte Masks - - // State constants - public const byte StateEmpty = 0; - public const byte StateInBucket = 1; - public const byte StateMarkedForRemoval = 2; - public const byte StateReserved = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // 字节级原子操作 - 使用lock-free的自旋方式 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - byte current; - do - { - current = Volatile.Read(ref StateMask); - if (current != expectedState) { - return false; - } - } while (Interlocked.CompareExchange(ref StateMask, newState, expectedState) != expectedState); - - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Left operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireLeftOp() - { - return Interlocked.CompareExchange(ref LeftOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseLeftOp() - { - Volatile.Write(ref LeftOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsLeftOpOccupied() => Volatile.Read(ref LeftOpMask) == OpOccupied; - - // Right operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireRightOp() - { - return Interlocked.CompareExchange(ref RightOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseRightOp() - { - Volatile.Write(ref RightOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsRightOpOccupied() => Volatile.Read(ref RightOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - return Interlocked.CompareExchange(ref SelfOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsInBucket() => GetState() == StateInBucket; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMarkedForRemoval() => GetState() == StateMarkedForRemoval; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsLeftOpOccupied() || IsRightOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/B5126D29D08B2553CC28B846B92EB369 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/B5126D29D08B2553CC28B846B92EB369 deleted file mode 100644 index b5ba0212..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/B5126D29D08B2553CC28B846B92EB369 +++ /dev/null @@ -1,91 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Free.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Buffers; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - /// - /// Free allocated memory block and perform adjacent block merging - /// - /// - /// Handle to the allocated memory block - /// - public void Free(hlsfHandle handle) - { - Entry* e = handle.EntryHandle; - if (e == null) { - return; - } - AcquireEntrySpinLock(e); - try - { - if (e->State != EntryState.Allocated) { - return; - } - e->State = EntryState.ThreadOccupied; - - // Step 4: Try merge with adjacent free blocks and remove them from buckets - Entry* mergedEntry = TryMergeAndRemoveFromBuckets(e); - - - // Step 5: Calculate final level and segment for the merged block - uint finalSize = mergedEntry->Size; - int finalLevel = GetLevelFromSize(finalSize); - int finalSegment = DetermineSegmentIndex(finalSize, finalLevel); - - // Step 6: Set the merged entry state to Empty (ready to be reused) - mergedEntry->State = EntryState.Empty; - - // Step 7: Push the merged entry back to appropriate bucket - PushLevel(finalLevel, finalSegment, (BucketNode*)mergedEntry->Position); - - // Note: If mergedEntry is different from original e, the original e - // and any merged entries have already been freed to _nodes by TryMergeAndRemoveFromBuckets - } - finally - { - // Step 8: Always release the spin lock - ReleaseEntrySpinLock(e); - } - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/B6E0C831A60B5CCE0C25008C735877A6 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/B6E0C831A60B5CCE0C25008C735877A6 deleted file mode 100644 index dbe55be8..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/B6E0C831A60B5CCE0C25008C735877A6 +++ /dev/null @@ -1,356 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref node->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->TrySetState(BucketNode.StateEmpty, BucketNode.StateInBucket); - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->TrySetState(BucketNode.StateEmpty, BucketNode.StateInBucket); - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref node->SpinLock, 0, thread); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - return (node == null) || - (Interlocked.CompareExchange(ref node->SpinLock, thread, - 0) == 0) || - (Volatile.Read(ref node->SpinLock) == thread); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->TrySetState(BucketNode.StateInBucket, BucketNode.StateEmpty); - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(29)] internal byte LeftOpMask; // Left pointer operation (Free=0, Occupied=1) - [FieldOffset(30)] internal byte RightOpMask; // Right pointer operation (Free=0, Occupied=1) - [FieldOffset(31)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations - [FieldOffset(28)] internal byte StateMask; // Usage state (Empty=0, InBucket=1, MarkedForRemoval=2) - [FieldOffset(32)] internal int SpinLock; // Spin lock for bucket head operation (保留用于兼容) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Four Independent Byte Masks - - // State constants - public const byte StateEmpty = 0; - public const byte StateInBucket = 1; - public const byte StateMarkedForRemoval = 2; - public const byte StateReserved = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // 字节级原子操作 - 使用lock-free的自旋方式 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - byte current; - do - { - current = Volatile.Read(ref StateMask); - if (current != expectedState) { - return false; - } - } while (Interlocked.CompareExchange(ref StateMask, newState, expectedState) != expectedState); - - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Left operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireLeftOp() - { - return Interlocked.CompareExchange(ref LeftOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseLeftOp() - { - Volatile.Write(ref LeftOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsLeftOpOccupied() => Volatile.Read(ref LeftOpMask) == OpOccupied; - - // Right operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireRightOp() - { - return Interlocked.CompareExchange(ref RightOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseRightOp() - { - Volatile.Write(ref RightOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsRightOpOccupied() => Volatile.Read(ref RightOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - return Interlocked.CompareExchange(ref SelfOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsInBucket() => GetState() == StateInBucket; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMarkedForRemoval() => GetState() == StateMarkedForRemoval; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsLeftOpOccupied() || IsRightOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/DD33CFD2FDC59A9C6D38F3D26986324C b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/DD33CFD2FDC59A9C6D38F3D26986324C deleted file mode 100644 index e6119d69..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/DD33CFD2FDC59A9C6D38F3D26986324C +++ /dev/null @@ -1,119 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Buffers; -using System.Runtime.InteropServices; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator : IDisposable - { - - private static readonly nuint EmptyHandle = (nuint)(void*)null; - - // Bucket system field - directly in main allocator class - private ulong[] _bucketHeads; - - private Entry* _spareMemory; - private readonly byte* m_Buffer; - private bool disposedValue; - private readonly int _align; - private readonly nuint _size; - private readonly SlabAllocator _nodes; - - public HybridLayerSegregatedFitAllocator(nuint byteSize) - { - if (byteSize < 64) { - throw new InvalidOperationException(); - } - _nodes = SlabAllocator.Create(64, BufferLayout.Chunked); - _size = byteSize; - m_Buffer = (byte*)NativeMemory.AlignedAlloc(byteSize, 16); - _align = 16; - - - // 初始化桶系统 - InitializeBucketSystem(); - - - // 初始化spareMemory - _spareMemory = (Entry*)_nodes.Allocate(); - _spareMemory->State = EntryState.ThreadOccupied; - _spareMemory->NextNear = EmptyHandle; - _spareMemory->Position = (nuint)m_Buffer; - } - - public HybridLayerSegregatedFitAllocator(nuint byteSize, int align) - { - if (align < 16 || (align & (align - 1)) != 0) { - throw new ArgumentException( - "Alignment must be a power of two and at least 8 bytes."); - } - _nodes = SlabAllocator.Create(64, BufferLayout.Chunked); - m_Buffer = (byte*)NativeMemory.AlignedAlloc(byteSize, (nuint)align); - _align = align; - _size = byteSize; - - InitializeBucketSystem(); - - - // 初始化spareMemory - _spareMemory = (Entry*)_nodes.Allocate(); - _spareMemory->State = EntryState.ThreadOccupied; - _spareMemory->NextNear = EmptyHandle; - _spareMemory->Position = (nuint)m_Buffer; - } - - public void Dispose() - { - Dispose(disposing:true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - if (!disposedValue) - { - if (disposing) { - _nodes.Dispose(); - } - NativeMemory.AlignedFree(m_Buffer); - disposedValue = true; - } - } - - ~HybridLayerSegregatedFitAllocator() - { - Dispose(disposing:false); - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/F1481D5666E0266F32099AD751F704AB b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/F1481D5666E0266F32099AD751F704AB deleted file mode 100644 index c5956a59..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/47A412A460F8CE4791211C01C6479045/F1481D5666E0266F32099AD751F704AB +++ /dev/null @@ -1,347 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref node->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->TrySetState(BucketNode.StateEmpty, BucketNode.StateInBucket); - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->TrySetState(BucketNode.StateEmpty, BucketNode.StateInBucket); - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref node->SpinLock, 0, thread); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - return (node == null) || - (Interlocked.CompareExchange(ref node->SpinLock, thread, - 0) == 0) || - (Volatile.Read(ref node->SpinLock) == thread); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->TrySetState(BucketNode.StateInBucket, BucketNode.StateEmpty); - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(29)] internal byte LeftOpMask; // Left pointer operation (Free=0, Occupied=1) - [FieldOffset(30)] internal byte RightOpMask; // Right pointer operation (Free=0, Occupied=1) - [FieldOffset(31)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations - [FieldOffset(28)] internal byte StateMask; // Usage state (Empty=0, InBucket=1, MarkedForRemoval=2) - [FieldOffset(32)] internal int SpinLock; // Spin lock for bucket head operation - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Four Independent Byte Masks - - // State constants - public const byte StateEmpty = 0; - public const byte StateInBucket = 1; - public const byte StateMarkedForRemoval = 2; - public const byte StateReserved = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // Atomic state operations - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - return Interlocked.CompareExchange(ref Unsafe.As(ref StateMask), newState, expectedState) == expectedState; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Left operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireLeftOp() - { - return Interlocked.CompareExchange(ref Unsafe.As(ref LeftOpMask), OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseLeftOp() - { - Volatile.Write(ref LeftOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsLeftOpOccupied() => Volatile.Read(ref LeftOpMask) == OpOccupied; - - // Right operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireRightOp() - { - return Interlocked.CompareExchange(ref Unsafe.As(ref RightOpMask), OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseRightOp() - { - Volatile.Write(ref RightOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsRightOpOccupied() => Volatile.Read(ref RightOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - return Interlocked.CompareExchange(ref Unsafe.As(ref SelfOpMask), OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsInBucket() => GetState() == StateInBucket; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMarkedForRemoval() => GetState() == StateMarkedForRemoval; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsLeftOpOccupied() || IsRightOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/12C4ED2AF9A8C75465EADDEA0EAFA617 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/12C4ED2AF9A8C75465EADDEA0EAFA617 deleted file mode 100644 index c3ac72ed..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/12C4ED2AF9A8C75465EADDEA0EAFA617 +++ /dev/null @@ -1,550 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:获取两个锁 - if (node != null) - { - node->AcquirePrevLock(); - node->AcquireNextLock(); - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - node->AcquireNextLock(); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !headNode->TryAcquirePrevLock()) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - headNode->ReleasePrevLock(); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - node->ReleaseNextLock(); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:释放两个锁 - if (node != null) - { - node->ReleaseBothLocks(); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(只读操作,暂时不加锁) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - - // 按照地址顺序获取锁,避免死锁 - BucketNode* firstLock = null, secondLock = null, thirdLock = null; - bool needPrevNextLock = false, needNodeBothLocks = false, needNextPrevLock = false; - - if (previous != null && next != null) - { - // 中间节点:需要修改前驱的next和后继的prev - if ((ulong)previous < (ulong)node && (ulong)node < (ulong)next) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - thirdLock = next; - needNextPrevLock = true; - } else if ((ulong)previous < (ulong)next && (ulong)next < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = next; - needNextPrevLock = true; - thirdLock = node; - needNodeBothLocks = true; - } else // other cases - { - firstLock = next; - needNextPrevLock = true; - secondLock = previous; - needPrevNextLock = true; - thirdLock = node; - needNodeBothLocks = true; - } - } else if (previous != null) - { - // 尾节点:只需要修改前驱的next - if ((ulong)previous < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - } else - { - firstLock = node; - needNodeBothLocks = true; - secondLock = previous; - needPrevNextLock = true; - } - } else - { - // 应该不会到这里,因为头节点已经在上面处理了 - Thread.Sleep(0); - continue; - } - - - // 按顺序获取锁 - bool acquired = false; - try - { - if (firstLock != null) - { - if (firstLock == previous && needPrevNextLock) - { - if (!firstLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == next && needNextPrevLock) - { - if (!firstLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == node && needNodeBothLocks) - { - if (!firstLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (secondLock != null) - { - if (secondLock == previous && needPrevNextLock) - { - if (!secondLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == next && needNextPrevLock) - { - if (!secondLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == node && needNodeBothLocks) - { - if (!secondLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (thirdLock != null) - { - if (thirdLock == previous && needPrevNextLock) - { - if (!thirdLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == next && needNextPrevLock) - { - if (!thirdLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == node && needNodeBothLocks) - { - if (!thirdLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - acquired = true; - - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - if (acquired) - { - // 释放锁 - if (thirdLock == previous && needPrevNextLock) - { - thirdLock->ReleaseNextLock(); - } else if (thirdLock == next && needNextPrevLock) - { - thirdLock->ReleasePrevLock(); - } else if (thirdLock == node && needNodeBothLocks) { - thirdLock->ReleaseBothLocks(); - } - - if (secondLock == previous && needPrevNextLock) - { - secondLock->ReleaseNextLock(); - } else if (secondLock == next && needNextPrevLock) - { - secondLock->ReleasePrevLock(); - } else if (secondLock == node && needNodeBothLocks) { - secondLock->ReleaseBothLocks(); - } - - if (firstLock == previous && needPrevNextLock) - { - firstLock->ReleaseNextLock(); - } else if (firstLock == next && needNextPrevLock) - { - firstLock->ReleasePrevLock(); - } else if (firstLock == node && needNodeBothLocks) { - firstLock->ReleaseBothLocks(); - } - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:尝试获取两个锁 - return node == null || node->TryAcquireBothLocks(); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!head->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !next->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - next->ReleasePrevLock(); - } - } - } - finally - { - head->ReleaseNextLock(); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] // 增加到40字节以容纳两个int锁 - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Dual Lock Operations - - // 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) == thread) { - Volatile.Write(ref PrevLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeld() => Volatile.Read(ref PrevLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeldByCurrentThread() => Volatile.Read(ref PrevLock) == Environment.CurrentManagedThreadId; - - // 后继锁操作(控制NextLevel字段)- 改为int类型 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquireNextLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref NextLock) != thread) - { - while (Interlocked.CompareExchange(ref NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref NextLock) == thread) { - Volatile.Write(ref NextLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeld() => Volatile.Read(ref NextLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeldByCurrentThread() => Volatile.Read(ref NextLock) == Environment.CurrentManagedThreadId; - - // 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireBothLocks() - { - if (TryAcquirePrevLock()) - { - if (TryAcquireNextLock()) - { - return true; - } else - { - ReleasePrevLock(); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseBothLocks() - { - ReleasePrevLock(); - ReleaseNextLock(); - } - - #endregion - } - - private bool. - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/15ECA87E3A6524336A306184CCF4359E b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/15ECA87E3A6524336A306184CCF4359E deleted file mode 100644 index cdcdb990..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/15ECA87E3A6524336A306184CCF4359E +++ /dev/null @@ -1,157 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Alloc.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Threading; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private BufferExpansionLock _spareLock = new(); - - public hlsfHandle Alloc(uint size) - { - ArgumentOutOfRangeException.ThrowIfGreaterThan(size, (nuint)levelSize[^1] * 2); - int level = GetLevelFromSize(size); - int segmentIndex = DetermineSegmentIndex(size, level); - - int i = level, s = segmentIndex; - if (TryPopLevelForAllocation(i, s, out Entry* handle)) - { - handle->State = EntryState.Allocated; - return new hlsfHandle(handle, size); - } - - fallback: - i = level; - s = segmentIndex; - while (!TryPopLevelForAllocation(i, s, out handle)) - { - if (++s >= 3) - { - s = 0; - i++; - } - if (i >= levelSize.Length) - { - if (TryAllocateNew16MBBlock(out handle)) - { - break; - } - Thread.Sleep(0); - goto fallback; - } - } - - if (handle != null) - { - SliceMemory(handle, (segmentIndex + 1) * levelSize[level]); - handle->State = EntryState.Allocated; - } - - return new hlsfHandle(handle, size); - } - - private void SliceMemory(Entry* e, int offset) { } - - /// - /// Try to allocate a new 16MB block when all buckets are empty - /// - /// - /// Output handle to the allocated Entry - /// - /// - /// True if allocation succeeded - /// - private bool TryAllocateNew16MBBlock(out Entry* handle) - { - nuint pos = Volatile.Read(ref _spareMemory->Position); - nuint blockSize = (nuint)levelSize[^1] * 2; // Use last level size (16MB) - nuint newPos = pos + blockSize; - - - // Check if we have enough space - if (newPos > ((nuint)m_Buffer) + _size) - { - handle = null; - return false; // Out of memory - } - - // Try to allocate new Entry from slab allocator - try - { - handle = (Entry*)_nodes.Allocate(); - handle->Position = pos; - handle->Size = (uint)blockSize; - handle->State = EntryState.ThreadOccupied; - handle->NextNear = EmptyHandle; - handle->PreviousNear = EmptyHandle; - handle->SpinLock = 0; - - - // Update spare memory position - _spareMemory->Position = newPos; - - return true; - } - catch - { - handle = null; - return false; - } - } - - /// - /// Helper method for allocation - converts BucketNode to Entry - /// - private bool TryPopLevelForAllocation(int levelIndex, int sizeIndex, out Entry* entry) - { - if (TryPopLevel(levelIndex, sizeIndex, out BucketNode* bucketNode)) - { - entry = bucketNode->EntryRef; - return entry != null; - } - entry = null; - return false; - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/1BFCBC1D28329246691E0D2AD2276290 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/1BFCBC1D28329246691E0D2AD2276290 deleted file mode 100644 index f4748d1a..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/1BFCBC1D28329246691E0D2AD2276290 +++ /dev/null @@ -1,366 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->Mask = false; - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:获取两个锁 - if (node != null) - { - node->AcquirePrevLock(); - node->AcquireNextLock(); - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - node->AcquireNextLock(); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !headNode->TryAcquirePrevLock()) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - headNode->ReleasePrevLock(); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - node->ReleaseNextLock(); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:释放两个锁 - if (node != null) - { - node->ReleaseBothLocks(); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:尝试获取两个锁 - return node == null || node->TryAcquireBothLocks(); - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(34)] internal short NextLock; // 后继指针锁(控制NextLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - // [FieldOffset(36)] 保留空间用于扩展 - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Dual Lock Operations - - // 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) == thread) { - Volatile.Write(ref PrevLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeld() => Volatile.Read(ref PrevLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeldByCurrentThread() => Volatile.Read(ref PrevLock) == Environment.CurrentManagedThreadId; - - // 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); // 使用低15位 - return Interlocked.CompareExchange(ref NextLock, thread, (short)0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquireNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); - if (Volatile.Read(ref NextLock) != thread) - { - while (Interlocked.CompareExchange(ref NextLock, thread, (short)0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); - if (Volatile.Read(ref NextLock) == thread) { - Volatile.Write(ref NextLock, (short)0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeld() => Volatile.Read(ref NextLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeldByCurrentThread() => Volatile.Read(ref NextLock) == (short)(Environment.CurrentManagedThreadId & 0x7FFF); - - // 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireBothLocks() - { - if (TryAcquirePrevLock()) - { - if (TryAcquireNextLock()) - { - return true; - } else - { - ReleasePrevLock(); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseBothLocks() - { - ReleasePrevLock(); - ReleaseNextLock(); - } - - #endregion - } - - private bool. - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/1CDC7F2E8227CD2167B6BE1EB5FD03E3 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/1CDC7F2E8227CD2167B6BE1EB5FD03E3 deleted file mode 100644 index 3215a0da..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/1CDC7F2E8227CD2167B6BE1EB5FD03E3 +++ /dev/null @@ -1,552 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:获取两个锁 - if (node != null) - { - node->AcquirePrevLock(); - node->AcquireNextLock(); - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - node->AcquireNextLock(); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !headNode->TryAcquirePrevLock()) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - headNode->ReleasePrevLock(); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - node->ReleaseNextLock(); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:释放两个锁 - if (node != null) - { - node->ReleaseBothLocks(); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(只读操作,暂时不加锁) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - - // 按照地址顺序获取锁,避免死锁 - BucketNode* firstLock = null, secondLock = null, thirdLock = null; - bool needPrevNextLock = false, needNodeBothLocks = false, needNextPrevLock = false; - - if (previous != null && next != null) - { - // 中间节点:需要修改前驱的next和后继的prev - if ((ulong)previous < (ulong)node && (ulong)node < (ulong)next) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - thirdLock = next; - needNextPrevLock = true; - } else if ((ulong)previous < (ulong)next && (ulong)next < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = next; - needNextPrevLock = true; - thirdLock = node; - needNodeBothLocks = true; - } else // other cases - { - firstLock = next; - needNextPrevLock = true; - secondLock = previous; - needPrevNextLock = true; - thirdLock = node; - needNodeBothLocks = true; - } - } else if (previous != null) - { - // 尾节点:只需要修改前驱的next - if ((ulong)previous < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - } else - { - firstLock = node; - needNodeBothLocks = true; - secondLock = previous; - needPrevNextLock = true; - } - } else - { - // 应该不会到这里,因为头节点已经在上面处理了 - Thread.Sleep(0); - continue; - } - - - // 按顺序获取锁 - bool acquired = false; - try - { - if (firstLock != null) - { - if (firstLock == previous && needPrevNextLock) - { - if (!firstLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == next && needNextPrevLock) - { - if (!firstLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == node && needNodeBothLocks) - { - if (!firstLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (secondLock != null) - { - if (secondLock == previous && needPrevNextLock) - { - if (!secondLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == next && needNextPrevLock) - { - if (!secondLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == node && needNodeBothLocks) - { - if (!secondLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (thirdLock != null) - { - if (thirdLock == previous && needPrevNextLock) - { - if (!thirdLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == next && needNextPrevLock) - { - if (!thirdLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == node && needNodeBothLocks) - { - if (!thirdLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - acquired = true; - - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - if (acquired) - { - // 释放锁 - if (thirdLock == previous && needPrevNextLock) - { - thirdLock->ReleaseNextLock(); - } else if (thirdLock == next && needNextPrevLock) - { - thirdLock->ReleasePrevLock(); - } else if (thirdLock == node && needNodeBothLocks) { - thirdLock->ReleaseBothLocks(); - } - - if (secondLock == previous && needPrevNextLock) - { - secondLock->ReleaseNextLock(); - } else if (secondLock == next && needNextPrevLock) - { - secondLock->ReleasePrevLock(); - } else if (secondLock == node && needNodeBothLocks) { - secondLock->ReleaseBothLocks(); - } - - if (firstLock == previous && needPrevNextLock) - { - firstLock->ReleaseNextLock(); - } else if (firstLock == next && needNextPrevLock) - { - firstLock->ReleasePrevLock(); - } else if (firstLock == node && needNodeBothLocks) { - firstLock->ReleaseBothLocks(); - } - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:尝试获取两个锁 - return node == null || node->TryAcquireBothLocks(); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!head->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !next->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - next->ReleasePrevLock(); - } - } - } - finally - { - head->ReleaseNextLock(); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(34)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - - [FieldOffset(24)] internal uint Magic; // Magic number verification - // [FieldOffset(36)] 保留空间用于扩展 - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Dual Lock Operations - - // 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) == thread) { - Volatile.Write(ref PrevLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeld() => Volatile.Read(ref PrevLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeldByCurrentThread() => Volatile.Read(ref PrevLock) == Environment.CurrentManagedThreadId; - - // 后继锁操作(控制NextLevel字段)- 改为int类型 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquireNextLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref NextLock) != thread) - { - while (Interlocked.CompareExchange(ref NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref NextLock) == thread) { - Volatile.Write(ref NextLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeld() => Volatile.Read(ref NextLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeldByCurrentThread() => Volatile.Read(ref NextLock) == Environment.CurrentManagedThreadId; - - // 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireBothLocks() - { - if (TryAcquirePrevLock()) - { - if (TryAcquireNextLock()) - { - return true; - } else - { - ReleasePrevLock(); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseBothLocks() - { - ReleasePrevLock(); - ReleaseNextLock(); - } - - #endregion - } - - private bool. - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/28BEC91E7E437895D389C02FECC17FD6 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/28BEC91E7E437895D389C02FECC17FD6 deleted file mode 100644 index 2be282ec..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/28BEC91E7E437895D389C02FECC17FD6 +++ /dev/null @@ -1,259 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - if (entry != null) - { - while (!entry->TryAcquireSelfOp()) { - Thread.Sleep(0); - } - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private void MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = -1; - int segment = DetermineSegmentIndex(size, originLevel); - if (TryAcquireEntrySpinLock(entry)) { - return; - } - - // current Level merge - while (originLevel != entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - AcquireBucketNodeSpinLock((BucketNode*)entry->Position); - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - RemoveFromBucket(originLevel, segment, (BucketNode*)near->Position); - } - - // forward merging - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - } - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - if (entry != null) - { - entry->ReleaseSelfOp(); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - return entry == null || entry->TryAcquireSelfOp(); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(36)] internal int Level; // Level of the block in the allocator - [FieldOffset(24)] internal int SpinLock; // Spin lock for thread safety protection - [FieldOffset(28)] internal int State; // Node state - [FieldOffset(32)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - } - - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/2AEFEF87A552BBCAE7EB5BE70A46BF06 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/2AEFEF87A552BBCAE7EB5BE70A46BF06 deleted file mode 100644 index ceadf80c..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/2AEFEF87A552BBCAE7EB5BE70A46BF06 +++ /dev/null @@ -1,383 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:获取两个锁 - if (node != null) - { - node->AcquirePrevLock(); - node->AcquireNextLock(); - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - node->AcquireNextLock(); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !headNode->TryAcquirePrevLock()) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - headNode->ReleasePrevLock(); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - node->ReleaseNextLock(); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:释放两个锁 - if (node != null) - { - node->ReleaseBothLocks(); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:尝试获取两个锁 - return node == null || node->TryAcquireBothLocks(); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!head->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !next->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - next->ReleasePrevLock(); - } - } - } - finally - { - head->ReleaseNextLock(); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(34)] internal short NextLock; // 后继指针锁(控制NextLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - // [FieldOffset(36)] 保留空间用于扩展 - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Dual Lock Operations - - // 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) == thread) { - Volatile.Write(ref PrevLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeld() => Volatile.Read(ref PrevLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeldByCurrentThread() => Volatile.Read(ref PrevLock) == Environment.CurrentManagedThreadId; - - // 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); // 使用低15位 - return Interlocked.CompareExchange(ref NextLock, thread, (short)0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquireNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); - if (Volatile.Read(ref NextLock) != thread) - { - while (Interlocked.CompareExchange(ref NextLock, thread, (short)0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); - if (Volatile.Read(ref NextLock) == thread) { - Volatile.Write(ref NextLock, (short)0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeld() => Volatile.Read(ref NextLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeldByCurrentThread() => Volatile.Read(ref NextLock) == (short)(Environment.CurrentManagedThreadId & 0x7FFF); - - // 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireBothLocks() - { - if (TryAcquirePrevLock()) - { - if (TryAcquireNextLock()) - { - return true; - } else - { - ReleasePrevLock(); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseBothLocks() - { - ReleasePrevLock(); - ReleaseNextLock(); - } - - #endregion - } - - private bool. - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/38EB91481842391B76343A8C3E63A1B7 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/38EB91481842391B76343A8C3E63A1B7 deleted file mode 100644 index c3ac72ed..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/38EB91481842391B76343A8C3E63A1B7 +++ /dev/null @@ -1,550 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:获取两个锁 - if (node != null) - { - node->AcquirePrevLock(); - node->AcquireNextLock(); - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - node->AcquireNextLock(); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !headNode->TryAcquirePrevLock()) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - headNode->ReleasePrevLock(); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - node->ReleaseNextLock(); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:释放两个锁 - if (node != null) - { - node->ReleaseBothLocks(); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(只读操作,暂时不加锁) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - - // 按照地址顺序获取锁,避免死锁 - BucketNode* firstLock = null, secondLock = null, thirdLock = null; - bool needPrevNextLock = false, needNodeBothLocks = false, needNextPrevLock = false; - - if (previous != null && next != null) - { - // 中间节点:需要修改前驱的next和后继的prev - if ((ulong)previous < (ulong)node && (ulong)node < (ulong)next) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - thirdLock = next; - needNextPrevLock = true; - } else if ((ulong)previous < (ulong)next && (ulong)next < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = next; - needNextPrevLock = true; - thirdLock = node; - needNodeBothLocks = true; - } else // other cases - { - firstLock = next; - needNextPrevLock = true; - secondLock = previous; - needPrevNextLock = true; - thirdLock = node; - needNodeBothLocks = true; - } - } else if (previous != null) - { - // 尾节点:只需要修改前驱的next - if ((ulong)previous < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - } else - { - firstLock = node; - needNodeBothLocks = true; - secondLock = previous; - needPrevNextLock = true; - } - } else - { - // 应该不会到这里,因为头节点已经在上面处理了 - Thread.Sleep(0); - continue; - } - - - // 按顺序获取锁 - bool acquired = false; - try - { - if (firstLock != null) - { - if (firstLock == previous && needPrevNextLock) - { - if (!firstLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == next && needNextPrevLock) - { - if (!firstLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == node && needNodeBothLocks) - { - if (!firstLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (secondLock != null) - { - if (secondLock == previous && needPrevNextLock) - { - if (!secondLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == next && needNextPrevLock) - { - if (!secondLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == node && needNodeBothLocks) - { - if (!secondLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (thirdLock != null) - { - if (thirdLock == previous && needPrevNextLock) - { - if (!thirdLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == next && needNextPrevLock) - { - if (!thirdLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == node && needNodeBothLocks) - { - if (!thirdLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - acquired = true; - - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - if (acquired) - { - // 释放锁 - if (thirdLock == previous && needPrevNextLock) - { - thirdLock->ReleaseNextLock(); - } else if (thirdLock == next && needNextPrevLock) - { - thirdLock->ReleasePrevLock(); - } else if (thirdLock == node && needNodeBothLocks) { - thirdLock->ReleaseBothLocks(); - } - - if (secondLock == previous && needPrevNextLock) - { - secondLock->ReleaseNextLock(); - } else if (secondLock == next && needNextPrevLock) - { - secondLock->ReleasePrevLock(); - } else if (secondLock == node && needNodeBothLocks) { - secondLock->ReleaseBothLocks(); - } - - if (firstLock == previous && needPrevNextLock) - { - firstLock->ReleaseNextLock(); - } else if (firstLock == next && needNextPrevLock) - { - firstLock->ReleasePrevLock(); - } else if (firstLock == node && needNodeBothLocks) { - firstLock->ReleaseBothLocks(); - } - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:尝试获取两个锁 - return node == null || node->TryAcquireBothLocks(); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!head->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !next->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - next->ReleasePrevLock(); - } - } - } - finally - { - head->ReleaseNextLock(); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] // 增加到40字节以容纳两个int锁 - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Dual Lock Operations - - // 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) == thread) { - Volatile.Write(ref PrevLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeld() => Volatile.Read(ref PrevLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeldByCurrentThread() => Volatile.Read(ref PrevLock) == Environment.CurrentManagedThreadId; - - // 后继锁操作(控制NextLevel字段)- 改为int类型 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquireNextLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref NextLock) != thread) - { - while (Interlocked.CompareExchange(ref NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref NextLock) == thread) { - Volatile.Write(ref NextLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeld() => Volatile.Read(ref NextLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeldByCurrentThread() => Volatile.Read(ref NextLock) == Environment.CurrentManagedThreadId; - - // 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireBothLocks() - { - if (TryAcquirePrevLock()) - { - if (TryAcquireNextLock()) - { - return true; - } else - { - ReleasePrevLock(); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseBothLocks() - { - ReleasePrevLock(); - ReleaseNextLock(); - } - - #endregion - } - - private bool. - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/4C7ED0249986557BA7FD083837058902 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/4C7ED0249986557BA7FD083837058902 deleted file mode 100644 index d05318c7..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/4C7ED0249986557BA7FD083837058902 +++ /dev/null @@ -1,551 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:获取两个锁 - if (node != null) - { - node->AcquirePrevLock(); - node->AcquireNextLock(); - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - node->AcquireNextLock(); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !headNode->TryAcquirePrevLock()) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - headNode->ReleasePrevLock(); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - node->ReleaseNextLock(); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:释放两个锁 - if (node != null) - { - node->ReleaseBothLocks(); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(只读操作,暂时不加锁) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - - // 按照地址顺序获取锁,避免死锁 - BucketNode* firstLock = null, secondLock = null, thirdLock = null; - bool needPrevNextLock = false, needNodeBothLocks = false, needNextPrevLock = false; - - if (previous != null && next != null) - { - // 中间节点:需要修改前驱的next和后继的prev - if ((ulong)previous < (ulong)node && (ulong)node < (ulong)next) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - thirdLock = next; - needNextPrevLock = true; - } else if ((ulong)previous < (ulong)next && (ulong)next < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = next; - needNextPrevLock = true; - thirdLock = node; - needNodeBothLocks = true; - } else // other cases - { - firstLock = next; - needNextPrevLock = true; - secondLock = previous; - needPrevNextLock = true; - thirdLock = node; - needNodeBothLocks = true; - } - } else if (previous != null) - { - // 尾节点:只需要修改前驱的next - if ((ulong)previous < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - } else - { - firstLock = node; - needNodeBothLocks = true; - secondLock = previous; - needPrevNextLock = true; - } - } else - { - // 应该不会到这里,因为头节点已经在上面处理了 - Thread.Sleep(0); - continue; - } - - - // 按顺序获取锁 - bool acquired = false; - try - { - if (firstLock != null) - { - if (firstLock == previous && needPrevNextLock) - { - if (!firstLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == next && needNextPrevLock) - { - if (!firstLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == node && needNodeBothLocks) - { - if (!firstLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (secondLock != null) - { - if (secondLock == previous && needPrevNextLock) - { - if (!secondLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == next && needNextPrevLock) - { - if (!secondLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == node && needNodeBothLocks) - { - if (!secondLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (thirdLock != null) - { - if (thirdLock == previous && needPrevNextLock) - { - if (!thirdLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == next && needNextPrevLock) - { - if (!thirdLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == node && needNodeBothLocks) - { - if (!thirdLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - acquired = true; - - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - if (acquired) - { - // 释放锁 - if (thirdLock == previous && needPrevNextLock) - { - thirdLock->ReleaseNextLock(); - } else if (thirdLock == next && needNextPrevLock) - { - thirdLock->ReleasePrevLock(); - } else if (thirdLock == node && needNodeBothLocks) { - thirdLock->ReleaseBothLocks(); - } - - if (secondLock == previous && needPrevNextLock) - { - secondLock->ReleaseNextLock(); - } else if (secondLock == next && needNextPrevLock) - { - secondLock->ReleasePrevLock(); - } else if (secondLock == node && needNodeBothLocks) { - secondLock->ReleaseBothLocks(); - } - - if (firstLock == previous && needPrevNextLock) - { - firstLock->ReleaseNextLock(); - } else if (firstLock == next && needNextPrevLock) - { - firstLock->ReleasePrevLock(); - } else if (firstLock == node && needNodeBothLocks) { - firstLock->ReleaseBothLocks(); - } - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:尝试获取两个锁 - return node == null || node->TryAcquireBothLocks(); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!head->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !next->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - next->ReleasePrevLock(); - } - } - } - finally - { - head->ReleaseNextLock(); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(34)] internal short NextLock; // 后继指针锁(控制NextLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - // [FieldOffset(36)] 保留空间用于扩展 - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Dual Lock Operations - - // 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) == thread) { - Volatile.Write(ref PrevLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeld() => Volatile.Read(ref PrevLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeldByCurrentThread() => Volatile.Read(ref PrevLock) == Environment.CurrentManagedThreadId; - - // 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); // 使用低15位 - return Interlocked.CompareExchange(ref NextLock, thread, (short)0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquireNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); - if (Volatile.Read(ref NextLock) != thread) - { - while (Interlocked.CompareExchange(ref NextLock, thread, (short)0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); - if (Volatile.Read(ref NextLock) == thread) { - Volatile.Write(ref NextLock, (short)0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeld() => Volatile.Read(ref NextLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeldByCurrentThread() => Volatile.Read(ref NextLock) == (short)(Environment.CurrentManagedThreadId & 0x7FFF); - - // 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireBothLocks() - { - if (TryAcquirePrevLock()) - { - if (TryAcquireNextLock()) - { - return true; - } else - { - ReleasePrevLock(); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseBothLocks() - { - ReleasePrevLock(); - ReleaseNextLock(); - } - - #endregion - } - - private bool. - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/4D35C1D48C61DA3186AF31509F1C686E b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/4D35C1D48C61DA3186AF31509F1C686E deleted file mode 100644 index 0015da29..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/4D35C1D48C61DA3186AF31509F1C686E +++ /dev/null @@ -1,276 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref node->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->Mask = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->Mask = true; - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref node->SpinLock, 0, thread); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - return (node == null) || - (Interlocked.CompareExchange(ref node->SpinLock, thread, - 0) == 0) || - (Volatile.Read(ref node->SpinLock) == thread); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->Mask = false; - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(32)] internal int SpinLock; // Spin lock for bucket head operation - [FieldOffset(24)] internal uint Magic; // Magic number verification - [FieldOffset(28)] internal uint Mask; // Whether in bucket - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region node mask - - public const uint AllOperating = 0b_11100000_00000000_00000000_00000111; - public const uint Empty = 0b_10000000_00000000_00000000_00000000; - public const uint InBucket = 0b_10000000_00000000_00000000_00000000; - public const uint LeftOperating = 0b_01000000_00000000_00000000_00000100; - public const uint ReadyForRemove = 0b_01000000_00000000_00000000_00000000; - public const uint RightOperating = 0b_00100000_00000000_00000000_00000001; - public const uint SelfOperating = 0b_00000000_00000000_00000000_00000010; - - private bool BucketNodeIsInBucket - { -[MethodImpl(MethodImplOptions.AggressiveInlining)] - get => (Mask & InBucket) != 0; -[MethodImpl(MethodImplOptions.AggressiveInlining)] - set => Mask |= value ? InBucket : 0; - } - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/57F7FFA3351F1888517D342105A63C6D b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/57F7FFA3351F1888517D342105A63C6D deleted file mode 100644 index d63ec980..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/57F7FFA3351F1888517D342105A63C6D +++ /dev/null @@ -1,378 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - if (entry != null) - { - while (!entry->TryAcquireSelfOp()) { - Thread.Sleep(0); - } - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private void MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = -1; - int segment = DetermineSegmentIndex(size, originLevel); - if (TryAcquireEntrySpinLock(entry)) { - return; - } - - // current Level merge - while (originLevel != entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - AcquireBucketNodeSpinLock((BucketNode*)entry->Position); - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - RemoveFromBucket(originLevel, segment, (BucketNode*)near->Position); - } - - // forward merging - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - } - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - if (entry != null) - { - entry->ReleaseSelfOp(); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - return entry == null || entry->TryAcquireSelfOp(); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(26)] internal byte NextOpMask; // Next pointer operation (Free=0, Occupied=1) - [FieldOffset(25)] internal byte PrevOpMask; // Previous pointer operation (Free=0, Occupied=1) - [FieldOffset(27)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations (replacing SpinLock) - [FieldOffset(24)] internal byte StateMask; // Entry state (Empty=0, Allocated=1, ThreadOccupied=2, Merging=3) - - [FieldOffset(28)] internal int _reserved; // Reserved for future use - - [FieldOffset(36)] internal int Level; // Level of the block in the allocator - [FieldOffset(32)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - #region Four Independent Byte Masks for Entry - - // State constants - public const byte StateEmpty = 0; - public const byte StateAllocated = 1; - public const byte StateThreadOccupied = 2; - public const byte StateMerging = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // 字节级原子操作 - 使用简单的volatile操作(调用者自觉模式) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - byte current = Volatile.Read(ref StateMask); - if (current != expectedState) { - return false; - } - - Volatile.Write(ref StateMask, newState); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Previous operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevOp() - { - byte current = Volatile.Read(ref PrevOpMask); - if (current != OpFree) { - return false; - } - - Volatile.Write(ref PrevOpMask, OpOccupied); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevOp() - { - Volatile.Write(ref PrevOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevOpOccupied() => Volatile.Read(ref PrevOpMask) == OpOccupied; - - // Next operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextOp() - { - byte current = Volatile.Read(ref NextOpMask); - if (current != OpFree) { - return false; - } - - Volatile.Write(ref NextOpMask, OpOccupied); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextOp() - { - Volatile.Write(ref NextOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextOpOccupied() => Volatile.Read(ref NextOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - byte current = Volatile.Read(ref SelfOpMask); - if (current != OpFree) { - return false; - } - - Volatile.Write(ref SelfOpMask, OpOccupied); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsAllocated() => GetState() == StateAllocated; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsThreadOccupied() => GetState() == StateThreadOccupied; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMerging() => GetState() == StateMerging; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsPrevOpOccupied() || IsNextOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - // 更新后的EntryState常量类 - 与新的字节掩码设计兼容 - private static class EntryState - { - - public const byte Allocated = 1; // Already allocated to user - public const byte Empty = 0; // Free, can be allocated - public const byte Merging = 3; // Currently being merged - public const byte ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/5A35330987E3995E9E0B480AE198A376 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/5A35330987E3995E9E0B480AE198A376 deleted file mode 100644 index f4748d1a..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/5A35330987E3995E9E0B480AE198A376 +++ /dev/null @@ -1,366 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->Mask = false; - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:获取两个锁 - if (node != null) - { - node->AcquirePrevLock(); - node->AcquireNextLock(); - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - node->AcquireNextLock(); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !headNode->TryAcquirePrevLock()) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - headNode->ReleasePrevLock(); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - node->ReleaseNextLock(); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:释放两个锁 - if (node != null) - { - node->ReleaseBothLocks(); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:尝试获取两个锁 - return node == null || node->TryAcquireBothLocks(); - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(34)] internal short NextLock; // 后继指针锁(控制NextLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - // [FieldOffset(36)] 保留空间用于扩展 - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Dual Lock Operations - - // 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) == thread) { - Volatile.Write(ref PrevLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeld() => Volatile.Read(ref PrevLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeldByCurrentThread() => Volatile.Read(ref PrevLock) == Environment.CurrentManagedThreadId; - - // 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); // 使用低15位 - return Interlocked.CompareExchange(ref NextLock, thread, (short)0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquireNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); - if (Volatile.Read(ref NextLock) != thread) - { - while (Interlocked.CompareExchange(ref NextLock, thread, (short)0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); - if (Volatile.Read(ref NextLock) == thread) { - Volatile.Write(ref NextLock, (short)0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeld() => Volatile.Read(ref NextLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeldByCurrentThread() => Volatile.Read(ref NextLock) == (short)(Environment.CurrentManagedThreadId & 0x7FFF); - - // 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireBothLocks() - { - if (TryAcquirePrevLock()) - { - if (TryAcquireNextLock()) - { - return true; - } else - { - ReleasePrevLock(); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseBothLocks() - { - ReleasePrevLock(); - ReleaseNextLock(); - } - - #endregion - } - - private bool. - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/6B45D6ABA626CDC6B6C28E91718D6E3B b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/6B45D6ABA626CDC6B6C28E91718D6E3B deleted file mode 100644 index 3215a0da..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/6B45D6ABA626CDC6B6C28E91718D6E3B +++ /dev/null @@ -1,552 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:获取两个锁 - if (node != null) - { - node->AcquirePrevLock(); - node->AcquireNextLock(); - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - node->AcquireNextLock(); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !headNode->TryAcquirePrevLock()) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - headNode->ReleasePrevLock(); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - node->ReleaseNextLock(); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:释放两个锁 - if (node != null) - { - node->ReleaseBothLocks(); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(只读操作,暂时不加锁) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - - // 按照地址顺序获取锁,避免死锁 - BucketNode* firstLock = null, secondLock = null, thirdLock = null; - bool needPrevNextLock = false, needNodeBothLocks = false, needNextPrevLock = false; - - if (previous != null && next != null) - { - // 中间节点:需要修改前驱的next和后继的prev - if ((ulong)previous < (ulong)node && (ulong)node < (ulong)next) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - thirdLock = next; - needNextPrevLock = true; - } else if ((ulong)previous < (ulong)next && (ulong)next < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = next; - needNextPrevLock = true; - thirdLock = node; - needNodeBothLocks = true; - } else // other cases - { - firstLock = next; - needNextPrevLock = true; - secondLock = previous; - needPrevNextLock = true; - thirdLock = node; - needNodeBothLocks = true; - } - } else if (previous != null) - { - // 尾节点:只需要修改前驱的next - if ((ulong)previous < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - } else - { - firstLock = node; - needNodeBothLocks = true; - secondLock = previous; - needPrevNextLock = true; - } - } else - { - // 应该不会到这里,因为头节点已经在上面处理了 - Thread.Sleep(0); - continue; - } - - - // 按顺序获取锁 - bool acquired = false; - try - { - if (firstLock != null) - { - if (firstLock == previous && needPrevNextLock) - { - if (!firstLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == next && needNextPrevLock) - { - if (!firstLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == node && needNodeBothLocks) - { - if (!firstLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (secondLock != null) - { - if (secondLock == previous && needPrevNextLock) - { - if (!secondLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == next && needNextPrevLock) - { - if (!secondLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == node && needNodeBothLocks) - { - if (!secondLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (thirdLock != null) - { - if (thirdLock == previous && needPrevNextLock) - { - if (!thirdLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == next && needNextPrevLock) - { - if (!thirdLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == node && needNodeBothLocks) - { - if (!thirdLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - acquired = true; - - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - if (acquired) - { - // 释放锁 - if (thirdLock == previous && needPrevNextLock) - { - thirdLock->ReleaseNextLock(); - } else if (thirdLock == next && needNextPrevLock) - { - thirdLock->ReleasePrevLock(); - } else if (thirdLock == node && needNodeBothLocks) { - thirdLock->ReleaseBothLocks(); - } - - if (secondLock == previous && needPrevNextLock) - { - secondLock->ReleaseNextLock(); - } else if (secondLock == next && needNextPrevLock) - { - secondLock->ReleasePrevLock(); - } else if (secondLock == node && needNodeBothLocks) { - secondLock->ReleaseBothLocks(); - } - - if (firstLock == previous && needPrevNextLock) - { - firstLock->ReleaseNextLock(); - } else if (firstLock == next && needNextPrevLock) - { - firstLock->ReleasePrevLock(); - } else if (firstLock == node && needNodeBothLocks) { - firstLock->ReleaseBothLocks(); - } - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:尝试获取两个锁 - return node == null || node->TryAcquireBothLocks(); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!head->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !next->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - next->ReleasePrevLock(); - } - } - } - finally - { - head->ReleaseNextLock(); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(34)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - - [FieldOffset(24)] internal uint Magic; // Magic number verification - // [FieldOffset(36)] 保留空间用于扩展 - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Dual Lock Operations - - // 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) == thread) { - Volatile.Write(ref PrevLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeld() => Volatile.Read(ref PrevLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeldByCurrentThread() => Volatile.Read(ref PrevLock) == Environment.CurrentManagedThreadId; - - // 后继锁操作(控制NextLevel字段)- 改为int类型 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquireNextLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref NextLock) != thread) - { - while (Interlocked.CompareExchange(ref NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref NextLock) == thread) { - Volatile.Write(ref NextLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeld() => Volatile.Read(ref NextLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeldByCurrentThread() => Volatile.Read(ref NextLock) == Environment.CurrentManagedThreadId; - - // 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireBothLocks() - { - if (TryAcquirePrevLock()) - { - if (TryAcquireNextLock()) - { - return true; - } else - { - ReleasePrevLock(); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseBothLocks() - { - ReleasePrevLock(); - ReleaseNextLock(); - } - - #endregion - } - - private bool. - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/7273FE34294FB16BA0FA46C07D9A6C13 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/7273FE34294FB16BA0FA46C07D9A6C13 deleted file mode 100644 index b58d6e1b..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/7273FE34294FB16BA0FA46C07D9A6C13 +++ /dev/null @@ -1,363 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - if (entry != null) - { - while (!entry->TryAcquireSelfOp()) { - Thread.Sleep(0); - } - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private void MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = -1; - int segment = DetermineSegmentIndex(size, originLevel); - if (TryAcquireEntrySpinLock(entry)) { - return; - } - - // current Level merge - while (originLevel != entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - AcquireBucketNodeSpinLock((BucketNode*)entry->Position); - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - RemoveFromBucket(originLevel, segment, (BucketNode*)near->Position); - } - - // forward merging - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - } - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - if (entry != null) - { - entry->ReleaseSelfOp(); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - return entry == null || entry->TryAcquireSelfOp(); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(26)] internal byte NextOpMask; // Next pointer operation (Free=0, Occupied=1) - [FieldOffset(25)] internal byte PrevOpMask; // Previous pointer operation (Free=0, Occupied=1) - [FieldOffset(27)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations (replacing SpinLock) - [FieldOffset(24)] internal byte StateMask; // Entry state (Empty=0, Allocated=1, ThreadOccupied=2, Merging=3) - - [FieldOffset(28)] internal int _reserved; // Reserved for future use - - [FieldOffset(36)] internal int Level; // Level of the block in the allocator - [FieldOffset(32)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - #region Four Independent Byte Masks for Entry - - // State constants - public const byte StateEmpty = 0; - public const byte StateAllocated = 1; - public const byte StateThreadOccupied = 2; - public const byte StateMerging = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // 字节级原子操作 - 使用lock-free的自旋方式 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - byte current; - do - { - current = Volatile.Read(ref StateMask); - if (current != expectedState) { - return false; - } - } while (Interlocked.CompareExchange(ref StateMask, newState, expectedState) != expectedState); - - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Previous operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevOp() - { - return Interlocked.CompareExchange(ref PrevOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevOp() - { - Volatile.Write(ref PrevOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevOpOccupied() => Volatile.Read(ref PrevOpMask) == OpOccupied; - - // Next operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextOp() - { - return Interlocked.CompareExchange(ref NextOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextOp() - { - Volatile.Write(ref NextOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextOpOccupied() => Volatile.Read(ref NextOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - return Interlocked.CompareExchange(ref SelfOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsAllocated() => GetState() == StateAllocated; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsThreadOccupied() => GetState() == StateThreadOccupied; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMerging() => GetState() == StateMerging; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsPrevOpOccupied() || IsNextOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - // 更新后的EntryState常量类 - 与新的字节掩码设计兼容 - private static class EntryState - { - - public const byte Allocated = 1; // Already allocated to user - public const byte Empty = 0; // Free, can be allocated - public const byte Merging = 3; // Currently being merged - public const byte ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/734F068D96EC8BB3B778C6F74192448C b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/734F068D96EC8BB3B778C6F74192448C deleted file mode 100644 index d7a25d75..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/734F068D96EC8BB3B778C6F74192448C +++ /dev/null @@ -1,359 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->Mask = false; - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:获取两个锁 - if (node != null) - { - node->AcquirePrevLock(); - node->AcquireNextLock(); - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->Mask = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->Mask = true; - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:释放两个锁 - if (node != null) - { - node->ReleaseBothLocks(); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:尝试获取两个锁 - return node == null || node->TryAcquireBothLocks(); - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(34)] internal short NextLock; // 后继指针锁(控制NextLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - // [FieldOffset(36)] 保留空间用于扩展 - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Dual Lock Operations - - // 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) == thread) { - Volatile.Write(ref PrevLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeld() => Volatile.Read(ref PrevLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeldByCurrentThread() => Volatile.Read(ref PrevLock) == Environment.CurrentManagedThreadId; - - // 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); // 使用低15位 - return Interlocked.CompareExchange(ref NextLock, thread, (short)0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquireNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); - if (Volatile.Read(ref NextLock) != thread) - { - while (Interlocked.CompareExchange(ref NextLock, thread, (short)0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); - if (Volatile.Read(ref NextLock) == thread) { - Volatile.Write(ref NextLock, (short)0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeld() => Volatile.Read(ref NextLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeldByCurrentThread() => Volatile.Read(ref NextLock) == (short)(Environment.CurrentManagedThreadId & 0x7FFF); - - // 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireBothLocks() - { - if (TryAcquirePrevLock()) - { - if (TryAcquireNextLock()) - { - return true; - } else - { - ReleasePrevLock(); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseBothLocks() - { - ReleasePrevLock(); - ReleaseNextLock(); - } - - #endregion - } - - private bool. - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/77DA1642FF8B0DC1F1DA13D99169CF30 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/77DA1642FF8B0DC1F1DA13D99169CF30 deleted file mode 100644 index 29fad368..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/77DA1642FF8B0DC1F1DA13D99169CF30 +++ /dev/null @@ -1,261 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - if (entry != null && Volatile.Read(ref entry->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref entry->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private void MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = -1; - int segment = DetermineSegmentIndex(size, originLevel); - if (TryAcquireEntrySpinLock(entry)) { - return; - } - - // current Level merge - while (originLevel != entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - AcquireBucketNodeSpinLock((BucketNode*)entry->Position); - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - RemoveFromBucket(originLevel, , (BucketNode*)near->Position); - } - - // forward merging - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - } - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - if (entry != null && Volatile.Read(ref entry->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref entry->SpinLock, 0, thread); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - return entry == null || - (Interlocked.CompareExchange(ref entry->SpinLock, thread, - 0) == 0) || - Volatile.Read(ref entry->SpinLock) == thread; - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(36)] internal int Level; // Level of the block in the allocator - [FieldOffset(24)] internal int SpinLock; // Spin lock for thread safety protection - [FieldOffset(28)] internal int State; // Node state - [FieldOffset(32)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - } - - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/78588336BE7BE6DBF7479309107FD732 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/78588336BE7BE6DBF7479309107FD732 deleted file mode 100644 index 4126cd2c..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/78588336BE7BE6DBF7479309107FD732 +++ /dev/null @@ -1,261 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - if (entry != null && Volatile.Read(ref entry->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref entry->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private void MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = -1; - int segment = DetermineSegmentIndex(size, originLevel); - if (TryAcquireEntrySpinLock(entry)) { - return; - } - - // current Level merge - while (originLevel != entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - AcquireBucketNodeSpinLock((BucketNode*)entry->Position); - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - RemoveFromBucket(originLevel, segment, (BucketNode*)near->Position); - } - - // forward merging - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - } - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - if (entry != null && Volatile.Read(ref entry->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref entry->SpinLock, 0, thread); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - return entry == null || - (Interlocked.CompareExchange(ref entry->SpinLock, thread, - 0) == 0) || - Volatile.Read(ref entry->SpinLock) == thread; - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(36)] internal int Level; // Level of the block in the allocator - [FieldOffset(24)] internal int SpinLock; // Spin lock for thread safety protection - [FieldOffset(28)] internal int State; // Node state - [FieldOffset(32)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - } - - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/8243791130463F1D1F538C0DDF924312 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/8243791130463F1D1F538C0DDF924312 deleted file mode 100644 index 29fad368..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/8243791130463F1D1F538C0DDF924312 +++ /dev/null @@ -1,261 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - if (entry != null && Volatile.Read(ref entry->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref entry->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private void MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = -1; - int segment = DetermineSegmentIndex(size, originLevel); - if (TryAcquireEntrySpinLock(entry)) { - return; - } - - // current Level merge - while (originLevel != entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - AcquireBucketNodeSpinLock((BucketNode*)entry->Position); - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - RemoveFromBucket(originLevel, , (BucketNode*)near->Position); - } - - // forward merging - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - } - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - if (entry != null && Volatile.Read(ref entry->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref entry->SpinLock, 0, thread); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - return entry == null || - (Interlocked.CompareExchange(ref entry->SpinLock, thread, - 0) == 0) || - Volatile.Read(ref entry->SpinLock) == thread; - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(36)] internal int Level; // Level of the block in the allocator - [FieldOffset(24)] internal int SpinLock; // Spin lock for thread safety protection - [FieldOffset(28)] internal int State; // Node state - [FieldOffset(32)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - } - - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/8AC11D873D7DAB54872F6450D2A243DD b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/8AC11D873D7DAB54872F6450D2A243DD deleted file mode 100644 index 7a24d6f4..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/8AC11D873D7DAB54872F6450D2A243DD +++ /dev/null @@ -1,360 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref node->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->Mask = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->Mask = true; - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref node->SpinLock, 0, thread); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - return (node == null) || - (Interlocked.CompareExchange(ref node->SpinLock, thread, - 0) == 0) || - (Volatile.Read(ref node->SpinLock) == thread); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->Mask = false; - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(34)] internal short NextLock; // 后继指针锁(控制NextLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - // [FieldOffset(36)] 保留空间用于扩展 - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Dual Lock Operations - - // 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) == thread) { - Volatile.Write(ref PrevLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeld() => Volatile.Read(ref PrevLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeldByCurrentThread() => Volatile.Read(ref PrevLock) == Environment.CurrentManagedThreadId; - - // 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); // 使用低15位 - return Interlocked.CompareExchange(ref NextLock, thread, (short)0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquireNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); - if (Volatile.Read(ref NextLock) != thread) - { - while (Interlocked.CompareExchange(ref NextLock, thread, (short)0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); - if (Volatile.Read(ref NextLock) == thread) { - Volatile.Write(ref NextLock, (short)0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeld() => Volatile.Read(ref NextLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeldByCurrentThread() => Volatile.Read(ref NextLock) == (short)(Environment.CurrentManagedThreadId & 0x7FFF); - - // 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireBothLocks() - { - if (TryAcquirePrevLock()) - { - if (TryAcquireNextLock()) - { - return true; - } else - { - ReleasePrevLock(); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseBothLocks() - { - ReleasePrevLock(); - ReleaseNextLock(); - } - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/8CE28BCDE68E4BC1C69623C5378AD1DC b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/8CE28BCDE68E4BC1C69623C5378AD1DC deleted file mode 100644 index b58d6e1b..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/8CE28BCDE68E4BC1C69623C5378AD1DC +++ /dev/null @@ -1,363 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - if (entry != null) - { - while (!entry->TryAcquireSelfOp()) { - Thread.Sleep(0); - } - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private void MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = -1; - int segment = DetermineSegmentIndex(size, originLevel); - if (TryAcquireEntrySpinLock(entry)) { - return; - } - - // current Level merge - while (originLevel != entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - AcquireBucketNodeSpinLock((BucketNode*)entry->Position); - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - RemoveFromBucket(originLevel, segment, (BucketNode*)near->Position); - } - - // forward merging - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - } - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - if (entry != null) - { - entry->ReleaseSelfOp(); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - return entry == null || entry->TryAcquireSelfOp(); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(26)] internal byte NextOpMask; // Next pointer operation (Free=0, Occupied=1) - [FieldOffset(25)] internal byte PrevOpMask; // Previous pointer operation (Free=0, Occupied=1) - [FieldOffset(27)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations (replacing SpinLock) - [FieldOffset(24)] internal byte StateMask; // Entry state (Empty=0, Allocated=1, ThreadOccupied=2, Merging=3) - - [FieldOffset(28)] internal int _reserved; // Reserved for future use - - [FieldOffset(36)] internal int Level; // Level of the block in the allocator - [FieldOffset(32)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - #region Four Independent Byte Masks for Entry - - // State constants - public const byte StateEmpty = 0; - public const byte StateAllocated = 1; - public const byte StateThreadOccupied = 2; - public const byte StateMerging = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // 字节级原子操作 - 使用lock-free的自旋方式 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - byte current; - do - { - current = Volatile.Read(ref StateMask); - if (current != expectedState) { - return false; - } - } while (Interlocked.CompareExchange(ref StateMask, newState, expectedState) != expectedState); - - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Previous operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevOp() - { - return Interlocked.CompareExchange(ref PrevOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevOp() - { - Volatile.Write(ref PrevOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevOpOccupied() => Volatile.Read(ref PrevOpMask) == OpOccupied; - - // Next operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextOp() - { - return Interlocked.CompareExchange(ref NextOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextOp() - { - Volatile.Write(ref NextOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextOpOccupied() => Volatile.Read(ref NextOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - return Interlocked.CompareExchange(ref SelfOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsAllocated() => GetState() == StateAllocated; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsThreadOccupied() => GetState() == StateThreadOccupied; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMerging() => GetState() == StateMerging; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsPrevOpOccupied() || IsNextOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - // 更新后的EntryState常量类 - 与新的字节掩码设计兼容 - private static class EntryState - { - - public const byte Allocated = 1; // Already allocated to user - public const byte Empty = 0; // Free, can be allocated - public const byte Merging = 3; // Currently being merged - public const byte ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/9164715D941E665B38B143E05B720998 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/9164715D941E665B38B143E05B720998 deleted file mode 100644 index 1cedd00d..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/9164715D941E665B38B143E05B720998 +++ /dev/null @@ -1,548 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:获取两个锁 - if (node != null) - { - node->AcquirePrevLock(); - node->AcquireNextLock(); - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - node->AcquireNextLock(); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !headNode->TryAcquirePrevLock()) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - headNode->ReleasePrevLock(); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - node->ReleaseNextLock(); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:释放两个锁 - if (node != null) - { - node->ReleaseBothLocks(); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(只读操作,暂时不加锁) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - - // 按照地址顺序获取锁,避免死锁 - BucketNode* firstLock = null, secondLock = null, thirdLock = null; - bool needPrevNextLock = false, needNodeBothLocks = false, needNextPrevLock = false; - - if (previous != null && next != null) - { - // 中间节点:需要修改前驱的next和后继的prev - if ((ulong)previous < (ulong)node && (ulong)node < (ulong)next) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - thirdLock = next; - needNextPrevLock = true; - } else if ((ulong)previous < (ulong)next && (ulong)next < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = next; - needNextPrevLock = true; - thirdLock = node; - needNodeBothLocks = true; - } else // other cases - { - firstLock = next; - needNextPrevLock = true; - secondLock = previous; - needPrevNextLock = true; - thirdLock = node; - needNodeBothLocks = true; - } - } else if (previous != null) - { - // 尾节点:只需要修改前驱的next - if ((ulong)previous < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - } else - { - firstLock = node; - needNodeBothLocks = true; - secondLock = previous; - needPrevNextLock = true; - } - } else - { - // 应该不会到这里,因为头节点已经在上面处理了 - Thread.Sleep(0); - continue; - } - - - // 按顺序获取锁 - bool acquired = false; - try - { - if (firstLock != null) - { - if (firstLock == previous && needPrevNextLock) - { - if (!firstLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == next && needNextPrevLock) - { - if (!firstLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == node && needNodeBothLocks) - { - if (!firstLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (secondLock != null) - { - if (secondLock == previous && needPrevNextLock) - { - if (!secondLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == next && needNextPrevLock) - { - if (!secondLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == node && needNodeBothLocks) - { - if (!secondLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (thirdLock != null) - { - if (thirdLock == previous && needPrevNextLock) - { - if (!thirdLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == next && needNextPrevLock) - { - if (!thirdLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == node && needNodeBothLocks) - { - if (!thirdLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - acquired = true; - - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - if (acquired) - { - // 释放锁 - if (thirdLock == previous && needPrevNextLock) - { - thirdLock->ReleaseNextLock(); - } else if (thirdLock == next && needNextPrevLock) - { - thirdLock->ReleasePrevLock(); - } else if (thirdLock == node && needNodeBothLocks) { - thirdLock->ReleaseBothLocks(); - } - - if (secondLock == previous && needPrevNextLock) - { - secondLock->ReleaseNextLock(); - } else if (secondLock == next && needNextPrevLock) - { - secondLock->ReleasePrevLock(); - } else if (secondLock == node && needNodeBothLocks) { - secondLock->ReleaseBothLocks(); - } - - if (firstLock == previous && needPrevNextLock) - { - firstLock->ReleaseNextLock(); - } else if (firstLock == next && needNextPrevLock) - { - firstLock->ReleasePrevLock(); - } else if (firstLock == node && needNodeBothLocks) { - firstLock->ReleaseBothLocks(); - } - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:尝试获取两个锁 - return node == null || node->TryAcquireBothLocks(); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!head->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !next->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - next->ReleasePrevLock(); - } - } - } - finally - { - head->ReleaseNextLock(); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] // 增加到40字节以容纳两个int锁 - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Dual Lock Operations - - // 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) == thread) { - Volatile.Write(ref PrevLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeld() => Volatile.Read(ref PrevLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeldByCurrentThread() => Volatile.Read(ref PrevLock) == Environment.CurrentManagedThreadId; - - // 后继锁操作(控制NextLevel字段)- 改为int类型 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquireNextLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref NextLock) != thread) - { - while (Interlocked.CompareExchange(ref NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref NextLock) == thread) { - Volatile.Write(ref NextLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeld() => Volatile.Read(ref NextLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeldByCurrentThread() => Volatile.Read(ref NextLock) == Environment.CurrentManagedThreadId; - - // 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireBothLocks() - { - if (TryAcquirePrevLock()) - { - if (TryAcquireNextLock()) - { - return true; - } else - { - ReleasePrevLock(); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseBothLocks() - { - ReleasePrevLock(); - ReleaseNextLock(); - } - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/9FBBE69DF50926D0628D5C84A10EBE7C b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/9FBBE69DF50926D0628D5C84A10EBE7C deleted file mode 100644 index ceadf80c..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/9FBBE69DF50926D0628D5C84A10EBE7C +++ /dev/null @@ -1,383 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:获取两个锁 - if (node != null) - { - node->AcquirePrevLock(); - node->AcquireNextLock(); - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - node->AcquireNextLock(); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !headNode->TryAcquirePrevLock()) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - headNode->ReleasePrevLock(); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - node->ReleaseNextLock(); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:释放两个锁 - if (node != null) - { - node->ReleaseBothLocks(); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:尝试获取两个锁 - return node == null || node->TryAcquireBothLocks(); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!head->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !next->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - next->ReleasePrevLock(); - } - } - } - finally - { - head->ReleaseNextLock(); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(34)] internal short NextLock; // 后继指针锁(控制NextLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - // [FieldOffset(36)] 保留空间用于扩展 - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Dual Lock Operations - - // 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) == thread) { - Volatile.Write(ref PrevLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeld() => Volatile.Read(ref PrevLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeldByCurrentThread() => Volatile.Read(ref PrevLock) == Environment.CurrentManagedThreadId; - - // 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); // 使用低15位 - return Interlocked.CompareExchange(ref NextLock, thread, (short)0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquireNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); - if (Volatile.Read(ref NextLock) != thread) - { - while (Interlocked.CompareExchange(ref NextLock, thread, (short)0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); - if (Volatile.Read(ref NextLock) == thread) { - Volatile.Write(ref NextLock, (short)0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeld() => Volatile.Read(ref NextLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeldByCurrentThread() => Volatile.Read(ref NextLock) == (short)(Environment.CurrentManagedThreadId & 0x7FFF); - - // 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireBothLocks() - { - if (TryAcquirePrevLock()) - { - if (TryAcquireNextLock()) - { - return true; - } else - { - ReleasePrevLock(); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseBothLocks() - { - ReleasePrevLock(); - ReleaseNextLock(); - } - - #endregion - } - - private bool. - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/A28BFD0747A77720A00D133F158B3336 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/A28BFD0747A77720A00D133F158B3336 deleted file mode 100644 index 2be282ec..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/A28BFD0747A77720A00D133F158B3336 +++ /dev/null @@ -1,259 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - if (entry != null) - { - while (!entry->TryAcquireSelfOp()) { - Thread.Sleep(0); - } - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private void MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = -1; - int segment = DetermineSegmentIndex(size, originLevel); - if (TryAcquireEntrySpinLock(entry)) { - return; - } - - // current Level merge - while (originLevel != entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - AcquireBucketNodeSpinLock((BucketNode*)entry->Position); - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - RemoveFromBucket(originLevel, segment, (BucketNode*)near->Position); - } - - // forward merging - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - } - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - if (entry != null) - { - entry->ReleaseSelfOp(); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - return entry == null || entry->TryAcquireSelfOp(); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(36)] internal int Level; // Level of the block in the allocator - [FieldOffset(24)] internal int SpinLock; // Spin lock for thread safety protection - [FieldOffset(28)] internal int State; // Node state - [FieldOffset(32)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - } - - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/ADDC452F9B7A57726264F7C50B0EAA6C b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/ADDC452F9B7A57726264F7C50B0EAA6C deleted file mode 100644 index 470e07fd..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/ADDC452F9B7A57726264F7C50B0EAA6C +++ /dev/null @@ -1,364 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - if (entry != null) - { - while (!entry->TryAcquireSelfOp()) { - Thread.Sleep(0); - } - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private void MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = -1; - int segment = DetermineSegmentIndex(size, originLevel); - if (TryAcquireEntrySpinLock(entry)) { - return; - } - - // current Level merge - while (originLevel != entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - AcquireBucketNodeSpinLock((BucketNode*)entry->Position); - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - RemoveFromBucket(originLevel, segment, (BucketNode*)near->Position); - } - - // forward merging - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - } - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - if (entry != null) - { - entry->ReleaseSelfOp(); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - return entry == null || entry->TryAcquireSelfOp(); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(26)] internal byte NextOpMask; // Next pointer operation (Free=0, Occupied=1) - [FieldOffset(25)] internal byte PrevOpMask; // Previous pointer operation (Free=0, Occupied=1) - [FieldOffset(27)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations (replacing SpinLock) - [FieldOffset(24)] internal byte StateMask; // Entry state (Empty=0, Allocated=1, ThreadOccupied=2, Merging=3) - - [FieldOffset(28)] internal int _reserved; // Reserved for future use - - [FieldOffset(36)] internal int Level; // Level of the block in the allocator - [FieldOffset(32)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - #region Four Independent Byte Masks for Entry - - // State constants - public const byte StateEmpty = 0; - public const byte StateAllocated = 1; - public const byte StateThreadOccupied = 2; - public const byte StateMerging = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // 字节级原子操作 - 使用lock-free的自旋方式 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - byte current; - do - { - current = Volatile.Read(ref StateMask); - if (current != expectedState) { - return false; - } - } while (Interlocked.CompareExchange(ref StateMask, newState, expectedState) != expectedState); - - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Previous operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevOp() - { - return Interlocked.CompareExchange(ref PrevOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevOp() - { - Volatile.Write(ref PrevOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevOpOccupied() => Volatile.Read(ref PrevOpMask) == OpOccupied; - - // Next operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextOp() - { - return Interlocked.CompareExchange(ref NextOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextOp() - { - Volatile.Write(ref NextOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextOpOccupied() => Volatile.Read(ref NextOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - return Interlocked.CompareExchange(ref SelfOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsAllocated() => GetState() == StateAllocated; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsThreadOccupied() => GetState() == StateThreadOccupied; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMerging() => GetState() == StateMerging; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsPrevOpOccupied() || IsNextOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - // 更新后的EntryState常量类 - 与新的字节掩码设计兼容 - private static class EntryState - { - - public const byte Allocated = 1; // Already allocated to user - public const byte Empty = 0; // Free, can be allocated - public const byte Merging = 3; // Currently being merged - public const byte ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/B5126D29D08B2553CC28B846B92EB369 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/B5126D29D08B2553CC28B846B92EB369 deleted file mode 100644 index b5ba0212..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/B5126D29D08B2553CC28B846B92EB369 +++ /dev/null @@ -1,91 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Free.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Buffers; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - /// - /// Free allocated memory block and perform adjacent block merging - /// - /// - /// Handle to the allocated memory block - /// - public void Free(hlsfHandle handle) - { - Entry* e = handle.EntryHandle; - if (e == null) { - return; - } - AcquireEntrySpinLock(e); - try - { - if (e->State != EntryState.Allocated) { - return; - } - e->State = EntryState.ThreadOccupied; - - // Step 4: Try merge with adjacent free blocks and remove them from buckets - Entry* mergedEntry = TryMergeAndRemoveFromBuckets(e); - - - // Step 5: Calculate final level and segment for the merged block - uint finalSize = mergedEntry->Size; - int finalLevel = GetLevelFromSize(finalSize); - int finalSegment = DetermineSegmentIndex(finalSize, finalLevel); - - // Step 6: Set the merged entry state to Empty (ready to be reused) - mergedEntry->State = EntryState.Empty; - - // Step 7: Push the merged entry back to appropriate bucket - PushLevel(finalLevel, finalSegment, (BucketNode*)mergedEntry->Position); - - // Note: If mergedEntry is different from original e, the original e - // and any merged entries have already been freed to _nodes by TryMergeAndRemoveFromBuckets - } - finally - { - // Step 8: Always release the spin lock - ReleaseEntrySpinLock(e); - } - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/C626874A5F7D7E7467DB86AD8F0D3072 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/C626874A5F7D7E7467DB86AD8F0D3072 deleted file mode 100644 index 7a24d6f4..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/C626874A5F7D7E7467DB86AD8F0D3072 +++ /dev/null @@ -1,360 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref node->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->Mask = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->Mask = true; - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref node->SpinLock, 0, thread); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - return (node == null) || - (Interlocked.CompareExchange(ref node->SpinLock, thread, - 0) == 0) || - (Volatile.Read(ref node->SpinLock) == thread); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->Mask = false; - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(34)] internal short NextLock; // 后继指针锁(控制NextLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - // [FieldOffset(36)] 保留空间用于扩展 - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Dual Lock Operations - - // 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) == thread) { - Volatile.Write(ref PrevLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeld() => Volatile.Read(ref PrevLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeldByCurrentThread() => Volatile.Read(ref PrevLock) == Environment.CurrentManagedThreadId; - - // 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); // 使用低15位 - return Interlocked.CompareExchange(ref NextLock, thread, (short)0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquireNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); - if (Volatile.Read(ref NextLock) != thread) - { - while (Interlocked.CompareExchange(ref NextLock, thread, (short)0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); - if (Volatile.Read(ref NextLock) == thread) { - Volatile.Write(ref NextLock, (short)0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeld() => Volatile.Read(ref NextLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeldByCurrentThread() => Volatile.Read(ref NextLock) == (short)(Environment.CurrentManagedThreadId & 0x7FFF); - - // 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireBothLocks() - { - if (TryAcquirePrevLock()) - { - if (TryAcquireNextLock()) - { - return true; - } else - { - ReleasePrevLock(); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseBothLocks() - { - ReleasePrevLock(); - ReleaseNextLock(); - } - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/CFAE2B819693026E9CD955B894F066FF b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/CFAE2B819693026E9CD955B894F066FF deleted file mode 100644 index d7a25d75..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/CFAE2B819693026E9CD955B894F066FF +++ /dev/null @@ -1,359 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->Mask = false; - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:获取两个锁 - if (node != null) - { - node->AcquirePrevLock(); - node->AcquireNextLock(); - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->Mask = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->Mask = true; - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:释放两个锁 - if (node != null) - { - node->ReleaseBothLocks(); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:尝试获取两个锁 - return node == null || node->TryAcquireBothLocks(); - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(34)] internal short NextLock; // 后继指针锁(控制NextLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - // [FieldOffset(36)] 保留空间用于扩展 - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Dual Lock Operations - - // 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) == thread) { - Volatile.Write(ref PrevLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeld() => Volatile.Read(ref PrevLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeldByCurrentThread() => Volatile.Read(ref PrevLock) == Environment.CurrentManagedThreadId; - - // 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); // 使用低15位 - return Interlocked.CompareExchange(ref NextLock, thread, (short)0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquireNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); - if (Volatile.Read(ref NextLock) != thread) - { - while (Interlocked.CompareExchange(ref NextLock, thread, (short)0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); - if (Volatile.Read(ref NextLock) == thread) { - Volatile.Write(ref NextLock, (short)0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeld() => Volatile.Read(ref NextLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeldByCurrentThread() => Volatile.Read(ref NextLock) == (short)(Environment.CurrentManagedThreadId & 0x7FFF); - - // 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireBothLocks() - { - if (TryAcquirePrevLock()) - { - if (TryAcquireNextLock()) - { - return true; - } else - { - ReleasePrevLock(); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseBothLocks() - { - ReleasePrevLock(); - ReleaseNextLock(); - } - - #endregion - } - - private bool. - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/D27E946D493464EA2D3CE814F1D3D351 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/D27E946D493464EA2D3CE814F1D3D351 deleted file mode 100644 index 4126cd2c..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/D27E946D493464EA2D3CE814F1D3D351 +++ /dev/null @@ -1,261 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - if (entry != null && Volatile.Read(ref entry->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref entry->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private void MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = -1; - int segment = DetermineSegmentIndex(size, originLevel); - if (TryAcquireEntrySpinLock(entry)) { - return; - } - - // current Level merge - while (originLevel != entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - AcquireBucketNodeSpinLock((BucketNode*)entry->Position); - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - RemoveFromBucket(originLevel, segment, (BucketNode*)near->Position); - } - - // forward merging - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - } - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - if (entry != null && Volatile.Read(ref entry->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref entry->SpinLock, 0, thread); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - return entry == null || - (Interlocked.CompareExchange(ref entry->SpinLock, thread, - 0) == 0) || - Volatile.Read(ref entry->SpinLock) == thread; - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(36)] internal int Level; // Level of the block in the allocator - [FieldOffset(24)] internal int SpinLock; // Spin lock for thread safety protection - [FieldOffset(28)] internal int State; // Node state - [FieldOffset(32)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - } - - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/DD33CFD2FDC59A9C6D38F3D26986324C b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/DD33CFD2FDC59A9C6D38F3D26986324C deleted file mode 100644 index e6119d69..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/DD33CFD2FDC59A9C6D38F3D26986324C +++ /dev/null @@ -1,119 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Buffers; -using System.Runtime.InteropServices; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator : IDisposable - { - - private static readonly nuint EmptyHandle = (nuint)(void*)null; - - // Bucket system field - directly in main allocator class - private ulong[] _bucketHeads; - - private Entry* _spareMemory; - private readonly byte* m_Buffer; - private bool disposedValue; - private readonly int _align; - private readonly nuint _size; - private readonly SlabAllocator _nodes; - - public HybridLayerSegregatedFitAllocator(nuint byteSize) - { - if (byteSize < 64) { - throw new InvalidOperationException(); - } - _nodes = SlabAllocator.Create(64, BufferLayout.Chunked); - _size = byteSize; - m_Buffer = (byte*)NativeMemory.AlignedAlloc(byteSize, 16); - _align = 16; - - - // 初始化桶系统 - InitializeBucketSystem(); - - - // 初始化spareMemory - _spareMemory = (Entry*)_nodes.Allocate(); - _spareMemory->State = EntryState.ThreadOccupied; - _spareMemory->NextNear = EmptyHandle; - _spareMemory->Position = (nuint)m_Buffer; - } - - public HybridLayerSegregatedFitAllocator(nuint byteSize, int align) - { - if (align < 16 || (align & (align - 1)) != 0) { - throw new ArgumentException( - "Alignment must be a power of two and at least 8 bytes."); - } - _nodes = SlabAllocator.Create(64, BufferLayout.Chunked); - m_Buffer = (byte*)NativeMemory.AlignedAlloc(byteSize, (nuint)align); - _align = align; - _size = byteSize; - - InitializeBucketSystem(); - - - // 初始化spareMemory - _spareMemory = (Entry*)_nodes.Allocate(); - _spareMemory->State = EntryState.ThreadOccupied; - _spareMemory->NextNear = EmptyHandle; - _spareMemory->Position = (nuint)m_Buffer; - } - - public void Dispose() - { - Dispose(disposing:true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - if (!disposedValue) - { - if (disposing) { - _nodes.Dispose(); - } - NativeMemory.AlignedFree(m_Buffer); - disposedValue = true; - } - } - - ~HybridLayerSegregatedFitAllocator() - { - Dispose(disposing:false); - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/EE59310E980FE9031AF9D5F6935A4A06 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/EE59310E980FE9031AF9D5F6935A4A06 deleted file mode 100644 index d05318c7..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/EE59310E980FE9031AF9D5F6935A4A06 +++ /dev/null @@ -1,551 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:获取两个锁 - if (node != null) - { - node->AcquirePrevLock(); - node->AcquireNextLock(); - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - node->AcquireNextLock(); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !headNode->TryAcquirePrevLock()) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - headNode->ReleasePrevLock(); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - node->ReleaseNextLock(); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:释放两个锁 - if (node != null) - { - node->ReleaseBothLocks(); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(只读操作,暂时不加锁) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - - // 按照地址顺序获取锁,避免死锁 - BucketNode* firstLock = null, secondLock = null, thirdLock = null; - bool needPrevNextLock = false, needNodeBothLocks = false, needNextPrevLock = false; - - if (previous != null && next != null) - { - // 中间节点:需要修改前驱的next和后继的prev - if ((ulong)previous < (ulong)node && (ulong)node < (ulong)next) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - thirdLock = next; - needNextPrevLock = true; - } else if ((ulong)previous < (ulong)next && (ulong)next < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = next; - needNextPrevLock = true; - thirdLock = node; - needNodeBothLocks = true; - } else // other cases - { - firstLock = next; - needNextPrevLock = true; - secondLock = previous; - needPrevNextLock = true; - thirdLock = node; - needNodeBothLocks = true; - } - } else if (previous != null) - { - // 尾节点:只需要修改前驱的next - if ((ulong)previous < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - } else - { - firstLock = node; - needNodeBothLocks = true; - secondLock = previous; - needPrevNextLock = true; - } - } else - { - // 应该不会到这里,因为头节点已经在上面处理了 - Thread.Sleep(0); - continue; - } - - - // 按顺序获取锁 - bool acquired = false; - try - { - if (firstLock != null) - { - if (firstLock == previous && needPrevNextLock) - { - if (!firstLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == next && needNextPrevLock) - { - if (!firstLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == node && needNodeBothLocks) - { - if (!firstLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (secondLock != null) - { - if (secondLock == previous && needPrevNextLock) - { - if (!secondLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == next && needNextPrevLock) - { - if (!secondLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == node && needNodeBothLocks) - { - if (!secondLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (thirdLock != null) - { - if (thirdLock == previous && needPrevNextLock) - { - if (!thirdLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == next && needNextPrevLock) - { - if (!thirdLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == node && needNodeBothLocks) - { - if (!thirdLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - acquired = true; - - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - if (acquired) - { - // 释放锁 - if (thirdLock == previous && needPrevNextLock) - { - thirdLock->ReleaseNextLock(); - } else if (thirdLock == next && needNextPrevLock) - { - thirdLock->ReleasePrevLock(); - } else if (thirdLock == node && needNodeBothLocks) { - thirdLock->ReleaseBothLocks(); - } - - if (secondLock == previous && needPrevNextLock) - { - secondLock->ReleaseNextLock(); - } else if (secondLock == next && needNextPrevLock) - { - secondLock->ReleasePrevLock(); - } else if (secondLock == node && needNodeBothLocks) { - secondLock->ReleaseBothLocks(); - } - - if (firstLock == previous && needPrevNextLock) - { - firstLock->ReleaseNextLock(); - } else if (firstLock == next && needNextPrevLock) - { - firstLock->ReleasePrevLock(); - } else if (firstLock == node && needNodeBothLocks) { - firstLock->ReleaseBothLocks(); - } - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:尝试获取两个锁 - return node == null || node->TryAcquireBothLocks(); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!head->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !next->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - next->ReleasePrevLock(); - } - } - } - finally - { - head->ReleaseNextLock(); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(34)] internal short NextLock; // 后继指针锁(控制NextLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - // [FieldOffset(36)] 保留空间用于扩展 - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Dual Lock Operations - - // 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) == thread) { - Volatile.Write(ref PrevLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeld() => Volatile.Read(ref PrevLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeldByCurrentThread() => Volatile.Read(ref PrevLock) == Environment.CurrentManagedThreadId; - - // 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); // 使用低15位 - return Interlocked.CompareExchange(ref NextLock, thread, (short)0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquireNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); - if (Volatile.Read(ref NextLock) != thread) - { - while (Interlocked.CompareExchange(ref NextLock, thread, (short)0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextLock() - { - short thread = (short)(Environment.CurrentManagedThreadId & 0x7FFF); - if (Volatile.Read(ref NextLock) == thread) { - Volatile.Write(ref NextLock, (short)0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeld() => Volatile.Read(ref NextLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeldByCurrentThread() => Volatile.Read(ref NextLock) == (short)(Environment.CurrentManagedThreadId & 0x7FFF); - - // 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireBothLocks() - { - if (TryAcquirePrevLock()) - { - if (TryAcquireNextLock()) - { - return true; - } else - { - ReleasePrevLock(); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseBothLocks() - { - ReleasePrevLock(); - ReleaseNextLock(); - } - - #endregion - } - - private bool. - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/F1481D5666E0266F32099AD751F704AB b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/F1481D5666E0266F32099AD751F704AB deleted file mode 100644 index 0015da29..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/F1481D5666E0266F32099AD751F704AB +++ /dev/null @@ -1,276 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref node->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->Mask = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->Mask = true; - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref node->SpinLock, 0, thread); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - return (node == null) || - (Interlocked.CompareExchange(ref node->SpinLock, thread, - 0) == 0) || - (Volatile.Read(ref node->SpinLock) == thread); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->Mask = false; - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(32)] internal int SpinLock; // Spin lock for bucket head operation - [FieldOffset(24)] internal uint Magic; // Magic number verification - [FieldOffset(28)] internal uint Mask; // Whether in bucket - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region node mask - - public const uint AllOperating = 0b_11100000_00000000_00000000_00000111; - public const uint Empty = 0b_10000000_00000000_00000000_00000000; - public const uint InBucket = 0b_10000000_00000000_00000000_00000000; - public const uint LeftOperating = 0b_01000000_00000000_00000000_00000100; - public const uint ReadyForRemove = 0b_01000000_00000000_00000000_00000000; - public const uint RightOperating = 0b_00100000_00000000_00000000_00000001; - public const uint SelfOperating = 0b_00000000_00000000_00000000_00000010; - - private bool BucketNodeIsInBucket - { -[MethodImpl(MethodImplOptions.AggressiveInlining)] - get => (Mask & InBucket) != 0; -[MethodImpl(MethodImplOptions.AggressiveInlining)] - set => Mask |= value ? InBucket : 0; - } - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/F70ED0E8A53AB3235DF266D0C8A04834 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/F70ED0E8A53AB3235DF266D0C8A04834 deleted file mode 100644 index 470e07fd..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/4D9BA39CF2B5784991D89E8E595FD6C4/F70ED0E8A53AB3235DF266D0C8A04834 +++ /dev/null @@ -1,364 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - if (entry != null) - { - while (!entry->TryAcquireSelfOp()) { - Thread.Sleep(0); - } - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private void MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = -1; - int segment = DetermineSegmentIndex(size, originLevel); - if (TryAcquireEntrySpinLock(entry)) { - return; - } - - // current Level merge - while (originLevel != entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - AcquireBucketNodeSpinLock((BucketNode*)entry->Position); - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - RemoveFromBucket(originLevel, segment, (BucketNode*)near->Position); - } - - // forward merging - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - } - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - if (entry != null) - { - entry->ReleaseSelfOp(); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - return entry == null || entry->TryAcquireSelfOp(); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(26)] internal byte NextOpMask; // Next pointer operation (Free=0, Occupied=1) - [FieldOffset(25)] internal byte PrevOpMask; // Previous pointer operation (Free=0, Occupied=1) - [FieldOffset(27)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations (replacing SpinLock) - [FieldOffset(24)] internal byte StateMask; // Entry state (Empty=0, Allocated=1, ThreadOccupied=2, Merging=3) - - [FieldOffset(28)] internal int _reserved; // Reserved for future use - - [FieldOffset(36)] internal int Level; // Level of the block in the allocator - [FieldOffset(32)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - #region Four Independent Byte Masks for Entry - - // State constants - public const byte StateEmpty = 0; - public const byte StateAllocated = 1; - public const byte StateThreadOccupied = 2; - public const byte StateMerging = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // 字节级原子操作 - 使用lock-free的自旋方式 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - byte current; - do - { - current = Volatile.Read(ref StateMask); - if (current != expectedState) { - return false; - } - } while (Interlocked.CompareExchange(ref StateMask, newState, expectedState) != expectedState); - - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Previous operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevOp() - { - return Interlocked.CompareExchange(ref PrevOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevOp() - { - Volatile.Write(ref PrevOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevOpOccupied() => Volatile.Read(ref PrevOpMask) == OpOccupied; - - // Next operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextOp() - { - return Interlocked.CompareExchange(ref NextOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextOp() - { - Volatile.Write(ref NextOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextOpOccupied() => Volatile.Read(ref NextOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - return Interlocked.CompareExchange(ref SelfOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsAllocated() => GetState() == StateAllocated; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsThreadOccupied() => GetState() == StateThreadOccupied; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMerging() => GetState() == StateMerging; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsPrevOpOccupied() || IsNextOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - // 更新后的EntryState常量类 - 与新的字节掩码设计兼容 - private static class EntryState - { - - public const byte Allocated = 1; // Already allocated to user - public const byte Empty = 0; // Free, can be allocated - public const byte Merging = 3; // Currently being merged - public const byte ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/0F2D3AA84F8ACF53E15BA64C7C39D9C1 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/0F2D3AA84F8ACF53E15BA64C7C39D9C1 deleted file mode 100644 index 31e5a32a..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/0F2D3AA84F8ACF53E15BA64C7C39D9C1 +++ /dev/null @@ -1,347 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref node->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->TrySetState(BucketNode.StateEmpty, BucketNode.StateInBucket); - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->TrySetState(BucketNode.StateEmpty, BucketNode.StateInBucket); - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref node->SpinLock, 0, thread); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - return (node == null) || - (Interlocked.CompareExchange(ref node->SpinLock, thread, - 0) == 0) || - (Volatile.Read(ref node->SpinLock) == thread); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->Mask = false; - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(29)] internal byte LeftOpMask; // Left pointer operation (Free=0, Occupied=1) - [FieldOffset(30)] internal byte RightOpMask; // Right pointer operation (Free=0, Occupied=1) - [FieldOffset(31)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations - [FieldOffset(28)] internal byte StateMask; // Usage state (Empty=0, InBucket=1, MarkedForRemoval=2) - [FieldOffset(32)] internal int SpinLock; // Spin lock for bucket head operation - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Four Independent Byte Masks - - // State constants - public const byte StateEmpty = 0; - public const byte StateInBucket = 1; - public const byte StateMarkedForRemoval = 2; - public const byte StateReserved = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // Atomic state operations - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - return Interlocked.CompareExchange(ref StateMask, newState, expectedState) == expectedState; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Left operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireLeftOp() - { - return Interlocked.CompareExchange(ref LeftOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseLeftOp() - { - Volatile.Write(ref LeftOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsLeftOpOccupied() => Volatile.Read(ref LeftOpMask) == OpOccupied; - - // Right operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireRightOp() - { - return Interlocked.CompareExchange(ref RightOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseRightOp() - { - Volatile.Write(ref RightOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsRightOpOccupied() => Volatile.Read(ref RightOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - return Interlocked.CompareExchange(ref SelfOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsInBucket() => GetState() == StateInBucket; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMarkedForRemoval() => GetState() == StateMarkedForRemoval; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsLeftOpOccupied() || IsRightOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/100532BEB356C3181B6D2589EC07916D b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/100532BEB356C3181B6D2589EC07916D deleted file mode 100644 index cbd61747..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/100532BEB356C3181B6D2589EC07916D +++ /dev/null @@ -1,347 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref node->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->TrySetState(BucketNode.StateEmpty, BucketNode.StateInBucket); - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->TrySetState(BucketNode.StateEmpty, BucketNode.StateInBucket); - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref node->SpinLock, 0, thread); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - return (node == null) || - (Interlocked.CompareExchange(ref node->SpinLock, thread, - 0) == 0) || - (Volatile.Read(ref node->SpinLock) == thread); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->TrySetState(BucketNode.StateInBucket, BucketNode.StateEmpty); - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(29)] internal byte LeftOpMask; // Left pointer operation (Free=0, Occupied=1) - [FieldOffset(30)] internal byte RightOpMask; // Right pointer operation (Free=0, Occupied=1) - [FieldOffset(31)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations - [FieldOffset(28)] internal byte StateMask; // Usage state (Empty=0, InBucket=1, MarkedForRemoval=2) - [FieldOffset(32)] internal int SpinLock; // Spin lock for bucket head operation - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Four Independent Byte Masks - - // State constants - public const byte StateEmpty = 0; - public const byte StateInBucket = 1; - public const byte StateMarkedForRemoval = 2; - public const byte StateReserved = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // Atomic state operations - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - return Interlocked.CompareExchange(ref StateMask, newState, expectedState) == expectedState; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Left operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireLeftOp() - { - return Interlocked.CompareExchange(ref LeftOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseLeftOp() - { - Volatile.Write(ref LeftOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsLeftOpOccupied() => Volatile.Read(ref LeftOpMask) == OpOccupied; - - // Right operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireRightOp() - { - return Interlocked.CompareExchange(ref RightOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseRightOp() - { - Volatile.Write(ref RightOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsRightOpOccupied() => Volatile.Read(ref RightOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - return Interlocked.CompareExchange(ref SelfOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsInBucket() => GetState() == StateInBucket; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMarkedForRemoval() => GetState() == StateMarkedForRemoval; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsLeftOpOccupied() || IsRightOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/10875C971CCA70DEB0DA6E7E44E6583D b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/10875C971CCA70DEB0DA6E7E44E6583D deleted file mode 100644 index c5956a59..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/10875C971CCA70DEB0DA6E7E44E6583D +++ /dev/null @@ -1,347 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref node->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->TrySetState(BucketNode.StateEmpty, BucketNode.StateInBucket); - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->TrySetState(BucketNode.StateEmpty, BucketNode.StateInBucket); - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref node->SpinLock, 0, thread); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - return (node == null) || - (Interlocked.CompareExchange(ref node->SpinLock, thread, - 0) == 0) || - (Volatile.Read(ref node->SpinLock) == thread); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->TrySetState(BucketNode.StateInBucket, BucketNode.StateEmpty); - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(29)] internal byte LeftOpMask; // Left pointer operation (Free=0, Occupied=1) - [FieldOffset(30)] internal byte RightOpMask; // Right pointer operation (Free=0, Occupied=1) - [FieldOffset(31)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations - [FieldOffset(28)] internal byte StateMask; // Usage state (Empty=0, InBucket=1, MarkedForRemoval=2) - [FieldOffset(32)] internal int SpinLock; // Spin lock for bucket head operation - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Four Independent Byte Masks - - // State constants - public const byte StateEmpty = 0; - public const byte StateInBucket = 1; - public const byte StateMarkedForRemoval = 2; - public const byte StateReserved = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // Atomic state operations - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - return Interlocked.CompareExchange(ref Unsafe.As(ref StateMask), newState, expectedState) == expectedState; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Left operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireLeftOp() - { - return Interlocked.CompareExchange(ref Unsafe.As(ref LeftOpMask), OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseLeftOp() - { - Volatile.Write(ref LeftOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsLeftOpOccupied() => Volatile.Read(ref LeftOpMask) == OpOccupied; - - // Right operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireRightOp() - { - return Interlocked.CompareExchange(ref Unsafe.As(ref RightOpMask), OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseRightOp() - { - Volatile.Write(ref RightOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsRightOpOccupied() => Volatile.Read(ref RightOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - return Interlocked.CompareExchange(ref Unsafe.As(ref SelfOpMask), OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsInBucket() => GetState() == StateInBucket; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMarkedForRemoval() => GetState() == StateMarkedForRemoval; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsLeftOpOccupied() || IsRightOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/15A4CFEDBFA69D9E688723D8AA3E1D70 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/15A4CFEDBFA69D9E688723D8AA3E1D70 deleted file mode 100644 index 0015da29..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/15A4CFEDBFA69D9E688723D8AA3E1D70 +++ /dev/null @@ -1,276 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref node->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->Mask = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->Mask = true; - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref node->SpinLock, 0, thread); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - return (node == null) || - (Interlocked.CompareExchange(ref node->SpinLock, thread, - 0) == 0) || - (Volatile.Read(ref node->SpinLock) == thread); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->Mask = false; - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(32)] internal int SpinLock; // Spin lock for bucket head operation - [FieldOffset(24)] internal uint Magic; // Magic number verification - [FieldOffset(28)] internal uint Mask; // Whether in bucket - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region node mask - - public const uint AllOperating = 0b_11100000_00000000_00000000_00000111; - public const uint Empty = 0b_10000000_00000000_00000000_00000000; - public const uint InBucket = 0b_10000000_00000000_00000000_00000000; - public const uint LeftOperating = 0b_01000000_00000000_00000000_00000100; - public const uint ReadyForRemove = 0b_01000000_00000000_00000000_00000000; - public const uint RightOperating = 0b_00100000_00000000_00000000_00000001; - public const uint SelfOperating = 0b_00000000_00000000_00000000_00000010; - - private bool BucketNodeIsInBucket - { -[MethodImpl(MethodImplOptions.AggressiveInlining)] - get => (Mask & InBucket) != 0; -[MethodImpl(MethodImplOptions.AggressiveInlining)] - set => Mask |= value ? InBucket : 0; - } - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/15ECA87E3A6524336A306184CCF4359E b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/15ECA87E3A6524336A306184CCF4359E deleted file mode 100644 index cdcdb990..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/15ECA87E3A6524336A306184CCF4359E +++ /dev/null @@ -1,157 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Alloc.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Threading; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private BufferExpansionLock _spareLock = new(); - - public hlsfHandle Alloc(uint size) - { - ArgumentOutOfRangeException.ThrowIfGreaterThan(size, (nuint)levelSize[^1] * 2); - int level = GetLevelFromSize(size); - int segmentIndex = DetermineSegmentIndex(size, level); - - int i = level, s = segmentIndex; - if (TryPopLevelForAllocation(i, s, out Entry* handle)) - { - handle->State = EntryState.Allocated; - return new hlsfHandle(handle, size); - } - - fallback: - i = level; - s = segmentIndex; - while (!TryPopLevelForAllocation(i, s, out handle)) - { - if (++s >= 3) - { - s = 0; - i++; - } - if (i >= levelSize.Length) - { - if (TryAllocateNew16MBBlock(out handle)) - { - break; - } - Thread.Sleep(0); - goto fallback; - } - } - - if (handle != null) - { - SliceMemory(handle, (segmentIndex + 1) * levelSize[level]); - handle->State = EntryState.Allocated; - } - - return new hlsfHandle(handle, size); - } - - private void SliceMemory(Entry* e, int offset) { } - - /// - /// Try to allocate a new 16MB block when all buckets are empty - /// - /// - /// Output handle to the allocated Entry - /// - /// - /// True if allocation succeeded - /// - private bool TryAllocateNew16MBBlock(out Entry* handle) - { - nuint pos = Volatile.Read(ref _spareMemory->Position); - nuint blockSize = (nuint)levelSize[^1] * 2; // Use last level size (16MB) - nuint newPos = pos + blockSize; - - - // Check if we have enough space - if (newPos > ((nuint)m_Buffer) + _size) - { - handle = null; - return false; // Out of memory - } - - // Try to allocate new Entry from slab allocator - try - { - handle = (Entry*)_nodes.Allocate(); - handle->Position = pos; - handle->Size = (uint)blockSize; - handle->State = EntryState.ThreadOccupied; - handle->NextNear = EmptyHandle; - handle->PreviousNear = EmptyHandle; - handle->SpinLock = 0; - - - // Update spare memory position - _spareMemory->Position = newPos; - - return true; - } - catch - { - handle = null; - return false; - } - } - - /// - /// Helper method for allocation - converts BucketNode to Entry - /// - private bool TryPopLevelForAllocation(int levelIndex, int sizeIndex, out Entry* entry) - { - if (TryPopLevel(levelIndex, sizeIndex, out BucketNode* bucketNode)) - { - entry = bucketNode->EntryRef; - return entry != null; - } - entry = null; - return false; - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/38EB4EF437C06B5FD17DD12FC88DDC76 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/38EB4EF437C06B5FD17DD12FC88DDC76 deleted file mode 100644 index cbd61747..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/38EB4EF437C06B5FD17DD12FC88DDC76 +++ /dev/null @@ -1,347 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref node->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->TrySetState(BucketNode.StateEmpty, BucketNode.StateInBucket); - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->TrySetState(BucketNode.StateEmpty, BucketNode.StateInBucket); - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref node->SpinLock, 0, thread); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - return (node == null) || - (Interlocked.CompareExchange(ref node->SpinLock, thread, - 0) == 0) || - (Volatile.Read(ref node->SpinLock) == thread); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->TrySetState(BucketNode.StateInBucket, BucketNode.StateEmpty); - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(29)] internal byte LeftOpMask; // Left pointer operation (Free=0, Occupied=1) - [FieldOffset(30)] internal byte RightOpMask; // Right pointer operation (Free=0, Occupied=1) - [FieldOffset(31)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations - [FieldOffset(28)] internal byte StateMask; // Usage state (Empty=0, InBucket=1, MarkedForRemoval=2) - [FieldOffset(32)] internal int SpinLock; // Spin lock for bucket head operation - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Four Independent Byte Masks - - // State constants - public const byte StateEmpty = 0; - public const byte StateInBucket = 1; - public const byte StateMarkedForRemoval = 2; - public const byte StateReserved = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // Atomic state operations - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - return Interlocked.CompareExchange(ref StateMask, newState, expectedState) == expectedState; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Left operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireLeftOp() - { - return Interlocked.CompareExchange(ref LeftOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseLeftOp() - { - Volatile.Write(ref LeftOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsLeftOpOccupied() => Volatile.Read(ref LeftOpMask) == OpOccupied; - - // Right operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireRightOp() - { - return Interlocked.CompareExchange(ref RightOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseRightOp() - { - Volatile.Write(ref RightOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsRightOpOccupied() => Volatile.Read(ref RightOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - return Interlocked.CompareExchange(ref SelfOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsInBucket() => GetState() == StateInBucket; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMarkedForRemoval() => GetState() == StateMarkedForRemoval; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsLeftOpOccupied() || IsRightOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/45825AEC44BF54D64C1E79353BE8B5BC b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/45825AEC44BF54D64C1E79353BE8B5BC deleted file mode 100644 index 590c2617..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/45825AEC44BF54D64C1E79353BE8B5BC +++ /dev/null @@ -1,357 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - if (entry != null && Volatile.Read(ref entry->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref entry->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private void MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = -1; - int segment = DetermineSegmentIndex(size, originLevel); - if (TryAcquireEntrySpinLock(entry)) { - return; - } - - // current Level merge - while (originLevel != entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - AcquireBucketNodeSpinLock((BucketNode*)entry->Position); - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - RemoveFromBucket(originLevel, , (BucketNode*)near->Position); - } - - // forward merging - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - } - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - if (entry != null && Volatile.Read(ref entry->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref entry->SpinLock, 0, thread); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - return entry == null || - (Interlocked.CompareExchange(ref entry->SpinLock, thread, - 0) == 0) || - Volatile.Read(ref entry->SpinLock) == thread; - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(26)] internal byte NextOpMask; // Next pointer operation (Free=0, Occupied=1) - [FieldOffset(25)] internal byte PrevOpMask; // Previous pointer operation (Free=0, Occupied=1) - [FieldOffset(27)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations (replacing SpinLock) - [FieldOffset(24)] internal byte StateMask; // Entry state (Empty=0, Allocated=1, ThreadOccupied=2, Merging=3) - - [FieldOffset(28)] internal int _reserved; // Reserved for future use - - [FieldOffset(36)] internal int Level; // Level of the block in the allocator - [FieldOffset(32)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - #region Four Independent Byte Masks for Entry - - // State constants - public const byte StateEmpty = 0; - public const byte StateAllocated = 1; - public const byte StateThreadOccupied = 2; - public const byte StateMerging = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // Atomic state operations - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - return Interlocked.CompareExchange(ref StateMask, newState, expectedState) == expectedState; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Previous operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevOp() - { - return Interlocked.CompareExchange(ref PrevOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevOp() - { - Volatile.Write(ref PrevOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevOpOccupied() => Volatile.Read(ref PrevOpMask) == OpOccupied; - - // Next operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextOp() - { - return Interlocked.CompareExchange(ref NextOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextOp() - { - Volatile.Write(ref NextOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextOpOccupied() => Volatile.Read(ref NextOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - return Interlocked.CompareExchange(ref SelfOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsAllocated() => GetState() == StateAllocated; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsThreadOccupied() => GetState() == StateThreadOccupied; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMerging() => GetState() == StateMerging; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsPrevOpOccupied() || IsNextOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - // 更新后的EntryState常量类 - 与新的字节掩码设计兼容 - private static class EntryState - { - - public const byte Allocated = 1; // Already allocated to user - public const byte Empty = 0; // Free, can be allocated - public const byte Merging = 3; // Currently being merged - public const byte ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/4BFD02B4CBA23B8D8211DD208715F1E0 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/4BFD02B4CBA23B8D8211DD208715F1E0 deleted file mode 100644 index 29fad368..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/4BFD02B4CBA23B8D8211DD208715F1E0 +++ /dev/null @@ -1,261 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - if (entry != null && Volatile.Read(ref entry->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref entry->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private void MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = -1; - int segment = DetermineSegmentIndex(size, originLevel); - if (TryAcquireEntrySpinLock(entry)) { - return; - } - - // current Level merge - while (originLevel != entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - AcquireBucketNodeSpinLock((BucketNode*)entry->Position); - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - RemoveFromBucket(originLevel, , (BucketNode*)near->Position); - } - - // forward merging - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - } - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - if (entry != null && Volatile.Read(ref entry->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref entry->SpinLock, 0, thread); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - return entry == null || - (Interlocked.CompareExchange(ref entry->SpinLock, thread, - 0) == 0) || - Volatile.Read(ref entry->SpinLock) == thread; - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(36)] internal int Level; // Level of the block in the allocator - [FieldOffset(24)] internal int SpinLock; // Spin lock for thread safety protection - [FieldOffset(28)] internal int State; // Node state - [FieldOffset(32)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - } - - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/76FBC096A1DF26A986327F0AEB7217A7 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/76FBC096A1DF26A986327F0AEB7217A7 deleted file mode 100644 index 07c55c7a..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/76FBC096A1DF26A986327F0AEB7217A7 +++ /dev/null @@ -1,349 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - if (entry != null) - { - while (!entry->TryAcquireSelfOp()) { - Thread.Sleep(0); - } - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private void MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = -1; - int segment = DetermineSegmentIndex(size, originLevel); - if (TryAcquireEntrySpinLock(entry)) { - return; - } - - // current Level merge - while (originLevel != entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - AcquireBucketNodeSpinLock((BucketNode*)entry->Position); - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - RemoveFromBucket(originLevel, , (BucketNode*)near->Position); - } - - // forward merging - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - } - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - return entry == null || - (Interlocked.CompareExchange(ref entry->SpinLock, thread, - 0) == 0) || - Volatile.Read(ref entry->SpinLock) == thread; - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(26)] internal byte NextOpMask; // Next pointer operation (Free=0, Occupied=1) - [FieldOffset(25)] internal byte PrevOpMask; // Previous pointer operation (Free=0, Occupied=1) - [FieldOffset(27)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations (replacing SpinLock) - [FieldOffset(24)] internal byte StateMask; // Entry state (Empty=0, Allocated=1, ThreadOccupied=2, Merging=3) - - [FieldOffset(28)] internal int _reserved; // Reserved for future use - - [FieldOffset(36)] internal int Level; // Level of the block in the allocator - [FieldOffset(32)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - #region Four Independent Byte Masks for Entry - - // State constants - public const byte StateEmpty = 0; - public const byte StateAllocated = 1; - public const byte StateThreadOccupied = 2; - public const byte StateMerging = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // Atomic state operations - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - return Interlocked.CompareExchange(ref StateMask, newState, expectedState) == expectedState; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Previous operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevOp() - { - return Interlocked.CompareExchange(ref PrevOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevOp() - { - Volatile.Write(ref PrevOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevOpOccupied() => Volatile.Read(ref PrevOpMask) == OpOccupied; - - // Next operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextOp() - { - return Interlocked.CompareExchange(ref NextOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextOp() - { - Volatile.Write(ref NextOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextOpOccupied() => Volatile.Read(ref NextOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - return Interlocked.CompareExchange(ref SelfOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsAllocated() => GetState() == StateAllocated; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsThreadOccupied() => GetState() == StateThreadOccupied; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMerging() => GetState() == StateMerging; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsPrevOpOccupied() || IsNextOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - // 更新后的EntryState常量类 - 与新的字节掩码设计兼容 - private static class EntryState - { - - public const byte Allocated = 1; // Already allocated to user - public const byte Empty = 0; // Free, can be allocated - public const byte Merging = 3; // Currently being merged - public const byte ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/77DA1642FF8B0DC1F1DA13D99169CF30 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/77DA1642FF8B0DC1F1DA13D99169CF30 deleted file mode 100644 index 29fad368..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/77DA1642FF8B0DC1F1DA13D99169CF30 +++ /dev/null @@ -1,261 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - if (entry != null && Volatile.Read(ref entry->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref entry->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private void MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = -1; - int segment = DetermineSegmentIndex(size, originLevel); - if (TryAcquireEntrySpinLock(entry)) { - return; - } - - // current Level merge - while (originLevel != entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - AcquireBucketNodeSpinLock((BucketNode*)entry->Position); - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - RemoveFromBucket(originLevel, , (BucketNode*)near->Position); - } - - // forward merging - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - } - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - if (entry != null && Volatile.Read(ref entry->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref entry->SpinLock, 0, thread); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - return entry == null || - (Interlocked.CompareExchange(ref entry->SpinLock, thread, - 0) == 0) || - Volatile.Read(ref entry->SpinLock) == thread; - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(36)] internal int Level; // Level of the block in the allocator - [FieldOffset(24)] internal int SpinLock; // Spin lock for thread safety protection - [FieldOffset(28)] internal int State; // Node state - [FieldOffset(32)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - } - - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/892CA02CFF3E005EC98319D9DBE48CDA b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/892CA02CFF3E005EC98319D9DBE48CDA deleted file mode 100644 index c5956a59..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/892CA02CFF3E005EC98319D9DBE48CDA +++ /dev/null @@ -1,347 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref node->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->TrySetState(BucketNode.StateEmpty, BucketNode.StateInBucket); - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->TrySetState(BucketNode.StateEmpty, BucketNode.StateInBucket); - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref node->SpinLock, 0, thread); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - return (node == null) || - (Interlocked.CompareExchange(ref node->SpinLock, thread, - 0) == 0) || - (Volatile.Read(ref node->SpinLock) == thread); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->TrySetState(BucketNode.StateInBucket, BucketNode.StateEmpty); - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(29)] internal byte LeftOpMask; // Left pointer operation (Free=0, Occupied=1) - [FieldOffset(30)] internal byte RightOpMask; // Right pointer operation (Free=0, Occupied=1) - [FieldOffset(31)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations - [FieldOffset(28)] internal byte StateMask; // Usage state (Empty=0, InBucket=1, MarkedForRemoval=2) - [FieldOffset(32)] internal int SpinLock; // Spin lock for bucket head operation - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Four Independent Byte Masks - - // State constants - public const byte StateEmpty = 0; - public const byte StateInBucket = 1; - public const byte StateMarkedForRemoval = 2; - public const byte StateReserved = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // Atomic state operations - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - return Interlocked.CompareExchange(ref Unsafe.As(ref StateMask), newState, expectedState) == expectedState; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Left operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireLeftOp() - { - return Interlocked.CompareExchange(ref Unsafe.As(ref LeftOpMask), OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseLeftOp() - { - Volatile.Write(ref LeftOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsLeftOpOccupied() => Volatile.Read(ref LeftOpMask) == OpOccupied; - - // Right operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireRightOp() - { - return Interlocked.CompareExchange(ref Unsafe.As(ref RightOpMask), OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseRightOp() - { - Volatile.Write(ref RightOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsRightOpOccupied() => Volatile.Read(ref RightOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - return Interlocked.CompareExchange(ref Unsafe.As(ref SelfOpMask), OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsInBucket() => GetState() == StateInBucket; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMarkedForRemoval() => GetState() == StateMarkedForRemoval; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsLeftOpOccupied() || IsRightOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/9A02BCF49759C26E543854FB778E1E64 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/9A02BCF49759C26E543854FB778E1E64 deleted file mode 100644 index 590c2617..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/9A02BCF49759C26E543854FB778E1E64 +++ /dev/null @@ -1,357 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - if (entry != null && Volatile.Read(ref entry->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref entry->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private void MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = -1; - int segment = DetermineSegmentIndex(size, originLevel); - if (TryAcquireEntrySpinLock(entry)) { - return; - } - - // current Level merge - while (originLevel != entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - AcquireBucketNodeSpinLock((BucketNode*)entry->Position); - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - RemoveFromBucket(originLevel, , (BucketNode*)near->Position); - } - - // forward merging - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - } - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - if (entry != null && Volatile.Read(ref entry->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref entry->SpinLock, 0, thread); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - return entry == null || - (Interlocked.CompareExchange(ref entry->SpinLock, thread, - 0) == 0) || - Volatile.Read(ref entry->SpinLock) == thread; - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(26)] internal byte NextOpMask; // Next pointer operation (Free=0, Occupied=1) - [FieldOffset(25)] internal byte PrevOpMask; // Previous pointer operation (Free=0, Occupied=1) - [FieldOffset(27)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations (replacing SpinLock) - [FieldOffset(24)] internal byte StateMask; // Entry state (Empty=0, Allocated=1, ThreadOccupied=2, Merging=3) - - [FieldOffset(28)] internal int _reserved; // Reserved for future use - - [FieldOffset(36)] internal int Level; // Level of the block in the allocator - [FieldOffset(32)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - #region Four Independent Byte Masks for Entry - - // State constants - public const byte StateEmpty = 0; - public const byte StateAllocated = 1; - public const byte StateThreadOccupied = 2; - public const byte StateMerging = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // Atomic state operations - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - return Interlocked.CompareExchange(ref StateMask, newState, expectedState) == expectedState; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Previous operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevOp() - { - return Interlocked.CompareExchange(ref PrevOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevOp() - { - Volatile.Write(ref PrevOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevOpOccupied() => Volatile.Read(ref PrevOpMask) == OpOccupied; - - // Next operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextOp() - { - return Interlocked.CompareExchange(ref NextOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextOp() - { - Volatile.Write(ref NextOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextOpOccupied() => Volatile.Read(ref NextOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - return Interlocked.CompareExchange(ref SelfOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsAllocated() => GetState() == StateAllocated; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsThreadOccupied() => GetState() == StateThreadOccupied; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMerging() => GetState() == StateMerging; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsPrevOpOccupied() || IsNextOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - // 更新后的EntryState常量类 - 与新的字节掩码设计兼容 - private static class EntryState - { - - public const byte Allocated = 1; // Already allocated to user - public const byte Empty = 0; // Free, can be allocated - public const byte Merging = 3; // Currently being merged - public const byte ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/9AB9AD560F16ACCB506D7798969A2674 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/9AB9AD560F16ACCB506D7798969A2674 deleted file mode 100644 index 7799db2b..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/9AB9AD560F16ACCB506D7798969A2674 +++ /dev/null @@ -1,347 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref node->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->Mask = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->Mask = true; - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref node->SpinLock, 0, thread); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - return (node == null) || - (Interlocked.CompareExchange(ref node->SpinLock, thread, - 0) == 0) || - (Volatile.Read(ref node->SpinLock) == thread); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->Mask = false; - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(29)] internal byte LeftOpMask; // Left pointer operation (Free=0, Occupied=1) - [FieldOffset(30)] internal byte RightOpMask; // Right pointer operation (Free=0, Occupied=1) - [FieldOffset(31)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations - [FieldOffset(28)] internal byte StateMask; // Usage state (Empty=0, InBucket=1, MarkedForRemoval=2) - [FieldOffset(32)] internal int SpinLock; // Spin lock for bucket head operation - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Four Independent Byte Masks - - // State constants - public const byte StateEmpty = 0; - public const byte StateInBucket = 1; - public const byte StateMarkedForRemoval = 2; - public const byte StateReserved = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // Atomic state operations - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - return Interlocked.CompareExchange(ref StateMask, newState, expectedState) == expectedState; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Left operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireLeftOp() - { - return Interlocked.CompareExchange(ref LeftOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseLeftOp() - { - Volatile.Write(ref LeftOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsLeftOpOccupied() => Volatile.Read(ref LeftOpMask) == OpOccupied; - - // Right operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireRightOp() - { - return Interlocked.CompareExchange(ref RightOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseRightOp() - { - Volatile.Write(ref RightOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsRightOpOccupied() => Volatile.Read(ref RightOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - return Interlocked.CompareExchange(ref SelfOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsInBucket() => GetState() == StateInBucket; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMarkedForRemoval() => GetState() == StateMarkedForRemoval; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsLeftOpOccupied() || IsRightOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/A771AAE48821EBA0F7B9EBF7FD8DBC56 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/A771AAE48821EBA0F7B9EBF7FD8DBC56 deleted file mode 100644 index c5956a59..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/A771AAE48821EBA0F7B9EBF7FD8DBC56 +++ /dev/null @@ -1,347 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref node->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->TrySetState(BucketNode.StateEmpty, BucketNode.StateInBucket); - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->TrySetState(BucketNode.StateEmpty, BucketNode.StateInBucket); - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref node->SpinLock, 0, thread); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - return (node == null) || - (Interlocked.CompareExchange(ref node->SpinLock, thread, - 0) == 0) || - (Volatile.Read(ref node->SpinLock) == thread); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->TrySetState(BucketNode.StateInBucket, BucketNode.StateEmpty); - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(29)] internal byte LeftOpMask; // Left pointer operation (Free=0, Occupied=1) - [FieldOffset(30)] internal byte RightOpMask; // Right pointer operation (Free=0, Occupied=1) - [FieldOffset(31)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations - [FieldOffset(28)] internal byte StateMask; // Usage state (Empty=0, InBucket=1, MarkedForRemoval=2) - [FieldOffset(32)] internal int SpinLock; // Spin lock for bucket head operation - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Four Independent Byte Masks - - // State constants - public const byte StateEmpty = 0; - public const byte StateInBucket = 1; - public const byte StateMarkedForRemoval = 2; - public const byte StateReserved = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // Atomic state operations - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - return Interlocked.CompareExchange(ref Unsafe.As(ref StateMask), newState, expectedState) == expectedState; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Left operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireLeftOp() - { - return Interlocked.CompareExchange(ref Unsafe.As(ref LeftOpMask), OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseLeftOp() - { - Volatile.Write(ref LeftOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsLeftOpOccupied() => Volatile.Read(ref LeftOpMask) == OpOccupied; - - // Right operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireRightOp() - { - return Interlocked.CompareExchange(ref Unsafe.As(ref RightOpMask), OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseRightOp() - { - Volatile.Write(ref RightOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsRightOpOccupied() => Volatile.Read(ref RightOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - return Interlocked.CompareExchange(ref Unsafe.As(ref SelfOpMask), OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsInBucket() => GetState() == StateInBucket; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMarkedForRemoval() => GetState() == StateMarkedForRemoval; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsLeftOpOccupied() || IsRightOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/B1BD4C4E4C3E65EE82D2E760F26AF672 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/B1BD4C4E4C3E65EE82D2E760F26AF672 deleted file mode 100644 index 31e5a32a..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/B1BD4C4E4C3E65EE82D2E760F26AF672 +++ /dev/null @@ -1,347 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref node->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->TrySetState(BucketNode.StateEmpty, BucketNode.StateInBucket); - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->TrySetState(BucketNode.StateEmpty, BucketNode.StateInBucket); - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref node->SpinLock, 0, thread); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - return (node == null) || - (Interlocked.CompareExchange(ref node->SpinLock, thread, - 0) == 0) || - (Volatile.Read(ref node->SpinLock) == thread); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->Mask = false; - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(29)] internal byte LeftOpMask; // Left pointer operation (Free=0, Occupied=1) - [FieldOffset(30)] internal byte RightOpMask; // Right pointer operation (Free=0, Occupied=1) - [FieldOffset(31)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations - [FieldOffset(28)] internal byte StateMask; // Usage state (Empty=0, InBucket=1, MarkedForRemoval=2) - [FieldOffset(32)] internal int SpinLock; // Spin lock for bucket head operation - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Four Independent Byte Masks - - // State constants - public const byte StateEmpty = 0; - public const byte StateInBucket = 1; - public const byte StateMarkedForRemoval = 2; - public const byte StateReserved = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // Atomic state operations - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - return Interlocked.CompareExchange(ref StateMask, newState, expectedState) == expectedState; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Left operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireLeftOp() - { - return Interlocked.CompareExchange(ref LeftOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseLeftOp() - { - Volatile.Write(ref LeftOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsLeftOpOccupied() => Volatile.Read(ref LeftOpMask) == OpOccupied; - - // Right operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireRightOp() - { - return Interlocked.CompareExchange(ref RightOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseRightOp() - { - Volatile.Write(ref RightOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsRightOpOccupied() => Volatile.Read(ref RightOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - return Interlocked.CompareExchange(ref SelfOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsInBucket() => GetState() == StateInBucket; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMarkedForRemoval() => GetState() == StateMarkedForRemoval; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsLeftOpOccupied() || IsRightOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/B1E910FE1FC4C246F09B8FF71EE349FA b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/B1E910FE1FC4C246F09B8FF71EE349FA deleted file mode 100644 index 7799db2b..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/B1E910FE1FC4C246F09B8FF71EE349FA +++ /dev/null @@ -1,347 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref node->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->Mask = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->Mask = true; - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref node->SpinLock, 0, thread); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - return (node == null) || - (Interlocked.CompareExchange(ref node->SpinLock, thread, - 0) == 0) || - (Volatile.Read(ref node->SpinLock) == thread); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->Mask = false; - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(29)] internal byte LeftOpMask; // Left pointer operation (Free=0, Occupied=1) - [FieldOffset(30)] internal byte RightOpMask; // Right pointer operation (Free=0, Occupied=1) - [FieldOffset(31)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations - [FieldOffset(28)] internal byte StateMask; // Usage state (Empty=0, InBucket=1, MarkedForRemoval=2) - [FieldOffset(32)] internal int SpinLock; // Spin lock for bucket head operation - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Four Independent Byte Masks - - // State constants - public const byte StateEmpty = 0; - public const byte StateInBucket = 1; - public const byte StateMarkedForRemoval = 2; - public const byte StateReserved = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // Atomic state operations - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - return Interlocked.CompareExchange(ref StateMask, newState, expectedState) == expectedState; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Left operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireLeftOp() - { - return Interlocked.CompareExchange(ref LeftOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseLeftOp() - { - Volatile.Write(ref LeftOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsLeftOpOccupied() => Volatile.Read(ref LeftOpMask) == OpOccupied; - - // Right operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireRightOp() - { - return Interlocked.CompareExchange(ref RightOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseRightOp() - { - Volatile.Write(ref RightOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsRightOpOccupied() => Volatile.Read(ref RightOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - return Interlocked.CompareExchange(ref SelfOpMask, OpOccupied, OpFree) == OpFree; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsInBucket() => GetState() == StateInBucket; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMarkedForRemoval() => GetState() == StateMarkedForRemoval; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsLeftOpOccupied() || IsRightOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/B5126D29D08B2553CC28B846B92EB369 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/B5126D29D08B2553CC28B846B92EB369 deleted file mode 100644 index b5ba0212..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/B5126D29D08B2553CC28B846B92EB369 +++ /dev/null @@ -1,91 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Free.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Buffers; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - /// - /// Free allocated memory block and perform adjacent block merging - /// - /// - /// Handle to the allocated memory block - /// - public void Free(hlsfHandle handle) - { - Entry* e = handle.EntryHandle; - if (e == null) { - return; - } - AcquireEntrySpinLock(e); - try - { - if (e->State != EntryState.Allocated) { - return; - } - e->State = EntryState.ThreadOccupied; - - // Step 4: Try merge with adjacent free blocks and remove them from buckets - Entry* mergedEntry = TryMergeAndRemoveFromBuckets(e); - - - // Step 5: Calculate final level and segment for the merged block - uint finalSize = mergedEntry->Size; - int finalLevel = GetLevelFromSize(finalSize); - int finalSegment = DetermineSegmentIndex(finalSize, finalLevel); - - // Step 6: Set the merged entry state to Empty (ready to be reused) - mergedEntry->State = EntryState.Empty; - - // Step 7: Push the merged entry back to appropriate bucket - PushLevel(finalLevel, finalSegment, (BucketNode*)mergedEntry->Position); - - // Note: If mergedEntry is different from original e, the original e - // and any merged entries have already been freed to _nodes by TryMergeAndRemoveFromBuckets - } - finally - { - // Step 8: Always release the spin lock - ReleaseEntrySpinLock(e); - } - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/DD33CFD2FDC59A9C6D38F3D26986324C b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/DD33CFD2FDC59A9C6D38F3D26986324C deleted file mode 100644 index e6119d69..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/DD33CFD2FDC59A9C6D38F3D26986324C +++ /dev/null @@ -1,119 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Buffers; -using System.Runtime.InteropServices; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator : IDisposable - { - - private static readonly nuint EmptyHandle = (nuint)(void*)null; - - // Bucket system field - directly in main allocator class - private ulong[] _bucketHeads; - - private Entry* _spareMemory; - private readonly byte* m_Buffer; - private bool disposedValue; - private readonly int _align; - private readonly nuint _size; - private readonly SlabAllocator _nodes; - - public HybridLayerSegregatedFitAllocator(nuint byteSize) - { - if (byteSize < 64) { - throw new InvalidOperationException(); - } - _nodes = SlabAllocator.Create(64, BufferLayout.Chunked); - _size = byteSize; - m_Buffer = (byte*)NativeMemory.AlignedAlloc(byteSize, 16); - _align = 16; - - - // 初始化桶系统 - InitializeBucketSystem(); - - - // 初始化spareMemory - _spareMemory = (Entry*)_nodes.Allocate(); - _spareMemory->State = EntryState.ThreadOccupied; - _spareMemory->NextNear = EmptyHandle; - _spareMemory->Position = (nuint)m_Buffer; - } - - public HybridLayerSegregatedFitAllocator(nuint byteSize, int align) - { - if (align < 16 || (align & (align - 1)) != 0) { - throw new ArgumentException( - "Alignment must be a power of two and at least 8 bytes."); - } - _nodes = SlabAllocator.Create(64, BufferLayout.Chunked); - m_Buffer = (byte*)NativeMemory.AlignedAlloc(byteSize, (nuint)align); - _align = align; - _size = byteSize; - - InitializeBucketSystem(); - - - // 初始化spareMemory - _spareMemory = (Entry*)_nodes.Allocate(); - _spareMemory->State = EntryState.ThreadOccupied; - _spareMemory->NextNear = EmptyHandle; - _spareMemory->Position = (nuint)m_Buffer; - } - - public void Dispose() - { - Dispose(disposing:true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - if (!disposedValue) - { - if (disposing) { - _nodes.Dispose(); - } - NativeMemory.AlignedFree(m_Buffer); - disposedValue = true; - } - } - - ~HybridLayerSegregatedFitAllocator() - { - Dispose(disposing:false); - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/F1481D5666E0266F32099AD751F704AB b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/F1481D5666E0266F32099AD751F704AB deleted file mode 100644 index 0015da29..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/60223AC4FEB14043B418B65F088AB6BB/F1481D5666E0266F32099AD751F704AB +++ /dev/null @@ -1,276 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref node->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->Mask = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->Mask = true; - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref node->SpinLock, 0, thread); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - return (node == null) || - (Interlocked.CompareExchange(ref node->SpinLock, thread, - 0) == 0) || - (Volatile.Read(ref node->SpinLock) == thread); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->Mask = false; - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(32)] internal int SpinLock; // Spin lock for bucket head operation - [FieldOffset(24)] internal uint Magic; // Magic number verification - [FieldOffset(28)] internal uint Mask; // Whether in bucket - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region node mask - - public const uint AllOperating = 0b_11100000_00000000_00000000_00000111; - public const uint Empty = 0b_10000000_00000000_00000000_00000000; - public const uint InBucket = 0b_10000000_00000000_00000000_00000000; - public const uint LeftOperating = 0b_01000000_00000000_00000000_00000100; - public const uint ReadyForRemove = 0b_01000000_00000000_00000000_00000000; - public const uint RightOperating = 0b_00100000_00000000_00000000_00000001; - public const uint SelfOperating = 0b_00000000_00000000_00000000_00000010; - - private bool BucketNodeIsInBucket - { -[MethodImpl(MethodImplOptions.AggressiveInlining)] - get => (Mask & InBucket) != 0; -[MethodImpl(MethodImplOptions.AggressiveInlining)] - set => Mask |= value ? InBucket : 0; - } - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/6EDA514D53D10042842E8CC4500B4269/15ECA87E3A6524336A306184CCF4359E b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/6EDA514D53D10042842E8CC4500B4269/15ECA87E3A6524336A306184CCF4359E deleted file mode 100644 index cdcdb990..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/6EDA514D53D10042842E8CC4500B4269/15ECA87E3A6524336A306184CCF4359E +++ /dev/null @@ -1,157 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Alloc.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Threading; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private BufferExpansionLock _spareLock = new(); - - public hlsfHandle Alloc(uint size) - { - ArgumentOutOfRangeException.ThrowIfGreaterThan(size, (nuint)levelSize[^1] * 2); - int level = GetLevelFromSize(size); - int segmentIndex = DetermineSegmentIndex(size, level); - - int i = level, s = segmentIndex; - if (TryPopLevelForAllocation(i, s, out Entry* handle)) - { - handle->State = EntryState.Allocated; - return new hlsfHandle(handle, size); - } - - fallback: - i = level; - s = segmentIndex; - while (!TryPopLevelForAllocation(i, s, out handle)) - { - if (++s >= 3) - { - s = 0; - i++; - } - if (i >= levelSize.Length) - { - if (TryAllocateNew16MBBlock(out handle)) - { - break; - } - Thread.Sleep(0); - goto fallback; - } - } - - if (handle != null) - { - SliceMemory(handle, (segmentIndex + 1) * levelSize[level]); - handle->State = EntryState.Allocated; - } - - return new hlsfHandle(handle, size); - } - - private void SliceMemory(Entry* e, int offset) { } - - /// - /// Try to allocate a new 16MB block when all buckets are empty - /// - /// - /// Output handle to the allocated Entry - /// - /// - /// True if allocation succeeded - /// - private bool TryAllocateNew16MBBlock(out Entry* handle) - { - nuint pos = Volatile.Read(ref _spareMemory->Position); - nuint blockSize = (nuint)levelSize[^1] * 2; // Use last level size (16MB) - nuint newPos = pos + blockSize; - - - // Check if we have enough space - if (newPos > ((nuint)m_Buffer) + _size) - { - handle = null; - return false; // Out of memory - } - - // Try to allocate new Entry from slab allocator - try - { - handle = (Entry*)_nodes.Allocate(); - handle->Position = pos; - handle->Size = (uint)blockSize; - handle->State = EntryState.ThreadOccupied; - handle->NextNear = EmptyHandle; - handle->PreviousNear = EmptyHandle; - handle->SpinLock = 0; - - - // Update spare memory position - _spareMemory->Position = newPos; - - return true; - } - catch - { - handle = null; - return false; - } - } - - /// - /// Helper method for allocation - converts BucketNode to Entry - /// - private bool TryPopLevelForAllocation(int levelIndex, int sizeIndex, out Entry* entry) - { - if (TryPopLevel(levelIndex, sizeIndex, out BucketNode* bucketNode)) - { - entry = bucketNode->EntryRef; - return entry != null; - } - entry = null; - return false; - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/6EDA514D53D10042842E8CC4500B4269/6EB395BE23AD19CE308C05B938EA46F8 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/6EDA514D53D10042842E8CC4500B4269/6EB395BE23AD19CE308C05B938EA46F8 deleted file mode 100644 index 29fad368..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/6EDA514D53D10042842E8CC4500B4269/6EB395BE23AD19CE308C05B938EA46F8 +++ /dev/null @@ -1,261 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - if (entry != null && Volatile.Read(ref entry->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref entry->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private void MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = -1; - int segment = DetermineSegmentIndex(size, originLevel); - if (TryAcquireEntrySpinLock(entry)) { - return; - } - - // current Level merge - while (originLevel != entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - AcquireBucketNodeSpinLock((BucketNode*)entry->Position); - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - RemoveFromBucket(originLevel, , (BucketNode*)near->Position); - } - - // forward merging - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - } - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - if (entry != null && Volatile.Read(ref entry->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref entry->SpinLock, 0, thread); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - return entry == null || - (Interlocked.CompareExchange(ref entry->SpinLock, thread, - 0) == 0) || - Volatile.Read(ref entry->SpinLock) == thread; - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(36)] internal int Level; // Level of the block in the allocator - [FieldOffset(24)] internal int SpinLock; // Spin lock for thread safety protection - [FieldOffset(28)] internal int State; // Node state - [FieldOffset(32)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - } - - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/6EDA514D53D10042842E8CC4500B4269/73093A33597FCB16D4BA646D7844A076 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/6EDA514D53D10042842E8CC4500B4269/73093A33597FCB16D4BA646D7844A076 deleted file mode 100644 index 008bb5dc..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/6EDA514D53D10042842E8CC4500B4269/73093A33597FCB16D4BA646D7844A076 +++ /dev/null @@ -1,404 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref node->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->Mask = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->Mask = true; - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref node->SpinLock, 0, thread); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - return (node == null) || - (Interlocked.CompareExchange(ref node->SpinLock, thread, - 0) == 0) || - (Volatile.Read(ref node->SpinLock) == thread); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->Mask = false; - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(32)] internal int SpinLock; // Spin lock for bucket head operation - [FieldOffset(24)] internal uint Magic; // Magic number verification - [FieldOffset(28)] internal uint Mask; // Four-byte mask for atomic operations - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Four-Byte Mask Design - - // Byte 0: Usage State (bits 0-7) - public const uint StateMask = 0x000000FF; - public const uint StateEmpty = 0x00000000; - public const uint StateInBucket = 0x00000001; - public const uint StateMarkedForRemoval = 0x00000002; - public const uint StateReserved = 0x00000003; - - // Byte 1: Left Pointer Operation (bits 8-15) - public const uint LeftOpMask = 0x0000FF00; - public const uint LeftOpFree = 0x00000000; - public const uint LeftOpOccupied = 0x00000100; - - // Byte 2: Right Pointer Operation (bits 16-23) - public const uint RightOpMask = 0x00FF0000; - public const uint RightOpFree = 0x00000000; - public const uint RightOpOccupied = 0x00010000; - - // Byte 3: Self Operation (bits 24-31) - public const uint SelfOpMask = 0xFF000000; - public const uint SelfOpFree = 0x00000000; - public const uint SelfOpOccupied = 0x01000000; - - // 快速访问器 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => (byte)(Volatile.Read(ref Mask) & StateMask); - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetLeftOpStatus() => (byte)((Volatile.Read(ref Mask) & LeftOpMask) >> 8); - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetRightOpStatus() => (byte)((Volatile.Read(ref Mask) & RightOpMask) >> 16); - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetSelfOpStatus() => (byte)((Volatile.Read(ref Mask) & SelfOpMask) >> 24); - - // 原子状态操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - uint current = Volatile.Read(ref Mask); - uint currentState = current & StateMask; - - if (currentState != expectedState) { - return false; - } - - uint newMask = (current & ~StateMask) | newState; - return Interlocked.CompareExchange(ref Mask, newMask, current) == current; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireLeftOp() - { - uint current, newMask; - do - { - current = Volatile.Read(ref Mask); - if ((current & LeftOpMask) != LeftOpFree) { - return false; - } - - newMask = current | LeftOpOccupied; - } while (Interlocked.CompareExchange(ref Mask, newMask, current) != current); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseLeftOp() - { - uint current, newMask; - do - { - current = Volatile.Read(ref Mask); - newMask = current & ~LeftOpMask; - } while (Interlocked.CompareExchange(ref Mask, newMask, current) != current); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireRightOp() - { - uint current, newMask; - do - { - current = Volatile.Read(ref Mask); - if ((current & RightOpMask) != RightOpFree) { - return false; - } - - newMask = current | RightOpOccupied; - } while (Interlocked.CompareExchange(ref Mask, newMask, current) != current); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseRightOp() - { - uint current, newMask; - do - { - current = Volatile.Read(ref Mask); - newMask = current & ~RightOpMask; - } while (Interlocked.CompareExchange(ref Mask, newMask, current) != current); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - uint current, newMask; - do - { - current = Volatile.Read(ref Mask); - if ((current & SelfOpMask) != SelfOpFree) { - return false; - } - - newMask = current | SelfOpOccupied; - } while (Interlocked.CompareExchange(ref Mask, newMask, current) != current); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - uint current, newMask; - do - { - current = Volatile.Read(ref Mask); - newMask = current & ~SelfOpMask; - } while (Interlocked.CompareExchange(ref Mask, newMask, current) != current); - } - - // 便利属性 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsInBucket() => GetState() == StateInBucket; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMarkedForRemoval() => GetState() == StateMarkedForRemoval; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => (Volatile.Read(ref Mask) & (LeftOpMask | RightOpMask | SelfOpMask)) != 0; - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/6EDA514D53D10042842E8CC4500B4269/77DA1642FF8B0DC1F1DA13D99169CF30 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/6EDA514D53D10042842E8CC4500B4269/77DA1642FF8B0DC1F1DA13D99169CF30 deleted file mode 100644 index 29fad368..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/6EDA514D53D10042842E8CC4500B4269/77DA1642FF8B0DC1F1DA13D99169CF30 +++ /dev/null @@ -1,261 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - if (entry != null && Volatile.Read(ref entry->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref entry->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private void MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = -1; - int segment = DetermineSegmentIndex(size, originLevel); - if (TryAcquireEntrySpinLock(entry)) { - return; - } - - // current Level merge - while (originLevel != entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - AcquireBucketNodeSpinLock((BucketNode*)entry->Position); - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - RemoveFromBucket(originLevel, , (BucketNode*)near->Position); - } - - // forward merging - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->State != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - } - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - if (entry != null && Volatile.Read(ref entry->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref entry->SpinLock, 0, thread); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - int thread = Environment.CurrentManagedThreadId; - return entry == null || - (Interlocked.CompareExchange(ref entry->SpinLock, thread, - 0) == 0) || - Volatile.Read(ref entry->SpinLock) == thread; - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(36)] internal int Level; // Level of the block in the allocator - [FieldOffset(24)] internal int SpinLock; // Spin lock for thread safety protection - [FieldOffset(28)] internal int State; // Node state - [FieldOffset(32)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - } - - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/6EDA514D53D10042842E8CC4500B4269/B5126D29D08B2553CC28B846B92EB369 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/6EDA514D53D10042842E8CC4500B4269/B5126D29D08B2553CC28B846B92EB369 deleted file mode 100644 index b5ba0212..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/6EDA514D53D10042842E8CC4500B4269/B5126D29D08B2553CC28B846B92EB369 +++ /dev/null @@ -1,91 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Free.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Buffers; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - /// - /// Free allocated memory block and perform adjacent block merging - /// - /// - /// Handle to the allocated memory block - /// - public void Free(hlsfHandle handle) - { - Entry* e = handle.EntryHandle; - if (e == null) { - return; - } - AcquireEntrySpinLock(e); - try - { - if (e->State != EntryState.Allocated) { - return; - } - e->State = EntryState.ThreadOccupied; - - // Step 4: Try merge with adjacent free blocks and remove them from buckets - Entry* mergedEntry = TryMergeAndRemoveFromBuckets(e); - - - // Step 5: Calculate final level and segment for the merged block - uint finalSize = mergedEntry->Size; - int finalLevel = GetLevelFromSize(finalSize); - int finalSegment = DetermineSegmentIndex(finalSize, finalLevel); - - // Step 6: Set the merged entry state to Empty (ready to be reused) - mergedEntry->State = EntryState.Empty; - - // Step 7: Push the merged entry back to appropriate bucket - PushLevel(finalLevel, finalSegment, (BucketNode*)mergedEntry->Position); - - // Note: If mergedEntry is different from original e, the original e - // and any merged entries have already been freed to _nodes by TryMergeAndRemoveFromBuckets - } - finally - { - // Step 8: Always release the spin lock - ReleaseEntrySpinLock(e); - } - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/6EDA514D53D10042842E8CC4500B4269/DD33CFD2FDC59A9C6D38F3D26986324C b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/6EDA514D53D10042842E8CC4500B4269/DD33CFD2FDC59A9C6D38F3D26986324C deleted file mode 100644 index e6119d69..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/6EDA514D53D10042842E8CC4500B4269/DD33CFD2FDC59A9C6D38F3D26986324C +++ /dev/null @@ -1,119 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Buffers; -using System.Runtime.InteropServices; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator : IDisposable - { - - private static readonly nuint EmptyHandle = (nuint)(void*)null; - - // Bucket system field - directly in main allocator class - private ulong[] _bucketHeads; - - private Entry* _spareMemory; - private readonly byte* m_Buffer; - private bool disposedValue; - private readonly int _align; - private readonly nuint _size; - private readonly SlabAllocator _nodes; - - public HybridLayerSegregatedFitAllocator(nuint byteSize) - { - if (byteSize < 64) { - throw new InvalidOperationException(); - } - _nodes = SlabAllocator.Create(64, BufferLayout.Chunked); - _size = byteSize; - m_Buffer = (byte*)NativeMemory.AlignedAlloc(byteSize, 16); - _align = 16; - - - // 初始化桶系统 - InitializeBucketSystem(); - - - // 初始化spareMemory - _spareMemory = (Entry*)_nodes.Allocate(); - _spareMemory->State = EntryState.ThreadOccupied; - _spareMemory->NextNear = EmptyHandle; - _spareMemory->Position = (nuint)m_Buffer; - } - - public HybridLayerSegregatedFitAllocator(nuint byteSize, int align) - { - if (align < 16 || (align & (align - 1)) != 0) { - throw new ArgumentException( - "Alignment must be a power of two and at least 8 bytes."); - } - _nodes = SlabAllocator.Create(64, BufferLayout.Chunked); - m_Buffer = (byte*)NativeMemory.AlignedAlloc(byteSize, (nuint)align); - _align = align; - _size = byteSize; - - InitializeBucketSystem(); - - - // 初始化spareMemory - _spareMemory = (Entry*)_nodes.Allocate(); - _spareMemory->State = EntryState.ThreadOccupied; - _spareMemory->NextNear = EmptyHandle; - _spareMemory->Position = (nuint)m_Buffer; - } - - public void Dispose() - { - Dispose(disposing:true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - if (!disposedValue) - { - if (disposing) { - _nodes.Dispose(); - } - NativeMemory.AlignedFree(m_Buffer); - disposedValue = true; - } - } - - ~HybridLayerSegregatedFitAllocator() - { - Dispose(disposing:false); - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/6EDA514D53D10042842E8CC4500B4269/F1481D5666E0266F32099AD751F704AB b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/6EDA514D53D10042842E8CC4500B4269/F1481D5666E0266F32099AD751F704AB deleted file mode 100644 index 0015da29..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/6EDA514D53D10042842E8CC4500B4269/F1481D5666E0266F32099AD751F704AB +++ /dev/null @@ -1,276 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref node->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->Mask = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->Mask = true; - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref node->SpinLock, 0, thread); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - return (node == null) || - (Interlocked.CompareExchange(ref node->SpinLock, thread, - 0) == 0) || - (Volatile.Read(ref node->SpinLock) == thread); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->Mask = false; - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(32)] internal int SpinLock; // Spin lock for bucket head operation - [FieldOffset(24)] internal uint Magic; // Magic number verification - [FieldOffset(28)] internal uint Mask; // Whether in bucket - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region node mask - - public const uint AllOperating = 0b_11100000_00000000_00000000_00000111; - public const uint Empty = 0b_10000000_00000000_00000000_00000000; - public const uint InBucket = 0b_10000000_00000000_00000000_00000000; - public const uint LeftOperating = 0b_01000000_00000000_00000000_00000100; - public const uint ReadyForRemove = 0b_01000000_00000000_00000000_00000000; - public const uint RightOperating = 0b_00100000_00000000_00000000_00000001; - public const uint SelfOperating = 0b_00000000_00000000_00000000_00000010; - - private bool BucketNodeIsInBucket - { -[MethodImpl(MethodImplOptions.AggressiveInlining)] - get => (Mask & InBucket) != 0; -[MethodImpl(MethodImplOptions.AggressiveInlining)] - set => Mask |= value ? InBucket : 0; - } - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/6EDA514D53D10042842E8CC4500B4269/FEB81C3E20A5195732A4B3D46DA939B0 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/6EDA514D53D10042842E8CC4500B4269/FEB81C3E20A5195732A4B3D46DA939B0 deleted file mode 100644 index 0015da29..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/6EDA514D53D10042842E8CC4500B4269/FEB81C3E20A5195732A4B3D46DA939B0 +++ /dev/null @@ -1,276 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != thread) - { - while (Interlocked.CompareExchange(ref node->SpinLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->Mask = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - AcquireBucketNodeSpinLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - if (!TryAcquireBucketNodeSpinLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->Mask = true; - node->Magic = BucketNode.MAGIC_NUMBER; - headNode->PreviousLevel = (ulong)node; - return; - } - finally - { - ReleaseBucketNodeSpinLock(headNode); - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - if (node != null && Volatile.Read(ref node->SpinLock) != 0) { - _ = Interlocked.CompareExchange(ref node->SpinLock, 0, thread); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // top of stack - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node && TryAcquireBucketNodeSpinLock(node)) - { - _ = TryPopLevel(levelIndex, sizeIndex, out _); - } else - { - AcquireBucketNodeSpinLock(node); - ulong p = Volatile.Read(ref node->PreviousLevel), n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p, next = (BucketNode*)n; - try - { - if (next is null) - { - // bottom of stack - if (!TryAcquireBucketNodeSpinLock(previous)) - { - Thread.Sleep(0); - continue; - } - previous->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - if (!(TryAcquireBucketNodeSpinLock(previous) && TryAcquireBucketNodeSpinLock(next))) - { - // middle of stack - Thread.Sleep(0); - continue; - } - previous ->NextLevel = n; - next->PreviousLevel = p; - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - return; - } - finally - { - ReleaseBucketNodeSpinLock(node); - ReleaseBucketNodeSpinLock(previous); - ReleaseBucketNodeSpinLock(next); - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - int thread = Environment.CurrentManagedThreadId; - return (node == null) || - (Interlocked.CompareExchange(ref node->SpinLock, thread, - 0) == 0) || - (Volatile.Read(ref node->SpinLock) == thread); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - BucketNode* next = null; - try - { - if (head == null) - { - node = null; - return false; - } - if (!TryAcquireBucketNodeSpinLock(head)) - { - Thread.Sleep(0); - continue; - } - ulong n = Volatile.Read(ref head->NextLevel); - next = (BucketNode*)n; - if (!TryAcquireBucketNodeSpinLock(next)) - { - Thread.Sleep(0); - continue; - } - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->Mask = false; - node->NextLevel = EmptyHandle; - next->PreviousLevel = EmptyHandle; - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeSpinLock(head); - ReleaseBucketNodeSpinLock(next); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 36)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(32)] internal int SpinLock; // Spin lock for bucket head operation - [FieldOffset(24)] internal uint Magic; // Magic number verification - [FieldOffset(28)] internal uint Mask; // Whether in bucket - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region node mask - - public const uint AllOperating = 0b_11100000_00000000_00000000_00000111; - public const uint Empty = 0b_10000000_00000000_00000000_00000000; - public const uint InBucket = 0b_10000000_00000000_00000000_00000000; - public const uint LeftOperating = 0b_01000000_00000000_00000000_00000100; - public const uint ReadyForRemove = 0b_01000000_00000000_00000000_00000000; - public const uint RightOperating = 0b_00100000_00000000_00000000_00000001; - public const uint SelfOperating = 0b_00000000_00000000_00000000_00000010; - - private bool BucketNodeIsInBucket - { -[MethodImpl(MethodImplOptions.AggressiveInlining)] - get => (Mask & InBucket) != 0; -[MethodImpl(MethodImplOptions.AggressiveInlining)] - set => Mask |= value ? InBucket : 0; - } - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/8AE7FB9323EF8244B42EF28161E8F5C6/203F6ECECD5A270D121689A82D8C055C b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/8AE7FB9323EF8244B42EF28161E8F5C6/203F6ECECD5A270D121689A82D8C055C deleted file mode 100644 index ad34d5a7..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/8AE7FB9323EF8244B42EF28161E8F5C6/203F6ECECD5A270D121689A82D8C055C +++ /dev/null @@ -1,523 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - AcquireBucketNodeBothLocks(node); - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - AcquireBucketNodeNextLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !TryAcquireBucketNodePrevLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - ReleaseBucketNodePrevLock(headNode); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeNextLock(node); - } - } - } - } - - /// - /// 根据锁类型释放BucketNode锁 - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeLockByType(BucketNode* node, byte lockType) - { - switch (lockType) - { - case 0: - ReleaseBucketNodePrevLock(node); - break; // PrevLock - case 1: - ReleaseBucketNodeBothLocks(node); - break; // BothLocks - case 2: - ReleaseBucketNodeNextLock(node); - break; // NextLock - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - ReleaseBucketNodeBothLocks(node); - } - - /// - /// 按地址顺序释放BucketNode锁 - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseOrderedBucketLocks(BucketNode* previous, BucketNode* node, BucketNode* next) - { - // 直接释放,顺序不重要 - if (previous != null) - { - ReleaseBucketNodeNextLock(previous); - } - if (node != null) { - ReleaseBucketNodeBothLocks(node); - } - if (next != null) { - ReleaseBucketNodePrevLock(next); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(无锁读取) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - // 直接抢锁策略:按地址顺序获取锁,避免死锁 - if (!TryAcquireOrderedBucketLocks(previous, node, next)) - { - Thread.Sleep(0); - continue; - } - - try - { - // 验证链表结构仍然有效(防止ABA问题) - if (Volatile.Read(ref node->PreviousLevel) != p || Volatile.Read(ref node->NextLevel) != n) - { - Thread.Sleep(0); - continue; - } - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - ReleaseOrderedBucketLocks(previous, node, next); - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - return TryAcquireBucketNodeBothLocks(node); - } - - /// - /// 按地址顺序获取BucketNode锁,避免死锁 - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireOrderedBucketLocks(BucketNode* previous, BucketNode* node, BucketNode* next) - { - // 创建排序数组(最多3个非null节点) - Span nodes = stackalloc BucketNode*[3]; - Span lockTypes = stackalloc byte[3]; // 0=prev, 1=both, 2=next - int count = 0; - - if (previous != null) - { - nodes[count] = previous; - lockTypes[count] = 2; // previous需要NextLock - count++; - } - if (node != null) - { - nodes[count] = node; - lockTypes[count] = 1; // node需要BothLocks - count++; - } - if (next != null) - { - nodes[count] = next; - lockTypes[count] = 0; // next需要PrevLock - count++; - } - - - // 按地址排序(简单冒泡排序,最多3个元素) - for (int i = 0; i < count - 1; i++) - { - for (int j = 0; j < count - i - 1; j++) - { - if ((ulong)nodes[j] > (ulong)nodes[j + 1]) - { - (nodes[j], nodes[j + 1]) = (nodes[j + 1], nodes[j]); - (lockTypes[j], lockTypes[j + 1]) = (lockTypes[j + 1], lockTypes[j]); - } - } - } - - - // 按顺序尝试获取锁 - int acquired = 0; - for (int i = 0; i < count; i++) - { - bool success = lockTypes[i] switch - { - 0 => TryAcquireBucketNodePrevLock(nodes[i]), // PrevLock - 1 => TryAcquireBucketNodeBothLocks(nodes[i]), // BothLocks - 2 => TryAcquireBucketNodeNextLock(nodes[i]), // NextLock - _ => false - }; - - if (!success) - { - // 回滚已获取的锁 - for (int j = acquired - 1; j >= 0; j--) - { - ReleaseBucketNodeLockByType(nodes[j], lockTypes[j]); - } - return false; - } - acquired++; - } - return true; - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!TryAcquireBucketNodeNextLock(head)) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !TryAcquireBucketNodePrevLock(next)) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - ReleaseBucketNodePrevLock(next); - } - } - } - finally - { - ReleaseBucketNodeNextLock(head); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - } - - #region BucketNode Operations - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != BucketNode.MAGIC_NUMBER; - } - - // BucketNode 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref node->PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) == thread) { - Volatile.Write(ref node->PrevLock, 0); - } - } - - // BucketNode 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) != thread) - { - while (Interlocked.CompareExchange(ref node->NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) == thread) { - Volatile.Write(ref node->NextLock, 0); - } - } - - // BucketNode 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return true; - } - - if (TryAcquireBucketNodePrevLock(node)) - { - if (TryAcquireBucketNodeNextLock(node)) - { - return true; - } else - { - ReleaseBucketNodePrevLock(node); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - ReleaseBucketNodePrevLock(node); - ReleaseBucketNodeNextLock(node); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - AcquireBucketNodePrevLock(node); - AcquireBucketNodeNextLock(node); - } - - #endregion - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/8AE7FB9323EF8244B42EF28161E8F5C6/4868DED0108982E4BB235964C91FB477 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/8AE7FB9323EF8244B42EF28161E8F5C6/4868DED0108982E4BB235964C91FB477 deleted file mode 100644 index 371db024..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/8AE7FB9323EF8244B42EF28161E8F5C6/4868DED0108982E4BB235964C91FB477 +++ /dev/null @@ -1,567 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - AcquireBucketNodeBothLocks(node); - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - AcquireBucketNodeNextLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !TryAcquireBucketNodePrevLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - ReleaseBucketNodePrevLock(headNode); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeNextLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - ReleaseBucketNodeBothLocks(node); - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(只读操作,暂时不加锁) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - - // 按照地址顺序获取锁,避免死锁 - BucketNode* firstLock = null, secondLock = null, thirdLock = null; - bool needPrevNextLock = false, needNodeBothLocks = false, needNextPrevLock = false; - - if (previous != null && next != null) - { - // 中间节点:需要修改前驱的next和后继的prev - if ((ulong)previous < (ulong)node && (ulong)node < (ulong)next) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - thirdLock = next; - needNextPrevLock = true; - } else if ((ulong)previous < (ulong)next && (ulong)next < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = next; - needNextPrevLock = true; - thirdLock = node; - needNodeBothLocks = true; - } else // other cases - { - firstLock = next; - needNextPrevLock = true; - secondLock = previous; - needPrevNextLock = true; - thirdLock = node; - needNodeBothLocks = true; - } - } else if (previous != null) - { - // 尾节点:只需要修改前驱的next - if ((ulong)previous < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - } else - { - firstLock = node; - needNodeBothLocks = true; - secondLock = previous; - needPrevNextLock = true; - } - } else - { - Thread.Sleep(0); - continue; - } - - bool acquired = false; - try - { - if (firstLock != null) - { - if (firstLock == previous && needPrevNextLock) - { - if (!TryAcquireBucketNodeNextLock(firstLock)) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == next && needNextPrevLock) - { - if (!TryAcquireBucketNodePrevLock(firstLock)) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == node && needNodeBothLocks) - { - if (!TryAcquireBucketNodeBothLocks(firstLock)) - { - Thread.Sleep(0); - continue; - } - } - } - - if (secondLock != null) - { - if (secondLock == previous && needPrevNextLock) - { - if (!TryAcquireBucketNodeNextLock(secondLock)) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == next && needNextPrevLock) - { - if (!TryAcquireBucketNodePrevLock(secondLock)) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == node && needNodeBothLocks) - { - if (!TryAcquireBucketNodeBothLocks(secondLock)) - { - Thread.Sleep(0); - continue; - } - } - } - - if (thirdLock != null) - { - if (thirdLock == previous && needPrevNextLock) - { - if (!TryAcquireBucketNodeNextLock(thirdLock)) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == next && needNextPrevLock) - { - if (!TryAcquireBucketNodePrevLock(thirdLock)) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == node && needNodeBothLocks) - { - if (!TryAcquireBucketNodeBothLocks(thirdLock)) - { - Thread.Sleep(0); - continue; - } - } - } - - acquired = true; - - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - if (acquired) - { - // 释放锁 - if (thirdLock == previous && needPrevNextLock) - { - ReleaseBucketNodeNextLock(thirdLock); - } else if (thirdLock == next && needNextPrevLock) - { - ReleaseBucketNodePrevLock(thirdLock); - } else if (thirdLock == node && needNodeBothLocks) { - ReleaseBucketNodeBothLocks(thirdLock); - } - - if (secondLock == previous && needPrevNextLock) - { - ReleaseBucketNodeNextLock(secondLock); - } else if (secondLock == next && needNextPrevLock) - { - ReleaseBucketNodePrevLock(secondLock); - } else if (secondLock == node && needNodeBothLocks) { - ReleaseBucketNodeBothLocks(secondLock); - } - - if (firstLock == previous && needPrevNextLock) - { - ReleaseBucketNodeNextLock(firstLock); - } else if (firstLock == next && needNextPrevLock) - { - ReleaseBucketNodePrevLock(firstLock); - } else if (firstLock == node && needNodeBothLocks) { - ReleaseBucketNodeBothLocks(firstLock); - } - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - return TryAcquireBucketNodeBothLocks(node); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!TryAcquireBucketNodeNextLock(head)) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !TryAcquireBucketNodePrevLock(next)) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - ReleaseBucketNodePrevLock(next); - } - } - } - finally - { - ReleaseBucketNodeNextLock(head); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - } - - #region BucketNode Operations - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != BucketNode.MAGIC_NUMBER; - } - - // BucketNode 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref node->PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) == thread) { - Volatile.Write(ref node->PrevLock, 0); - } - } - - // BucketNode 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) != thread) - { - while (Interlocked.CompareExchange(ref node->NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) == thread) { - Volatile.Write(ref node->NextLock, 0); - } - } - - // BucketNode 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return true; - } - - if (TryAcquireBucketNodePrevLock(node)) - { - if (TryAcquireBucketNodeNextLock(node)) - { - return true; - } else - { - ReleaseBucketNodePrevLock(node); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - ReleaseBucketNodePrevLock(node); - ReleaseBucketNodeNextLock(node); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - AcquireBucketNodePrevLock(node); - AcquireBucketNodeNextLock(node); - } - - #endregion - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/8AE7FB9323EF8244B42EF28161E8F5C6/722D43708EDC12E24403A555015A1067 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/8AE7FB9323EF8244B42EF28161E8F5C6/722D43708EDC12E24403A555015A1067 deleted file mode 100644 index bdfce390..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/8AE7FB9323EF8244B42EF28161E8F5C6/722D43708EDC12E24403A555015A1067 +++ /dev/null @@ -1,534 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - AcquireBucketNodeBothLocks(node); - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - AcquireBucketNodeNextLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !TryAcquireBucketNodePrevLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - ReleaseBucketNodePrevLock(headNode); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeNextLock(node); - } - } - } - } - - /// - /// 根据锁类型释放BucketNode锁 - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeLockByType(BucketNode* node, byte lockType) - { - switch (lockType) - { - case 0: - ReleaseBucketNodePrevLock(node); - break; // PrevLock - case 1: - ReleaseBucketNodeBothLocks(node); - break; // BothLocks - case 2: - ReleaseBucketNodeNextLock(node); - break; // NextLock - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - ReleaseBucketNodeBothLocks(node); - } - - /// - /// 按地址顺序释放BucketNode锁 - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseOrderedBucketLocks(BucketNode* previous, BucketNode* node, BucketNode* next) - { - // 直接释放,顺序不重要 - if (previous != null) - { - ReleaseBucketNodeNextLock(previous); - } - if (node != null) { - ReleaseBucketNodeBothLocks(node); - } - if (next != null) { - ReleaseBucketNodePrevLock(next); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(无锁读取) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - // 简化的地址排序锁获取策略 - if (!TryAcquireOrderedBucketLocks(previous, node, next)) - { - Thread.Sleep(0); - continue; - } - - try - { - // 验证链表结构仍然有效(防止ABA问题) - if (Volatile.Read(ref node->PreviousLevel) != p || Volatile.Read(ref node->NextLevel) != n) - { - Thread.Sleep(0); - continue; - } - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - ReleaseOrderedBucketLocks(previous, node, next); - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - return TryAcquireBucketNodeBothLocks(node); - } - - /// - /// 按地址顺序获取BucketNode锁,避免死锁 - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireOrderedBucketLocks(BucketNode* previous, BucketNode* node, BucketNode* next) - { - // 创建排序数组(使用nuint数组存储地址和锁类型) - nuint prevAddr = (nuint)previous; - nuint nodeAddr = (nuint)node; - nuint nextAddr = (nuint)next; - - - // 使用简单的比较来确定锁的顺序 - if (previous != null && node != null && next != null) - { - // 三个节点都存在,按地址排序 - if (prevAddr < nodeAddr && nodeAddr < nextAddr) - { - // previous -> node -> next - return TryAcquireBucketNodeNextLock(previous) && - TryAcquireBucketNodeBothLocks(node) && - TryAcquireBucketNodePrevLock(next); - } else if (prevAddr < nextAddr && nextAddr < nodeAddr) - { - // previous -> next -> node - return TryAcquireBucketNodeNextLock(previous) && - TryAcquireBucketNodePrevLock(next) && - TryAcquireBucketNodeBothLocks(node); - } else if (nodeAddr < prevAddr && prevAddr < nextAddr) - { - // node -> previous -> next - return TryAcquireBucketNodeBothLocks(node) && - TryAcquireBucketNodeNextLock(previous) && - TryAcquireBucketNodePrevLock(next); - } else if (nodeAddr < nextAddr && nextAddr < prevAddr) - { - // node -> next -> previous - return TryAcquireBucketNodeBothLocks(node) && - TryAcquireBucketNodePrevLock(next) && - TryAcquireBucketNodeNextLock(previous); - } else if (nextAddr < prevAddr && prevAddr < nodeAddr) - { - // next -> previous -> node - return TryAcquireBucketNodePrevLock(next) && - TryAcquireBucketNodeNextLock(previous) && - TryAcquireBucketNodeBothLocks(node); - } else // nextAddr < nodeAddr && nodeAddr < prevAddr - { - // next -> node -> previous - return TryAcquireBucketNodePrevLock(next) && - TryAcquireBucketNodeBothLocks(node) && - TryAcquireBucketNodeNextLock(previous); - } - } else if (previous != null && node != null) - { - // 只有previous和node - if (prevAddr < nodeAddr) - { - return TryAcquireBucketNodeNextLock(previous) && TryAcquireBucketNodeBothLocks(node); - } else - { - return TryAcquireBucketNodeBothLocks(node) && TryAcquireBucketNodeNextLock(previous); - } - } else if (node != null && next != null) - { - // 只有node和next - if (nodeAddr < nextAddr) - { - return TryAcquireBucketNodeBothLocks(node) && TryAcquireBucketNodePrevLock(next); - } else - { - return TryAcquireBucketNodePrevLock(next) && TryAcquireBucketNodeBothLocks(node); - } - } else if (node != null) - { - // 只有node - return TryAcquireBucketNodeBothLocks(node); - } - - return true; // 没有节点需要锁定 - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!TryAcquireBucketNodeNextLock(head)) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !TryAcquireBucketNodePrevLock(next)) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - ReleaseBucketNodePrevLock(next); - } - } - } - finally - { - ReleaseBucketNodeNextLock(head); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - } - - #region BucketNode Operations - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != BucketNode.MAGIC_NUMBER; - } - - // BucketNode 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref node->PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) == thread) { - Volatile.Write(ref node->PrevLock, 0); - } - } - - // BucketNode 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) != thread) - { - while (Interlocked.CompareExchange(ref node->NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) == thread) { - Volatile.Write(ref node->NextLock, 0); - } - } - - // BucketNode 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return true; - } - - if (TryAcquireBucketNodePrevLock(node)) - { - if (TryAcquireBucketNodeNextLock(node)) - { - return true; - } else - { - ReleaseBucketNodePrevLock(node); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - ReleaseBucketNodePrevLock(node); - ReleaseBucketNodeNextLock(node); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - AcquireBucketNodePrevLock(node); - AcquireBucketNodeNextLock(node); - } - - #endregion - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/8AE7FB9323EF8244B42EF28161E8F5C6/7836966E26BCF63D2F012E502C262F08 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/8AE7FB9323EF8244B42EF28161E8F5C6/7836966E26BCF63D2F012E502C262F08 deleted file mode 100644 index 924d259a..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/8AE7FB9323EF8244B42EF28161E8F5C6/7836966E26BCF63D2F012E502C262F08 +++ /dev/null @@ -1,534 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - AcquireBucketNodeBothLocks(node); - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - AcquireBucketNodeNextLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !TryAcquireBucketNodePrevLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - ReleaseBucketNodePrevLock(headNode); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeNextLock(node); - } - } - } - } - - /// - /// 根据锁类型释放BucketNode锁 - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeLockByType(BucketNode* node, byte lockType) - { - switch (lockType) - { - case 0: - ReleaseBucketNodePrevLock(node); - break; // PrevLock - case 1: - ReleaseBucketNodeBothLocks(node); - break; // BothLocks - case 2: - ReleaseBucketNodeNextLock(node); - break; // NextLock - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - ReleaseBucketNodeBothLocks(node); - } - - /// - /// 按地址顺序释放BucketNode锁 - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseOrderedBucketLocks(BucketNode* previous, BucketNode* node, BucketNode* next) - { - // 直接释放,顺序不重要 - if (previous != null) - { - ReleaseBucketNodeNextLock(previous); - } - if (node != null) { - ReleaseBucketNodeBothLocks(node); - } - if (next != null) { - ReleaseBucketNodePrevLock(next); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(无锁读取) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - // 直接抢锁策略:按地址顺序获取锁,避免死锁 - if (!TryAcquireOrderedBucketLocks(previous, node, next)) - { - Thread.Sleep(0); - continue; - } - - try - { - // 验证链表结构仍然有效(防止ABA问题) - if (Volatile.Read(ref node->PreviousLevel) != p || Volatile.Read(ref node->NextLevel) != n) - { - Thread.Sleep(0); - continue; - } - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - ReleaseOrderedBucketLocks(previous, node, next); - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - return TryAcquireBucketNodeBothLocks(node); - } - - /// - /// 按地址顺序获取BucketNode锁,避免死锁 - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireOrderedBucketLocks(BucketNode* previous, BucketNode* node, BucketNode* next) - { - // 创建排序数组(使用nuint数组存储地址和锁类型) - nuint prevAddr = (nuint)previous; - nuint nodeAddr = (nuint)node; - nuint nextAddr = (nuint)next; - - - // 使用简单的比较来确定锁的顺序 - if (previous != null && node != null && next != null) - { - // 三个节点都存在,按地址排序 - if (prevAddr < nodeAddr && nodeAddr < nextAddr) - { - // previous -> node -> next - return TryAcquireBucketNodeNextLock(previous) && - TryAcquireBucketNodeBothLocks(node) && - TryAcquireBucketNodePrevLock(next); - } else if (prevAddr < nextAddr && nextAddr < nodeAddr) - { - // previous -> next -> node - return TryAcquireBucketNodeNextLock(previous) && - TryAcquireBucketNodePrevLock(next) && - TryAcquireBucketNodeBothLocks(node); - } else if (nodeAddr < prevAddr && prevAddr < nextAddr) - { - // node -> previous -> next - return TryAcquireBucketNodeBothLocks(node) && - TryAcquireBucketNodeNextLock(previous) && - TryAcquireBucketNodePrevLock(next); - } else if (nodeAddr < nextAddr && nextAddr < prevAddr) - { - // node -> next -> previous - return TryAcquireBucketNodeBothLocks(node) && - TryAcquireBucketNodePrevLock(next) && - TryAcquireBucketNodeNextLock(previous); - } else if (nextAddr < prevAddr && prevAddr < nodeAddr) - { - // next -> previous -> node - return TryAcquireBucketNodePrevLock(next) && - TryAcquireBucketNodeNextLock(previous) && - TryAcquireBucketNodeBothLocks(node); - } else // nextAddr < nodeAddr && nodeAddr < prevAddr - { - // next -> node -> previous - return TryAcquireBucketNodePrevLock(next) && - TryAcquireBucketNodeBothLocks(node) && - TryAcquireBucketNodeNextLock(previous); - } - } else if (previous != null && node != null) - { - // 只有previous和node - if (prevAddr < nodeAddr) - { - return TryAcquireBucketNodeNextLock(previous) && TryAcquireBucketNodeBothLocks(node); - } else - { - return TryAcquireBucketNodeBothLocks(node) && TryAcquireBucketNodeNextLock(previous); - } - } else if (node != null && next != null) - { - // 只有node和next - if (nodeAddr < nextAddr) - { - return TryAcquireBucketNodeBothLocks(node) && TryAcquireBucketNodePrevLock(next); - } else - { - return TryAcquireBucketNodePrevLock(next) && TryAcquireBucketNodeBothLocks(node); - } - } else if (node != null) - { - // 只有node - return TryAcquireBucketNodeBothLocks(node); - } - - return true; // 没有节点需要锁定 - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!TryAcquireBucketNodeNextLock(head)) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !TryAcquireBucketNodePrevLock(next)) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - ReleaseBucketNodePrevLock(next); - } - } - } - finally - { - ReleaseBucketNodeNextLock(head); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - } - - #region BucketNode Operations - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != BucketNode.MAGIC_NUMBER; - } - - // BucketNode 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref node->PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) == thread) { - Volatile.Write(ref node->PrevLock, 0); - } - } - - // BucketNode 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) != thread) - { - while (Interlocked.CompareExchange(ref node->NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) == thread) { - Volatile.Write(ref node->NextLock, 0); - } - } - - // BucketNode 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return true; - } - - if (TryAcquireBucketNodePrevLock(node)) - { - if (TryAcquireBucketNodeNextLock(node)) - { - return true; - } else - { - ReleaseBucketNodePrevLock(node); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - ReleaseBucketNodePrevLock(node); - ReleaseBucketNodeNextLock(node); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - AcquireBucketNodePrevLock(node); - AcquireBucketNodeNextLock(node); - } - - #endregion - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/8AE7FB9323EF8244B42EF28161E8F5C6/94DD937B0F4CFFD1438FBE47343ECEF9 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/8AE7FB9323EF8244B42EF28161E8F5C6/94DD937B0F4CFFD1438FBE47343ECEF9 deleted file mode 100644 index 924d259a..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/8AE7FB9323EF8244B42EF28161E8F5C6/94DD937B0F4CFFD1438FBE47343ECEF9 +++ /dev/null @@ -1,534 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - AcquireBucketNodeBothLocks(node); - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - AcquireBucketNodeNextLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !TryAcquireBucketNodePrevLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - ReleaseBucketNodePrevLock(headNode); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeNextLock(node); - } - } - } - } - - /// - /// 根据锁类型释放BucketNode锁 - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeLockByType(BucketNode* node, byte lockType) - { - switch (lockType) - { - case 0: - ReleaseBucketNodePrevLock(node); - break; // PrevLock - case 1: - ReleaseBucketNodeBothLocks(node); - break; // BothLocks - case 2: - ReleaseBucketNodeNextLock(node); - break; // NextLock - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - ReleaseBucketNodeBothLocks(node); - } - - /// - /// 按地址顺序释放BucketNode锁 - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseOrderedBucketLocks(BucketNode* previous, BucketNode* node, BucketNode* next) - { - // 直接释放,顺序不重要 - if (previous != null) - { - ReleaseBucketNodeNextLock(previous); - } - if (node != null) { - ReleaseBucketNodeBothLocks(node); - } - if (next != null) { - ReleaseBucketNodePrevLock(next); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(无锁读取) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - // 直接抢锁策略:按地址顺序获取锁,避免死锁 - if (!TryAcquireOrderedBucketLocks(previous, node, next)) - { - Thread.Sleep(0); - continue; - } - - try - { - // 验证链表结构仍然有效(防止ABA问题) - if (Volatile.Read(ref node->PreviousLevel) != p || Volatile.Read(ref node->NextLevel) != n) - { - Thread.Sleep(0); - continue; - } - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - ReleaseOrderedBucketLocks(previous, node, next); - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - return TryAcquireBucketNodeBothLocks(node); - } - - /// - /// 按地址顺序获取BucketNode锁,避免死锁 - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireOrderedBucketLocks(BucketNode* previous, BucketNode* node, BucketNode* next) - { - // 创建排序数组(使用nuint数组存储地址和锁类型) - nuint prevAddr = (nuint)previous; - nuint nodeAddr = (nuint)node; - nuint nextAddr = (nuint)next; - - - // 使用简单的比较来确定锁的顺序 - if (previous != null && node != null && next != null) - { - // 三个节点都存在,按地址排序 - if (prevAddr < nodeAddr && nodeAddr < nextAddr) - { - // previous -> node -> next - return TryAcquireBucketNodeNextLock(previous) && - TryAcquireBucketNodeBothLocks(node) && - TryAcquireBucketNodePrevLock(next); - } else if (prevAddr < nextAddr && nextAddr < nodeAddr) - { - // previous -> next -> node - return TryAcquireBucketNodeNextLock(previous) && - TryAcquireBucketNodePrevLock(next) && - TryAcquireBucketNodeBothLocks(node); - } else if (nodeAddr < prevAddr && prevAddr < nextAddr) - { - // node -> previous -> next - return TryAcquireBucketNodeBothLocks(node) && - TryAcquireBucketNodeNextLock(previous) && - TryAcquireBucketNodePrevLock(next); - } else if (nodeAddr < nextAddr && nextAddr < prevAddr) - { - // node -> next -> previous - return TryAcquireBucketNodeBothLocks(node) && - TryAcquireBucketNodePrevLock(next) && - TryAcquireBucketNodeNextLock(previous); - } else if (nextAddr < prevAddr && prevAddr < nodeAddr) - { - // next -> previous -> node - return TryAcquireBucketNodePrevLock(next) && - TryAcquireBucketNodeNextLock(previous) && - TryAcquireBucketNodeBothLocks(node); - } else // nextAddr < nodeAddr && nodeAddr < prevAddr - { - // next -> node -> previous - return TryAcquireBucketNodePrevLock(next) && - TryAcquireBucketNodeBothLocks(node) && - TryAcquireBucketNodeNextLock(previous); - } - } else if (previous != null && node != null) - { - // 只有previous和node - if (prevAddr < nodeAddr) - { - return TryAcquireBucketNodeNextLock(previous) && TryAcquireBucketNodeBothLocks(node); - } else - { - return TryAcquireBucketNodeBothLocks(node) && TryAcquireBucketNodeNextLock(previous); - } - } else if (node != null && next != null) - { - // 只有node和next - if (nodeAddr < nextAddr) - { - return TryAcquireBucketNodeBothLocks(node) && TryAcquireBucketNodePrevLock(next); - } else - { - return TryAcquireBucketNodePrevLock(next) && TryAcquireBucketNodeBothLocks(node); - } - } else if (node != null) - { - // 只有node - return TryAcquireBucketNodeBothLocks(node); - } - - return true; // 没有节点需要锁定 - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!TryAcquireBucketNodeNextLock(head)) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !TryAcquireBucketNodePrevLock(next)) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - ReleaseBucketNodePrevLock(next); - } - } - } - finally - { - ReleaseBucketNodeNextLock(head); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - } - - #region BucketNode Operations - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != BucketNode.MAGIC_NUMBER; - } - - // BucketNode 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref node->PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) == thread) { - Volatile.Write(ref node->PrevLock, 0); - } - } - - // BucketNode 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) != thread) - { - while (Interlocked.CompareExchange(ref node->NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) == thread) { - Volatile.Write(ref node->NextLock, 0); - } - } - - // BucketNode 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return true; - } - - if (TryAcquireBucketNodePrevLock(node)) - { - if (TryAcquireBucketNodeNextLock(node)) - { - return true; - } else - { - ReleaseBucketNodePrevLock(node); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - ReleaseBucketNodePrevLock(node); - ReleaseBucketNodeNextLock(node); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - AcquireBucketNodePrevLock(node); - AcquireBucketNodeNextLock(node); - } - - #endregion - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/8AE7FB9323EF8244B42EF28161E8F5C6/F1481D5666E0266F32099AD751F704AB b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/8AE7FB9323EF8244B42EF28161E8F5C6/F1481D5666E0266F32099AD751F704AB deleted file mode 100644 index 371db024..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/8AE7FB9323EF8244B42EF28161E8F5C6/F1481D5666E0266F32099AD751F704AB +++ /dev/null @@ -1,567 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - AcquireBucketNodeBothLocks(node); - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - AcquireBucketNodeNextLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !TryAcquireBucketNodePrevLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - ReleaseBucketNodePrevLock(headNode); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeNextLock(node); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - ReleaseBucketNodeBothLocks(node); - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(只读操作,暂时不加锁) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - - // 按照地址顺序获取锁,避免死锁 - BucketNode* firstLock = null, secondLock = null, thirdLock = null; - bool needPrevNextLock = false, needNodeBothLocks = false, needNextPrevLock = false; - - if (previous != null && next != null) - { - // 中间节点:需要修改前驱的next和后继的prev - if ((ulong)previous < (ulong)node && (ulong)node < (ulong)next) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - thirdLock = next; - needNextPrevLock = true; - } else if ((ulong)previous < (ulong)next && (ulong)next < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = next; - needNextPrevLock = true; - thirdLock = node; - needNodeBothLocks = true; - } else // other cases - { - firstLock = next; - needNextPrevLock = true; - secondLock = previous; - needPrevNextLock = true; - thirdLock = node; - needNodeBothLocks = true; - } - } else if (previous != null) - { - // 尾节点:只需要修改前驱的next - if ((ulong)previous < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - } else - { - firstLock = node; - needNodeBothLocks = true; - secondLock = previous; - needPrevNextLock = true; - } - } else - { - Thread.Sleep(0); - continue; - } - - bool acquired = false; - try - { - if (firstLock != null) - { - if (firstLock == previous && needPrevNextLock) - { - if (!TryAcquireBucketNodeNextLock(firstLock)) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == next && needNextPrevLock) - { - if (!TryAcquireBucketNodePrevLock(firstLock)) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == node && needNodeBothLocks) - { - if (!TryAcquireBucketNodeBothLocks(firstLock)) - { - Thread.Sleep(0); - continue; - } - } - } - - if (secondLock != null) - { - if (secondLock == previous && needPrevNextLock) - { - if (!TryAcquireBucketNodeNextLock(secondLock)) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == next && needNextPrevLock) - { - if (!TryAcquireBucketNodePrevLock(secondLock)) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == node && needNodeBothLocks) - { - if (!TryAcquireBucketNodeBothLocks(secondLock)) - { - Thread.Sleep(0); - continue; - } - } - } - - if (thirdLock != null) - { - if (thirdLock == previous && needPrevNextLock) - { - if (!TryAcquireBucketNodeNextLock(thirdLock)) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == next && needNextPrevLock) - { - if (!TryAcquireBucketNodePrevLock(thirdLock)) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == node && needNodeBothLocks) - { - if (!TryAcquireBucketNodeBothLocks(thirdLock)) - { - Thread.Sleep(0); - continue; - } - } - } - - acquired = true; - - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - if (acquired) - { - // 释放锁 - if (thirdLock == previous && needPrevNextLock) - { - ReleaseBucketNodeNextLock(thirdLock); - } else if (thirdLock == next && needNextPrevLock) - { - ReleaseBucketNodePrevLock(thirdLock); - } else if (thirdLock == node && needNodeBothLocks) { - ReleaseBucketNodeBothLocks(thirdLock); - } - - if (secondLock == previous && needPrevNextLock) - { - ReleaseBucketNodeNextLock(secondLock); - } else if (secondLock == next && needNextPrevLock) - { - ReleaseBucketNodePrevLock(secondLock); - } else if (secondLock == node && needNodeBothLocks) { - ReleaseBucketNodeBothLocks(secondLock); - } - - if (firstLock == previous && needPrevNextLock) - { - ReleaseBucketNodeNextLock(firstLock); - } else if (firstLock == next && needNextPrevLock) - { - ReleaseBucketNodePrevLock(firstLock); - } else if (firstLock == node && needNodeBothLocks) { - ReleaseBucketNodeBothLocks(firstLock); - } - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - return TryAcquireBucketNodeBothLocks(node); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!TryAcquireBucketNodeNextLock(head)) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !TryAcquireBucketNodePrevLock(next)) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - ReleaseBucketNodePrevLock(next); - } - } - } - finally - { - ReleaseBucketNodeNextLock(head); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - } - - #region BucketNode Operations - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != BucketNode.MAGIC_NUMBER; - } - - // BucketNode 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref node->PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) == thread) { - Volatile.Write(ref node->PrevLock, 0); - } - } - - // BucketNode 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) != thread) - { - while (Interlocked.CompareExchange(ref node->NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) == thread) { - Volatile.Write(ref node->NextLock, 0); - } - } - - // BucketNode 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return true; - } - - if (TryAcquireBucketNodePrevLock(node)) - { - if (TryAcquireBucketNodeNextLock(node)) - { - return true; - } else - { - ReleaseBucketNodePrevLock(node); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - ReleaseBucketNodePrevLock(node); - ReleaseBucketNodeNextLock(node); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - AcquireBucketNodePrevLock(node); - AcquireBucketNodeNextLock(node); - } - - #endregion - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/8AE7FB9323EF8244B42EF28161E8F5C6/F80916AD0F7515C75C7E004A44839AE5 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/8AE7FB9323EF8244B42EF28161E8F5C6/F80916AD0F7515C75C7E004A44839AE5 deleted file mode 100644 index ad34d5a7..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/8AE7FB9323EF8244B42EF28161E8F5C6/F80916AD0F7515C75C7E004A44839AE5 +++ /dev/null @@ -1,523 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - AcquireBucketNodeBothLocks(node); - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - AcquireBucketNodeNextLock(node); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !TryAcquireBucketNodePrevLock(headNode)) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - ReleaseBucketNodePrevLock(headNode); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - ReleaseBucketNodeNextLock(node); - } - } - } - } - - /// - /// 根据锁类型释放BucketNode锁 - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeLockByType(BucketNode* node, byte lockType) - { - switch (lockType) - { - case 0: - ReleaseBucketNodePrevLock(node); - break; // PrevLock - case 1: - ReleaseBucketNodeBothLocks(node); - break; // BothLocks - case 2: - ReleaseBucketNodeNextLock(node); - break; // NextLock - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - ReleaseBucketNodeBothLocks(node); - } - - /// - /// 按地址顺序释放BucketNode锁 - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseOrderedBucketLocks(BucketNode* previous, BucketNode* node, BucketNode* next) - { - // 直接释放,顺序不重要 - if (previous != null) - { - ReleaseBucketNodeNextLock(previous); - } - if (node != null) { - ReleaseBucketNodeBothLocks(node); - } - if (next != null) { - ReleaseBucketNodePrevLock(next); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(无锁读取) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - // 直接抢锁策略:按地址顺序获取锁,避免死锁 - if (!TryAcquireOrderedBucketLocks(previous, node, next)) - { - Thread.Sleep(0); - continue; - } - - try - { - // 验证链表结构仍然有效(防止ABA问题) - if (Volatile.Read(ref node->PreviousLevel) != p || Volatile.Read(ref node->NextLevel) != n) - { - Thread.Sleep(0); - continue; - } - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - ReleaseOrderedBucketLocks(previous, node, next); - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用HLSFAllocator的private static方法 - return TryAcquireBucketNodeBothLocks(node); - } - - /// - /// 按地址顺序获取BucketNode锁,避免死锁 - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireOrderedBucketLocks(BucketNode* previous, BucketNode* node, BucketNode* next) - { - // 创建排序数组(最多3个非null节点) - Span nodes = stackalloc BucketNode*[3]; - Span lockTypes = stackalloc byte[3]; // 0=prev, 1=both, 2=next - int count = 0; - - if (previous != null) - { - nodes[count] = previous; - lockTypes[count] = 2; // previous需要NextLock - count++; - } - if (node != null) - { - nodes[count] = node; - lockTypes[count] = 1; // node需要BothLocks - count++; - } - if (next != null) - { - nodes[count] = next; - lockTypes[count] = 0; // next需要PrevLock - count++; - } - - - // 按地址排序(简单冒泡排序,最多3个元素) - for (int i = 0; i < count - 1; i++) - { - for (int j = 0; j < count - i - 1; j++) - { - if ((ulong)nodes[j] > (ulong)nodes[j + 1]) - { - (nodes[j], nodes[j + 1]) = (nodes[j + 1], nodes[j]); - (lockTypes[j], lockTypes[j + 1]) = (lockTypes[j + 1], lockTypes[j]); - } - } - } - - - // 按顺序尝试获取锁 - int acquired = 0; - for (int i = 0; i < count; i++) - { - bool success = lockTypes[i] switch - { - 0 => TryAcquireBucketNodePrevLock(nodes[i]), // PrevLock - 1 => TryAcquireBucketNodeBothLocks(nodes[i]), // BothLocks - 2 => TryAcquireBucketNodeNextLock(nodes[i]), // NextLock - _ => false - }; - - if (!success) - { - // 回滚已获取的锁 - for (int j = acquired - 1; j >= 0; j--) - { - ReleaseBucketNodeLockByType(nodes[j], lockTypes[j]); - } - return false; - } - acquired++; - } - return true; - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!TryAcquireBucketNodeNextLock(head)) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !TryAcquireBucketNodePrevLock(next)) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - ReleaseBucketNodePrevLock(next); - } - } - } - finally - { - ReleaseBucketNodeNextLock(head); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - } - - #region BucketNode Operations - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != BucketNode.MAGIC_NUMBER; - } - - // BucketNode 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref node->PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) == thread) { - Volatile.Write(ref node->PrevLock, 0); - } - } - - // BucketNode 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) != thread) - { - while (Interlocked.CompareExchange(ref node->NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) == thread) { - Volatile.Write(ref node->NextLock, 0); - } - } - - // BucketNode 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return true; - } - - if (TryAcquireBucketNodePrevLock(node)) - { - if (TryAcquireBucketNodeNextLock(node)) - { - return true; - } else - { - ReleaseBucketNodePrevLock(node); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void ReleaseBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - ReleaseBucketNodePrevLock(node); - ReleaseBucketNodeNextLock(node); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static void AcquireBucketNodeBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - AcquireBucketNodePrevLock(node); - AcquireBucketNodeNextLock(node); - } - - #endregion - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/0F12EF88149E0F6598D2861781199439 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/0F12EF88149E0F6598D2861781199439 deleted file mode 100644 index 88556cfa..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/0F12EF88149E0F6598D2861781199439 +++ /dev/null @@ -1,160 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Alloc.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Threading; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private BufferExpansionLock _spareLock = new(); - - public hlsfHandle Alloc(uint size) - { - ArgumentOutOfRangeException.ThrowIfGreaterThan(size, (nuint)levelSize[^1] * 2); - int level = GetLevelFromSize(size); - int segmentIndex = DetermineSegmentIndex(size, level); - - int i = level, s = segmentIndex; - if (TryPopLevelForAllocation(i, s, out Entry* handle)) - { - handle->SetState(EntryState.Allocated); - return new hlsfHandle(handle, size); - } - - fallback: - i = level; - s = segmentIndex; - while (!TryPopLevelForAllocation(i, s, out handle)) - { - if (++s >= 3) - { - s = 0; - i++; - } - if (i >= levelSize.Length) - { - if (TryAllocateNew16MBBlock(out handle)) - { - break; - } - Thread.Sleep(0); - goto fallback; - } - } - - if (handle != null) - { - SliceMemory(handle, (segmentIndex + 1) * levelSize[level]); - handle->SetState(EntryState.Allocated); - } - - return new hlsfHandle(handle, size); - } - - private void SliceMemory(Entry* e, int offset) { } - - /// - /// Try to allocate a new 16MB block when all buckets are empty - /// - /// - /// Output handle to the allocated Entry - /// - /// - /// True if allocation succeeded - /// - private bool TryAllocateNew16MBBlock(out Entry* handle) - { - nuint pos = Volatile.Read(ref _spareMemory->Position); - nuint blockSize = (nuint)levelSize[^1] * 2; // Use last level size (16MB) - nuint newPos = pos + blockSize; - - // Check if we have enough space - if (newPos > ((nuint)m_Buffer) + _size) - { - handle = null; - return false; // Out of memory - } - - // Try to allocate new Entry from slab allocator - try - { - handle = (Entry*)_nodes.Allocate(); - handle->Position = pos; - handle->Size = (uint)blockSize; - handle->SetState(EntryState.ThreadOccupied); - handle->NextNear = EmptyHandle; - handle->PreviousNear = EmptyHandle; - handle->Level = GetLevelFromSize((uint)blockSize); - - - // 初始化双锁为未锁定状态 - handle->PrevLock = 0; - handle->NextLock = 0; - - // Update spare memory position - _spareMemory->Position = newPos; - - return true; - } - catch - { - handle = null; - return false; - } - } - - /// - /// Helper method for allocation - converts BucketNode to Entry - /// - private bool TryPopLevelForAllocation(int levelIndex, int sizeIndex, out Entry* entry) - { - if (TryPopLevel(levelIndex, sizeIndex, out BucketNode* bucketNode)) - { - entry = bucketNode->EntryRef; - return entry != null; - } - entry = null; - return false; - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/15ECA87E3A6524336A306184CCF4359E b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/15ECA87E3A6524336A306184CCF4359E deleted file mode 100644 index cdcdb990..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/15ECA87E3A6524336A306184CCF4359E +++ /dev/null @@ -1,157 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Alloc.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Threading; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private BufferExpansionLock _spareLock = new(); - - public hlsfHandle Alloc(uint size) - { - ArgumentOutOfRangeException.ThrowIfGreaterThan(size, (nuint)levelSize[^1] * 2); - int level = GetLevelFromSize(size); - int segmentIndex = DetermineSegmentIndex(size, level); - - int i = level, s = segmentIndex; - if (TryPopLevelForAllocation(i, s, out Entry* handle)) - { - handle->State = EntryState.Allocated; - return new hlsfHandle(handle, size); - } - - fallback: - i = level; - s = segmentIndex; - while (!TryPopLevelForAllocation(i, s, out handle)) - { - if (++s >= 3) - { - s = 0; - i++; - } - if (i >= levelSize.Length) - { - if (TryAllocateNew16MBBlock(out handle)) - { - break; - } - Thread.Sleep(0); - goto fallback; - } - } - - if (handle != null) - { - SliceMemory(handle, (segmentIndex + 1) * levelSize[level]); - handle->State = EntryState.Allocated; - } - - return new hlsfHandle(handle, size); - } - - private void SliceMemory(Entry* e, int offset) { } - - /// - /// Try to allocate a new 16MB block when all buckets are empty - /// - /// - /// Output handle to the allocated Entry - /// - /// - /// True if allocation succeeded - /// - private bool TryAllocateNew16MBBlock(out Entry* handle) - { - nuint pos = Volatile.Read(ref _spareMemory->Position); - nuint blockSize = (nuint)levelSize[^1] * 2; // Use last level size (16MB) - nuint newPos = pos + blockSize; - - - // Check if we have enough space - if (newPos > ((nuint)m_Buffer) + _size) - { - handle = null; - return false; // Out of memory - } - - // Try to allocate new Entry from slab allocator - try - { - handle = (Entry*)_nodes.Allocate(); - handle->Position = pos; - handle->Size = (uint)blockSize; - handle->State = EntryState.ThreadOccupied; - handle->NextNear = EmptyHandle; - handle->PreviousNear = EmptyHandle; - handle->SpinLock = 0; - - - // Update spare memory position - _spareMemory->Position = newPos; - - return true; - } - catch - { - handle = null; - return false; - } - } - - /// - /// Helper method for allocation - converts BucketNode to Entry - /// - private bool TryPopLevelForAllocation(int levelIndex, int sizeIndex, out Entry* entry) - { - if (TryPopLevel(levelIndex, sizeIndex, out BucketNode* bucketNode)) - { - entry = bucketNode->EntryRef; - return entry != null; - } - entry = null; - return false; - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/1C013A2F0C580DFA65907BA00885F705 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/1C013A2F0C580DFA65907BA00885F705 deleted file mode 100644 index d63ec980..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/1C013A2F0C580DFA65907BA00885F705 +++ /dev/null @@ -1,378 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - if (entry != null) - { - while (!entry->TryAcquireSelfOp()) { - Thread.Sleep(0); - } - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private void MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = -1; - int segment = DetermineSegmentIndex(size, originLevel); - if (TryAcquireEntrySpinLock(entry)) { - return; - } - - // current Level merge - while (originLevel != entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - AcquireBucketNodeSpinLock((BucketNode*)entry->Position); - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - RemoveFromBucket(originLevel, segment, (BucketNode*)near->Position); - } - - // forward merging - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - } - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - if (entry != null) - { - entry->ReleaseSelfOp(); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - return entry == null || entry->TryAcquireSelfOp(); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(26)] internal byte NextOpMask; // Next pointer operation (Free=0, Occupied=1) - [FieldOffset(25)] internal byte PrevOpMask; // Previous pointer operation (Free=0, Occupied=1) - [FieldOffset(27)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations (replacing SpinLock) - [FieldOffset(24)] internal byte StateMask; // Entry state (Empty=0, Allocated=1, ThreadOccupied=2, Merging=3) - - [FieldOffset(28)] internal int _reserved; // Reserved for future use - - [FieldOffset(36)] internal int Level; // Level of the block in the allocator - [FieldOffset(32)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - #region Four Independent Byte Masks for Entry - - // State constants - public const byte StateEmpty = 0; - public const byte StateAllocated = 1; - public const byte StateThreadOccupied = 2; - public const byte StateMerging = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // 字节级原子操作 - 使用简单的volatile操作(调用者自觉模式) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - byte current = Volatile.Read(ref StateMask); - if (current != expectedState) { - return false; - } - - Volatile.Write(ref StateMask, newState); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Previous operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevOp() - { - byte current = Volatile.Read(ref PrevOpMask); - if (current != OpFree) { - return false; - } - - Volatile.Write(ref PrevOpMask, OpOccupied); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevOp() - { - Volatile.Write(ref PrevOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevOpOccupied() => Volatile.Read(ref PrevOpMask) == OpOccupied; - - // Next operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextOp() - { - byte current = Volatile.Read(ref NextOpMask); - if (current != OpFree) { - return false; - } - - Volatile.Write(ref NextOpMask, OpOccupied); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextOp() - { - Volatile.Write(ref NextOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextOpOccupied() => Volatile.Read(ref NextOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - byte current = Volatile.Read(ref SelfOpMask); - if (current != OpFree) { - return false; - } - - Volatile.Write(ref SelfOpMask, OpOccupied); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsAllocated() => GetState() == StateAllocated; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsThreadOccupied() => GetState() == StateThreadOccupied; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMerging() => GetState() == StateMerging; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsPrevOpOccupied() || IsNextOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - // 更新后的EntryState常量类 - 与新的字节掩码设计兼容 - private static class EntryState - { - - public const byte Allocated = 1; // Already allocated to user - public const byte Empty = 0; // Free, can be allocated - public const byte Merging = 3; // Currently being merged - public const byte ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/2AB9D9000632DBD9957009B8F7769E9D b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/2AB9D9000632DBD9957009B8F7769E9D deleted file mode 100644 index b5ba0212..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/2AB9D9000632DBD9957009B8F7769E9D +++ /dev/null @@ -1,91 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Free.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Buffers; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - /// - /// Free allocated memory block and perform adjacent block merging - /// - /// - /// Handle to the allocated memory block - /// - public void Free(hlsfHandle handle) - { - Entry* e = handle.EntryHandle; - if (e == null) { - return; - } - AcquireEntrySpinLock(e); - try - { - if (e->State != EntryState.Allocated) { - return; - } - e->State = EntryState.ThreadOccupied; - - // Step 4: Try merge with adjacent free blocks and remove them from buckets - Entry* mergedEntry = TryMergeAndRemoveFromBuckets(e); - - - // Step 5: Calculate final level and segment for the merged block - uint finalSize = mergedEntry->Size; - int finalLevel = GetLevelFromSize(finalSize); - int finalSegment = DetermineSegmentIndex(finalSize, finalLevel); - - // Step 6: Set the merged entry state to Empty (ready to be reused) - mergedEntry->State = EntryState.Empty; - - // Step 7: Push the merged entry back to appropriate bucket - PushLevel(finalLevel, finalSegment, (BucketNode*)mergedEntry->Position); - - // Note: If mergedEntry is different from original e, the original e - // and any merged entries have already been freed to _nodes by TryMergeAndRemoveFromBuckets - } - finally - { - // Step 8: Always release the spin lock - ReleaseEntrySpinLock(e); - } - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/2AFE2A8804F82A2FFA5AEE33716A587F b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/2AFE2A8804F82A2FFA5AEE33716A587F deleted file mode 100644 index e6119d69..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/2AFE2A8804F82A2FFA5AEE33716A587F +++ /dev/null @@ -1,119 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Buffers; -using System.Runtime.InteropServices; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator : IDisposable - { - - private static readonly nuint EmptyHandle = (nuint)(void*)null; - - // Bucket system field - directly in main allocator class - private ulong[] _bucketHeads; - - private Entry* _spareMemory; - private readonly byte* m_Buffer; - private bool disposedValue; - private readonly int _align; - private readonly nuint _size; - private readonly SlabAllocator _nodes; - - public HybridLayerSegregatedFitAllocator(nuint byteSize) - { - if (byteSize < 64) { - throw new InvalidOperationException(); - } - _nodes = SlabAllocator.Create(64, BufferLayout.Chunked); - _size = byteSize; - m_Buffer = (byte*)NativeMemory.AlignedAlloc(byteSize, 16); - _align = 16; - - - // 初始化桶系统 - InitializeBucketSystem(); - - - // 初始化spareMemory - _spareMemory = (Entry*)_nodes.Allocate(); - _spareMemory->State = EntryState.ThreadOccupied; - _spareMemory->NextNear = EmptyHandle; - _spareMemory->Position = (nuint)m_Buffer; - } - - public HybridLayerSegregatedFitAllocator(nuint byteSize, int align) - { - if (align < 16 || (align & (align - 1)) != 0) { - throw new ArgumentException( - "Alignment must be a power of two and at least 8 bytes."); - } - _nodes = SlabAllocator.Create(64, BufferLayout.Chunked); - m_Buffer = (byte*)NativeMemory.AlignedAlloc(byteSize, (nuint)align); - _align = align; - _size = byteSize; - - InitializeBucketSystem(); - - - // 初始化spareMemory - _spareMemory = (Entry*)_nodes.Allocate(); - _spareMemory->State = EntryState.ThreadOccupied; - _spareMemory->NextNear = EmptyHandle; - _spareMemory->Position = (nuint)m_Buffer; - } - - public void Dispose() - { - Dispose(disposing:true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - if (!disposedValue) - { - if (disposing) { - _nodes.Dispose(); - } - NativeMemory.AlignedFree(m_Buffer); - disposedValue = true; - } - } - - ~HybridLayerSegregatedFitAllocator() - { - Dispose(disposing:false); - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/3208284FEA4EA068C8DADDBA33C656A4 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/3208284FEA4EA068C8DADDBA33C656A4 deleted file mode 100644 index 8593de9d..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/3208284FEA4EA068C8DADDBA33C656A4 +++ /dev/null @@ -1,377 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,获取两个锁 - if (entry != null) - { - entry->AcquirePrevLock(); - entry->AcquireNextLock(); - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private void MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = -1; - int segment = DetermineSegmentIndex(size, originLevel); - if (TryAcquireEntrySpinLock(entry)) { - return; - } - - // current Level merge - while (originLevel != entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - AcquireBucketNodeSpinLock((BucketNode*)entry->Position); - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - RemoveFromBucket(originLevel, segment, (BucketNode*)near->Position); - } - - // forward merging - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - } - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,释放两个锁 - if (entry != null) - { - entry->ReleaseBothLocks(); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,尝试获取两个锁 - return entry == null || entry->TryAcquireBothLocks(); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(26)] internal byte NextOpMask; // Next pointer operation (Free=0, Occupied=1) - [FieldOffset(25)] internal byte PrevOpMask; // Previous pointer operation (Free=0, Occupied=1) - [FieldOffset(27)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations (replacing SpinLock) - [FieldOffset(24)] internal byte StateMask; // Entry state (Empty=0, Allocated=1, ThreadOccupied=2, Merging=3) - - [FieldOffset(28)] internal int _reserved; // Reserved for future use - - [FieldOffset(36)] internal int Level; // Level of the block in the allocator - [FieldOffset(32)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - #region Four Independent Byte Masks for Entry - - // State constants - public const byte StateEmpty = 0; - public const byte StateAllocated = 1; - public const byte StateThreadOccupied = 2; - public const byte StateMerging = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // 字节级原子操作 - 使用简单的volatile操作(调用者自觉模式) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - byte current = Volatile.Read(ref StateMask); - if (current != expectedState) { - return false; - } - - Volatile.Write(ref StateMask, newState); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Previous operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevOp() - { - byte current = Volatile.Read(ref PrevOpMask); - if (current != OpFree) { - return false; - } - - Volatile.Write(ref PrevOpMask, OpOccupied); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevOp() - { - Volatile.Write(ref PrevOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevOpOccupied() => Volatile.Read(ref PrevOpMask) == OpOccupied; - - // Next operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextOp() - { - byte current = Volatile.Read(ref NextOpMask); - if (current != OpFree) { - return false; - } - - Volatile.Write(ref NextOpMask, OpOccupied); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextOp() - { - Volatile.Write(ref NextOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextOpOccupied() => Volatile.Read(ref NextOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - byte current = Volatile.Read(ref SelfOpMask); - if (current != OpFree) { - return false; - } - - Volatile.Write(ref SelfOpMask, OpOccupied); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsAllocated() => GetState() == StateAllocated; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsThreadOccupied() => GetState() == StateThreadOccupied; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMerging() => GetState() == StateMerging; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsPrevOpOccupied() || IsNextOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - // 更新后的EntryState常量类 - 与新的字节掩码设计兼容 - private static class EntryState - { - - public const byte Allocated = 1; // Already allocated to user - public const byte Empty = 0; // Free, can be allocated - public const byte Merging = 3; // Currently being merged - public const byte ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/3C3CEA1E27E48F19FD2C2F6291175C48 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/3C3CEA1E27E48F19FD2C2F6291175C48 deleted file mode 100644 index 0c7ef8b9..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/3C3CEA1E27E48F19FD2C2F6291175C48 +++ /dev/null @@ -1,123 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Buffers; -using System.Runtime.InteropServices; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator : IDisposable - { - - private static readonly nuint EmptyHandle = (nuint)(void*)null; - - // Bucket system field - directly in main allocator class - private ulong[] _bucketHeads; - - private Entry* _spareMemory; - private readonly byte* m_Buffer; - private bool disposedValue; - private readonly int _align; - private readonly nuint _size; - private readonly SlabAllocator _nodes; - - public HybridLayerSegregatedFitAllocator(nuint byteSize) - { - if (byteSize < 64) { - throw new InvalidOperationException(); - } - _nodes = SlabAllocator.Create(64, BufferLayout.Chunked); - _size = byteSize; - m_Buffer = (byte*)NativeMemory.AlignedAlloc(byteSize, 16); - _align = 16; - - - // 初始化桶系统 - InitializeBucketSystem(); - - - // 初始化spareMemory - _spareMemory = (Entry*)_nodes.Allocate(); - _spareMemory->SetState(EntryState.ThreadOccupied); - _spareMemory->NextNear = EmptyHandle; - _spareMemory->Position = (nuint)m_Buffer; - _spareMemory->PrevLock = 0; - _spareMemory->NextLock = 0; - } - - public HybridLayerSegregatedFitAllocator(nuint byteSize, int align) - { - if (align < 16 || (align & (align - 1)) != 0) { - throw new ArgumentException( - "Alignment must be a power of two and at least 8 bytes."); - } - _nodes = SlabAllocator.Create(64, BufferLayout.Chunked); - m_Buffer = (byte*)NativeMemory.AlignedAlloc(byteSize, (nuint)align); - _align = align; - _size = byteSize; - - InitializeBucketSystem(); - - - // 初始化spareMemory - _spareMemory = (Entry*)_nodes.Allocate(); - _spareMemory->SetState(EntryState.ThreadOccupied); - _spareMemory->NextNear = EmptyHandle; - _spareMemory->Position = (nuint)m_Buffer; - _spareMemory->PrevLock = 0; - _spareMemory->NextLock = 0; - } - - public void Dispose() - { - Dispose(disposing:true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - if (!disposedValue) - { - if (disposing) { - _nodes.Dispose(); - } - NativeMemory.AlignedFree(m_Buffer); - disposedValue = true; - } - } - - ~HybridLayerSegregatedFitAllocator() - { - Dispose(disposing:false); - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/4B4C918B463CF3806A15775F2FBD86EC b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/4B4C918B463CF3806A15775F2FBD86EC deleted file mode 100644 index cdcdb990..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/4B4C918B463CF3806A15775F2FBD86EC +++ /dev/null @@ -1,157 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Alloc.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Threading; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private BufferExpansionLock _spareLock = new(); - - public hlsfHandle Alloc(uint size) - { - ArgumentOutOfRangeException.ThrowIfGreaterThan(size, (nuint)levelSize[^1] * 2); - int level = GetLevelFromSize(size); - int segmentIndex = DetermineSegmentIndex(size, level); - - int i = level, s = segmentIndex; - if (TryPopLevelForAllocation(i, s, out Entry* handle)) - { - handle->State = EntryState.Allocated; - return new hlsfHandle(handle, size); - } - - fallback: - i = level; - s = segmentIndex; - while (!TryPopLevelForAllocation(i, s, out handle)) - { - if (++s >= 3) - { - s = 0; - i++; - } - if (i >= levelSize.Length) - { - if (TryAllocateNew16MBBlock(out handle)) - { - break; - } - Thread.Sleep(0); - goto fallback; - } - } - - if (handle != null) - { - SliceMemory(handle, (segmentIndex + 1) * levelSize[level]); - handle->State = EntryState.Allocated; - } - - return new hlsfHandle(handle, size); - } - - private void SliceMemory(Entry* e, int offset) { } - - /// - /// Try to allocate a new 16MB block when all buckets are empty - /// - /// - /// Output handle to the allocated Entry - /// - /// - /// True if allocation succeeded - /// - private bool TryAllocateNew16MBBlock(out Entry* handle) - { - nuint pos = Volatile.Read(ref _spareMemory->Position); - nuint blockSize = (nuint)levelSize[^1] * 2; // Use last level size (16MB) - nuint newPos = pos + blockSize; - - - // Check if we have enough space - if (newPos > ((nuint)m_Buffer) + _size) - { - handle = null; - return false; // Out of memory - } - - // Try to allocate new Entry from slab allocator - try - { - handle = (Entry*)_nodes.Allocate(); - handle->Position = pos; - handle->Size = (uint)blockSize; - handle->State = EntryState.ThreadOccupied; - handle->NextNear = EmptyHandle; - handle->PreviousNear = EmptyHandle; - handle->SpinLock = 0; - - - // Update spare memory position - _spareMemory->Position = newPos; - - return true; - } - catch - { - handle = null; - return false; - } - } - - /// - /// Helper method for allocation - converts BucketNode to Entry - /// - private bool TryPopLevelForAllocation(int levelIndex, int sizeIndex, out Entry* entry) - { - if (TryPopLevel(levelIndex, sizeIndex, out BucketNode* bucketNode)) - { - entry = bucketNode->EntryRef; - return entry != null; - } - entry = null; - return false; - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/6076650BD7D728A66708DE4D50D69C40 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/6076650BD7D728A66708DE4D50D69C40 deleted file mode 100644 index 694e060f..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/6076650BD7D728A66708DE4D50D69C40 +++ /dev/null @@ -1,157 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Alloc.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Threading; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private BufferExpansionLock _spareLock = new(); - - public hlsfHandle Alloc(uint size) - { - ArgumentOutOfRangeException.ThrowIfGreaterThan(size, (nuint)levelSize[^1] * 2); - int level = GetLevelFromSize(size); - int segmentIndex = DetermineSegmentIndex(size, level); - - int i = level, s = segmentIndex; - if (TryPopLevelForAllocation(i, s, out Entry* handle)) - { - handle->SetState(EntryState.Allocated); - return new hlsfHandle(handle, size); - } - - fallback: - i = level; - s = segmentIndex; - while (!TryPopLevelForAllocation(i, s, out handle)) - { - if (++s >= 3) - { - s = 0; - i++; - } - if (i >= levelSize.Length) - { - if (TryAllocateNew16MBBlock(out handle)) - { - break; - } - Thread.Sleep(0); - goto fallback; - } - } - - if (handle != null) - { - SliceMemory(handle, (segmentIndex + 1) * levelSize[level]); - handle->SetState(EntryState.Allocated); - } - - return new hlsfHandle(handle, size); - } - - private void SliceMemory(Entry* e, int offset) { } - - /// - /// Try to allocate a new 16MB block when all buckets are empty - /// - /// - /// Output handle to the allocated Entry - /// - /// - /// True if allocation succeeded - /// - private bool TryAllocateNew16MBBlock(out Entry* handle) - { - nuint pos = Volatile.Read(ref _spareMemory->Position); - nuint blockSize = (nuint)levelSize[^1] * 2; // Use last level size (16MB) - nuint newPos = pos + blockSize; - - - // Check if we have enough space - if (newPos > ((nuint)m_Buffer) + _size) - { - handle = null; - return false; // Out of memory - } - - // Try to allocate new Entry from slab allocator - try - { - handle = (Entry*)_nodes.Allocate(); - handle->Position = pos; - handle->Size = (uint)blockSize; - handle->State = EntryState.ThreadOccupied; - handle->NextNear = EmptyHandle; - handle->PreviousNear = EmptyHandle; - handle->SpinLock = 0; - - - // Update spare memory position - _spareMemory->Position = newPos; - - return true; - } - catch - { - handle = null; - return false; - } - } - - /// - /// Helper method for allocation - converts BucketNode to Entry - /// - private bool TryPopLevelForAllocation(int levelIndex, int sizeIndex, out Entry* entry) - { - if (TryPopLevel(levelIndex, sizeIndex, out BucketNode* bucketNode)) - { - entry = bucketNode->EntryRef; - return entry != null; - } - entry = null; - return false; - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/6F8605672BC6B8778ADB15A0C2DE36DA b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/6F8605672BC6B8778ADB15A0C2DE36DA deleted file mode 100644 index 4457088d..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/6F8605672BC6B8778ADB15A0C2DE36DA +++ /dev/null @@ -1,90 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Free.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Buffers; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - /// - /// Free allocated memory block and perform adjacent block merging - /// - /// - /// Handle to the allocated memory block - /// - public void Free(hlsfHandle handle) - { - Entry* e = handle.EntryHandle; - if (e == null) { - return; - } - AcquireEntrySpinLock(e); - try - { - if (e->GetState() != EntryState.Allocated) { - return; - } - e->SetState(EntryState.ThreadOccupied); - - // Step 4: Try merge with adjacent free blocks and remove them from buckets - Entry* mergedEntry = MergeAndRemoveFromBuckets(e); - - // Step 5: Calculate final level and segment for the merged block - uint finalSize = mergedEntry->Size; - int finalLevel = GetLevelFromSize(finalSize); - int finalSegment = DetermineSegmentIndex(finalSize, finalLevel); - - // Step 6: Set the merged entry state to Empty (ready to be reused) - mergedEntry->SetState(EntryState.Empty); - - // Step 7: Push the merged entry back to appropriate bucket - PushLevel(finalLevel, finalSegment, (BucketNode*)mergedEntry->Position); - - // Note: If mergedEntry is different from original e, the original e - // and any merged entries have already been freed to _nodes by MergeAndRemoveFromBuckets - } - finally - { - // Step 8: Always release the spin lock - ReleaseEntrySpinLock(e); - } - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/77DA1642FF8B0DC1F1DA13D99169CF30 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/77DA1642FF8B0DC1F1DA13D99169CF30 deleted file mode 100644 index d63ec980..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/77DA1642FF8B0DC1F1DA13D99169CF30 +++ /dev/null @@ -1,378 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - if (entry != null) - { - while (!entry->TryAcquireSelfOp()) { - Thread.Sleep(0); - } - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private void MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = -1; - int segment = DetermineSegmentIndex(size, originLevel); - if (TryAcquireEntrySpinLock(entry)) { - return; - } - - // current Level merge - while (originLevel != entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - AcquireBucketNodeSpinLock((BucketNode*)entry->Position); - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - RemoveFromBucket(originLevel, segment, (BucketNode*)near->Position); - } - - // forward merging - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - } - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - if (entry != null) - { - entry->ReleaseSelfOp(); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用新的自操作锁代替SpinLock - return entry == null || entry->TryAcquireSelfOp(); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(26)] internal byte NextOpMask; // Next pointer operation (Free=0, Occupied=1) - [FieldOffset(25)] internal byte PrevOpMask; // Previous pointer operation (Free=0, Occupied=1) - [FieldOffset(27)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations (replacing SpinLock) - [FieldOffset(24)] internal byte StateMask; // Entry state (Empty=0, Allocated=1, ThreadOccupied=2, Merging=3) - - [FieldOffset(28)] internal int _reserved; // Reserved for future use - - [FieldOffset(36)] internal int Level; // Level of the block in the allocator - [FieldOffset(32)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - #region Four Independent Byte Masks for Entry - - // State constants - public const byte StateEmpty = 0; - public const byte StateAllocated = 1; - public const byte StateThreadOccupied = 2; - public const byte StateMerging = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // 字节级原子操作 - 使用简单的volatile操作(调用者自觉模式) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - byte current = Volatile.Read(ref StateMask); - if (current != expectedState) { - return false; - } - - Volatile.Write(ref StateMask, newState); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Previous operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevOp() - { - byte current = Volatile.Read(ref PrevOpMask); - if (current != OpFree) { - return false; - } - - Volatile.Write(ref PrevOpMask, OpOccupied); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevOp() - { - Volatile.Write(ref PrevOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevOpOccupied() => Volatile.Read(ref PrevOpMask) == OpOccupied; - - // Next operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextOp() - { - byte current = Volatile.Read(ref NextOpMask); - if (current != OpFree) { - return false; - } - - Volatile.Write(ref NextOpMask, OpOccupied); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextOp() - { - Volatile.Write(ref NextOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextOpOccupied() => Volatile.Read(ref NextOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - byte current = Volatile.Read(ref SelfOpMask); - if (current != OpFree) { - return false; - } - - Volatile.Write(ref SelfOpMask, OpOccupied); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsAllocated() => GetState() == StateAllocated; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsThreadOccupied() => GetState() == StateThreadOccupied; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMerging() => GetState() == StateMerging; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsPrevOpOccupied() || IsNextOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - // 更新后的EntryState常量类 - 与新的字节掩码设计兼容 - private static class EntryState - { - - public const byte Allocated = 1; // Already allocated to user - public const byte Empty = 0; // Free, can be allocated - public const byte Merging = 3; // Currently being merged - public const byte ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/8836D899503AD91182371D35A4BC0988 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/8836D899503AD91182371D35A4BC0988 deleted file mode 100644 index 8593de9d..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/8836D899503AD91182371D35A4BC0988 +++ /dev/null @@ -1,377 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,获取两个锁 - if (entry != null) - { - entry->AcquirePrevLock(); - entry->AcquireNextLock(); - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private void MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = -1; - int segment = DetermineSegmentIndex(size, originLevel); - if (TryAcquireEntrySpinLock(entry)) { - return; - } - - // current Level merge - while (originLevel != entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - AcquireBucketNodeSpinLock((BucketNode*)entry->Position); - - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - RemoveFromBucket(originLevel, segment, (BucketNode*)near->Position); - } - - // forward merging - while (true) - { - ulong n = entry->NextNear; - Entry* near = (Entry*)n; - if (near == null || - near->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, near) || - entry->Level != near->Level || - !AssertAlignBoundry(offset, near, entry->Level) || - !TryAcquireEntrySpinLock(near)) - { - break; - } - } - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,释放两个锁 - if (entry != null) - { - entry->ReleaseBothLocks(); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,尝试获取两个锁 - return entry == null || entry->TryAcquireBothLocks(); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(26)] internal byte NextOpMask; // Next pointer operation (Free=0, Occupied=1) - [FieldOffset(25)] internal byte PrevOpMask; // Previous pointer operation (Free=0, Occupied=1) - [FieldOffset(27)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations (replacing SpinLock) - [FieldOffset(24)] internal byte StateMask; // Entry state (Empty=0, Allocated=1, ThreadOccupied=2, Merging=3) - - [FieldOffset(28)] internal int _reserved; // Reserved for future use - - [FieldOffset(36)] internal int Level; // Level of the block in the allocator - [FieldOffset(32)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - #region Four Independent Byte Masks for Entry - - // State constants - public const byte StateEmpty = 0; - public const byte StateAllocated = 1; - public const byte StateThreadOccupied = 2; - public const byte StateMerging = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // 字节级原子操作 - 使用简单的volatile操作(调用者自觉模式) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - byte current = Volatile.Read(ref StateMask); - if (current != expectedState) { - return false; - } - - Volatile.Write(ref StateMask, newState); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Previous operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevOp() - { - byte current = Volatile.Read(ref PrevOpMask); - if (current != OpFree) { - return false; - } - - Volatile.Write(ref PrevOpMask, OpOccupied); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevOp() - { - Volatile.Write(ref PrevOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevOpOccupied() => Volatile.Read(ref PrevOpMask) == OpOccupied; - - // Next operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextOp() - { - byte current = Volatile.Read(ref NextOpMask); - if (current != OpFree) { - return false; - } - - Volatile.Write(ref NextOpMask, OpOccupied); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextOp() - { - Volatile.Write(ref NextOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextOpOccupied() => Volatile.Read(ref NextOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - byte current = Volatile.Read(ref SelfOpMask); - if (current != OpFree) { - return false; - } - - Volatile.Write(ref SelfOpMask, OpOccupied); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsAllocated() => GetState() == StateAllocated; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsThreadOccupied() => GetState() == StateThreadOccupied; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMerging() => GetState() == StateMerging; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsPrevOpOccupied() || IsNextOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - // 更新后的EntryState常量类 - 与新的字节掩码设计兼容 - private static class EntryState - { - - public const byte Allocated = 1; // Already allocated to user - public const byte Empty = 0; // Free, can be allocated - public const byte Merging = 3; // Currently being merged - public const byte ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/A65B83C22F91BDBF414960FEA0AFDB8A b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/A65B83C22F91BDBF414960FEA0AFDB8A deleted file mode 100644 index 67856675..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/A65B83C22F91BDBF414960FEA0AFDB8A +++ /dev/null @@ -1,437 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,获取两个锁 - if (entry != null) - { - entry->AcquirePrevLock(); - entry->AcquireNextLock(); - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private Entry* MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return null; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = GetLevelFromSize(size); - int segment = DetermineSegmentIndex(size, originLevel); - - if (!TryAcquireEntrySpinLock(entry)) - { - return entry; // 无法获取锁,返回原Entry - } - - try - { - // 设置状态为合并中 - entry->TrySetState(EntryState.Empty, EntryState.Merging); - - - // current Level merge - while (originLevel <= entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - - - // backward merging - 向前合并 - while (true) - { - ulong p = entry->PreviousNear; - Entry* prev = (Entry*)p; - if (prev == null || - prev->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, prev) || - entry->Level != prev->Level || - !AssertAlignBoundry(offset, prev, entry->Level) || - !TryAcquireEntrySpinLock(prev)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)prev->Position); - MergeEntry(entry, prev); - RecycleEntry(prev); - } - finally - { - ReleaseEntrySpinLock(prev); - } - } - - // forward merging - 向后合并 - while (true) - { - ulong n = entry->NextNear; - Entry* next = (Entry*)n; - if (next == null || - next->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, next) || - entry->Level != next->Level || - !AssertAlignBoundry(offset, next, entry->Level) || - !TryAcquireEntrySpinLock(next)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)next->Position); - MergeEntry(entry, next); - RecycleEntry(next); - } - finally - { - ReleaseEntrySpinLock(next); - } - } - - - // 更新level信息 - originLevel++; - if (originLevel > entry->Level) - { - break; - } - } - - - // 恢复状态为空 - entry->TrySetState(EntryState.Merging, EntryState.Empty); - return entry; - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,释放两个锁 - if (entry != null) - { - entry->ReleaseBothLocks(); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,尝试获取两个锁 - return entry == null || entry->TryAcquireBothLocks(); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 44)] - internal struct Entry - { - - [FieldOffset(28)] internal int Level; // Level of the block in the allocator - [FieldOffset(40)] internal int NextLock; // 后继指针锁(控制NextNear指针操作) - - // 双锁设计:分离前后指针操作(和BucketNode保持一致) - [FieldOffset(36)] internal int PrevLock; // 前驱指针锁(控制PreviousNear指针操作) - [FieldOffset(32)] internal int State; // Node state (using int for atomic operations) - [FieldOffset(24)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - #region State Operations (using int for atomic operations) - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(int expectedState, int newState) - { - return Interlocked.CompareExchange(ref State, newState, expectedState) == expectedState; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public int GetState() => Volatile.Read(ref State); - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void SetState(int newState) => Volatile.Write(ref State, newState); - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == EntryState.Empty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsAllocated() => GetState() == EntryState.Allocated; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsThreadOccupied() => GetState() == EntryState.ThreadOccupied; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMerging() => GetState() == EntryState.Merging; - - #endregion - - #region Dual Lock Operations (和BucketNode保持一致) - - // 前驱锁操作(控制PreviousNear字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) == thread) { - Volatile.Write(ref PrevLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeld() => Volatile.Read(ref PrevLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeldByCurrentThread() => Volatile.Read(ref PrevLock) == Environment.CurrentManagedThreadId; - - // 后继锁操作(控制NextNear字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquireNextLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref NextLock) != thread) - { - while (Interlocked.CompareExchange(ref NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref NextLock) == thread) { - Volatile.Write(ref NextLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeld() => Volatile.Read(ref NextLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeldByCurrentThread() => Volatile.Read(ref NextLock) == Environment.CurrentManagedThreadId; - - // 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireBothLocks() - { - if (TryAcquirePrevLock()) - { - if (TryAcquireNextLock()) - { - return true; - } else - { - ReleasePrevLock(); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseBothLocks() - { - ReleasePrevLock(); - ReleaseNextLock(); - } - - #endregion - } - - // 更新后的EntryState常量类 - 使用int类型 - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int Merging = 3; // Currently being merged - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/B5126D29D08B2553CC28B846B92EB369 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/B5126D29D08B2553CC28B846B92EB369 deleted file mode 100644 index b5ba0212..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/B5126D29D08B2553CC28B846B92EB369 +++ /dev/null @@ -1,91 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Free.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Buffers; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - /// - /// Free allocated memory block and perform adjacent block merging - /// - /// - /// Handle to the allocated memory block - /// - public void Free(hlsfHandle handle) - { - Entry* e = handle.EntryHandle; - if (e == null) { - return; - } - AcquireEntrySpinLock(e); - try - { - if (e->State != EntryState.Allocated) { - return; - } - e->State = EntryState.ThreadOccupied; - - // Step 4: Try merge with adjacent free blocks and remove them from buckets - Entry* mergedEntry = TryMergeAndRemoveFromBuckets(e); - - - // Step 5: Calculate final level and segment for the merged block - uint finalSize = mergedEntry->Size; - int finalLevel = GetLevelFromSize(finalSize); - int finalSegment = DetermineSegmentIndex(finalSize, finalLevel); - - // Step 6: Set the merged entry state to Empty (ready to be reused) - mergedEntry->State = EntryState.Empty; - - // Step 7: Push the merged entry back to appropriate bucket - PushLevel(finalLevel, finalSegment, (BucketNode*)mergedEntry->Position); - - // Note: If mergedEntry is different from original e, the original e - // and any merged entries have already been freed to _nodes by TryMergeAndRemoveFromBuckets - } - finally - { - // Step 8: Always release the spin lock - ReleaseEntrySpinLock(e); - } - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/B74BA039EAD2B5236FE9E51ED1B75484 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/B74BA039EAD2B5236FE9E51ED1B75484 deleted file mode 100644 index 06282893..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/B74BA039EAD2B5236FE9E51ED1B75484 +++ /dev/null @@ -1,425 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,获取两个锁 - if (entry != null) - { - entry->AcquirePrevLock(); - entry->AcquireNextLock(); - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private Entry* MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return null; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = GetLevelFromSize(size); - int segment = DetermineSegmentIndex(size, originLevel); - - if (!TryAcquireEntrySpinLock(entry)) - { - return entry; // 无法获取锁,返回原Entry - } - - try - { - // 设置状态为合并中 - entry->TrySetState(EntryState.Empty, EntryState.Merging); - - - // current Level merge - while (originLevel <= entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - - - // backward merging - 向前合并 - while (true) - { - ulong p = entry->PreviousNear; - Entry* prev = (Entry*)p; - if (prev == null || - prev->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, prev) || - entry->Level != prev->Level || - !AssertAlignBoundry(offset, prev, entry->Level) || - !TryAcquireEntrySpinLock(prev)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)prev->Position); - MergeEntry(entry, prev); - RecycleEntry(prev); - } - finally - { - ReleaseEntrySpinLock(prev); - } - } - - // forward merging - 向后合并 - while (true) - { - ulong n = entry->NextNear; - Entry* next = (Entry*)n; - if (next == null || - next->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, next) || - entry->Level != next->Level || - !AssertAlignBoundry(offset, next, entry->Level) || - !TryAcquireEntrySpinLock(next)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)next->Position); - MergeEntry(entry, next); - RecycleEntry(next); - } - finally - { - ReleaseEntrySpinLock(next); - } - } - - - // 更新level信息 - originLevel++; - if (originLevel > entry->Level) - { - break; - } - } - - - // 恢复状态为空 - entry->TrySetState(EntryState.Merging, EntryState.Empty); - return entry; - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,释放两个锁 - if (entry != null) - { - entry->ReleaseBothLocks(); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,尝试获取两个锁 - return entry == null || entry->TryAcquireBothLocks(); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(26)] internal byte NextOpMask; // Next pointer operation (Free=0, Occupied=1) - [FieldOffset(25)] internal byte PrevOpMask; // Previous pointer operation (Free=0, Occupied=1) - [FieldOffset(27)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations (replacing SpinLock) - [FieldOffset(24)] internal byte StateMask; // Entry state (Empty=0, Allocated=1, ThreadOccupied=2, Merging=3) - - [FieldOffset(28)] internal int _reserved; // Reserved for future use - - [FieldOffset(36)] internal int Level; // Level of the block in the allocator - [FieldOffset(32)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - #region Four Independent Byte Masks for Entry - - // State constants - public const byte StateEmpty = 0; - public const byte StateAllocated = 1; - public const byte StateThreadOccupied = 2; - public const byte StateMerging = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // 字节级原子操作 - 使用简单的volatile操作(调用者自觉模式) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - byte current = Volatile.Read(ref StateMask); - if (current != expectedState) { - return false; - } - - Volatile.Write(ref StateMask, newState); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Previous operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevOp() - { - byte current = Volatile.Read(ref PrevOpMask); - if (current != OpFree) { - return false; - } - - Volatile.Write(ref PrevOpMask, OpOccupied); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevOp() - { - Volatile.Write(ref PrevOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevOpOccupied() => Volatile.Read(ref PrevOpMask) == OpOccupied; - - // Next operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextOp() - { - byte current = Volatile.Read(ref NextOpMask); - if (current != OpFree) { - return false; - } - - Volatile.Write(ref NextOpMask, OpOccupied); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextOp() - { - Volatile.Write(ref NextOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextOpOccupied() => Volatile.Read(ref NextOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - byte current = Volatile.Read(ref SelfOpMask); - if (current != OpFree) { - return false; - } - - Volatile.Write(ref SelfOpMask, OpOccupied); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsAllocated() => GetState() == StateAllocated; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsThreadOccupied() => GetState() == StateThreadOccupied; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMerging() => GetState() == StateMerging; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsPrevOpOccupied() || IsNextOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - // 更新后的EntryState常量类 - 与新的字节掩码设计兼容 - private static class EntryState - { - - public const byte Allocated = 1; // Already allocated to user - public const byte Empty = 0; // Free, can be allocated - public const byte Merging = 3; // Currently being merged - public const byte ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/D8BBF3A7BAD6E2FC7CF520CFF3FD6762 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/D8BBF3A7BAD6E2FC7CF520CFF3FD6762 deleted file mode 100644 index 694e060f..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/D8BBF3A7BAD6E2FC7CF520CFF3FD6762 +++ /dev/null @@ -1,157 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Alloc.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Threading; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private BufferExpansionLock _spareLock = new(); - - public hlsfHandle Alloc(uint size) - { - ArgumentOutOfRangeException.ThrowIfGreaterThan(size, (nuint)levelSize[^1] * 2); - int level = GetLevelFromSize(size); - int segmentIndex = DetermineSegmentIndex(size, level); - - int i = level, s = segmentIndex; - if (TryPopLevelForAllocation(i, s, out Entry* handle)) - { - handle->SetState(EntryState.Allocated); - return new hlsfHandle(handle, size); - } - - fallback: - i = level; - s = segmentIndex; - while (!TryPopLevelForAllocation(i, s, out handle)) - { - if (++s >= 3) - { - s = 0; - i++; - } - if (i >= levelSize.Length) - { - if (TryAllocateNew16MBBlock(out handle)) - { - break; - } - Thread.Sleep(0); - goto fallback; - } - } - - if (handle != null) - { - SliceMemory(handle, (segmentIndex + 1) * levelSize[level]); - handle->SetState(EntryState.Allocated); - } - - return new hlsfHandle(handle, size); - } - - private void SliceMemory(Entry* e, int offset) { } - - /// - /// Try to allocate a new 16MB block when all buckets are empty - /// - /// - /// Output handle to the allocated Entry - /// - /// - /// True if allocation succeeded - /// - private bool TryAllocateNew16MBBlock(out Entry* handle) - { - nuint pos = Volatile.Read(ref _spareMemory->Position); - nuint blockSize = (nuint)levelSize[^1] * 2; // Use last level size (16MB) - nuint newPos = pos + blockSize; - - - // Check if we have enough space - if (newPos > ((nuint)m_Buffer) + _size) - { - handle = null; - return false; // Out of memory - } - - // Try to allocate new Entry from slab allocator - try - { - handle = (Entry*)_nodes.Allocate(); - handle->Position = pos; - handle->Size = (uint)blockSize; - handle->State = EntryState.ThreadOccupied; - handle->NextNear = EmptyHandle; - handle->PreviousNear = EmptyHandle; - handle->SpinLock = 0; - - - // Update spare memory position - _spareMemory->Position = newPos; - - return true; - } - catch - { - handle = null; - return false; - } - } - - /// - /// Helper method for allocation - converts BucketNode to Entry - /// - private bool TryPopLevelForAllocation(int levelIndex, int sizeIndex, out Entry* entry) - { - if (TryPopLevel(levelIndex, sizeIndex, out BucketNode* bucketNode)) - { - entry = bucketNode->EntryRef; - return entry != null; - } - entry = null; - return false; - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/DD33CFD2FDC59A9C6D38F3D26986324C b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/DD33CFD2FDC59A9C6D38F3D26986324C deleted file mode 100644 index e6119d69..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/DD33CFD2FDC59A9C6D38F3D26986324C +++ /dev/null @@ -1,119 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Buffers; -using System.Runtime.InteropServices; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator : IDisposable - { - - private static readonly nuint EmptyHandle = (nuint)(void*)null; - - // Bucket system field - directly in main allocator class - private ulong[] _bucketHeads; - - private Entry* _spareMemory; - private readonly byte* m_Buffer; - private bool disposedValue; - private readonly int _align; - private readonly nuint _size; - private readonly SlabAllocator _nodes; - - public HybridLayerSegregatedFitAllocator(nuint byteSize) - { - if (byteSize < 64) { - throw new InvalidOperationException(); - } - _nodes = SlabAllocator.Create(64, BufferLayout.Chunked); - _size = byteSize; - m_Buffer = (byte*)NativeMemory.AlignedAlloc(byteSize, 16); - _align = 16; - - - // 初始化桶系统 - InitializeBucketSystem(); - - - // 初始化spareMemory - _spareMemory = (Entry*)_nodes.Allocate(); - _spareMemory->State = EntryState.ThreadOccupied; - _spareMemory->NextNear = EmptyHandle; - _spareMemory->Position = (nuint)m_Buffer; - } - - public HybridLayerSegregatedFitAllocator(nuint byteSize, int align) - { - if (align < 16 || (align & (align - 1)) != 0) { - throw new ArgumentException( - "Alignment must be a power of two and at least 8 bytes."); - } - _nodes = SlabAllocator.Create(64, BufferLayout.Chunked); - m_Buffer = (byte*)NativeMemory.AlignedAlloc(byteSize, (nuint)align); - _align = align; - _size = byteSize; - - InitializeBucketSystem(); - - - // 初始化spareMemory - _spareMemory = (Entry*)_nodes.Allocate(); - _spareMemory->State = EntryState.ThreadOccupied; - _spareMemory->NextNear = EmptyHandle; - _spareMemory->Position = (nuint)m_Buffer; - } - - public void Dispose() - { - Dispose(disposing:true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - if (!disposedValue) - { - if (disposing) { - _nodes.Dispose(); - } - NativeMemory.AlignedFree(m_Buffer); - disposedValue = true; - } - } - - ~HybridLayerSegregatedFitAllocator() - { - Dispose(disposing:false); - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/F1481D5666E0266F32099AD751F704AB b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/F1481D5666E0266F32099AD751F704AB deleted file mode 100644 index 1cedd00d..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/F1481D5666E0266F32099AD751F704AB +++ /dev/null @@ -1,548 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:获取两个锁 - if (node != null) - { - node->AcquirePrevLock(); - node->AcquireNextLock(); - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - node->AcquireNextLock(); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !headNode->TryAcquirePrevLock()) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - headNode->ReleasePrevLock(); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - node->ReleaseNextLock(); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:释放两个锁 - if (node != null) - { - node->ReleaseBothLocks(); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(只读操作,暂时不加锁) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - - // 按照地址顺序获取锁,避免死锁 - BucketNode* firstLock = null, secondLock = null, thirdLock = null; - bool needPrevNextLock = false, needNodeBothLocks = false, needNextPrevLock = false; - - if (previous != null && next != null) - { - // 中间节点:需要修改前驱的next和后继的prev - if ((ulong)previous < (ulong)node && (ulong)node < (ulong)next) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - thirdLock = next; - needNextPrevLock = true; - } else if ((ulong)previous < (ulong)next && (ulong)next < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = next; - needNextPrevLock = true; - thirdLock = node; - needNodeBothLocks = true; - } else // other cases - { - firstLock = next; - needNextPrevLock = true; - secondLock = previous; - needPrevNextLock = true; - thirdLock = node; - needNodeBothLocks = true; - } - } else if (previous != null) - { - // 尾节点:只需要修改前驱的next - if ((ulong)previous < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - } else - { - firstLock = node; - needNodeBothLocks = true; - secondLock = previous; - needPrevNextLock = true; - } - } else - { - // 应该不会到这里,因为头节点已经在上面处理了 - Thread.Sleep(0); - continue; - } - - - // 按顺序获取锁 - bool acquired = false; - try - { - if (firstLock != null) - { - if (firstLock == previous && needPrevNextLock) - { - if (!firstLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == next && needNextPrevLock) - { - if (!firstLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == node && needNodeBothLocks) - { - if (!firstLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (secondLock != null) - { - if (secondLock == previous && needPrevNextLock) - { - if (!secondLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == next && needNextPrevLock) - { - if (!secondLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == node && needNodeBothLocks) - { - if (!secondLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (thirdLock != null) - { - if (thirdLock == previous && needPrevNextLock) - { - if (!thirdLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == next && needNextPrevLock) - { - if (!thirdLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == node && needNodeBothLocks) - { - if (!thirdLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - acquired = true; - - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - if (acquired) - { - // 释放锁 - if (thirdLock == previous && needPrevNextLock) - { - thirdLock->ReleaseNextLock(); - } else if (thirdLock == next && needNextPrevLock) - { - thirdLock->ReleasePrevLock(); - } else if (thirdLock == node && needNodeBothLocks) { - thirdLock->ReleaseBothLocks(); - } - - if (secondLock == previous && needPrevNextLock) - { - secondLock->ReleaseNextLock(); - } else if (secondLock == next && needNextPrevLock) - { - secondLock->ReleasePrevLock(); - } else if (secondLock == node && needNodeBothLocks) { - secondLock->ReleaseBothLocks(); - } - - if (firstLock == previous && needPrevNextLock) - { - firstLock->ReleaseNextLock(); - } else if (firstLock == next && needNextPrevLock) - { - firstLock->ReleasePrevLock(); - } else if (firstLock == node && needNodeBothLocks) { - firstLock->ReleaseBothLocks(); - } - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:尝试获取两个锁 - return node == null || node->TryAcquireBothLocks(); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!head->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !next->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - next->ReleasePrevLock(); - } - } - } - finally - { - head->ReleaseNextLock(); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] // 增加到40字节以容纳两个int锁 - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Dual Lock Operations - - // 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) == thread) { - Volatile.Write(ref PrevLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeld() => Volatile.Read(ref PrevLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeldByCurrentThread() => Volatile.Read(ref PrevLock) == Environment.CurrentManagedThreadId; - - // 后继锁操作(控制NextLevel字段)- 改为int类型 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquireNextLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref NextLock) != thread) - { - while (Interlocked.CompareExchange(ref NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref NextLock) == thread) { - Volatile.Write(ref NextLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeld() => Volatile.Read(ref NextLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeldByCurrentThread() => Volatile.Read(ref NextLock) == Environment.CurrentManagedThreadId; - - // 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireBothLocks() - { - if (TryAcquirePrevLock()) - { - if (TryAcquireNextLock()) - { - return true; - } else - { - ReleasePrevLock(); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseBothLocks() - { - ReleasePrevLock(); - ReleaseNextLock(); - } - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/FFFE7B9B6E9B7793816CD986C64C0EA5 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/FFFE7B9B6E9B7793816CD986C64C0EA5 deleted file mode 100644 index 06282893..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/C679105E89CC664B839C606657FC52F2/FFFE7B9B6E9B7793816CD986C64C0EA5 +++ /dev/null @@ -1,425 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,获取两个锁 - if (entry != null) - { - entry->AcquirePrevLock(); - entry->AcquireNextLock(); - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private Entry* MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return null; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = GetLevelFromSize(size); - int segment = DetermineSegmentIndex(size, originLevel); - - if (!TryAcquireEntrySpinLock(entry)) - { - return entry; // 无法获取锁,返回原Entry - } - - try - { - // 设置状态为合并中 - entry->TrySetState(EntryState.Empty, EntryState.Merging); - - - // current Level merge - while (originLevel <= entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - - - // backward merging - 向前合并 - while (true) - { - ulong p = entry->PreviousNear; - Entry* prev = (Entry*)p; - if (prev == null || - prev->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, prev) || - entry->Level != prev->Level || - !AssertAlignBoundry(offset, prev, entry->Level) || - !TryAcquireEntrySpinLock(prev)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)prev->Position); - MergeEntry(entry, prev); - RecycleEntry(prev); - } - finally - { - ReleaseEntrySpinLock(prev); - } - } - - // forward merging - 向后合并 - while (true) - { - ulong n = entry->NextNear; - Entry* next = (Entry*)n; - if (next == null || - next->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, next) || - entry->Level != next->Level || - !AssertAlignBoundry(offset, next, entry->Level) || - !TryAcquireEntrySpinLock(next)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)next->Position); - MergeEntry(entry, next); - RecycleEntry(next); - } - finally - { - ReleaseEntrySpinLock(next); - } - } - - - // 更新level信息 - originLevel++; - if (originLevel > entry->Level) - { - break; - } - } - - - // 恢复状态为空 - entry->TrySetState(EntryState.Merging, EntryState.Empty); - return entry; - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,释放两个锁 - if (entry != null) - { - entry->ReleaseBothLocks(); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,尝试获取两个锁 - return entry == null || entry->TryAcquireBothLocks(); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct Entry - { - - [FieldOffset(26)] internal byte NextOpMask; // Next pointer operation (Free=0, Occupied=1) - [FieldOffset(25)] internal byte PrevOpMask; // Previous pointer operation (Free=0, Occupied=1) - [FieldOffset(27)] internal byte SelfOpMask; // Self operation (Free=0, Occupied=1) - - // Four independent byte masks for atomic operations (replacing SpinLock) - [FieldOffset(24)] internal byte StateMask; // Entry state (Empty=0, Allocated=1, ThreadOccupied=2, Merging=3) - - [FieldOffset(28)] internal int _reserved; // Reserved for future use - - [FieldOffset(36)] internal int Level; // Level of the block in the allocator - [FieldOffset(32)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - #region Four Independent Byte Masks for Entry - - // State constants - public const byte StateEmpty = 0; - public const byte StateAllocated = 1; - public const byte StateThreadOccupied = 2; - public const byte StateMerging = 3; - - // Operation constants - public const byte OpFree = 0; - public const byte OpOccupied = 1; - - // 字节级原子操作 - 使用简单的volatile操作(调用者自觉模式) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(byte expectedState, byte newState) - { - byte current = Volatile.Read(ref StateMask); - if (current != expectedState) { - return false; - } - - Volatile.Write(ref StateMask, newState); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public byte GetState() => Volatile.Read(ref StateMask); - - // Previous operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevOp() - { - byte current = Volatile.Read(ref PrevOpMask); - if (current != OpFree) { - return false; - } - - Volatile.Write(ref PrevOpMask, OpOccupied); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevOp() - { - Volatile.Write(ref PrevOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevOpOccupied() => Volatile.Read(ref PrevOpMask) == OpOccupied; - - // Next operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextOp() - { - byte current = Volatile.Read(ref NextOpMask); - if (current != OpFree) { - return false; - } - - Volatile.Write(ref NextOpMask, OpOccupied); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextOp() - { - Volatile.Write(ref NextOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextOpOccupied() => Volatile.Read(ref NextOpMask) == OpOccupied; - - // Self operation atomic methods - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireSelfOp() - { - byte current = Volatile.Read(ref SelfOpMask); - if (current != OpFree) { - return false; - } - - Volatile.Write(ref SelfOpMask, OpOccupied); - return true; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseSelfOp() - { - Volatile.Write(ref SelfOpMask, OpFree); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsSelfOpOccupied() => Volatile.Read(ref SelfOpMask) == OpOccupied; - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == StateEmpty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsAllocated() => GetState() == StateAllocated; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsThreadOccupied() => GetState() == StateThreadOccupied; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMerging() => GetState() == StateMerging; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool HasAnyOperation() => IsPrevOpOccupied() || IsNextOpOccupied() || IsSelfOpOccupied(); - - #endregion - } - - // 更新后的EntryState常量类 - 与新的字节掩码设计兼容 - private static class EntryState - { - - public const byte Allocated = 1; // Already allocated to user - public const byte Empty = 0; // Free, can be allocated - public const byte Merging = 3; // Currently being merged - public const byte ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/00E2E42949050526538E88CD3B6A4C2A b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/00E2E42949050526538E88CD3B6A4C2A deleted file mode 100644 index 04f3e4ad..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/00E2E42949050526538E88CD3B6A4C2A +++ /dev/null @@ -1,603 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:获取两个锁 - if (node != null) - { - BucketNodeOperations.AcquirePrevLock(node); - BucketNodeOperations.AcquireNextLock(node); - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - node->AcquireNextLock(); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !headNode->TryAcquirePrevLock()) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - headNode->ReleasePrevLock(); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - node->ReleaseNextLock(); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:释放两个锁 - if (node != null) - { - node->ReleaseBothLocks(); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(只读操作,暂时不加锁) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - - // 按照地址顺序获取锁,避免死锁 - BucketNode* firstLock = null, secondLock = null, thirdLock = null; - bool needPrevNextLock = false, needNodeBothLocks = false, needNextPrevLock = false; - - if (previous != null && next != null) - { - // 中间节点:需要修改前驱的next和后继的prev - if ((ulong)previous < (ulong)node && (ulong)node < (ulong)next) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - thirdLock = next; - needNextPrevLock = true; - } else if ((ulong)previous < (ulong)next && (ulong)next < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = next; - needNextPrevLock = true; - thirdLock = node; - needNodeBothLocks = true; - } else // other cases - { - firstLock = next; - needNextPrevLock = true; - secondLock = previous; - needPrevNextLock = true; - thirdLock = node; - needNodeBothLocks = true; - } - } else if (previous != null) - { - // 尾节点:只需要修改前驱的next - if ((ulong)previous < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - } else - { - firstLock = node; - needNodeBothLocks = true; - secondLock = previous; - needPrevNextLock = true; - } - } else - { - // 应该不会到这里,因为头节点已经在上面处理了 - Thread.Sleep(0); - continue; - } - - - // 按顺序获取锁 - bool acquired = false; - try - { - if (firstLock != null) - { - if (firstLock == previous && needPrevNextLock) - { - if (!firstLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == next && needNextPrevLock) - { - if (!firstLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == node && needNodeBothLocks) - { - if (!firstLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (secondLock != null) - { - if (secondLock == previous && needPrevNextLock) - { - if (!secondLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == next && needNextPrevLock) - { - if (!secondLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == node && needNodeBothLocks) - { - if (!secondLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (thirdLock != null) - { - if (thirdLock == previous && needPrevNextLock) - { - if (!thirdLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == next && needNextPrevLock) - { - if (!thirdLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == node && needNodeBothLocks) - { - if (!thirdLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - acquired = true; - - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - if (acquired) - { - // 释放锁 - if (thirdLock == previous && needPrevNextLock) - { - thirdLock->ReleaseNextLock(); - } else if (thirdLock == next && needNextPrevLock) - { - thirdLock->ReleasePrevLock(); - } else if (thirdLock == node && needNodeBothLocks) { - thirdLock->ReleaseBothLocks(); - } - - if (secondLock == previous && needPrevNextLock) - { - secondLock->ReleaseNextLock(); - } else if (secondLock == next && needNextPrevLock) - { - secondLock->ReleasePrevLock(); - } else if (secondLock == node && needNodeBothLocks) { - secondLock->ReleaseBothLocks(); - } - - if (firstLock == previous && needPrevNextLock) - { - firstLock->ReleaseNextLock(); - } else if (firstLock == next && needNextPrevLock) - { - firstLock->ReleasePrevLock(); - } else if (firstLock == node && needNodeBothLocks) { - firstLock->ReleaseBothLocks(); - } - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:尝试获取两个锁 - return node == null || node->TryAcquireBothLocks(); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!head->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !next->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - next->ReleasePrevLock(); - } - } - } - finally - { - head->ReleaseNextLock(); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - } - - /// - /// BucketNode操作的静态方法集合 - /// - private static class BucketNodeOperations - { - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != BucketNode.MAGIC_NUMBER; - } - - #region Lock Operations - - // 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool TryAcquirePrevLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void AcquirePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref node->PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void ReleasePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) == thread) { - Volatile.Write(ref node->PrevLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsPrevLockHeld(BucketNode* node) => node != null && - Volatile.Read(ref node->PrevLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsPrevLockHeldByCurrentThread(BucketNode* node) => node != null && - Volatile.Read(ref node->PrevLock) == Environment.CurrentManagedThreadId; - - // 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool TryAcquireNextLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void AcquireNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) != thread) - { - while (Interlocked.CompareExchange(ref node->NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void ReleaseNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) == thread) { - Volatile.Write(ref node->NextLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNextLockHeld(BucketNode* node) => node != null && - Volatile.Read(ref node->NextLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNextLockHeldByCurrentThread(BucketNode* node) => node != null && - Volatile.Read(ref node->NextLock) == Environment.CurrentManagedThreadId; - - // 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool TryAcquireBothLocks(BucketNode* node) - { - if (node == null) { - return true; - } - - if (TryAcquirePrevLock(node)) - { - if (TryAcquireNextLock(node)) - { - return true; - } else - { - ReleasePrevLock(node); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void ReleaseBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - ReleasePrevLock(node); - ReleaseNextLock(node); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void AcquireBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - AcquirePrevLock(node); - AcquireNextLock(node); - } - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/11384D04CF5A0D228270594B1942580D b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/11384D04CF5A0D228270594B1942580D deleted file mode 100644 index e29c03b1..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/11384D04CF5A0D228270594B1942580D +++ /dev/null @@ -1,290 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用新的静态方法 - if (entry != null) - { - EntryOperations.AcquireBothLocks(entry); - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private Entry* MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return null; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = GetLevelFromSize(size); - int segment = DetermineSegmentIndex(size, originLevel); - - if (!TryAcquireEntrySpinLock(entry)) - { - return entry; // 无法获取锁,返回原Entry - } - - try - { - // 设置状态为合并中 - entry->TrySetState(EntryState.Empty, EntryState.Merging); - - - // current Level merge - while (originLevel <= entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - - - // backward merging - 向前合并 - while (true) - { - ulong p = entry->PreviousNear; - Entry* prev = (Entry*)p; - if (prev == null || - prev->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, prev) || - entry->Level != prev->Level || - !AssertAlignBoundry(offset, prev, entry->Level) || - !TryAcquireEntrySpinLock(prev)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)prev->Position); - MergeEntry(entry, prev); - RecycleEntry(prev); - } - finally - { - ReleaseEntrySpinLock(prev); - } - } - - // forward merging - 向后合并 - while (true) - { - ulong n = entry->NextNear; - Entry* next = (Entry*)n; - if (next == null || - next->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, next) || - entry->Level != next->Level || - !AssertAlignBoundry(offset, next, entry->Level) || - !TryAcquireEntrySpinLock(next)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)next->Position); - MergeEntry(entry, next); - RecycleEntry(next); - } - finally - { - ReleaseEntrySpinLock(next); - } - } - - - // 更新level信息 - originLevel++; - if (originLevel > entry->Level) - { - break; - } - } - - - // 恢复状态为空 - entry->TrySetState(EntryState.Merging, EntryState.Empty); - return entry; - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用新的静态方法 - if (entry != null) - { - EntryOperations.ReleaseBothLocks(entry); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用新的静态方法 - return EntryOperations.TryAcquireBothLocks(entry); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 44)] - internal struct Entry - { - - [FieldOffset(28)] internal int Level; // Level of the block in the allocator - [FieldOffset(40)] internal int NextLock; // 后继指针锁(控制NextNear指针操作) - - // 双锁设计:分离前后指针操作(和BucketNode保持一致) - [FieldOffset(36)] internal int PrevLock; // 前驱指针锁(控制PreviousNear指针操作) - [FieldOffset(32)] internal int State; // Node state (using int for atomic operations) - [FieldOffset(24)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - } - - // 更新后的EntryState常量类 - 使用int类型 - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int Merging = 3; // Currently being merged - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/1268A0FB8441492D7675658A441771C8 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/1268A0FB8441492D7675658A441771C8 deleted file mode 100644 index 67fb7f9b..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/1268A0FB8441492D7675658A441771C8 +++ /dev/null @@ -1,596 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用新的静态方法 - BucketNodeOperations.AcquireBothLocks(node); - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - node->AcquireNextLock(); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !headNode->TryAcquirePrevLock()) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - headNode->ReleasePrevLock(); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - node->ReleaseNextLock(); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 使用新的静态方法 - BucketNodeOperations.ReleaseBothLocks(node); - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(只读操作,暂时不加锁) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - - // 按照地址顺序获取锁,避免死锁 - BucketNode* firstLock = null, secondLock = null, thirdLock = null; - bool needPrevNextLock = false, needNodeBothLocks = false, needNextPrevLock = false; - - if (previous != null && next != null) - { - // 中间节点:需要修改前驱的next和后继的prev - if ((ulong)previous < (ulong)node && (ulong)node < (ulong)next) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - thirdLock = next; - needNextPrevLock = true; - } else if ((ulong)previous < (ulong)next && (ulong)next < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = next; - needNextPrevLock = true; - thirdLock = node; - needNodeBothLocks = true; - } else // other cases - { - firstLock = next; - needNextPrevLock = true; - secondLock = previous; - needPrevNextLock = true; - thirdLock = node; - needNodeBothLocks = true; - } - } else if (previous != null) - { - // 尾节点:只需要修改前驱的next - if ((ulong)previous < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - } else - { - firstLock = node; - needNodeBothLocks = true; - secondLock = previous; - needPrevNextLock = true; - } - } else - { - // 应该不会到这里,因为头节点已经在上面处理了 - Thread.Sleep(0); - continue; - } - - - // 按顺序获取锁 - bool acquired = false; - try - { - if (firstLock != null) - { - if (firstLock == previous && needPrevNextLock) - { - if (!firstLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == next && needNextPrevLock) - { - if (!firstLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == node && needNodeBothLocks) - { - if (!firstLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (secondLock != null) - { - if (secondLock == previous && needPrevNextLock) - { - if (!secondLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == next && needNextPrevLock) - { - if (!secondLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == node && needNodeBothLocks) - { - if (!secondLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (thirdLock != null) - { - if (thirdLock == previous && needPrevNextLock) - { - if (!thirdLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == next && needNextPrevLock) - { - if (!thirdLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == node && needNodeBothLocks) - { - if (!thirdLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - acquired = true; - - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - if (acquired) - { - // 释放锁 - if (thirdLock == previous && needPrevNextLock) - { - thirdLock->ReleaseNextLock(); - } else if (thirdLock == next && needNextPrevLock) - { - thirdLock->ReleasePrevLock(); - } else if (thirdLock == node && needNodeBothLocks) { - thirdLock->ReleaseBothLocks(); - } - - if (secondLock == previous && needPrevNextLock) - { - secondLock->ReleaseNextLock(); - } else if (secondLock == next && needNextPrevLock) - { - secondLock->ReleasePrevLock(); - } else if (secondLock == node && needNodeBothLocks) { - secondLock->ReleaseBothLocks(); - } - - if (firstLock == previous && needPrevNextLock) - { - firstLock->ReleaseNextLock(); - } else if (firstLock == next && needNextPrevLock) - { - firstLock->ReleasePrevLock(); - } else if (firstLock == node && needNodeBothLocks) { - firstLock->ReleaseBothLocks(); - } - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 使用新的静态方法 - return BucketNodeOperations.TryAcquireBothLocks(node); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!head->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !next->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - next->ReleasePrevLock(); - } - } - } - finally - { - head->ReleaseNextLock(); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - } - - /// - /// BucketNode操作的静态方法集合 - /// - private static class BucketNodeOperations - { - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != BucketNode.MAGIC_NUMBER; - } - - #region Lock Operations - - // 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool TryAcquirePrevLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void AcquirePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref node->PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void ReleasePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) == thread) { - Volatile.Write(ref node->PrevLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsPrevLockHeld(BucketNode* node) => node != null && - Volatile.Read(ref node->PrevLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsPrevLockHeldByCurrentThread(BucketNode* node) => node != null && - Volatile.Read(ref node->PrevLock) == Environment.CurrentManagedThreadId; - - // 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool TryAcquireNextLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void AcquireNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) != thread) - { - while (Interlocked.CompareExchange(ref node->NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void ReleaseNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) == thread) { - Volatile.Write(ref node->NextLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNextLockHeld(BucketNode* node) => node != null && - Volatile.Read(ref node->NextLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNextLockHeldByCurrentThread(BucketNode* node) => node != null && - Volatile.Read(ref node->NextLock) == Environment.CurrentManagedThreadId; - - // 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool TryAcquireBothLocks(BucketNode* node) - { - if (node == null) { - return true; - } - - if (TryAcquirePrevLock(node)) - { - if (TryAcquireNextLock(node)) - { - return true; - } else - { - ReleasePrevLock(node); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void ReleaseBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - ReleasePrevLock(node); - ReleaseNextLock(node); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void AcquireBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - AcquirePrevLock(node); - AcquireNextLock(node); - } - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/15ECA87E3A6524336A306184CCF4359E b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/15ECA87E3A6524336A306184CCF4359E deleted file mode 100644 index 88556cfa..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/15ECA87E3A6524336A306184CCF4359E +++ /dev/null @@ -1,160 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Alloc.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using StgSharp.Threading; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private BufferExpansionLock _spareLock = new(); - - public hlsfHandle Alloc(uint size) - { - ArgumentOutOfRangeException.ThrowIfGreaterThan(size, (nuint)levelSize[^1] * 2); - int level = GetLevelFromSize(size); - int segmentIndex = DetermineSegmentIndex(size, level); - - int i = level, s = segmentIndex; - if (TryPopLevelForAllocation(i, s, out Entry* handle)) - { - handle->SetState(EntryState.Allocated); - return new hlsfHandle(handle, size); - } - - fallback: - i = level; - s = segmentIndex; - while (!TryPopLevelForAllocation(i, s, out handle)) - { - if (++s >= 3) - { - s = 0; - i++; - } - if (i >= levelSize.Length) - { - if (TryAllocateNew16MBBlock(out handle)) - { - break; - } - Thread.Sleep(0); - goto fallback; - } - } - - if (handle != null) - { - SliceMemory(handle, (segmentIndex + 1) * levelSize[level]); - handle->SetState(EntryState.Allocated); - } - - return new hlsfHandle(handle, size); - } - - private void SliceMemory(Entry* e, int offset) { } - - /// - /// Try to allocate a new 16MB block when all buckets are empty - /// - /// - /// Output handle to the allocated Entry - /// - /// - /// True if allocation succeeded - /// - private bool TryAllocateNew16MBBlock(out Entry* handle) - { - nuint pos = Volatile.Read(ref _spareMemory->Position); - nuint blockSize = (nuint)levelSize[^1] * 2; // Use last level size (16MB) - nuint newPos = pos + blockSize; - - // Check if we have enough space - if (newPos > ((nuint)m_Buffer) + _size) - { - handle = null; - return false; // Out of memory - } - - // Try to allocate new Entry from slab allocator - try - { - handle = (Entry*)_nodes.Allocate(); - handle->Position = pos; - handle->Size = (uint)blockSize; - handle->SetState(EntryState.ThreadOccupied); - handle->NextNear = EmptyHandle; - handle->PreviousNear = EmptyHandle; - handle->Level = GetLevelFromSize((uint)blockSize); - - - // 初始化双锁为未锁定状态 - handle->PrevLock = 0; - handle->NextLock = 0; - - // Update spare memory position - _spareMemory->Position = newPos; - - return true; - } - catch - { - handle = null; - return false; - } - } - - /// - /// Helper method for allocation - converts BucketNode to Entry - /// - private bool TryPopLevelForAllocation(int levelIndex, int sizeIndex, out Entry* entry) - { - if (TryPopLevel(levelIndex, sizeIndex, out BucketNode* bucketNode)) - { - entry = bucketNode->EntryRef; - return entry != null; - } - entry = null; - return false; - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/27E9FA7F1636CC1E21E733CF7685E5DC b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/27E9FA7F1636CC1E21E733CF7685E5DC deleted file mode 100644 index e29c03b1..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/27E9FA7F1636CC1E21E733CF7685E5DC +++ /dev/null @@ -1,290 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用新的静态方法 - if (entry != null) - { - EntryOperations.AcquireBothLocks(entry); - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private Entry* MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return null; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = GetLevelFromSize(size); - int segment = DetermineSegmentIndex(size, originLevel); - - if (!TryAcquireEntrySpinLock(entry)) - { - return entry; // 无法获取锁,返回原Entry - } - - try - { - // 设置状态为合并中 - entry->TrySetState(EntryState.Empty, EntryState.Merging); - - - // current Level merge - while (originLevel <= entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - - - // backward merging - 向前合并 - while (true) - { - ulong p = entry->PreviousNear; - Entry* prev = (Entry*)p; - if (prev == null || - prev->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, prev) || - entry->Level != prev->Level || - !AssertAlignBoundry(offset, prev, entry->Level) || - !TryAcquireEntrySpinLock(prev)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)prev->Position); - MergeEntry(entry, prev); - RecycleEntry(prev); - } - finally - { - ReleaseEntrySpinLock(prev); - } - } - - // forward merging - 向后合并 - while (true) - { - ulong n = entry->NextNear; - Entry* next = (Entry*)n; - if (next == null || - next->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, next) || - entry->Level != next->Level || - !AssertAlignBoundry(offset, next, entry->Level) || - !TryAcquireEntrySpinLock(next)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)next->Position); - MergeEntry(entry, next); - RecycleEntry(next); - } - finally - { - ReleaseEntrySpinLock(next); - } - } - - - // 更新level信息 - originLevel++; - if (originLevel > entry->Level) - { - break; - } - } - - - // 恢复状态为空 - entry->TrySetState(EntryState.Merging, EntryState.Empty); - return entry; - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用新的静态方法 - if (entry != null) - { - EntryOperations.ReleaseBothLocks(entry); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用新的静态方法 - return EntryOperations.TryAcquireBothLocks(entry); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 44)] - internal struct Entry - { - - [FieldOffset(28)] internal int Level; // Level of the block in the allocator - [FieldOffset(40)] internal int NextLock; // 后继指针锁(控制NextNear指针操作) - - // 双锁设计:分离前后指针操作(和BucketNode保持一致) - [FieldOffset(36)] internal int PrevLock; // 前驱指针锁(控制PreviousNear指针操作) - [FieldOffset(32)] internal int State; // Node state (using int for atomic operations) - [FieldOffset(24)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - } - - // 更新后的EntryState常量类 - 使用int类型 - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int Merging = 3; // Currently being merged - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/69DA60389B7DE94520FDE49080B985EC b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/69DA60389B7DE94520FDE49080B985EC deleted file mode 100644 index 04f3e4ad..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/69DA60389B7DE94520FDE49080B985EC +++ /dev/null @@ -1,603 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:获取两个锁 - if (node != null) - { - BucketNodeOperations.AcquirePrevLock(node); - BucketNodeOperations.AcquireNextLock(node); - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - node->AcquireNextLock(); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !headNode->TryAcquirePrevLock()) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - headNode->ReleasePrevLock(); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - node->ReleaseNextLock(); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:释放两个锁 - if (node != null) - { - node->ReleaseBothLocks(); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(只读操作,暂时不加锁) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - - // 按照地址顺序获取锁,避免死锁 - BucketNode* firstLock = null, secondLock = null, thirdLock = null; - bool needPrevNextLock = false, needNodeBothLocks = false, needNextPrevLock = false; - - if (previous != null && next != null) - { - // 中间节点:需要修改前驱的next和后继的prev - if ((ulong)previous < (ulong)node && (ulong)node < (ulong)next) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - thirdLock = next; - needNextPrevLock = true; - } else if ((ulong)previous < (ulong)next && (ulong)next < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = next; - needNextPrevLock = true; - thirdLock = node; - needNodeBothLocks = true; - } else // other cases - { - firstLock = next; - needNextPrevLock = true; - secondLock = previous; - needPrevNextLock = true; - thirdLock = node; - needNodeBothLocks = true; - } - } else if (previous != null) - { - // 尾节点:只需要修改前驱的next - if ((ulong)previous < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - } else - { - firstLock = node; - needNodeBothLocks = true; - secondLock = previous; - needPrevNextLock = true; - } - } else - { - // 应该不会到这里,因为头节点已经在上面处理了 - Thread.Sleep(0); - continue; - } - - - // 按顺序获取锁 - bool acquired = false; - try - { - if (firstLock != null) - { - if (firstLock == previous && needPrevNextLock) - { - if (!firstLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == next && needNextPrevLock) - { - if (!firstLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == node && needNodeBothLocks) - { - if (!firstLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (secondLock != null) - { - if (secondLock == previous && needPrevNextLock) - { - if (!secondLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == next && needNextPrevLock) - { - if (!secondLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == node && needNodeBothLocks) - { - if (!secondLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (thirdLock != null) - { - if (thirdLock == previous && needPrevNextLock) - { - if (!thirdLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == next && needNextPrevLock) - { - if (!thirdLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == node && needNodeBothLocks) - { - if (!thirdLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - acquired = true; - - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - if (acquired) - { - // 释放锁 - if (thirdLock == previous && needPrevNextLock) - { - thirdLock->ReleaseNextLock(); - } else if (thirdLock == next && needNextPrevLock) - { - thirdLock->ReleasePrevLock(); - } else if (thirdLock == node && needNodeBothLocks) { - thirdLock->ReleaseBothLocks(); - } - - if (secondLock == previous && needPrevNextLock) - { - secondLock->ReleaseNextLock(); - } else if (secondLock == next && needNextPrevLock) - { - secondLock->ReleasePrevLock(); - } else if (secondLock == node && needNodeBothLocks) { - secondLock->ReleaseBothLocks(); - } - - if (firstLock == previous && needPrevNextLock) - { - firstLock->ReleaseNextLock(); - } else if (firstLock == next && needNextPrevLock) - { - firstLock->ReleasePrevLock(); - } else if (firstLock == node && needNodeBothLocks) { - firstLock->ReleaseBothLocks(); - } - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:尝试获取两个锁 - return node == null || node->TryAcquireBothLocks(); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!head->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !next->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - next->ReleasePrevLock(); - } - } - } - finally - { - head->ReleaseNextLock(); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - } - - /// - /// BucketNode操作的静态方法集合 - /// - private static class BucketNodeOperations - { - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != BucketNode.MAGIC_NUMBER; - } - - #region Lock Operations - - // 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool TryAcquirePrevLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void AcquirePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref node->PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void ReleasePrevLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->PrevLock) == thread) { - Volatile.Write(ref node->PrevLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsPrevLockHeld(BucketNode* node) => node != null && - Volatile.Read(ref node->PrevLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsPrevLockHeldByCurrentThread(BucketNode* node) => node != null && - Volatile.Read(ref node->PrevLock) == Environment.CurrentManagedThreadId; - - // 后继锁操作(控制NextLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool TryAcquireNextLock(BucketNode* node) - { - if (node == null) { - return true; - } - - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref node->NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void AcquireNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) != thread) - { - while (Interlocked.CompareExchange(ref node->NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void ReleaseNextLock(BucketNode* node) - { - if (node == null) { - return; - } - - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref node->NextLock) == thread) { - Volatile.Write(ref node->NextLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNextLockHeld(BucketNode* node) => node != null && - Volatile.Read(ref node->NextLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNextLockHeldByCurrentThread(BucketNode* node) => node != null && - Volatile.Read(ref node->NextLock) == Environment.CurrentManagedThreadId; - - // 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool TryAcquireBothLocks(BucketNode* node) - { - if (node == null) { - return true; - } - - if (TryAcquirePrevLock(node)) - { - if (TryAcquireNextLock(node)) - { - return true; - } else - { - ReleasePrevLock(node); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void ReleaseBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - ReleasePrevLock(node); - ReleaseNextLock(node); - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static void AcquireBothLocks(BucketNode* node) - { - if (node == null) { - return; - } - - AcquirePrevLock(node); - AcquireNextLock(node); - } - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/77DA1642FF8B0DC1F1DA13D99169CF30 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/77DA1642FF8B0DC1F1DA13D99169CF30 deleted file mode 100644 index 67856675..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/77DA1642FF8B0DC1F1DA13D99169CF30 +++ /dev/null @@ -1,437 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,获取两个锁 - if (entry != null) - { - entry->AcquirePrevLock(); - entry->AcquireNextLock(); - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private Entry* MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return null; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = GetLevelFromSize(size); - int segment = DetermineSegmentIndex(size, originLevel); - - if (!TryAcquireEntrySpinLock(entry)) - { - return entry; // 无法获取锁,返回原Entry - } - - try - { - // 设置状态为合并中 - entry->TrySetState(EntryState.Empty, EntryState.Merging); - - - // current Level merge - while (originLevel <= entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - - - // backward merging - 向前合并 - while (true) - { - ulong p = entry->PreviousNear; - Entry* prev = (Entry*)p; - if (prev == null || - prev->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, prev) || - entry->Level != prev->Level || - !AssertAlignBoundry(offset, prev, entry->Level) || - !TryAcquireEntrySpinLock(prev)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)prev->Position); - MergeEntry(entry, prev); - RecycleEntry(prev); - } - finally - { - ReleaseEntrySpinLock(prev); - } - } - - // forward merging - 向后合并 - while (true) - { - ulong n = entry->NextNear; - Entry* next = (Entry*)n; - if (next == null || - next->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, next) || - entry->Level != next->Level || - !AssertAlignBoundry(offset, next, entry->Level) || - !TryAcquireEntrySpinLock(next)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)next->Position); - MergeEntry(entry, next); - RecycleEntry(next); - } - finally - { - ReleaseEntrySpinLock(next); - } - } - - - // 更新level信息 - originLevel++; - if (originLevel > entry->Level) - { - break; - } - } - - - // 恢复状态为空 - entry->TrySetState(EntryState.Merging, EntryState.Empty); - return entry; - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,释放两个锁 - if (entry != null) - { - entry->ReleaseBothLocks(); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,尝试获取两个锁 - return entry == null || entry->TryAcquireBothLocks(); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 44)] - internal struct Entry - { - - [FieldOffset(28)] internal int Level; // Level of the block in the allocator - [FieldOffset(40)] internal int NextLock; // 后继指针锁(控制NextNear指针操作) - - // 双锁设计:分离前后指针操作(和BucketNode保持一致) - [FieldOffset(36)] internal int PrevLock; // 前驱指针锁(控制PreviousNear指针操作) - [FieldOffset(32)] internal int State; // Node state (using int for atomic operations) - [FieldOffset(24)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - #region State Operations (using int for atomic operations) - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(int expectedState, int newState) - { - return Interlocked.CompareExchange(ref State, newState, expectedState) == expectedState; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public int GetState() => Volatile.Read(ref State); - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void SetState(int newState) => Volatile.Write(ref State, newState); - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == EntryState.Empty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsAllocated() => GetState() == EntryState.Allocated; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsThreadOccupied() => GetState() == EntryState.ThreadOccupied; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMerging() => GetState() == EntryState.Merging; - - #endregion - - #region Dual Lock Operations (和BucketNode保持一致) - - // 前驱锁操作(控制PreviousNear字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) == thread) { - Volatile.Write(ref PrevLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeld() => Volatile.Read(ref PrevLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeldByCurrentThread() => Volatile.Read(ref PrevLock) == Environment.CurrentManagedThreadId; - - // 后继锁操作(控制NextNear字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquireNextLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref NextLock) != thread) - { - while (Interlocked.CompareExchange(ref NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref NextLock) == thread) { - Volatile.Write(ref NextLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeld() => Volatile.Read(ref NextLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeldByCurrentThread() => Volatile.Read(ref NextLock) == Environment.CurrentManagedThreadId; - - // 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireBothLocks() - { - if (TryAcquirePrevLock()) - { - if (TryAcquireNextLock()) - { - return true; - } else - { - ReleasePrevLock(); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseBothLocks() - { - ReleasePrevLock(); - ReleaseNextLock(); - } - - #endregion - } - - // 更新后的EntryState常量类 - 使用int类型 - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int Merging = 3; // Currently being merged - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/8C6951CF911AE990C57FC6D39107104B b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/8C6951CF911AE990C57FC6D39107104B deleted file mode 100644 index 6d7e3e34..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/8C6951CF911AE990C57FC6D39107104B +++ /dev/null @@ -1,291 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,获取两个锁 - if (entry != null) - { - entry->AcquirePrevLock(); - entry->AcquireNextLock(); - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private Entry* MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return null; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = GetLevelFromSize(size); - int segment = DetermineSegmentIndex(size, originLevel); - - if (!TryAcquireEntrySpinLock(entry)) - { - return entry; // 无法获取锁,返回原Entry - } - - try - { - // 设置状态为合并中 - entry->TrySetState(EntryState.Empty, EntryState.Merging); - - - // current Level merge - while (originLevel <= entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - - - // backward merging - 向前合并 - while (true) - { - ulong p = entry->PreviousNear; - Entry* prev = (Entry*)p; - if (prev == null || - prev->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, prev) || - entry->Level != prev->Level || - !AssertAlignBoundry(offset, prev, entry->Level) || - !TryAcquireEntrySpinLock(prev)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)prev->Position); - MergeEntry(entry, prev); - RecycleEntry(prev); - } - finally - { - ReleaseEntrySpinLock(prev); - } - } - - // forward merging - 向后合并 - while (true) - { - ulong n = entry->NextNear; - Entry* next = (Entry*)n; - if (next == null || - next->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, next) || - entry->Level != next->Level || - !AssertAlignBoundry(offset, next, entry->Level) || - !TryAcquireEntrySpinLock(next)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)next->Position); - MergeEntry(entry, next); - RecycleEntry(next); - } - finally - { - ReleaseEntrySpinLock(next); - } - } - - - // 更新level信息 - originLevel++; - if (originLevel > entry->Level) - { - break; - } - } - - - // 恢复状态为空 - entry->TrySetState(EntryState.Merging, EntryState.Empty); - return entry; - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,释放两个锁 - if (entry != null) - { - entry->ReleaseBothLocks(); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,尝试获取两个锁 - return entry == null || entry->TryAcquireBothLocks(); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 44)] - internal struct Entry - { - - [FieldOffset(28)] internal int Level; // Level of the block in the allocator - [FieldOffset(40)] internal int NextLock; // 后继指针锁(控制NextNear指针操作) - - // 双锁设计:分离前后指针操作(和BucketNode保持一致) - [FieldOffset(36)] internal int PrevLock; // 前驱指针锁(控制PreviousNear指针操作) - [FieldOffset(32)] internal int State; // Node state (using int for atomic operations) - [FieldOffset(24)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - } - - // 更新后的EntryState常量类 - 使用int类型 - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int Merging = 3; // Currently being merged - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/A4A159A4BD64A37C24D10F0099FB6C65 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/A4A159A4BD64A37C24D10F0099FB6C65 deleted file mode 100644 index c2e194ce..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/A4A159A4BD64A37C24D10F0099FB6C65 +++ /dev/null @@ -1,286 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用新的静态方法 - if (entry != null) - { - EntryOperations.AcquireBothLocks(entry); - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private Entry* MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return null; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = GetLevelFromSize(size); - int segment = DetermineSegmentIndex(size, originLevel); - - if (!TryAcquireEntrySpinLock(entry)) - { - return entry; // 无法获取锁,返回原Entry - } - - try - { - // 设置状态为合并中 - EntryOperations.TrySetState(entry, EntryState.Empty, EntryState.Merging); - - // current Level merge - while (originLevel <= entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - - // backward merging - 向前合并 - while (true) - { - ulong p = entry->PreviousNear; - Entry* prev = (Entry*)p; - if (prev == null || - EntryOperations.GetState(prev) != EntryState.Empty || - !IsAdjacentTo(entry, prev) || - entry->Level != prev->Level || - !AssertAlignBoundry(offset, prev, entry->Level) || - !TryAcquireEntrySpinLock(prev)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)prev->Position); - MergeEntry(entry, prev); - RecycleEntry(prev); - } - finally - { - ReleaseEntrySpinLock(prev); - } - } - - // forward merging - 向后合并 - while (true) - { - ulong n = entry->NextNear; - Entry* next = (Entry*)n; - if (next == null || - EntryOperations.GetState(next) != EntryState.Empty || - !IsAdjacentTo(entry, next) || - entry->Level != next->Level || - !AssertAlignBoundry(offset, next, entry->Level) || - !TryAcquireEntrySpinLock(next)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)next->Position); - MergeEntry(entry, next); - RecycleEntry(next); - } - finally - { - ReleaseEntrySpinLock(next); - } - } - - // 更新level信息 - originLevel++; - if (originLevel > entry->Level) - { - break; - } - } - - // 恢复状态为空 - EntryOperations.TrySetState(entry, EntryState.Merging, EntryState.Empty); - return entry; - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用新的静态方法 - if (entry != null) - { - EntryOperations.ReleaseBothLocks(entry); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用新的静态方法 - return EntryOperations.TryAcquireBothLocks(entry); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 44)] - internal struct Entry - { - - [FieldOffset(28)] internal int Level; // Level of the block in the allocator - [FieldOffset(40)] internal int NextLock; // 后继指针锁(控制NextNear指针操作) - - // 双锁设计:分离前后指针操作(和BucketNode保持一致) - [FieldOffset(36)] internal int PrevLock; // 前驱指针锁(控制PreviousNear指针操作) - [FieldOffset(32)] internal int State; // Node state (using int for atomic operations) - [FieldOffset(24)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - } - - // 更新后的EntryState常量类 - 使用int类型 - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int Merging = 3; // Currently being merged - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/B33447F6A49CD17C76B1998CB0C702A9 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/B33447F6A49CD17C76B1998CB0C702A9 deleted file mode 100644 index 67856675..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/B33447F6A49CD17C76B1998CB0C702A9 +++ /dev/null @@ -1,437 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,获取两个锁 - if (entry != null) - { - entry->AcquirePrevLock(); - entry->AcquireNextLock(); - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private Entry* MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return null; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = GetLevelFromSize(size); - int segment = DetermineSegmentIndex(size, originLevel); - - if (!TryAcquireEntrySpinLock(entry)) - { - return entry; // 无法获取锁,返回原Entry - } - - try - { - // 设置状态为合并中 - entry->TrySetState(EntryState.Empty, EntryState.Merging); - - - // current Level merge - while (originLevel <= entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - - - // backward merging - 向前合并 - while (true) - { - ulong p = entry->PreviousNear; - Entry* prev = (Entry*)p; - if (prev == null || - prev->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, prev) || - entry->Level != prev->Level || - !AssertAlignBoundry(offset, prev, entry->Level) || - !TryAcquireEntrySpinLock(prev)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)prev->Position); - MergeEntry(entry, prev); - RecycleEntry(prev); - } - finally - { - ReleaseEntrySpinLock(prev); - } - } - - // forward merging - 向后合并 - while (true) - { - ulong n = entry->NextNear; - Entry* next = (Entry*)n; - if (next == null || - next->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, next) || - entry->Level != next->Level || - !AssertAlignBoundry(offset, next, entry->Level) || - !TryAcquireEntrySpinLock(next)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)next->Position); - MergeEntry(entry, next); - RecycleEntry(next); - } - finally - { - ReleaseEntrySpinLock(next); - } - } - - - // 更新level信息 - originLevel++; - if (originLevel > entry->Level) - { - break; - } - } - - - // 恢复状态为空 - entry->TrySetState(EntryState.Merging, EntryState.Empty); - return entry; - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,释放两个锁 - if (entry != null) - { - entry->ReleaseBothLocks(); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,尝试获取两个锁 - return entry == null || entry->TryAcquireBothLocks(); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 44)] - internal struct Entry - { - - [FieldOffset(28)] internal int Level; // Level of the block in the allocator - [FieldOffset(40)] internal int NextLock; // 后继指针锁(控制NextNear指针操作) - - // 双锁设计:分离前后指针操作(和BucketNode保持一致) - [FieldOffset(36)] internal int PrevLock; // 前驱指针锁(控制PreviousNear指针操作) - [FieldOffset(32)] internal int State; // Node state (using int for atomic operations) - [FieldOffset(24)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(ulong index) - { - return index == EmptyHandle; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmptyIndex(Entry* entry) - { - return entry == null; - } - - /// - /// Merge two adjacent Entries (caller must ensure they are adjacent and both Empty - /// state) - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void MergeWith(Entry* other) { } - - #region State Operations (using int for atomic operations) - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TrySetState(int expectedState, int newState) - { - return Interlocked.CompareExchange(ref State, newState, expectedState) == expectedState; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public int GetState() => Volatile.Read(ref State); - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void SetState(int newState) => Volatile.Write(ref State, newState); - - // Convenience properties - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsEmpty() => GetState() == EntryState.Empty; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsAllocated() => GetState() == EntryState.Allocated; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsThreadOccupied() => GetState() == EntryState.ThreadOccupied; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsMerging() => GetState() == EntryState.Merging; - - #endregion - - #region Dual Lock Operations (和BucketNode保持一致) - - // 前驱锁操作(控制PreviousNear字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) == thread) { - Volatile.Write(ref PrevLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeld() => Volatile.Read(ref PrevLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeldByCurrentThread() => Volatile.Read(ref PrevLock) == Environment.CurrentManagedThreadId; - - // 后继锁操作(控制NextNear字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquireNextLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref NextLock) != thread) - { - while (Interlocked.CompareExchange(ref NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref NextLock) == thread) { - Volatile.Write(ref NextLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeld() => Volatile.Read(ref NextLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeldByCurrentThread() => Volatile.Read(ref NextLock) == Environment.CurrentManagedThreadId; - - // 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireBothLocks() - { - if (TryAcquirePrevLock()) - { - if (TryAcquireNextLock()) - { - return true; - } else - { - ReleasePrevLock(); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseBothLocks() - { - ReleasePrevLock(); - ReleaseNextLock(); - } - - #endregion - } - - // 更新后的EntryState常量类 - 使用int类型 - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int Merging = 3; // Currently being merged - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/B5126D29D08B2553CC28B846B92EB369 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/B5126D29D08B2553CC28B846B92EB369 deleted file mode 100644 index 4457088d..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/B5126D29D08B2553CC28B846B92EB369 +++ /dev/null @@ -1,90 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.Free.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Buffers; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -using hlsfHandle = StgSharp.HighPerformance.Memory.HybridLayerSegregatedFitAllocationHandle; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - /// - /// Free allocated memory block and perform adjacent block merging - /// - /// - /// Handle to the allocated memory block - /// - public void Free(hlsfHandle handle) - { - Entry* e = handle.EntryHandle; - if (e == null) { - return; - } - AcquireEntrySpinLock(e); - try - { - if (e->GetState() != EntryState.Allocated) { - return; - } - e->SetState(EntryState.ThreadOccupied); - - // Step 4: Try merge with adjacent free blocks and remove them from buckets - Entry* mergedEntry = MergeAndRemoveFromBuckets(e); - - // Step 5: Calculate final level and segment for the merged block - uint finalSize = mergedEntry->Size; - int finalLevel = GetLevelFromSize(finalSize); - int finalSegment = DetermineSegmentIndex(finalSize, finalLevel); - - // Step 6: Set the merged entry state to Empty (ready to be reused) - mergedEntry->SetState(EntryState.Empty); - - // Step 7: Push the merged entry back to appropriate bucket - PushLevel(finalLevel, finalSegment, (BucketNode*)mergedEntry->Position); - - // Note: If mergedEntry is different from original e, the original e - // and any merged entries have already been freed to _nodes by MergeAndRemoveFromBuckets - } - finally - { - // Step 8: Always release the spin lock - ReleaseEntrySpinLock(e); - } - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/DD33CFD2FDC59A9C6D38F3D26986324C b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/DD33CFD2FDC59A9C6D38F3D26986324C deleted file mode 100644 index 0c7ef8b9..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/DD33CFD2FDC59A9C6D38F3D26986324C +++ /dev/null @@ -1,123 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Buffers; -using System.Runtime.InteropServices; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator : IDisposable - { - - private static readonly nuint EmptyHandle = (nuint)(void*)null; - - // Bucket system field - directly in main allocator class - private ulong[] _bucketHeads; - - private Entry* _spareMemory; - private readonly byte* m_Buffer; - private bool disposedValue; - private readonly int _align; - private readonly nuint _size; - private readonly SlabAllocator _nodes; - - public HybridLayerSegregatedFitAllocator(nuint byteSize) - { - if (byteSize < 64) { - throw new InvalidOperationException(); - } - _nodes = SlabAllocator.Create(64, BufferLayout.Chunked); - _size = byteSize; - m_Buffer = (byte*)NativeMemory.AlignedAlloc(byteSize, 16); - _align = 16; - - - // 初始化桶系统 - InitializeBucketSystem(); - - - // 初始化spareMemory - _spareMemory = (Entry*)_nodes.Allocate(); - _spareMemory->SetState(EntryState.ThreadOccupied); - _spareMemory->NextNear = EmptyHandle; - _spareMemory->Position = (nuint)m_Buffer; - _spareMemory->PrevLock = 0; - _spareMemory->NextLock = 0; - } - - public HybridLayerSegregatedFitAllocator(nuint byteSize, int align) - { - if (align < 16 || (align & (align - 1)) != 0) { - throw new ArgumentException( - "Alignment must be a power of two and at least 8 bytes."); - } - _nodes = SlabAllocator.Create(64, BufferLayout.Chunked); - m_Buffer = (byte*)NativeMemory.AlignedAlloc(byteSize, (nuint)align); - _align = align; - _size = byteSize; - - InitializeBucketSystem(); - - - // 初始化spareMemory - _spareMemory = (Entry*)_nodes.Allocate(); - _spareMemory->SetState(EntryState.ThreadOccupied); - _spareMemory->NextNear = EmptyHandle; - _spareMemory->Position = (nuint)m_Buffer; - _spareMemory->PrevLock = 0; - _spareMemory->NextLock = 0; - } - - public void Dispose() - { - Dispose(disposing:true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - if (!disposedValue) - { - if (disposing) { - _nodes.Dispose(); - } - NativeMemory.AlignedFree(m_Buffer); - disposedValue = true; - } - } - - ~HybridLayerSegregatedFitAllocator() - { - Dispose(disposing:false); - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/DECC2BECA4DED326CEEAA2CED0A53942 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/DECC2BECA4DED326CEEAA2CED0A53942 deleted file mode 100644 index 1cedd00d..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/DECC2BECA4DED326CEEAA2CED0A53942 +++ /dev/null @@ -1,548 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:获取两个锁 - if (node != null) - { - node->AcquirePrevLock(); - node->AcquireNextLock(); - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - node->AcquireNextLock(); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !headNode->TryAcquirePrevLock()) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - headNode->ReleasePrevLock(); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - node->ReleaseNextLock(); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:释放两个锁 - if (node != null) - { - node->ReleaseBothLocks(); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(只读操作,暂时不加锁) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - - // 按照地址顺序获取锁,避免死锁 - BucketNode* firstLock = null, secondLock = null, thirdLock = null; - bool needPrevNextLock = false, needNodeBothLocks = false, needNextPrevLock = false; - - if (previous != null && next != null) - { - // 中间节点:需要修改前驱的next和后继的prev - if ((ulong)previous < (ulong)node && (ulong)node < (ulong)next) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - thirdLock = next; - needNextPrevLock = true; - } else if ((ulong)previous < (ulong)next && (ulong)next < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = next; - needNextPrevLock = true; - thirdLock = node; - needNodeBothLocks = true; - } else // other cases - { - firstLock = next; - needNextPrevLock = true; - secondLock = previous; - needPrevNextLock = true; - thirdLock = node; - needNodeBothLocks = true; - } - } else if (previous != null) - { - // 尾节点:只需要修改前驱的next - if ((ulong)previous < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - } else - { - firstLock = node; - needNodeBothLocks = true; - secondLock = previous; - needPrevNextLock = true; - } - } else - { - // 应该不会到这里,因为头节点已经在上面处理了 - Thread.Sleep(0); - continue; - } - - - // 按顺序获取锁 - bool acquired = false; - try - { - if (firstLock != null) - { - if (firstLock == previous && needPrevNextLock) - { - if (!firstLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == next && needNextPrevLock) - { - if (!firstLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == node && needNodeBothLocks) - { - if (!firstLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (secondLock != null) - { - if (secondLock == previous && needPrevNextLock) - { - if (!secondLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == next && needNextPrevLock) - { - if (!secondLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == node && needNodeBothLocks) - { - if (!secondLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (thirdLock != null) - { - if (thirdLock == previous && needPrevNextLock) - { - if (!thirdLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == next && needNextPrevLock) - { - if (!thirdLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == node && needNodeBothLocks) - { - if (!thirdLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - acquired = true; - - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - if (acquired) - { - // 释放锁 - if (thirdLock == previous && needPrevNextLock) - { - thirdLock->ReleaseNextLock(); - } else if (thirdLock == next && needNextPrevLock) - { - thirdLock->ReleasePrevLock(); - } else if (thirdLock == node && needNodeBothLocks) { - thirdLock->ReleaseBothLocks(); - } - - if (secondLock == previous && needPrevNextLock) - { - secondLock->ReleaseNextLock(); - } else if (secondLock == next && needNextPrevLock) - { - secondLock->ReleasePrevLock(); - } else if (secondLock == node && needNodeBothLocks) { - secondLock->ReleaseBothLocks(); - } - - if (firstLock == previous && needPrevNextLock) - { - firstLock->ReleaseNextLock(); - } else if (firstLock == next && needNextPrevLock) - { - firstLock->ReleasePrevLock(); - } else if (firstLock == node && needNodeBothLocks) { - firstLock->ReleaseBothLocks(); - } - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:尝试获取两个锁 - return node == null || node->TryAcquireBothLocks(); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!head->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !next->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - next->ReleasePrevLock(); - } - } - } - finally - { - head->ReleaseNextLock(); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] // 增加到40字节以容纳两个int锁 - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Dual Lock Operations - - // 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) == thread) { - Volatile.Write(ref PrevLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeld() => Volatile.Read(ref PrevLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeldByCurrentThread() => Volatile.Read(ref PrevLock) == Environment.CurrentManagedThreadId; - - // 后继锁操作(控制NextLevel字段)- 改为int类型 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquireNextLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref NextLock) != thread) - { - while (Interlocked.CompareExchange(ref NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref NextLock) == thread) { - Volatile.Write(ref NextLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeld() => Volatile.Read(ref NextLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeldByCurrentThread() => Volatile.Read(ref NextLock) == Environment.CurrentManagedThreadId; - - // 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireBothLocks() - { - if (TryAcquirePrevLock()) - { - if (TryAcquireNextLock()) - { - return true; - } else - { - ReleasePrevLock(); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseBothLocks() - { - ReleasePrevLock(); - ReleaseNextLock(); - } - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/E4A71FEC062DF5A85BED3133A86292F7 b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/E4A71FEC062DF5A85BED3133A86292F7 deleted file mode 100644 index 6d7e3e34..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/E4A71FEC062DF5A85BED3133A86292F7 +++ /dev/null @@ -1,291 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.SegmentEntry.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Linq.Expressions; -using System.Reflection.PortableExecutable; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Runtime.Serialization; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,获取两个锁 - if (entry != null) - { - entry->AcquirePrevLock(); - entry->AcquireNextLock(); - } - } - - private bool AssertAlignBoundry(ulong current, Entry* target, int level) - { - int size = (level * 2) + 6; - ulong align = current >> size; - return align == target->Position >> size && align == target->Size; - } - - /// - /// Determine segment index based on size and originLevel - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int DetermineSegmentIndex(uint size, int level) - { - return (int)size / levelSize[level]; - } - - /// - /// Check if two Entries are adjacent in memory - /// - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool IsAdjacentTo(Entry* current, Entry* other) - { - // Check if this immediately follows other - return other->Position + other->Size == current->Position || - current->Position + current->Size == other->Position; - } - - /// - /// Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - /// Current Entry will serve as the final merged block. The Merge will be in lazy - /// stretagey, any fail in acquiring spin lock will end a merging process. - /// - private Entry* MergeAndRemoveFromBuckets(Entry* entry) - { - if (entry == null) { - return null; - } - - Entry* result = entry; - uint size = entry->Size; - int originLevel = GetLevelFromSize(size); - int segment = DetermineSegmentIndex(size, originLevel); - - if (!TryAcquireEntrySpinLock(entry)) - { - return entry; // 无法获取锁,返回原Entry - } - - try - { - // 设置状态为合并中 - entry->TrySetState(EntryState.Empty, EntryState.Merging); - - - // current Level merge - while (originLevel <= entry->Level) - { - ulong offset = entry->Position - (ulong)m_Buffer; - - - // backward merging - 向前合并 - while (true) - { - ulong p = entry->PreviousNear; - Entry* prev = (Entry*)p; - if (prev == null || - prev->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, prev) || - entry->Level != prev->Level || - !AssertAlignBoundry(offset, prev, entry->Level) || - !TryAcquireEntrySpinLock(prev)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)prev->Position); - MergeEntry(entry, prev); - RecycleEntry(prev); - } - finally - { - ReleaseEntrySpinLock(prev); - } - } - - // forward merging - 向后合并 - while (true) - { - ulong n = entry->NextNear; - Entry* next = (Entry*)n; - if (next == null || - next->GetState() != EntryState.Empty || - !IsAdjacentTo(entry, next) || - entry->Level != next->Level || - !AssertAlignBoundry(offset, next, entry->Level) || - !TryAcquireEntrySpinLock(next)) - { - break; - } - - try - { - RemoveFromBucket(originLevel, segment, (BucketNode*)next->Position); - MergeEntry(entry, next); - RecycleEntry(next); - } - finally - { - ReleaseEntrySpinLock(next); - } - } - - - // 更新level信息 - originLevel++; - if (originLevel > entry->Level) - { - break; - } - } - - - // 恢复状态为空 - entry->TrySetState(EntryState.Merging, EntryState.Empty); - return entry; - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - private void MergeEntry(Entry* remain, Entry* other) - { - if (other == null) { - return; - } - - // Determine merged starting position and size - nuint newPosition = remain->Position < other->Position ? other->Position : other->Position; - uint newSize = remain->Size + other->Size; - - // Update current Entry - remain->Position = newPosition; - remain->Size = newSize; - } - - private void RecycleEntry(Entry* entry) - { - if (entry is null) { - return; - } - entry-> PreviousNear = EmptyHandle; - entry-> Position = EmptyHandle; - _nodes.Free((nuint)entry); - } - - private static void ReleaseEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,释放两个锁 - if (entry != null) - { - entry->ReleaseBothLocks(); - } - } - - /// - /// Remove node from position linked list - /// - private void RemoveFromPositionChain(Entry* entry) - { - AcquireEntrySpinLock(entry); - try - { - Entry* prev = (Entry*)entry->PreviousNear; - Entry* next = (Entry*)entry->NextNear; - - if (prev != null) { - prev->NextNear = entry->NextNear; - } - if (next != null) { - next->PreviousNear = entry->PreviousNear; - } - - // Clear node pointers - entry->NextNear = EmptyHandle; - entry->PreviousNear = EmptyHandle; - _nodes.Free((nuint)entry); - } - finally - { - ReleaseEntrySpinLock(entry); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static bool TryAcquireEntrySpinLock(Entry* entry) - { - // 使用新的双锁设计,尝试获取两个锁 - return entry == null || entry->TryAcquireBothLocks(); - } - - /// - /// Entry structure - streamlined version (only position and state information) Stored in - /// external SLAB - /// - [StructLayout(LayoutKind.Explicit, Size = 44)] - internal struct Entry - { - - [FieldOffset(28)] internal int Level; // Level of the block in the allocator - [FieldOffset(40)] internal int NextLock; // 后继指针锁(控制NextNear指针操作) - - // 双锁设计:分离前后指针操作(和BucketNode保持一致) - [FieldOffset(36)] internal int PrevLock; // 前驱指针锁(控制PreviousNear指针操作) - [FieldOffset(32)] internal int State; // Node state (using int for atomic operations) - [FieldOffset(24)] internal uint Size; // Block size information - [FieldOffset(8)] internal ulong NextNear; // Position linked list: next pointer - [FieldOffset(16)] internal ulong PreviousNear; // Position linked list: previous pointer - [FieldOffset(0)] public nuint Position; // Memory block position - - } - - // 更新后的EntryState常量类 - 使用int类型 - private static class EntryState - { - - public const int Allocated = 1; // Already allocated to user - public const int Empty = 0; // Free, can be allocated - public const int Merging = 3; // Currently being merged - public const int ThreadOccupied = 2; // Occupied by thread (being operated on) - - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/F1481D5666E0266F32099AD751F704AB b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/F1481D5666E0266F32099AD751F704AB deleted file mode 100644 index 1cedd00d..00000000 --- a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/F99524D9239DD54BA9E5F83C564589D2/F1481D5666E0266F32099AD751F704AB +++ /dev/null @@ -1,548 +0,0 @@ -//----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -// file="HLSFAllocator.BucketNode.cs" -// Project: StgSharp -// AuthorGroup: Nitload Space -// Copyright (c) Nitload Space. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the “Software”), to deal in the Software without restriction, -// including without limitation the rights to use, copy, modify, merge, -// publish, distribute, sublicense, and/or sell copies of the Software, -// and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: -// -// The above copyright notice and -// this permission notice shall be included in all copies -// or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED “AS IS”, -// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, -// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -// ARISING FROM, OUT OF OR IN CONNECTION WITH -// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// ----------------------------------------------------------------------- -// ----------------------------------------------------------------------- -using System; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Threading; - -namespace StgSharp.HighPerformance.Memory -{ - public unsafe partial class HybridLayerSegregatedFitAllocator - { - - private static void AcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:获取两个锁 - if (node != null) - { - node->AcquirePrevLock(); - node->AcquireNextLock(); - } - } - - /// - /// Initialize bucket system (called in constructor) - /// - private void InitializeBucketSystem() - { - _bucketHeads = new ulong[levelSize.Length * 3]; - } - - private void PushLevel(int levelIndex, int sizeIndex, BucketNode* node) - { - if (node == null || node->EntryRef == null) { - return; - } - - int index = (3 * levelIndex) + sizeIndex; - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, EmptyHandle) == EmptyHandle) - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - return; - } else - { - while (true) - { - // 对新节点只需要获取NextLock,因为我们要设置它的NextLevel - node->AcquireNextLock(); - ulong head = Volatile.Read(ref _bucketHeads[index]); - node->NextLevel = head; - BucketNode* headNode = (BucketNode*)head; - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], (nuint)node, head) == head) - { - // 对头节点只需要获取PrevLock,因为我们要设置它的PreviousLevel - if (headNode != null && !headNode->TryAcquirePrevLock()) - { - // reset state and retry - _ = Interlocked.CompareExchange(ref _bucketHeads[index], head, (nuint)node); - Thread.Sleep(0); - continue; - } - try - { - node->IsInBucket = true; - node->Magic = BucketNode.MAGIC_NUMBER; - if (headNode != null) { - headNode->PreviousLevel = (ulong)node; - } - return; - } - finally - { - if (headNode != null) { - headNode->ReleasePrevLock(); - } - } - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - node->ReleaseNextLock(); - } - } - } - } - - private static void ReleaseBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:释放两个锁 - if (node != null) - { - node->ReleaseBothLocks(); - } - } - - private void RemoveFromBucket(int levelIndex, int sizeIndex, BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - // 检查是否是栈顶节点 - if ((BucketNode*)Volatile.Read(ref _bucketHeads[index]) == node) - { - // 栈顶节点直接使用TryPopLevel - if (TryPopLevel(levelIndex, sizeIndex, out _)) - { - return; - } - continue; - } - - - // 中间或底部节点的删除操作 - // 获取当前节点的前后指针(只读操作,暂时不加锁) - ulong p = Volatile.Read(ref node->PreviousLevel); - ulong n = Volatile.Read(ref node->NextLevel); - BucketNode* previous = (BucketNode*)p; - BucketNode* next = (BucketNode*)n; - - - // 按照地址顺序获取锁,避免死锁 - BucketNode* firstLock = null, secondLock = null, thirdLock = null; - bool needPrevNextLock = false, needNodeBothLocks = false, needNextPrevLock = false; - - if (previous != null && next != null) - { - // 中间节点:需要修改前驱的next和后继的prev - if ((ulong)previous < (ulong)node && (ulong)node < (ulong)next) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - thirdLock = next; - needNextPrevLock = true; - } else if ((ulong)previous < (ulong)next && (ulong)next < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = next; - needNextPrevLock = true; - thirdLock = node; - needNodeBothLocks = true; - } else // other cases - { - firstLock = next; - needNextPrevLock = true; - secondLock = previous; - needPrevNextLock = true; - thirdLock = node; - needNodeBothLocks = true; - } - } else if (previous != null) - { - // 尾节点:只需要修改前驱的next - if ((ulong)previous < (ulong)node) - { - firstLock = previous; - needPrevNextLock = true; - secondLock = node; - needNodeBothLocks = true; - } else - { - firstLock = node; - needNodeBothLocks = true; - secondLock = previous; - needPrevNextLock = true; - } - } else - { - // 应该不会到这里,因为头节点已经在上面处理了 - Thread.Sleep(0); - continue; - } - - - // 按顺序获取锁 - bool acquired = false; - try - { - if (firstLock != null) - { - if (firstLock == previous && needPrevNextLock) - { - if (!firstLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == next && needNextPrevLock) - { - if (!firstLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (firstLock == node && needNodeBothLocks) - { - if (!firstLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (secondLock != null) - { - if (secondLock == previous && needPrevNextLock) - { - if (!secondLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == next && needNextPrevLock) - { - if (!secondLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (secondLock == node && needNodeBothLocks) - { - if (!secondLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - if (thirdLock != null) - { - if (thirdLock == previous && needPrevNextLock) - { - if (!thirdLock->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == next && needNextPrevLock) - { - if (!thirdLock->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - } else if (thirdLock == node && needNodeBothLocks) - { - if (!thirdLock->TryAcquireBothLocks()) - { - Thread.Sleep(0); - continue; - } - } - } - - acquired = true; - - - // 执行链表操作 - if (previous != null) - { - previous->NextLevel = n; - } - if (next != null) { - next->PreviousLevel = p; - } - node->NextLevel = EmptyHandle; - node->PreviousLevel = EmptyHandle; - node->IsInBucket = false; - return; - } - finally - { - if (acquired) - { - // 释放锁 - if (thirdLock == previous && needPrevNextLock) - { - thirdLock->ReleaseNextLock(); - } else if (thirdLock == next && needNextPrevLock) - { - thirdLock->ReleasePrevLock(); - } else if (thirdLock == node && needNodeBothLocks) { - thirdLock->ReleaseBothLocks(); - } - - if (secondLock == previous && needPrevNextLock) - { - secondLock->ReleaseNextLock(); - } else if (secondLock == next && needNextPrevLock) - { - secondLock->ReleasePrevLock(); - } else if (secondLock == node && needNodeBothLocks) { - secondLock->ReleaseBothLocks(); - } - - if (firstLock == previous && needPrevNextLock) - { - firstLock->ReleaseNextLock(); - } else if (firstLock == next && needNextPrevLock) - { - firstLock->ReleasePrevLock(); - } else if (firstLock == node && needNodeBothLocks) { - firstLock->ReleaseBothLocks(); - } - } - } - } - } - - private static bool TryAcquireBucketNodeSpinLock(BucketNode* node) - { - // 兼容性包装:尝试获取两个锁 - return node == null || node->TryAcquireBothLocks(); - } - - private bool TryPopLevel(int levelIndex, int sizeIndex, out BucketNode* node) - { - int index = (3 * levelIndex) + sizeIndex; - while (true) - { - ulong h = Volatile.Read(ref _bucketHeads[index]); - BucketNode* head = (BucketNode*)h; - - if (head == null) - { - node = null; - return false; - } - - - // 对头节点获取NextLock,因为我们要读取它的NextLevel - if (!head->TryAcquireNextLock()) - { - Thread.Sleep(0); - continue; - } - - ulong n = Volatile.Read(ref head->NextLevel); - BucketNode* next = (BucketNode*)n; - - try - { - // 对next节点获取PrevLock,因为我们要修改它的PreviousLevel - if (next != null && !next->TryAcquirePrevLock()) - { - Thread.Sleep(0); - continue; - } - - try - { - if (Interlocked.CompareExchange(ref _bucketHeads[index], head->NextLevel, h) == h) - { - node = head; - node->IsInBucket = false; - node->NextLevel = EmptyHandle; - if (next != null) { - next->PreviousLevel = EmptyHandle; - } - return true; - } else - { - Thread.Sleep(0); - continue; - } - } - finally - { - if (next != null) { - next->ReleasePrevLock(); - } - } - } - finally - { - head->ReleaseNextLock(); - } - } - } - - /// - /// BucketNode structure - specialized node for bucket linked lists Stored in main - /// allocation area (user-overwritable region) - /// - [StructLayout(LayoutKind.Explicit, Size = 40)] // 增加到40字节以容纳两个int锁 - internal struct BucketNode - { - - public const uint MAGIC_NUMBER = 0xBEEFCAFE; // Magic number for node integrity verification - - [FieldOffset(16)] internal Entry* EntryRef; // Pointer to corresponding Entry - [FieldOffset(28)] internal bool IsInBucket; // Whether in bucket - [FieldOffset(36)] internal int NextLock; // 后继指针锁(控制NextLevel指针操作) - - // 双锁设计:分离前后指针操作 - [FieldOffset(32)] internal int PrevLock; // 前驱指针锁(控制PreviousLevel指针操作) - [FieldOffset(24)] internal uint Magic; // Magic number verification - - [FieldOffset(0)] internal ulong NextLevel; // Bucket stack linked list: next pointer - [FieldOffset(8)] internal ulong PreviousLevel; // Bucket stack linked list: previous pointer - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool IsNullOrEmpty(BucketNode* node) - { - return node == null || node->Magic != MAGIC_NUMBER; - } - - #region Dual Lock Operations - - // 前驱锁操作(控制PreviousLevel字段) - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref PrevLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquirePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) != thread) - { - while (Interlocked.CompareExchange(ref PrevLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleasePrevLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref PrevLock) == thread) { - Volatile.Write(ref PrevLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeld() => Volatile.Read(ref PrevLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsPrevLockHeldByCurrentThread() => Volatile.Read(ref PrevLock) == Environment.CurrentManagedThreadId; - - // 后继锁操作(控制NextLevel字段)- 改为int类型 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireNextLock() - { - int thread = Environment.CurrentManagedThreadId; - return Interlocked.CompareExchange(ref NextLock, thread, 0) == 0; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void AcquireNextLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref NextLock) != thread) - { - while (Interlocked.CompareExchange(ref NextLock, thread, 0) != 0) { - Thread.Sleep(0); - } - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseNextLock() - { - int thread = Environment.CurrentManagedThreadId; - if (Volatile.Read(ref NextLock) == thread) { - Volatile.Write(ref NextLock, 0); - } - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeld() => Volatile.Read(ref NextLock) != 0; - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool IsNextLockHeldByCurrentThread() => Volatile.Read(ref NextLock) == Environment.CurrentManagedThreadId; - - // 双锁组合操作 - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public bool TryAcquireBothLocks() - { - if (TryAcquirePrevLock()) - { - if (TryAcquireNextLock()) - { - return true; - } else - { - ReleasePrevLock(); // 回滚 - return false; - } - } - return false; - } - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public void ReleaseBothLocks() - { - ReleasePrevLock(); - ReleaseNextLock(); - } - - #endregion - } - - } -} diff --git a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/state.mpack b/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/state.mpack deleted file mode 100644 index d6021e4a..00000000 Binary files a/.vs/CopilotSnapshots/F647F1E24D09C24DB19C5EC7EB5E2560/state.mpack and /dev/null differ diff --git a/.vs/StgSharpDevelop/CopilotIndices/17.14.1091.29919/CodeChunks.db b/.vs/StgSharpDevelop/CopilotIndices/17.14.1091.29919/CodeChunks.db deleted file mode 100644 index 8afd308b..00000000 Binary files a/.vs/StgSharpDevelop/CopilotIndices/17.14.1091.29919/CodeChunks.db and /dev/null differ diff --git a/.vs/StgSharpDevelop/CopilotIndices/17.14.1091.29919/SemanticSymbols.db b/.vs/StgSharpDevelop/CopilotIndices/17.14.1091.29919/SemanticSymbols.db deleted file mode 100644 index 7624a4de..00000000 Binary files a/.vs/StgSharpDevelop/CopilotIndices/17.14.1091.29919/SemanticSymbols.db and /dev/null differ diff --git a/.vs/StgSharpDevelop/CopilotIndices/17.14.878.3237/CodeChunks.db b/.vs/StgSharpDevelop/CopilotIndices/17.14.878.3237/CodeChunks.db deleted file mode 100644 index 7746b1f6..00000000 Binary files a/.vs/StgSharpDevelop/CopilotIndices/17.14.878.3237/CodeChunks.db and /dev/null differ diff --git a/.vs/StgSharpDevelop/CopilotIndices/17.14.878.3237/SemanticSymbols.db b/.vs/StgSharpDevelop/CopilotIndices/17.14.878.3237/SemanticSymbols.db deleted file mode 100644 index d7988756..00000000 Binary files a/.vs/StgSharpDevelop/CopilotIndices/17.14.878.3237/SemanticSymbols.db and /dev/null differ diff --git a/.vs/StgSharpDevelop/DesignTimeBuild/.dtbcache.v2 b/.vs/StgSharpDevelop/DesignTimeBuild/.dtbcache.v2 deleted file mode 100644 index 2041095c..00000000 Binary files a/.vs/StgSharpDevelop/DesignTimeBuild/.dtbcache.v2 and /dev/null differ diff --git a/.vs/StgSharpDevelop/copilot-chat/202838e5/sessions/2943f248-9931-400b-9c72-a63e1cbbc1be b/.vs/StgSharpDevelop/copilot-chat/202838e5/sessions/2943f248-9931-400b-9c72-a63e1cbbc1be deleted file mode 100644 index 64122aae..00000000 Binary files a/.vs/StgSharpDevelop/copilot-chat/202838e5/sessions/2943f248-9931-400b-9c72-a63e1cbbc1be and /dev/null differ diff --git a/.vs/StgSharpDevelop/copilot-chat/202838e5/sessions/3ba26b9d-2eca-43d5-996c-4fd6c028b664 b/.vs/StgSharpDevelop/copilot-chat/202838e5/sessions/3ba26b9d-2eca-43d5-996c-4fd6c028b664 deleted file mode 100644 index 6b00e062..00000000 Binary files a/.vs/StgSharpDevelop/copilot-chat/202838e5/sessions/3ba26b9d-2eca-43d5-996c-4fd6c028b664 and /dev/null differ diff --git a/.vs/StgSharpDevelop/copilot-chat/202838e5/sessions/96f061a1-27d8-4913-94ba-9e58738becbf b/.vs/StgSharpDevelop/copilot-chat/202838e5/sessions/96f061a1-27d8-4913-94ba-9e58738becbf deleted file mode 100644 index 434b3964..00000000 Binary files a/.vs/StgSharpDevelop/copilot-chat/202838e5/sessions/96f061a1-27d8-4913-94ba-9e58738becbf and /dev/null differ diff --git a/.vs/StgSharpDevelop/copilot-chat/202838e5/sessions/c14f0335-7a0b-420d-b2d3-a964032675d5 b/.vs/StgSharpDevelop/copilot-chat/202838e5/sessions/c14f0335-7a0b-420d-b2d3-a964032675d5 deleted file mode 100644 index 0f866ca5..00000000 Binary files a/.vs/StgSharpDevelop/copilot-chat/202838e5/sessions/c14f0335-7a0b-420d-b2d3-a964032675d5 and /dev/null differ diff --git a/.vs/StgSharpDevelop/copilot-chat/202838e5/sessions/e2f147f6-094d-4dc2-b19c-5ec7eb5e2560 b/.vs/StgSharpDevelop/copilot-chat/202838e5/sessions/e2f147f6-094d-4dc2-b19c-5ec7eb5e2560 deleted file mode 100644 index 555f065d..00000000 Binary files a/.vs/StgSharpDevelop/copilot-chat/202838e5/sessions/e2f147f6-094d-4dc2-b19c-5ec7eb5e2560 and /dev/null differ diff --git a/.vs/StgSharpDevelop/copilot-chat/202838e5/sessions/ed125734-fb84-43a3-9448-996122710c03 b/.vs/StgSharpDevelop/copilot-chat/202838e5/sessions/ed125734-fb84-43a3-9448-996122710c03 deleted file mode 100644 index 7def7f1e..00000000 Binary files a/.vs/StgSharpDevelop/copilot-chat/202838e5/sessions/ed125734-fb84-43a3-9448-996122710c03 and /dev/null differ diff --git a/.vs/StgSharpDevelop/v17/.futdcache.v2 b/.vs/StgSharpDevelop/v17/.futdcache.v2 deleted file mode 100644 index 5eed287e..00000000 Binary files a/.vs/StgSharpDevelop/v17/.futdcache.v2 and /dev/null differ diff --git a/.vs/StgSharpDevelop/v17/.suo b/.vs/StgSharpDevelop/v17/.suo deleted file mode 100644 index 76be2d7d..00000000 Binary files a/.vs/StgSharpDevelop/v17/.suo and /dev/null differ diff --git a/.vs/StgSharpDevelop/v17/Browse.VC.db b/.vs/StgSharpDevelop/v17/Browse.VC.db deleted file mode 100644 index 8b7f5a2d..00000000 Binary files a/.vs/StgSharpDevelop/v17/Browse.VC.db and /dev/null differ diff --git a/.vs/StgSharpDevelop/v17/DocumentLayout.backup.json b/.vs/StgSharpDevelop/v17/DocumentLayout.backup.json deleted file mode 100644 index b1e3adbe..00000000 --- a/.vs/StgSharpDevelop/v17/DocumentLayout.backup.json +++ /dev/null @@ -1,643 +0,0 @@ -{ - "Version": 1, - "WorkspaceRootPath": "D:\\platform-dev\\", - "Documents": [ - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\highperformance\\memory\\hlsfallocator.bucketnode.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\highperformance\\memory\\hlsfallocator.bucketnode.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\highperformance\\memory\\hlsfallocator.alloc.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\highperformance\\memory\\hlsfallocator.alloc.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{610B992B-BB34-49C3-9993-676C595FC12E}|StgSharpDebug\\StgSharpDebug.csproj|d:\\platform-dev\\stgsharpdebug\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{610B992B-BB34-49C3-9993-676C595FC12E}|StgSharpDebug\\StgSharpDebug.csproj|solutionrelative:stgsharpdebug\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\highperformance\\memory\\hlsfallocator.segmententry.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\highperformance\\memory\\hlsfallocator.segmententry.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\highperformance\\memory\\hlsfallocator.free.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\highperformance\\memory\\hlsfallocator.free.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\highperformance\\memory\\slaballocator.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\highperformance\\memory\\slaballocator.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\highperformance\\memory\\hlsfallocator.level.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\highperformance\\memory\\hlsfallocator.level.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\highperformance\\memory\\hlsfallocator.debug.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\highperformance\\memory\\hlsfallocator.debug.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\highperformance\\memory\\hlsfallocator.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\highperformance\\memory\\hlsfallocator.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\internal\\internalio.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\internal\\internalio.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|D:\\platform-dev\\StgSharp.Native\\sn-src\\load_glfw.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|solutionrelative:StgSharp.Native\\sn-src\\load_glfw.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\internal\\glfwfunction.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\internal\\glfwfunction.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\internal\\glfw.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\internal\\glfw.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\environment\\platform.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\environment\\platform.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\stgsharp.common.csproj||{FA3CD31E-987B-443A-9B81-186104E8DAC1}|", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\stgsharp.common.csproj||{FA3CD31E-987B-443A-9B81-186104E8DAC1}|" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\graphics\\opengl\\glapimanager.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\graphics\\opengl\\glapimanager.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|D:\\platform-dev\\StgSharp.Native\\glfw\\glfw3.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|solutionrelative:StgSharp.Native\\glfw\\glfw3.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\mvvm\\viewmodel\\viewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\mvvm\\viewmodel\\viewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\graphics\\framework.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\graphics\\framework.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|D:\\platform-dev\\StgSharp.Native\\sn-head\\StgSharpNative.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|solutionrelative:StgSharp.Native\\sn-head\\StgSharpNative.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, - { - "AbsoluteMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|D:\\platform-dev\\StgSharp.Native\\sn-head\\glfw_function.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|solutionrelative:StgSharp.Native\\sn-head\\glfw_function.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\mvvm\\viewport.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\mvvm\\viewport.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\graphics\\opengl\\glrenderstream.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\graphics\\opengl\\glrenderstream.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|D:\\platform-dev\\StgSharp.Native\\sn-src\\stgsharp_native.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|solutionrelative:StgSharp.Native\\sn-src\\stgsharp_native.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\internal\\structdefine.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\internal\\structdefine.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{610B992B-BB34-49C3-9993-676C595FC12E}|StgSharpDebug\\StgSharpDebug.csproj|d:\\platform-dev\\stgsharpdebug\\stgsharpdebug.csproj||{FA3CD31E-987B-443A-9B81-186104E8DAC1}|", - "RelativeMoniker": "D:0:0:{610B992B-BB34-49C3-9993-676C595FC12E}|StgSharpDebug\\StgSharpDebug.csproj|solutionrelative:stgsharpdebug\\stgsharpdebug.csproj||{FA3CD31E-987B-443A-9B81-186104E8DAC1}|" - }, - { - "AbsoluteMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|D:\\platform-dev\\StgSharp.Native\\sn-head\\sn_intrinsic.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|solutionrelative:StgSharp.Native\\sn-head\\sn_intrinsic.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, - { - "AbsoluteMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|D:\\platform-dev\\StgSharp.Native\\sn-head\\stb_image.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|solutionrelative:StgSharp.Native\\sn-head\\stb_image.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, - { - "AbsoluteMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|D:\\platform-dev\\StgSharp.Native\\sn-head\\sn_internal.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|solutionrelative:StgSharp.Native\\sn-head\\sn_internal.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, - { - "AbsoluteMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|D:\\platform-dev\\StgSharp.Native\\sn-src\\intrinsic.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|solutionrelative:StgSharp.Native\\sn-src\\intrinsic.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, - { - "AbsoluteMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|D:\\platform-dev\\StgSharp.Native\\sn-src\\vector_dot.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|solutionrelative:StgSharp.Native\\sn-src\\vector_dot.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, - { - "AbsoluteMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|D:\\platform-dev\\StgSharp.Native\\sn-src\\dllmain.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|solutionrelative:StgSharp.Native\\sn-src\\dllmain.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\highperformance\\matrixkernel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\highperformance\\matrixkernel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{610B992B-BB34-49C3-9993-676C595FC12E}|StgSharpDebug\\StgSharpDebug.csproj|d:\\platform-dev\\stgsharpdebug\\renderstream\\partical.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{610B992B-BB34-49C3-9993-676C595FC12E}|StgSharpDebug\\StgSharpDebug.csproj|solutionrelative:stgsharpdebug\\renderstream\\partical.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{610B992B-BB34-49C3-9993-676C595FC12E}|StgSharpDebug\\StgSharpDebug.csproj|d:\\platform-dev\\stgsharpdebug\\simddemo.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{610B992B-BB34-49C3-9993-676C595FC12E}|StgSharpDebug\\StgSharpDebug.csproj|solutionrelative:stgsharpdebug\\simddemo.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\graphics\\opengl\\buffer\\vbo.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\graphics\\opengl\\buffer\\vbo.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\mathematics\\linear\\vec4.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\mathematics\\linear\\vec4.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|D:\\NitloadIndustry\\\u7814\u7A76\u9879\u76EE\\1-Flagship\\TH2020\\ProjectFile\\\u5185\u6838\u6E90\u4EE3\u7801\\StgSharp.Native\\sn-head\\glfw3.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - } - ], - "DocumentGroupContainers": [ - { - "Orientation": 0, - "VerticalTabListWidth": 100, - "DocumentGroups": [ - { - "DockedWidth": 200, - "SelectedChildIndex": 6, - "Children": [ - { - "$type": "Bookmark", - "Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}" - }, - { - "$type": "Bookmark", - "Name": "ST:0:0:{57d563b6-44a5-47df-85be-f4199ad6b651}" - }, - { - "$type": "Document", - "DocumentIndex": 6, - "Title": "HLSFAllocator.Level.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Level.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Level.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Level.cs", - "RelativeToolTip": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Level.cs", - "ViewState": "AgIAADkAAAAAAAAAAAAAAEwAAAAIAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-17T01:35:17.495Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 2, - "Title": "Program.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharpDebug\\Program.cs", - "RelativeDocumentMoniker": "StgSharpDebug\\Program.cs", - "ToolTip": "D:\\platform-dev\\StgSharpDebug\\Program.cs", - "RelativeToolTip": "StgSharpDebug\\Program.cs", - "ViewState": "AgIAAEEAAAAAAAAAAADwv2oAAAAUAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-19T13:39:37.168Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 4, - "Title": "HLSFAllocator.Free.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Free.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Free.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Free.cs", - "RelativeToolTip": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Free.cs", - "ViewState": "AgIAACYAAAAAAAAAAAA0wDEAAAAMAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-16T07:12:52.541Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 23, - "Title": "stgsharp_native.c", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Native\\sn-src\\stgsharp_native.c", - "RelativeDocumentMoniker": "StgSharp.Native\\sn-src\\stgsharp_native.c", - "ToolTip": "D:\\platform-dev\\StgSharp.Native\\sn-src\\stgsharp_native.c", - "RelativeToolTip": "StgSharp.Native\\sn-src\\stgsharp_native.c", - "ViewState": "AgIAAAAAAAAAAAAAAAAAAEsAAAAAAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000423|", - "WhenOpened": "2025-08-20T11:53:48.245Z" - }, - { - "$type": "Document", - "DocumentIndex": 0, - "Title": "HLSFAllocator.BucketNode.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.BucketNode.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.BucketNode.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.BucketNode.cs", - "RelativeToolTip": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.BucketNode.cs", - "ViewState": "AgIAAOUBAAAAAAAAAAAywPEBAAAXAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-16T06:37:54.934Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 1, - "Title": "HLSFAllocator.Alloc.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Alloc.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Alloc.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Alloc.cs", - "RelativeToolTip": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Alloc.cs", - "ViewState": "AgIAAFoAAAAAAAAAAAAwwJ8AAAAAAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-16T06:56:06.851Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 24, - "Title": "StructDefine.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\Internal\\StructDefine.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\Internal\\StructDefine.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\Internal\\StructDefine.cs", - "RelativeToolTip": "StgSharp.Common\\Internal\\StructDefine.cs", - "ViewState": "AgIAAAAAAAAAAAAAAAA6wAAAAAAAAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-20T11:52:08.55Z" - }, - { - "$type": "Document", - "DocumentIndex": 7, - "Title": "HLSFAllocator.Debug.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Debug.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Debug.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Debug.cs", - "RelativeToolTip": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Debug.cs", - "ViewState": "AgIAADcAAAAAAAAAAAAAADcAAAAZAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-21T02:32:20.394Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 3, - "Title": "HLSFAllocator.SegmentEntry.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.SegmentEntry.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.SegmentEntry.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.SegmentEntry.cs", - "RelativeToolTip": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.SegmentEntry.cs", - "ViewState": "AgIAAMwBAAAAAAAAAADwv+gBAAAAAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-16T06:52:26.58Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 8, - "Title": "HLSFAllocator.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.cs", - "RelativeToolTip": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.cs", - "ViewState": "AgIAADwAAAAAAAAAAAAkwFkAAAAxAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-16T07:39:27.688Z" - }, - { - "$type": "Document", - "DocumentIndex": 5, - "Title": "SlabAllocator.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\SlabAllocator.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\HighPerformance\\Memory\\SlabAllocator.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\SlabAllocator.cs", - "RelativeToolTip": "StgSharp.Common\\HighPerformance\\Memory\\SlabAllocator.cs", - "ViewState": "AgIAACsAAAAAAAAAAAA7wDEAAAAAAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-21T01:47:03.06Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 18, - "Title": "framework.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\Graphics\\framework.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\Graphics\\framework.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\Graphics\\framework.cs", - "RelativeToolTip": "StgSharp.Common\\Graphics\\framework.cs", - "ViewState": "AgIAACcAAAAAAAAAAAAQwD4AAAAAAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-20T12:36:39.134Z" - }, - { - "$type": "Document", - "DocumentIndex": 17, - "Title": "ViewModel.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\MVVM\\ViewModel\\ViewModel.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\MVVM\\ViewModel\\ViewModel.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\MVVM\\ViewModel\\ViewModel.cs", - "RelativeToolTip": "StgSharp.Common\\MVVM\\ViewModel\\ViewModel.cs", - "ViewState": "AgIAAEUAAAAAAAAAAAAawFkAAAA9AAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-20T12:32:11.892Z" - }, - { - "$type": "Document", - "DocumentIndex": 14, - "Title": "StgSharp.Common.csproj", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\StgSharp.Common.csproj", - "RelativeDocumentMoniker": "StgSharp.Common\\StgSharp.Common.csproj", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\StgSharp.Common.csproj", - "RelativeToolTip": "StgSharp.Common\\StgSharp.Common.csproj", - "ViewState": "AgIAAAAAAAAAAAAAAAAAAHIAAAAAAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000758|", - "WhenOpened": "2025-08-20T13:25:44.308Z" - }, - { - "$type": "Document", - "DocumentIndex": 12, - "Title": "glfw.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\Internal\\glfw.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\Internal\\glfw.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\Internal\\glfw.cs", - "RelativeToolTip": "StgSharp.Common\\Internal\\glfw.cs", - "ViewState": "AgIAACAAAAAAAAAAAAAowDQAAAAYAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-20T11:54:37.501Z" - }, - { - "$type": "Document", - "DocumentIndex": 22, - "Title": "glRenderStream.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\Graphics\\OpenGL\\glRenderStream.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\Graphics\\OpenGL\\glRenderStream.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\Graphics\\OpenGL\\glRenderStream.cs", - "RelativeToolTip": "StgSharp.Common\\Graphics\\OpenGL\\glRenderStream.cs", - "ViewState": "AgIAAJsAAAAAAAAAAAAlwKkAAAAiAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-20T12:02:17.107Z" - }, - { - "$type": "Document", - "DocumentIndex": 11, - "Title": "glfwFunction.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\Internal\\glfwFunction.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\Internal\\glfwFunction.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\Internal\\glfwFunction.cs", - "RelativeToolTip": "StgSharp.Common\\Internal\\glfwFunction.cs", - "ViewState": "AgIAAIMAAAAAAAAAAAAswCcAAAAAAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-20T11:55:11.991Z" - }, - { - "$type": "Document", - "DocumentIndex": 10, - "Title": "load_glfw.c", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Native\\sn-src\\load_glfw.c", - "RelativeDocumentMoniker": "StgSharp.Native\\sn-src\\load_glfw.c", - "ToolTip": "D:\\platform-dev\\StgSharp.Native\\sn-src\\load_glfw.c", - "RelativeToolTip": "StgSharp.Native\\sn-src\\load_glfw.c", - "ViewState": "AgIAAAAAAAAAAAAAAAAAACAAAAAxAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000423|", - "WhenOpened": "2025-08-20T12:05:52.802Z" - }, - { - "$type": "Document", - "DocumentIndex": 20, - "Title": "glfw_function.h", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Native\\sn-head\\glfw_function.h", - "RelativeDocumentMoniker": "StgSharp.Native\\sn-head\\glfw_function.h", - "ToolTip": "D:\\platform-dev\\StgSharp.Native\\sn-head\\glfw_function.h", - "RelativeToolTip": "StgSharp.Native\\sn-head\\glfw_function.h", - "ViewState": "AgIAAAAAAAAAAAAAAAAAAAkAAAAeAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", - "WhenOpened": "2025-08-20T12:08:46.273Z" - }, - { - "$type": "Document", - "DocumentIndex": 21, - "Title": "ViewPort.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\MVVM\\ViewPort.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\MVVM\\ViewPort.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\MVVM\\ViewPort.cs", - "RelativeToolTip": "StgSharp.Common\\MVVM\\ViewPort.cs", - "ViewState": "AgIAACMAAAAAAAAAAAAywC8AAAAJAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-20T12:12:13.435Z" - }, - { - "$type": "Document", - "DocumentIndex": 16, - "Title": "glfw3.h", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Native\\glfw\\glfw3.h", - "RelativeDocumentMoniker": "StgSharp.Native\\glfw\\glfw3.h", - "ToolTip": "D:\\platform-dev\\StgSharp.Native\\glfw\\glfw3.h", - "RelativeToolTip": "StgSharp.Native\\glfw\\glfw3.h", - "ViewState": "AgIAAEIWAAAAAAAAAAAQwFYWAAAnAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", - "WhenOpened": "2025-08-20T12:29:52.585Z" - }, - { - "$type": "Document", - "DocumentIndex": 15, - "Title": "glApiManager.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\Graphics\\OpenGL\\glApiManager.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\Graphics\\OpenGL\\glApiManager.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\Graphics\\OpenGL\\glApiManager.cs", - "RelativeToolTip": "StgSharp.Common\\Graphics\\OpenGL\\glApiManager.cs", - "ViewState": "AgIAAJcAAAAAAAAAAAAQwLQAAABfAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-20T12:40:58.216Z" - }, - { - "$type": "Document", - "DocumentIndex": 9, - "Title": "InternalIO.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\Internal\\InternalIO.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\Internal\\InternalIO.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\Internal\\InternalIO.cs", - "RelativeToolTip": "StgSharp.Common\\Internal\\InternalIO.cs", - "ViewState": "AgIAACsAAAAAAAAAAAAAAEMAAAAJAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-20T13:05:03.789Z" - }, - { - "$type": "Document", - "DocumentIndex": 13, - "Title": "Platform.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\Environment\\Platform.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\Environment\\Platform.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\Environment\\Platform.cs", - "RelativeToolTip": "StgSharp.Common\\Environment\\Platform.cs", - "ViewState": "AgIAACsAAAAAAAAAAIA1wD8AAAAeAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-20T13:14:42.715Z" - }, - { - "$type": "Document", - "DocumentIndex": 25, - "Title": "StgSharpDebug.csproj", - "DocumentMoniker": "D:\\platform-dev\\StgSharpDebug\\StgSharpDebug.csproj", - "RelativeDocumentMoniker": "StgSharpDebug\\StgSharpDebug.csproj", - "ToolTip": "D:\\platform-dev\\StgSharpDebug\\StgSharpDebug.csproj", - "RelativeToolTip": "StgSharpDebug\\StgSharpDebug.csproj", - "ViewState": "AgIAAE4AAAAAAAAAAAAEwGIAAAAIAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000758|", - "WhenOpened": "2025-08-20T05:47:53.711Z" - }, - { - "$type": "Document", - "DocumentIndex": 26, - "Title": "sn_intrinsic.h", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Native\\sn-head\\sn_intrinsic.h", - "RelativeDocumentMoniker": "StgSharp.Native\\sn-head\\sn_intrinsic.h", - "ToolTip": "D:\\platform-dev\\StgSharp.Native\\sn-head\\sn_intrinsic.h", - "RelativeToolTip": "StgSharp.Native\\sn-head\\sn_intrinsic.h", - "ViewState": "AgIAAAsAAAAAAAAAAAAswCIAAAAZAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", - "WhenOpened": "2025-08-20T02:37:06.377Z" - }, - { - "$type": "Document", - "DocumentIndex": 29, - "Title": "intrinsic.c", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Native\\sn-src\\intrinsic.c", - "RelativeDocumentMoniker": "StgSharp.Native\\sn-src\\intrinsic.c", - "ToolTip": "D:\\platform-dev\\StgSharp.Native\\sn-src\\intrinsic.c", - "RelativeToolTip": "StgSharp.Native\\sn-src\\intrinsic.c", - "ViewState": "AgIAAAAAAAAAAAAAAAAAABEAAAApAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000423|", - "WhenOpened": "2025-08-20T02:38:45.215Z" - }, - { - "$type": "Document", - "DocumentIndex": 30, - "Title": "vector_dot.c", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Native\\sn-src\\vector_dot.c", - "RelativeDocumentMoniker": "StgSharp.Native\\sn-src\\vector_dot.c", - "ToolTip": "D:\\platform-dev\\StgSharp.Native\\sn-src\\vector_dot.c", - "RelativeToolTip": "StgSharp.Native\\sn-src\\vector_dot.c", - "ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000423|", - "WhenOpened": "2025-08-20T02:37:22.381Z" - }, - { - "$type": "Document", - "DocumentIndex": 19, - "Title": "StgSharpNative.h", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Native\\sn-head\\StgSharpNative.h", - "RelativeDocumentMoniker": "StgSharp.Native\\sn-head\\StgSharpNative.h", - "ToolTip": "D:\\platform-dev\\StgSharp.Native\\sn-head\\StgSharpNative.h", - "RelativeToolTip": "StgSharp.Native\\sn-head\\StgSharpNative.h", - "ViewState": "AgIAAAAAAAAAAAAAAAAAABIAAAAXAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", - "WhenOpened": "2025-08-20T02:34:25.457Z" - }, - { - "$type": "Document", - "DocumentIndex": 27, - "Title": "stb_image.h", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Native\\sn-head\\stb_image.h", - "RelativeDocumentMoniker": "StgSharp.Native\\sn-head\\stb_image.h", - "ToolTip": "D:\\platform-dev\\StgSharp.Native\\sn-head\\stb_image.h", - "RelativeToolTip": "StgSharp.Native\\sn-head\\stb_image.h", - "ViewState": "AgIAAKMBAAAAAAAAAAASwLcBAAADAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", - "WhenOpened": "2025-08-20T02:33:48.669Z" - }, - { - "$type": "Document", - "DocumentIndex": 31, - "Title": "dllmain.c", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Native\\sn-src\\dllmain.c", - "RelativeDocumentMoniker": "StgSharp.Native\\sn-src\\dllmain.c", - "ToolTip": "D:\\platform-dev\\StgSharp.Native\\sn-src\\dllmain.c", - "RelativeToolTip": "StgSharp.Native\\sn-src\\dllmain.c", - "ViewState": "AgIAAAAAAAAAAAAAAAAAAA8AAAAgAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000423|", - "WhenOpened": "2025-08-20T02:28:38.694Z" - }, - { - "$type": "Document", - "DocumentIndex": 37, - "Title": "glfw3.h", - "DocumentMoniker": "D:\\NitloadIndustry\\\u7814\u7A76\u9879\u76EE\\1-Flagship\\TH2020\\ProjectFile\\\u5185\u6838\u6E90\u4EE3\u7801\\StgSharp.Native\\sn-head\\glfw3.h", - "RelativeDocumentMoniker": "..\\NitloadIndustry\\\u7814\u7A76\u9879\u76EE\\1-Flagship\\TH2020\\ProjectFile\\\u5185\u6838\u6E90\u4EE3\u7801\\StgSharp.Native\\sn-head\\glfw3.h", - "ToolTip": "D:\\NitloadIndustry\\\u7814\u7A76\u9879\u76EE\\1-Flagship\\TH2020\\ProjectFile\\\u5185\u6838\u6E90\u4EE3\u7801\\StgSharp.Native\\sn-head\\glfw3.h", - "RelativeToolTip": "..\\NitloadIndustry\\\u7814\u7A76\u9879\u76EE\\1-Flagship\\TH2020\\ProjectFile\\\u5185\u6838\u6E90\u4EE3\u7801\\StgSharp.Native\\sn-head\\glfw3.h", - "ViewState": "AgIAAG0QAAAAAAAAAIA4wH4QAABSAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", - "WhenOpened": "2025-08-20T01:11:12.671Z" - }, - { - "$type": "Document", - "DocumentIndex": 32, - "Title": "MatrixKernel.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\MatrixKernel.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\HighPerformance\\MatrixKernel.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\MatrixKernel.cs", - "RelativeToolTip": "StgSharp.Common\\HighPerformance\\MatrixKernel.cs", - "ViewState": "AgIAACkAAAAAAAAAAAAmwCcAAAATAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-16T07:35:19.74Z" - }, - { - "$type": "Document", - "DocumentIndex": 33, - "Title": "Partical.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharpDebug\\RenderStream\\Partical.cs", - "RelativeDocumentMoniker": "StgSharpDebug\\RenderStream\\Partical.cs", - "ToolTip": "D:\\platform-dev\\StgSharpDebug\\RenderStream\\Partical.cs", - "RelativeToolTip": "StgSharpDebug\\RenderStream\\Partical.cs", - "ViewState": "AgIAAB0BAAAAAAAAAAAuwCwBAAAUAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-16T07:57:41.271Z" - }, - { - "$type": "Document", - "DocumentIndex": 34, - "Title": "SimdDemo.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharpDebug\\SimdDemo.cs", - "RelativeDocumentMoniker": "StgSharpDebug\\SimdDemo.cs", - "ToolTip": "D:\\platform-dev\\StgSharpDebug\\SimdDemo.cs", - "RelativeToolTip": "StgSharpDebug\\SimdDemo.cs", - "ViewState": "AgIAABkAAAAAAAAAAAA5wCUAAAArAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-16T08:12:36.718Z" - }, - { - "$type": "Document", - "DocumentIndex": 35, - "Title": "VBO.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\Graphics\\OpenGL\\Buffer\\VBO.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\Graphics\\OpenGL\\Buffer\\VBO.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\Graphics\\OpenGL\\Buffer\\VBO.cs", - "RelativeToolTip": "StgSharp.Common\\Graphics\\OpenGL\\Buffer\\VBO.cs", - "ViewState": "AgIAAEcAAAAAAAAAAAAuwFIAAAAgAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-16T07:59:45.885Z" - }, - { - "$type": "Document", - "DocumentIndex": 36, - "Title": "Vec4.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\Mathematics\\Linear\\Vec4.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\Mathematics\\Linear\\Vec4.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\Mathematics\\Linear\\Vec4.cs", - "RelativeToolTip": "StgSharp.Common\\Mathematics\\Linear\\Vec4.cs", - "ViewState": "AgIAAKAAAAAAAAAAAAA5wKIAAAAAAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-16T07:57:21.557Z" - }, - { - "$type": "Document", - "DocumentIndex": 28, - "Title": "sn_internal.h", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Native\\sn-head\\sn_internal.h", - "RelativeDocumentMoniker": "StgSharp.Native\\sn-head\\sn_internal.h", - "ToolTip": "D:\\platform-dev\\StgSharp.Native\\sn-head\\sn_internal.h", - "RelativeToolTip": "StgSharp.Native\\sn-head\\sn_internal.h", - "ViewState": "AgIAAAAAAAAAAAAAAAAAAA0AAAAPAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", - "WhenOpened": "2025-08-16T07:31:27.146Z" - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/.vs/StgSharpDevelop/v17/DocumentLayout.json b/.vs/StgSharpDevelop/v17/DocumentLayout.json deleted file mode 100644 index 88fb7321..00000000 --- a/.vs/StgSharpDevelop/v17/DocumentLayout.json +++ /dev/null @@ -1,643 +0,0 @@ -{ - "Version": 1, - "WorkspaceRootPath": "D:\\platform-dev\\", - "Documents": [ - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\highperformance\\memory\\hlsfallocator.bucketnode.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\highperformance\\memory\\hlsfallocator.bucketnode.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\highperformance\\memory\\hlsfallocator.alloc.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\highperformance\\memory\\hlsfallocator.alloc.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\highperformance\\memory\\hlsfallocator.segmententry.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\highperformance\\memory\\hlsfallocator.segmententry.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{610B992B-BB34-49C3-9993-676C595FC12E}|StgSharpDebug\\StgSharpDebug.csproj|d:\\platform-dev\\stgsharpdebug\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{610B992B-BB34-49C3-9993-676C595FC12E}|StgSharpDebug\\StgSharpDebug.csproj|solutionrelative:stgsharpdebug\\program.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\highperformance\\memory\\hlsfallocator.free.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\highperformance\\memory\\hlsfallocator.free.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\highperformance\\memory\\slaballocator.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\highperformance\\memory\\slaballocator.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\highperformance\\memory\\hlsfallocator.level.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\highperformance\\memory\\hlsfallocator.level.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\highperformance\\memory\\hlsfallocator.debug.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\highperformance\\memory\\hlsfallocator.debug.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\highperformance\\memory\\hlsfallocator.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\highperformance\\memory\\hlsfallocator.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\internal\\internalio.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\internal\\internalio.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|D:\\platform-dev\\StgSharp.Native\\sn-src\\load_glfw.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|solutionrelative:StgSharp.Native\\sn-src\\load_glfw.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\internal\\glfwfunction.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\internal\\glfwfunction.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\internal\\glfw.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\internal\\glfw.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\environment\\platform.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\environment\\platform.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\stgsharp.common.csproj||{FA3CD31E-987B-443A-9B81-186104E8DAC1}|", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\stgsharp.common.csproj||{FA3CD31E-987B-443A-9B81-186104E8DAC1}|" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\graphics\\opengl\\glapimanager.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\graphics\\opengl\\glapimanager.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|D:\\platform-dev\\StgSharp.Native\\glfw\\glfw3.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|solutionrelative:StgSharp.Native\\glfw\\glfw3.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\mvvm\\viewmodel\\viewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\mvvm\\viewmodel\\viewmodel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\graphics\\framework.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\graphics\\framework.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|D:\\platform-dev\\StgSharp.Native\\sn-head\\StgSharpNative.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|solutionrelative:StgSharp.Native\\sn-head\\StgSharpNative.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, - { - "AbsoluteMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|D:\\platform-dev\\StgSharp.Native\\sn-head\\glfw_function.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|solutionrelative:StgSharp.Native\\sn-head\\glfw_function.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\mvvm\\viewport.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\mvvm\\viewport.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\graphics\\opengl\\glrenderstream.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\graphics\\opengl\\glrenderstream.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|D:\\platform-dev\\StgSharp.Native\\sn-src\\stgsharp_native.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|solutionrelative:StgSharp.Native\\sn-src\\stgsharp_native.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\internal\\structdefine.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\internal\\structdefine.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{610B992B-BB34-49C3-9993-676C595FC12E}|StgSharpDebug\\StgSharpDebug.csproj|d:\\platform-dev\\stgsharpdebug\\stgsharpdebug.csproj||{FA3CD31E-987B-443A-9B81-186104E8DAC1}|", - "RelativeMoniker": "D:0:0:{610B992B-BB34-49C3-9993-676C595FC12E}|StgSharpDebug\\StgSharpDebug.csproj|solutionrelative:stgsharpdebug\\stgsharpdebug.csproj||{FA3CD31E-987B-443A-9B81-186104E8DAC1}|" - }, - { - "AbsoluteMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|D:\\platform-dev\\StgSharp.Native\\sn-head\\sn_intrinsic.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|solutionrelative:StgSharp.Native\\sn-head\\sn_intrinsic.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, - { - "AbsoluteMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|D:\\platform-dev\\StgSharp.Native\\sn-head\\stb_image.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|solutionrelative:StgSharp.Native\\sn-head\\stb_image.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, - { - "AbsoluteMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|D:\\platform-dev\\StgSharp.Native\\sn-head\\sn_internal.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|solutionrelative:StgSharp.Native\\sn-head\\sn_internal.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, - { - "AbsoluteMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|D:\\platform-dev\\StgSharp.Native\\sn-src\\intrinsic.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|solutionrelative:StgSharp.Native\\sn-src\\intrinsic.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, - { - "AbsoluteMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|D:\\platform-dev\\StgSharp.Native\\sn-src\\vector_dot.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|solutionrelative:StgSharp.Native\\sn-src\\vector_dot.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, - { - "AbsoluteMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|D:\\platform-dev\\StgSharp.Native\\sn-src\\dllmain.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", - "RelativeMoniker": "D:0:0:{20CBFF26-6746-402E-992C-7B643E9423EB}|StgSharp.Native\\StgSharp.Native.vcxproj|solutionrelative:StgSharp.Native\\sn-src\\dllmain.c||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\highperformance\\matrixkernel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\highperformance\\matrixkernel.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{610B992B-BB34-49C3-9993-676C595FC12E}|StgSharpDebug\\StgSharpDebug.csproj|d:\\platform-dev\\stgsharpdebug\\renderstream\\partical.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{610B992B-BB34-49C3-9993-676C595FC12E}|StgSharpDebug\\StgSharpDebug.csproj|solutionrelative:stgsharpdebug\\renderstream\\partical.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{610B992B-BB34-49C3-9993-676C595FC12E}|StgSharpDebug\\StgSharpDebug.csproj|d:\\platform-dev\\stgsharpdebug\\simddemo.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{610B992B-BB34-49C3-9993-676C595FC12E}|StgSharpDebug\\StgSharpDebug.csproj|solutionrelative:stgsharpdebug\\simddemo.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\graphics\\opengl\\buffer\\vbo.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\graphics\\opengl\\buffer\\vbo.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|d:\\platform-dev\\stgsharp.common\\mathematics\\linear\\vec4.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}", - "RelativeMoniker": "D:0:0:{3EAF2EE6-FA9E-4F57-951F-7E6F8125DFBF}|StgSharp.Common\\StgSharp.Common.csproj|solutionrelative:stgsharp.common\\mathematics\\linear\\vec4.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}" - }, - { - "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|D:\\NitloadIndustry\\\u7814\u7A76\u9879\u76EE\\1-Flagship\\TH2020\\ProjectFile\\\u5185\u6838\u6E90\u4EE3\u7801\\StgSharp.Native\\sn-head\\glfw3.h||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" - } - ], - "DocumentGroupContainers": [ - { - "Orientation": 0, - "VerticalTabListWidth": 100, - "DocumentGroups": [ - { - "DockedWidth": 200, - "SelectedChildIndex": 6, - "Children": [ - { - "$type": "Bookmark", - "Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}" - }, - { - "$type": "Bookmark", - "Name": "ST:0:0:{57d563b6-44a5-47df-85be-f4199ad6b651}" - }, - { - "$type": "Document", - "DocumentIndex": 6, - "Title": "HLSFAllocator.Level.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Level.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Level.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Level.cs", - "RelativeToolTip": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Level.cs", - "ViewState": "AgIAADkAAAAAAAAAAAAAAEwAAAAIAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-17T01:35:17.495Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 3, - "Title": "Program.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharpDebug\\Program.cs", - "RelativeDocumentMoniker": "StgSharpDebug\\Program.cs", - "ToolTip": "D:\\platform-dev\\StgSharpDebug\\Program.cs", - "RelativeToolTip": "StgSharpDebug\\Program.cs", - "ViewState": "AgIAAEEAAAAAAAAAAADwv1MAAAAcAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-19T13:39:37.168Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 4, - "Title": "HLSFAllocator.Free.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Free.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Free.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Free.cs", - "RelativeToolTip": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Free.cs", - "ViewState": "AgIAACYAAAAAAAAAAAA0wDEAAAAMAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-16T07:12:52.541Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 23, - "Title": "stgsharp_native.c", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Native\\sn-src\\stgsharp_native.c", - "RelativeDocumentMoniker": "StgSharp.Native\\sn-src\\stgsharp_native.c", - "ToolTip": "D:\\platform-dev\\StgSharp.Native\\sn-src\\stgsharp_native.c", - "RelativeToolTip": "StgSharp.Native\\sn-src\\stgsharp_native.c", - "ViewState": "AgIAAAAAAAAAAAAAAAAAAEsAAAAAAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000423|", - "WhenOpened": "2025-08-20T11:53:48.245Z" - }, - { - "$type": "Document", - "DocumentIndex": 0, - "Title": "HLSFAllocator.BucketNode.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.BucketNode.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.BucketNode.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.BucketNode.cs", - "RelativeToolTip": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.BucketNode.cs", - "ViewState": "AgIAAOUBAAAAAAAAAAAUwBcCAAAAAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-16T06:37:54.934Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 1, - "Title": "HLSFAllocator.Alloc.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Alloc.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Alloc.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Alloc.cs", - "RelativeToolTip": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Alloc.cs", - "ViewState": "AgIAAEMAAAAAAAAAAAArwFgAAAAUAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-16T06:56:06.851Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 24, - "Title": "StructDefine.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\Internal\\StructDefine.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\Internal\\StructDefine.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\Internal\\StructDefine.cs", - "RelativeToolTip": "StgSharp.Common\\Internal\\StructDefine.cs", - "ViewState": "AgIAAAAAAAAAAAAAAAA6wAAAAAAAAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-20T11:52:08.55Z" - }, - { - "$type": "Document", - "DocumentIndex": 7, - "Title": "HLSFAllocator.Debug.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Debug.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Debug.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Debug.cs", - "RelativeToolTip": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.Debug.cs", - "ViewState": "AgIAADcAAAAAAAAAAAAAADcAAAAZAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-21T02:32:20.394Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 2, - "Title": "HLSFAllocator.SegmentEntry.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.SegmentEntry.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.SegmentEntry.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.SegmentEntry.cs", - "RelativeToolTip": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.SegmentEntry.cs", - "ViewState": "AgIAAIkBAAAAAAAAAAAAwJ0BAAAUAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-16T06:52:26.58Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 8, - "Title": "HLSFAllocator.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.cs", - "RelativeToolTip": "StgSharp.Common\\HighPerformance\\Memory\\HLSFAllocator.cs", - "ViewState": "AgIAADwAAAAAAAAAAAAkwFkAAAAxAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-16T07:39:27.688Z" - }, - { - "$type": "Document", - "DocumentIndex": 5, - "Title": "SlabAllocator.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\SlabAllocator.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\HighPerformance\\Memory\\SlabAllocator.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\Memory\\SlabAllocator.cs", - "RelativeToolTip": "StgSharp.Common\\HighPerformance\\Memory\\SlabAllocator.cs", - "ViewState": "AgIAACsAAAAAAAAAAAA7wDEAAAAAAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-21T01:47:03.06Z", - "EditorCaption": "" - }, - { - "$type": "Document", - "DocumentIndex": 18, - "Title": "framework.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\Graphics\\framework.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\Graphics\\framework.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\Graphics\\framework.cs", - "RelativeToolTip": "StgSharp.Common\\Graphics\\framework.cs", - "ViewState": "AgIAACcAAAAAAAAAAAAQwD4AAAAAAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-20T12:36:39.134Z" - }, - { - "$type": "Document", - "DocumentIndex": 17, - "Title": "ViewModel.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\MVVM\\ViewModel\\ViewModel.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\MVVM\\ViewModel\\ViewModel.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\MVVM\\ViewModel\\ViewModel.cs", - "RelativeToolTip": "StgSharp.Common\\MVVM\\ViewModel\\ViewModel.cs", - "ViewState": "AgIAAEUAAAAAAAAAAAAawFkAAAA9AAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-20T12:32:11.892Z" - }, - { - "$type": "Document", - "DocumentIndex": 14, - "Title": "StgSharp.Common.csproj", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\StgSharp.Common.csproj", - "RelativeDocumentMoniker": "StgSharp.Common\\StgSharp.Common.csproj", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\StgSharp.Common.csproj", - "RelativeToolTip": "StgSharp.Common\\StgSharp.Common.csproj", - "ViewState": "AgIAAAAAAAAAAAAAAAAAAHIAAAAAAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000758|", - "WhenOpened": "2025-08-20T13:25:44.308Z" - }, - { - "$type": "Document", - "DocumentIndex": 12, - "Title": "glfw.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\Internal\\glfw.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\Internal\\glfw.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\Internal\\glfw.cs", - "RelativeToolTip": "StgSharp.Common\\Internal\\glfw.cs", - "ViewState": "AgIAACAAAAAAAAAAAAAowDQAAAAYAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-20T11:54:37.501Z" - }, - { - "$type": "Document", - "DocumentIndex": 22, - "Title": "glRenderStream.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\Graphics\\OpenGL\\glRenderStream.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\Graphics\\OpenGL\\glRenderStream.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\Graphics\\OpenGL\\glRenderStream.cs", - "RelativeToolTip": "StgSharp.Common\\Graphics\\OpenGL\\glRenderStream.cs", - "ViewState": "AgIAAJsAAAAAAAAAAAAlwKkAAAAiAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-20T12:02:17.107Z" - }, - { - "$type": "Document", - "DocumentIndex": 11, - "Title": "glfwFunction.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\Internal\\glfwFunction.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\Internal\\glfwFunction.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\Internal\\glfwFunction.cs", - "RelativeToolTip": "StgSharp.Common\\Internal\\glfwFunction.cs", - "ViewState": "AgIAAIMAAAAAAAAAAAAswCcAAAAAAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-20T11:55:11.991Z" - }, - { - "$type": "Document", - "DocumentIndex": 10, - "Title": "load_glfw.c", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Native\\sn-src\\load_glfw.c", - "RelativeDocumentMoniker": "StgSharp.Native\\sn-src\\load_glfw.c", - "ToolTip": "D:\\platform-dev\\StgSharp.Native\\sn-src\\load_glfw.c", - "RelativeToolTip": "StgSharp.Native\\sn-src\\load_glfw.c", - "ViewState": "AgIAAAAAAAAAAAAAAAAAACAAAAAxAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000423|", - "WhenOpened": "2025-08-20T12:05:52.802Z" - }, - { - "$type": "Document", - "DocumentIndex": 20, - "Title": "glfw_function.h", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Native\\sn-head\\glfw_function.h", - "RelativeDocumentMoniker": "StgSharp.Native\\sn-head\\glfw_function.h", - "ToolTip": "D:\\platform-dev\\StgSharp.Native\\sn-head\\glfw_function.h", - "RelativeToolTip": "StgSharp.Native\\sn-head\\glfw_function.h", - "ViewState": "AgIAAAAAAAAAAAAAAAAAAAkAAAAeAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", - "WhenOpened": "2025-08-20T12:08:46.273Z" - }, - { - "$type": "Document", - "DocumentIndex": 21, - "Title": "ViewPort.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\MVVM\\ViewPort.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\MVVM\\ViewPort.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\MVVM\\ViewPort.cs", - "RelativeToolTip": "StgSharp.Common\\MVVM\\ViewPort.cs", - "ViewState": "AgIAACMAAAAAAAAAAAAywC8AAAAJAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-20T12:12:13.435Z" - }, - { - "$type": "Document", - "DocumentIndex": 16, - "Title": "glfw3.h", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Native\\glfw\\glfw3.h", - "RelativeDocumentMoniker": "StgSharp.Native\\glfw\\glfw3.h", - "ToolTip": "D:\\platform-dev\\StgSharp.Native\\glfw\\glfw3.h", - "RelativeToolTip": "StgSharp.Native\\glfw\\glfw3.h", - "ViewState": "AgIAAEIWAAAAAAAAAAAQwFYWAAAnAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", - "WhenOpened": "2025-08-20T12:29:52.585Z" - }, - { - "$type": "Document", - "DocumentIndex": 15, - "Title": "glApiManager.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\Graphics\\OpenGL\\glApiManager.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\Graphics\\OpenGL\\glApiManager.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\Graphics\\OpenGL\\glApiManager.cs", - "RelativeToolTip": "StgSharp.Common\\Graphics\\OpenGL\\glApiManager.cs", - "ViewState": "AgIAAJcAAAAAAAAAAAAQwLQAAABfAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-20T12:40:58.216Z" - }, - { - "$type": "Document", - "DocumentIndex": 9, - "Title": "InternalIO.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\Internal\\InternalIO.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\Internal\\InternalIO.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\Internal\\InternalIO.cs", - "RelativeToolTip": "StgSharp.Common\\Internal\\InternalIO.cs", - "ViewState": "AgIAACsAAAAAAAAAAAAAAEMAAAAJAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-20T13:05:03.789Z" - }, - { - "$type": "Document", - "DocumentIndex": 13, - "Title": "Platform.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\Environment\\Platform.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\Environment\\Platform.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\Environment\\Platform.cs", - "RelativeToolTip": "StgSharp.Common\\Environment\\Platform.cs", - "ViewState": "AgIAACsAAAAAAAAAAIA1wD8AAAAeAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-20T13:14:42.715Z" - }, - { - "$type": "Document", - "DocumentIndex": 25, - "Title": "StgSharpDebug.csproj", - "DocumentMoniker": "D:\\platform-dev\\StgSharpDebug\\StgSharpDebug.csproj", - "RelativeDocumentMoniker": "StgSharpDebug\\StgSharpDebug.csproj", - "ToolTip": "D:\\platform-dev\\StgSharpDebug\\StgSharpDebug.csproj", - "RelativeToolTip": "StgSharpDebug\\StgSharpDebug.csproj", - "ViewState": "AgIAAE4AAAAAAAAAAAAEwGIAAAAIAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000758|", - "WhenOpened": "2025-08-20T05:47:53.711Z" - }, - { - "$type": "Document", - "DocumentIndex": 26, - "Title": "sn_intrinsic.h", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Native\\sn-head\\sn_intrinsic.h", - "RelativeDocumentMoniker": "StgSharp.Native\\sn-head\\sn_intrinsic.h", - "ToolTip": "D:\\platform-dev\\StgSharp.Native\\sn-head\\sn_intrinsic.h", - "RelativeToolTip": "StgSharp.Native\\sn-head\\sn_intrinsic.h", - "ViewState": "AgIAAAsAAAAAAAAAAAAswCIAAAAZAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", - "WhenOpened": "2025-08-20T02:37:06.377Z" - }, - { - "$type": "Document", - "DocumentIndex": 29, - "Title": "intrinsic.c", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Native\\sn-src\\intrinsic.c", - "RelativeDocumentMoniker": "StgSharp.Native\\sn-src\\intrinsic.c", - "ToolTip": "D:\\platform-dev\\StgSharp.Native\\sn-src\\intrinsic.c", - "RelativeToolTip": "StgSharp.Native\\sn-src\\intrinsic.c", - "ViewState": "AgIAAAAAAAAAAAAAAAAAABEAAAApAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000423|", - "WhenOpened": "2025-08-20T02:38:45.215Z" - }, - { - "$type": "Document", - "DocumentIndex": 30, - "Title": "vector_dot.c", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Native\\sn-src\\vector_dot.c", - "RelativeDocumentMoniker": "StgSharp.Native\\sn-src\\vector_dot.c", - "ToolTip": "D:\\platform-dev\\StgSharp.Native\\sn-src\\vector_dot.c", - "RelativeToolTip": "StgSharp.Native\\sn-src\\vector_dot.c", - "ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000423|", - "WhenOpened": "2025-08-20T02:37:22.381Z" - }, - { - "$type": "Document", - "DocumentIndex": 19, - "Title": "StgSharpNative.h", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Native\\sn-head\\StgSharpNative.h", - "RelativeDocumentMoniker": "StgSharp.Native\\sn-head\\StgSharpNative.h", - "ToolTip": "D:\\platform-dev\\StgSharp.Native\\sn-head\\StgSharpNative.h", - "RelativeToolTip": "StgSharp.Native\\sn-head\\StgSharpNative.h", - "ViewState": "AgIAAAAAAAAAAAAAAAAAABIAAAAXAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", - "WhenOpened": "2025-08-20T02:34:25.457Z" - }, - { - "$type": "Document", - "DocumentIndex": 27, - "Title": "stb_image.h", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Native\\sn-head\\stb_image.h", - "RelativeDocumentMoniker": "StgSharp.Native\\sn-head\\stb_image.h", - "ToolTip": "D:\\platform-dev\\StgSharp.Native\\sn-head\\stb_image.h", - "RelativeToolTip": "StgSharp.Native\\sn-head\\stb_image.h", - "ViewState": "AgIAAKMBAAAAAAAAAAASwLcBAAADAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", - "WhenOpened": "2025-08-20T02:33:48.669Z" - }, - { - "$type": "Document", - "DocumentIndex": 31, - "Title": "dllmain.c", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Native\\sn-src\\dllmain.c", - "RelativeDocumentMoniker": "StgSharp.Native\\sn-src\\dllmain.c", - "ToolTip": "D:\\platform-dev\\StgSharp.Native\\sn-src\\dllmain.c", - "RelativeToolTip": "StgSharp.Native\\sn-src\\dllmain.c", - "ViewState": "AgIAAAAAAAAAAAAAAAAAAA8AAAAgAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000423|", - "WhenOpened": "2025-08-20T02:28:38.694Z" - }, - { - "$type": "Document", - "DocumentIndex": 37, - "Title": "glfw3.h", - "DocumentMoniker": "D:\\NitloadIndustry\\\u7814\u7A76\u9879\u76EE\\1-Flagship\\TH2020\\ProjectFile\\\u5185\u6838\u6E90\u4EE3\u7801\\StgSharp.Native\\sn-head\\glfw3.h", - "RelativeDocumentMoniker": "..\\NitloadIndustry\\\u7814\u7A76\u9879\u76EE\\1-Flagship\\TH2020\\ProjectFile\\\u5185\u6838\u6E90\u4EE3\u7801\\StgSharp.Native\\sn-head\\glfw3.h", - "ToolTip": "D:\\NitloadIndustry\\\u7814\u7A76\u9879\u76EE\\1-Flagship\\TH2020\\ProjectFile\\\u5185\u6838\u6E90\u4EE3\u7801\\StgSharp.Native\\sn-head\\glfw3.h", - "RelativeToolTip": "..\\NitloadIndustry\\\u7814\u7A76\u9879\u76EE\\1-Flagship\\TH2020\\ProjectFile\\\u5185\u6838\u6E90\u4EE3\u7801\\StgSharp.Native\\sn-head\\glfw3.h", - "ViewState": "AgIAAG0QAAAAAAAAAIA4wH4QAABSAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", - "WhenOpened": "2025-08-20T01:11:12.671Z" - }, - { - "$type": "Document", - "DocumentIndex": 32, - "Title": "MatrixKernel.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\MatrixKernel.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\HighPerformance\\MatrixKernel.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\HighPerformance\\MatrixKernel.cs", - "RelativeToolTip": "StgSharp.Common\\HighPerformance\\MatrixKernel.cs", - "ViewState": "AgIAACkAAAAAAAAAAAAmwCcAAAATAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-16T07:35:19.74Z" - }, - { - "$type": "Document", - "DocumentIndex": 33, - "Title": "Partical.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharpDebug\\RenderStream\\Partical.cs", - "RelativeDocumentMoniker": "StgSharpDebug\\RenderStream\\Partical.cs", - "ToolTip": "D:\\platform-dev\\StgSharpDebug\\RenderStream\\Partical.cs", - "RelativeToolTip": "StgSharpDebug\\RenderStream\\Partical.cs", - "ViewState": "AgIAAB0BAAAAAAAAAAAuwCwBAAAUAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-16T07:57:41.271Z" - }, - { - "$type": "Document", - "DocumentIndex": 34, - "Title": "SimdDemo.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharpDebug\\SimdDemo.cs", - "RelativeDocumentMoniker": "StgSharpDebug\\SimdDemo.cs", - "ToolTip": "D:\\platform-dev\\StgSharpDebug\\SimdDemo.cs", - "RelativeToolTip": "StgSharpDebug\\SimdDemo.cs", - "ViewState": "AgIAABkAAAAAAAAAAAA5wCUAAAArAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-16T08:12:36.718Z" - }, - { - "$type": "Document", - "DocumentIndex": 35, - "Title": "VBO.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\Graphics\\OpenGL\\Buffer\\VBO.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\Graphics\\OpenGL\\Buffer\\VBO.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\Graphics\\OpenGL\\Buffer\\VBO.cs", - "RelativeToolTip": "StgSharp.Common\\Graphics\\OpenGL\\Buffer\\VBO.cs", - "ViewState": "AgIAAEcAAAAAAAAAAAAuwFIAAAAgAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-16T07:59:45.885Z" - }, - { - "$type": "Document", - "DocumentIndex": 36, - "Title": "Vec4.cs", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Common\\Mathematics\\Linear\\Vec4.cs", - "RelativeDocumentMoniker": "StgSharp.Common\\Mathematics\\Linear\\Vec4.cs", - "ToolTip": "D:\\platform-dev\\StgSharp.Common\\Mathematics\\Linear\\Vec4.cs", - "RelativeToolTip": "StgSharp.Common\\Mathematics\\Linear\\Vec4.cs", - "ViewState": "AgIAAKAAAAAAAAAAAAA5wKIAAAAAAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|", - "WhenOpened": "2025-08-16T07:57:21.557Z" - }, - { - "$type": "Document", - "DocumentIndex": 28, - "Title": "sn_internal.h", - "DocumentMoniker": "D:\\platform-dev\\StgSharp.Native\\sn-head\\sn_internal.h", - "RelativeDocumentMoniker": "StgSharp.Native\\sn-head\\sn_internal.h", - "ToolTip": "D:\\platform-dev\\StgSharp.Native\\sn-head\\sn_internal.h", - "RelativeToolTip": "StgSharp.Native\\sn-head\\sn_internal.h", - "ViewState": "AgIAAAAAAAAAAAAAAAAAAA0AAAAPAAAAAAAAAA==", - "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000680|", - "WhenOpened": "2025-08-16T07:31:27.146Z" - } - ] - } - ] - } - ] -} \ No newline at end of file diff --git a/.vs/StgSharpDevelop/v17/Solution.VC.db b/.vs/StgSharpDevelop/v17/Solution.VC.db deleted file mode 100644 index b06bd167..00000000 Binary files a/.vs/StgSharpDevelop/v17/Solution.VC.db and /dev/null differ diff --git a/.vs/StgSharpDevelop/v17/TestStore/0/000.testlog b/.vs/StgSharpDevelop/v17/TestStore/0/000.testlog deleted file mode 100644 index 3d0a4d37..00000000 Binary files a/.vs/StgSharpDevelop/v17/TestStore/0/000.testlog and /dev/null differ diff --git a/.vs/StgSharpDevelop/v17/TestStore/0/testlog.manifest b/.vs/StgSharpDevelop/v17/TestStore/0/testlog.manifest deleted file mode 100644 index e92ede29..00000000 Binary files a/.vs/StgSharpDevelop/v17/TestStore/0/testlog.manifest and /dev/null differ diff --git a/.vs/StgSharpDevelop/v17/fileList.bin b/.vs/StgSharpDevelop/v17/fileList.bin deleted file mode 100644 index 5e00711f..00000000 Binary files a/.vs/StgSharpDevelop/v17/fileList.bin and /dev/null differ diff --git a/STgSharpTest/bin/Debug/net8.0/CoverletSourceRootsMapping_StgSharpTest b/STgSharpTest/bin/Debug/net8.0/CoverletSourceRootsMapping_StgSharpTest deleted file mode 100644 index 3c62a83c..00000000 Binary files a/STgSharpTest/bin/Debug/net8.0/CoverletSourceRootsMapping_StgSharpTest and /dev/null differ diff --git a/STgSharpTest/bin/Release/net8.0/CoverletSourceRootsMapping_StgSharpTest b/STgSharpTest/bin/Release/net8.0/CoverletSourceRootsMapping_StgSharpTest deleted file mode 100644 index 925c3db8..00000000 Binary files a/STgSharpTest/bin/Release/net8.0/CoverletSourceRootsMapping_StgSharpTest and /dev/null differ diff --git a/STgSharpTest/bin/x64/Debug/net8.0/CoverletSourceRootsMapping_StgSharpTest b/STgSharpTest/bin/x64/Debug/net8.0/CoverletSourceRootsMapping_StgSharpTest deleted file mode 100644 index 3de90130..00000000 Binary files a/STgSharpTest/bin/x64/Debug/net8.0/CoverletSourceRootsMapping_StgSharpTest and /dev/null differ diff --git a/STgSharpTest/bin/x64/Debug/net8.0/StgSharp.C.bsc b/STgSharpTest/bin/x64/Debug/net8.0/StgSharp.C.bsc deleted file mode 100644 index 2997a079..00000000 Binary files a/STgSharpTest/bin/x64/Debug/net8.0/StgSharp.C.bsc and /dev/null differ diff --git a/STgSharpTest/bin/x64/Debug/net8.0/StgSharp.C.dll b/STgSharpTest/bin/x64/Debug/net8.0/StgSharp.C.dll deleted file mode 100644 index e475a459..00000000 Binary files a/STgSharpTest/bin/x64/Debug/net8.0/StgSharp.C.dll and /dev/null differ diff --git a/STgSharpTest/bin/x64/Debug/net8.0/StgSharp.C.exp b/STgSharpTest/bin/x64/Debug/net8.0/StgSharp.C.exp deleted file mode 100644 index 676ba294..00000000 Binary files a/STgSharpTest/bin/x64/Debug/net8.0/StgSharp.C.exp and /dev/null differ diff --git a/STgSharpTest/bin/x64/Debug/net8.0/StgSharp.C.lib b/STgSharpTest/bin/x64/Debug/net8.0/StgSharp.C.lib deleted file mode 100644 index 8d346e87..00000000 Binary files a/STgSharpTest/bin/x64/Debug/net8.0/StgSharp.C.lib and /dev/null differ diff --git a/STgSharpTest/bin/x64/Debug/net8.0/StgSharp.C.pdb b/STgSharpTest/bin/x64/Debug/net8.0/StgSharp.C.pdb deleted file mode 100644 index df7e31df..00000000 Binary files a/STgSharpTest/bin/x64/Debug/net8.0/StgSharp.C.pdb and /dev/null differ diff --git a/STgSharpTest/bin/x64/Debug/net8.0/StgSharp.Common.deps.json b/STgSharpTest/bin/x64/Debug/net8.0/StgSharp.Common.deps.json deleted file mode 100644 index 4c755f05..00000000 --- a/STgSharpTest/bin/x64/Debug/net8.0/StgSharp.Common.deps.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "runtimeTarget": { - "name": ".NETCoreApp,Version=v8.0", - "signature": "" - }, - "compilationOptions": {}, - "targets": { - ".NETCoreApp,Version=v8.0": { - "StgSharp.Common/1.0.0": { - "dependencies": { - "Microsoft.CSharp": "4.7.0", - "System.Runtime.CompilerServices.Unsafe": "6.1.0" - }, - "runtime": { - "StgSharp.Common.dll": {} - } - }, - "Microsoft.CSharp/4.7.0": {}, - "System.Runtime.CompilerServices.Unsafe/6.1.0": {} - } - }, - "libraries": { - "StgSharp.Common/1.0.0": { - "type": "project", - "serviceable": false, - "sha512": "" - }, - "Microsoft.CSharp/4.7.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==", - "path": "microsoft.csharp/4.7.0", - "hashPath": "microsoft.csharp.4.7.0.nupkg.sha512" - }, - "System.Runtime.CompilerServices.Unsafe/6.1.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-5o/HZxx6RVqYlhKSq8/zronDkALJZUT2Vz0hx43f0gwe8mwlM0y2nYlqdBwLMzr262Bwvpikeb/yEwkAa5PADg==", - "path": "system.runtime.compilerservices.unsafe/6.1.0", - "hashPath": "system.runtime.compilerservices.unsafe.6.1.0.nupkg.sha512" - } - } -} \ No newline at end of file diff --git a/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/ColorHelper.dll b/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/ColorHelper.dll deleted file mode 100644 index 9251e005..00000000 Binary files a/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/ColorHelper.dll and /dev/null differ diff --git a/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/StgSharp.TerminalDialogue.deps.json b/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/StgSharp.TerminalDialogue.deps.json deleted file mode 100644 index 08e44e6f..00000000 --- a/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/StgSharp.TerminalDialogue.deps.json +++ /dev/null @@ -1,149 +0,0 @@ -{ - "runtimeTarget": { - "name": ".NETCoreApp,Version=v8.0", - "signature": "" - }, - "compilationOptions": {}, - "targets": { - ".NETCoreApp,Version=v8.0": { - "StgSharp.TerminalDialogue/1.0.0": { - "dependencies": { - "Terminal.Gui": "2.0.0-v2-develop.2329" - }, - "runtime": { - "StgSharp.TerminalDialogue.dll": {} - } - }, - "ColorHelper/1.8.1": { - "runtime": { - "lib/netstandard2.0/ColorHelper.dll": { - "assemblyVersion": "1.8.1.0", - "fileVersion": "1.8.1.0" - } - } - }, - "System.IO.Abstractions/21.0.22": { - "dependencies": { - "TestableIO.System.IO.Abstractions": "21.0.22", - "TestableIO.System.IO.Abstractions.Wrappers": "21.0.22" - }, - "runtime": { - "lib/net8.0/System.IO.Abstractions.dll": { - "assemblyVersion": "21.0.0.0", - "fileVersion": "21.0.22.62509" - } - } - }, - "System.Text.Encodings.Web/8.0.0": {}, - "System.Text.Json/8.0.4": { - "dependencies": { - "System.Text.Encodings.Web": "8.0.0" - } - }, - "Terminal.Gui/2.0.0-v2-develop.2329": { - "dependencies": { - "ColorHelper": "1.8.1", - "System.IO.Abstractions": "21.0.22", - "System.Text.Json": "8.0.4", - "Wcwidth": "2.0.0" - }, - "runtime": { - "lib/net8.0/Terminal.Gui.dll": { - "assemblyVersion": "2.0.0.0", - "fileVersion": "2.0.0.0" - } - } - }, - "TestableIO.System.IO.Abstractions/21.0.22": { - "runtime": { - "lib/net8.0/TestableIO.System.IO.Abstractions.dll": { - "assemblyVersion": "21.0.0.0", - "fileVersion": "21.0.22.62509" - } - } - }, - "TestableIO.System.IO.Abstractions.Wrappers/21.0.22": { - "dependencies": { - "TestableIO.System.IO.Abstractions": "21.0.22" - }, - "runtime": { - "lib/net8.0/TestableIO.System.IO.Abstractions.Wrappers.dll": { - "assemblyVersion": "21.0.0.0", - "fileVersion": "21.0.22.62509" - } - } - }, - "Wcwidth/2.0.0": { - "runtime": { - "lib/net8.0/Wcwidth.dll": { - "assemblyVersion": "2.0.0.0", - "fileVersion": "2.0.0.0" - } - } - } - } - }, - "libraries": { - "StgSharp.TerminalDialogue/1.0.0": { - "type": "project", - "serviceable": false, - "sha512": "" - }, - "ColorHelper/1.8.1": { - "type": "package", - "serviceable": true, - "sha512": "sha512-rblWXd/02TfwJjX53xEfQnbnDRKxCm09VtavV8JaIcmIFWt9efNf6xTQ3WeXgy/she5R31eRTtnizFoUoDrs5w==", - "path": "colorhelper/1.8.1", - "hashPath": "colorhelper.1.8.1.nupkg.sha512" - }, - "System.IO.Abstractions/21.0.22": { - "type": "package", - "serviceable": true, - "sha512": "sha512-DRnFyMIjO1KG9fqUPKV7XDPgECEwrNpsb3OLD0mImViVpRZ5747o7vqrOYbn9AMaQ8eajLeKH0fXQglgH7v42A==", - "path": "system.io.abstractions/21.0.22", - "hashPath": "system.io.abstractions.21.0.22.nupkg.sha512" - }, - "System.Text.Encodings.Web/8.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-yev/k9GHAEGx2Rg3/tU6MQh4HGBXJs70y7j1LaM1i/ER9po+6nnQ6RRqTJn1E7Xu0fbIFK80Nh5EoODxrbxwBQ==", - "path": "system.text.encodings.web/8.0.0", - "hashPath": "system.text.encodings.web.8.0.0.nupkg.sha512" - }, - "System.Text.Json/8.0.4": { - "type": "package", - "serviceable": true, - "sha512": "sha512-bAkhgDJ88XTsqczoxEMliSrpijKZHhbJQldhAmObj/RbrN3sU5dcokuXmWJWsdQAhiMJ9bTayWsL1C9fbbCRhw==", - "path": "system.text.json/8.0.4", - "hashPath": "system.text.json.8.0.4.nupkg.sha512" - }, - "Terminal.Gui/2.0.0-v2-develop.2329": { - "type": "package", - "serviceable": true, - "sha512": "sha512-1WRHeZKN5tnF8DUu0vHz5pGZIY9ETwufKbUHCoH3UTcIeOlduhRCpBhTyJWri/fePsUkij2euFMGX2yHfk4h/A==", - "path": "terminal.gui/2.0.0-v2-develop.2329", - "hashPath": "terminal.gui.2.0.0-v2-develop.2329.nupkg.sha512" - }, - "TestableIO.System.IO.Abstractions/21.0.22": { - "type": "package", - "serviceable": true, - "sha512": "sha512-yq3I8rUjNoo4JTOT3jbGfTM5VfowaSYiooDO2bfvQe6XGVyZiSIzaKyCmSnuUEyuktw6zzuVE1lJnUeDhJWtyQ==", - "path": "testableio.system.io.abstractions/21.0.22", - "hashPath": "testableio.system.io.abstractions.21.0.22.nupkg.sha512" - }, - "TestableIO.System.IO.Abstractions.Wrappers/21.0.22": { - "type": "package", - "serviceable": true, - "sha512": "sha512-ETpw1B6VOsQ5zbfqxqLKjITnMvB9M0K5/bK8qJc6jih+tnlKQmtnnOPSS+OeKCqsZDYeHxPNp4ytQPJS3R+WXA==", - "path": "testableio.system.io.abstractions.wrappers/21.0.22", - "hashPath": "testableio.system.io.abstractions.wrappers.21.0.22.nupkg.sha512" - }, - "Wcwidth/2.0.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-eGZYH/V+X1DwEXrPUlUcAp8pU5a38d8IvaQzq4pclJxF1x8bizssIo4uWc3qxmS64BNGK5WnDxyBYJz84+Msqg==", - "path": "wcwidth/2.0.0", - "hashPath": "wcwidth.2.0.0.nupkg.sha512" - } - } -} \ No newline at end of file diff --git a/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/StgSharp.TerminalDialogue.dll b/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/StgSharp.TerminalDialogue.dll deleted file mode 100644 index 625ab5a2..00000000 Binary files a/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/StgSharp.TerminalDialogue.dll and /dev/null differ diff --git a/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/StgSharp.TerminalDialogue.exe b/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/StgSharp.TerminalDialogue.exe deleted file mode 100644 index 1763650b..00000000 Binary files a/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/StgSharp.TerminalDialogue.exe and /dev/null differ diff --git a/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/StgSharp.TerminalDialogue.pdb b/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/StgSharp.TerminalDialogue.pdb deleted file mode 100644 index f8ae29e4..00000000 Binary files a/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/StgSharp.TerminalDialogue.pdb and /dev/null differ diff --git a/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/StgSharp.TerminalDialogue.runtimeconfig.json b/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/StgSharp.TerminalDialogue.runtimeconfig.json deleted file mode 100644 index becfaeac..00000000 --- a/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/StgSharp.TerminalDialogue.runtimeconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "runtimeOptions": { - "tfm": "net8.0", - "framework": { - "name": "Microsoft.NETCore.App", - "version": "8.0.0" - }, - "configProperties": { - "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false - } - } -} \ No newline at end of file diff --git a/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/System.IO.Abstractions.dll b/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/System.IO.Abstractions.dll deleted file mode 100644 index f008c6bf..00000000 Binary files a/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/System.IO.Abstractions.dll and /dev/null differ diff --git a/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/Terminal.Gui.dll b/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/Terminal.Gui.dll deleted file mode 100644 index 3739678f..00000000 Binary files a/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/Terminal.Gui.dll and /dev/null differ diff --git a/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/TestableIO.System.IO.Abstractions.Wrappers.dll b/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/TestableIO.System.IO.Abstractions.Wrappers.dll deleted file mode 100644 index bc202d87..00000000 Binary files a/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/TestableIO.System.IO.Abstractions.Wrappers.dll and /dev/null differ diff --git a/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/TestableIO.System.IO.Abstractions.dll b/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/TestableIO.System.IO.Abstractions.dll deleted file mode 100644 index ee3ad392..00000000 Binary files a/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/TestableIO.System.IO.Abstractions.dll and /dev/null differ diff --git a/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/Wcwidth.dll b/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/Wcwidth.dll deleted file mode 100644 index 7c50bbcd..00000000 Binary files a/STgSharpTest/bin/x64/Debug/net8.0/StgSharpTerminalDialogue/Wcwidth.dll and /dev/null differ diff --git a/STgSharpTest/bin/x64/Release/net8.0/CoverletSourceRootsMapping_StgSharpTest b/STgSharpTest/bin/x64/Release/net8.0/CoverletSourceRootsMapping_StgSharpTest deleted file mode 100644 index 925c3db8..00000000 Binary files a/STgSharpTest/bin/x64/Release/net8.0/CoverletSourceRootsMapping_StgSharpTest and /dev/null differ diff --git a/STgSharpTest/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs b/STgSharpTest/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs deleted file mode 100644 index 2217181c..00000000 --- a/STgSharpTest/obj/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs +++ /dev/null @@ -1,4 +0,0 @@ -// -using System; -using System.Reflection; -[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")] diff --git a/STgSharpTest/obj/Debug/net8.0/StgSharpTest.AssemblyInfo.cs b/STgSharpTest/obj/Debug/net8.0/StgSharpTest.AssemblyInfo.cs deleted file mode 100644 index db6355fa..00000000 --- a/STgSharpTest/obj/Debug/net8.0/StgSharpTest.AssemblyInfo.cs +++ /dev/null @@ -1,22 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -using System; -using System.Reflection; - -[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharpTest")] -[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] -[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ccef0de6f686f94da655b0e7d854d0acaf907d04")] -[assembly: System.Reflection.AssemblyProductAttribute("StgSharpTest")] -[assembly: System.Reflection.AssemblyTitleAttribute("StgSharpTest")] -[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] - -// 由 MSBuild WriteCodeFragment 类生成。 - diff --git a/STgSharpTest/obj/Debug/net8.0/StgSharpTest.AssemblyInfoInputs.cache b/STgSharpTest/obj/Debug/net8.0/StgSharpTest.AssemblyInfoInputs.cache deleted file mode 100644 index dc71fdd4..00000000 --- a/STgSharpTest/obj/Debug/net8.0/StgSharpTest.AssemblyInfoInputs.cache +++ /dev/null @@ -1 +0,0 @@ -65036ac1aa2b022462b1cc6e16ab36cd70d4499450850d171ae425a6610fe37b diff --git a/STgSharpTest/obj/Debug/net8.0/StgSharpTest.GeneratedMSBuildEditorConfig.editorconfig b/STgSharpTest/obj/Debug/net8.0/StgSharpTest.GeneratedMSBuildEditorConfig.editorconfig deleted file mode 100644 index 21e2cab2..00000000 --- a/STgSharpTest/obj/Debug/net8.0/StgSharpTest.GeneratedMSBuildEditorConfig.editorconfig +++ /dev/null @@ -1,13 +0,0 @@ -is_global = true -build_property.TargetFramework = net8.0 -build_property.TargetPlatformMinVersion = -build_property.UsingMicrosoftNETSdkWeb = -build_property.ProjectTypeGuids = -build_property.InvariantGlobalization = -build_property.PlatformNeutralAssembly = -build_property.EnforceExtendedAnalyzerRules = -build_property._SupportedPlatformList = Linux,macOS,Windows -build_property.RootNamespace = StgSharpTest -build_property.ProjectDir = D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\STgSharpTest\ -build_property.EnableComHosting = -build_property.EnableGeneratedComInterfaceComImportInterop = diff --git a/STgSharpTest/obj/Debug/net8.0/StgSharpTest.GlobalUsings.g.cs b/STgSharpTest/obj/Debug/net8.0/StgSharpTest.GlobalUsings.g.cs deleted file mode 100644 index a1f6d1a8..00000000 --- a/STgSharpTest/obj/Debug/net8.0/StgSharpTest.GlobalUsings.g.cs +++ /dev/null @@ -1,9 +0,0 @@ -// -global using global::Microsoft.VisualStudio.TestTools.UnitTesting; -global using global::System; -global using global::System.Collections.Generic; -global using global::System.IO; -global using global::System.Linq; -global using global::System.Net.Http; -global using global::System.Threading; -global using global::System.Threading.Tasks; diff --git a/STgSharpTest/obj/Debug/net8.0/StgSharpTest.assets.cache b/STgSharpTest/obj/Debug/net8.0/StgSharpTest.assets.cache deleted file mode 100644 index d8981c69..00000000 Binary files a/STgSharpTest/obj/Debug/net8.0/StgSharpTest.assets.cache and /dev/null differ diff --git a/STgSharpTest/obj/Debug/net8.0/StgSharpTest.csproj.AssemblyReference.cache b/STgSharpTest/obj/Debug/net8.0/StgSharpTest.csproj.AssemblyReference.cache deleted file mode 100644 index 376c54ea..00000000 Binary files a/STgSharpTest/obj/Debug/net8.0/StgSharpTest.csproj.AssemblyReference.cache and /dev/null differ diff --git a/STgSharpTest/obj/Debug/net8.0/StgSharpTest.csproj.FileListAbsolute.txt b/STgSharpTest/obj/Debug/net8.0/StgSharpTest.csproj.FileListAbsolute.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/STgSharpTest/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs b/STgSharpTest/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs deleted file mode 100644 index 2217181c..00000000 --- a/STgSharpTest/obj/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs +++ /dev/null @@ -1,4 +0,0 @@ -// -using System; -using System.Reflection; -[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")] diff --git a/STgSharpTest/obj/Release/net8.0/StgSharpTest.AssemblyInfo.cs b/STgSharpTest/obj/Release/net8.0/StgSharpTest.AssemblyInfo.cs deleted file mode 100644 index 6537f127..00000000 --- a/STgSharpTest/obj/Release/net8.0/StgSharpTest.AssemblyInfo.cs +++ /dev/null @@ -1,23 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 此代码由工具生成。 -// 运行时版本:4.0.30319.42000 -// -// 对此文件的更改可能会导致不正确的行为,并且如果 -// 重新生成代码,这些更改将会丢失。 -// -//------------------------------------------------------------------------------ - -using System; -using System.Reflection; - -[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharpTest")] -[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")] -[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e687473132786f419a48170313782d6779890c3d")] -[assembly: System.Reflection.AssemblyProductAttribute("StgSharpTest")] -[assembly: System.Reflection.AssemblyTitleAttribute("StgSharpTest")] -[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] - -// 由 MSBuild WriteCodeFragment 类生成。 - diff --git a/STgSharpTest/obj/Release/net8.0/StgSharpTest.AssemblyInfoInputs.cache b/STgSharpTest/obj/Release/net8.0/StgSharpTest.AssemblyInfoInputs.cache deleted file mode 100644 index cb5cffcb..00000000 --- a/STgSharpTest/obj/Release/net8.0/StgSharpTest.AssemblyInfoInputs.cache +++ /dev/null @@ -1 +0,0 @@ -1d3d676225642d4c08f4cbcba46a80275bd9d96fbf7d11d138efd8f869f71da6 diff --git a/STgSharpTest/obj/Release/net8.0/StgSharpTest.GeneratedMSBuildEditorConfig.editorconfig b/STgSharpTest/obj/Release/net8.0/StgSharpTest.GeneratedMSBuildEditorConfig.editorconfig deleted file mode 100644 index 21e2cab2..00000000 --- a/STgSharpTest/obj/Release/net8.0/StgSharpTest.GeneratedMSBuildEditorConfig.editorconfig +++ /dev/null @@ -1,13 +0,0 @@ -is_global = true -build_property.TargetFramework = net8.0 -build_property.TargetPlatformMinVersion = -build_property.UsingMicrosoftNETSdkWeb = -build_property.ProjectTypeGuids = -build_property.InvariantGlobalization = -build_property.PlatformNeutralAssembly = -build_property.EnforceExtendedAnalyzerRules = -build_property._SupportedPlatformList = Linux,macOS,Windows -build_property.RootNamespace = StgSharpTest -build_property.ProjectDir = D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\STgSharpTest\ -build_property.EnableComHosting = -build_property.EnableGeneratedComInterfaceComImportInterop = diff --git a/STgSharpTest/obj/Release/net8.0/StgSharpTest.GlobalUsings.g.cs b/STgSharpTest/obj/Release/net8.0/StgSharpTest.GlobalUsings.g.cs deleted file mode 100644 index a1f6d1a8..00000000 --- a/STgSharpTest/obj/Release/net8.0/StgSharpTest.GlobalUsings.g.cs +++ /dev/null @@ -1,9 +0,0 @@ -// -global using global::Microsoft.VisualStudio.TestTools.UnitTesting; -global using global::System; -global using global::System.Collections.Generic; -global using global::System.IO; -global using global::System.Linq; -global using global::System.Net.Http; -global using global::System.Threading; -global using global::System.Threading.Tasks; diff --git a/STgSharpTest/obj/Release/net8.0/StgSharpTest.assets.cache b/STgSharpTest/obj/Release/net8.0/StgSharpTest.assets.cache deleted file mode 100644 index 416cde93..00000000 Binary files a/STgSharpTest/obj/Release/net8.0/StgSharpTest.assets.cache and /dev/null differ diff --git a/STgSharpTest/obj/Release/net8.0/StgSharpTest.csproj.AssemblyReference.cache b/STgSharpTest/obj/Release/net8.0/StgSharpTest.csproj.AssemblyReference.cache deleted file mode 100644 index 6099094b..00000000 Binary files a/STgSharpTest/obj/Release/net8.0/StgSharpTest.csproj.AssemblyReference.cache and /dev/null differ diff --git a/STgSharpTest/obj/StgSharpTest.csproj.nuget.dgspec.json b/STgSharpTest/obj/StgSharpTest.csproj.nuget.dgspec.json deleted file mode 100644 index 0e78de4e..00000000 --- a/STgSharpTest/obj/StgSharpTest.csproj.nuget.dgspec.json +++ /dev/null @@ -1,410 +0,0 @@ -{ - "format": 1, - "restore": { - "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\STgSharpTest\\StgSharpTest.csproj": {} - }, - "projects": { - "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj": { - "version": "1.0.0", - "restore": { - "projectUniqueName": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj", - "projectName": "StgSharp.Common", - "projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj", - "packagesPath": "C:\\Users\\Youmu\\.nuget\\packages\\", - "outputPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\obj\\", - "projectStyle": "PackageReference", - "fallbackFolders": [ - "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" - ], - "configFilePaths": [ - "C:\\Users\\Youmu\\AppData\\Roaming\\NuGet\\NuGet.Config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" - ], - "originalTargetFrameworks": [ - "net8.0" - ], - "sources": { - "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, - "C:\\Program Files\\dotnet\\library-packs": {}, - "D:\\Programmer\\NugetLocal": {}, - "https://api.nuget.org/v3/index.json": {} - }, - "frameworks": { - "net8.0": { - "targetAlias": "net8.0", - "projectReferences": {} - } - }, - "warningProperties": { - "warnAsError": [ - "NU1605" - ] - }, - "restoreAuditProperties": { - "enableAudit": "true", - "auditLevel": "low", - "auditMode": "direct" - } - }, - "frameworks": { - "net8.0": { - "targetAlias": "net8.0", - "dependencies": { - "Microsoft.CSharp": { - "target": "Package", - "version": "[4.7.0, )" - }, - "System.Runtime.CompilerServices.Unsafe": { - "target": "Package", - "version": "[6.1.0, )" - } - }, - "imports": [ - "net461", - "net462", - "net47", - "net471", - "net472", - "net48", - "net481" - ], - "assetTargetFallback": true, - "warn": true, - "frameworkReferences": { - "Microsoft.NETCore.App": { - "privateAssets": "all" - } - }, - "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.400/PortableRuntimeIdentifierGraph.json" - } - } - }, - "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Model\\StgSharp.Model.csproj": { - "version": "1.0.0", - "restore": { - "projectUniqueName": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Model\\StgSharp.Model.csproj", - "projectName": "StgSharp.Model", - "projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Model\\StgSharp.Model.csproj", - "packagesPath": "C:\\Users\\Youmu\\.nuget\\packages\\", - "outputPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Model\\obj\\", - "projectStyle": "PackageReference", - "fallbackFolders": [ - "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" - ], - "configFilePaths": [ - "C:\\Users\\Youmu\\AppData\\Roaming\\NuGet\\NuGet.Config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" - ], - "originalTargetFrameworks": [ - "net8.0" - ], - "sources": { - "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, - "C:\\Program Files\\dotnet\\library-packs": {}, - "D:\\Programmer\\NugetLocal": {}, - "https://api.nuget.org/v3/index.json": {} - }, - "frameworks": { - "net8.0": { - "targetAlias": "net8.0", - "projectReferences": { - "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj": { - "projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj" - }, - "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj": { - "projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj" - } - } - } - }, - "warningProperties": { - "warnAsError": [ - "NU1605" - ] - }, - "restoreAuditProperties": { - "enableAudit": "true", - "auditLevel": "low", - "auditMode": "direct" - } - }, - "frameworks": { - "net8.0": { - "targetAlias": "net8.0", - "imports": [ - "net461", - "net462", - "net47", - "net471", - "net472", - "net48", - "net481" - ], - "assetTargetFallback": true, - "warn": true, - "frameworkReferences": { - "Microsoft.NETCore.App": { - "privateAssets": "all" - } - }, - "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.400/PortableRuntimeIdentifierGraph.json" - } - } - }, - "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj": { - "version": "1.0.0", - "restore": { - "projectUniqueName": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj", - "projectName": "StgSharp.Script", - "projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj", - "packagesPath": "C:\\Users\\Youmu\\.nuget\\packages\\", - "outputPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\obj\\", - "projectStyle": "PackageReference", - "fallbackFolders": [ - "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" - ], - "configFilePaths": [ - "C:\\Users\\Youmu\\AppData\\Roaming\\NuGet\\NuGet.Config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" - ], - "originalTargetFrameworks": [ - "net8.0" - ], - "sources": { - "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, - "C:\\Program Files\\dotnet\\library-packs": {}, - "D:\\Programmer\\NugetLocal": {}, - "https://api.nuget.org/v3/index.json": {} - }, - "frameworks": { - "net8.0": { - "targetAlias": "net8.0", - "projectReferences": { - "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj": { - "projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj" - } - } - } - }, - "warningProperties": { - "warnAsError": [ - "NU1605" - ] - }, - "restoreAuditProperties": { - "enableAudit": "true", - "auditLevel": "low", - "auditMode": "direct" - } - }, - "frameworks": { - "net8.0": { - "targetAlias": "net8.0", - "dependencies": { - "CommunityToolkit.HighPerformance": { - "target": "Package", - "version": "[8.4.0, )" - }, - "Microsoft.CodeAnalysis.CSharp": { - "target": "Package", - "version": "[4.13.0, )" - } - }, - "imports": [ - "net461", - "net462", - "net47", - "net471", - "net472", - "net48", - "net481" - ], - "assetTargetFallback": true, - "warn": true, - "frameworkReferences": { - "Microsoft.NETCore.App": { - "privateAssets": "all" - } - }, - "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.400/PortableRuntimeIdentifierGraph.json" - } - } - }, - "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.TerminalDialogue\\StgSharp.TerminalDialogue.csproj": { - "version": "1.0.0", - "restore": { - "projectUniqueName": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.TerminalDialogue\\StgSharp.TerminalDialogue.csproj", - "projectName": "StgSharp.TerminalDialogue", - "projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.TerminalDialogue\\StgSharp.TerminalDialogue.csproj", - "packagesPath": "C:\\Users\\Youmu\\.nuget\\packages\\", - "outputPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.TerminalDialogue\\obj\\", - "projectStyle": "PackageReference", - "fallbackFolders": [ - "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" - ], - "configFilePaths": [ - "C:\\Users\\Youmu\\AppData\\Roaming\\NuGet\\NuGet.Config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" - ], - "originalTargetFrameworks": [ - "net8.0" - ], - "sources": { - "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, - "C:\\Program Files\\dotnet\\library-packs": {}, - "D:\\Programmer\\NugetLocal": {}, - "https://api.nuget.org/v3/index.json": {} - }, - "frameworks": { - "net8.0": { - "targetAlias": "net8.0", - "projectReferences": {} - } - }, - "warningProperties": { - "warnAsError": [ - "NU1605" - ] - }, - "restoreAuditProperties": { - "enableAudit": "true", - "auditLevel": "low", - "auditMode": "direct" - } - }, - "frameworks": { - "net8.0": { - "targetAlias": "net8.0", - "dependencies": { - "Terminal.Gui": { - "target": "Package", - "version": "[2.0.0-v2-develop.2329, )" - } - }, - "imports": [ - "net461", - "net462", - "net47", - "net471", - "net472", - "net48", - "net481" - ], - "assetTargetFallback": true, - "warn": true, - "frameworkReferences": { - "Microsoft.NETCore.App": { - "privateAssets": "all" - } - }, - "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.400/PortableRuntimeIdentifierGraph.json" - } - } - }, - "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\STgSharpTest\\StgSharpTest.csproj": { - "version": "1.0.0", - "restore": { - "projectUniqueName": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\STgSharpTest\\StgSharpTest.csproj", - "projectName": "StgSharpTest", - "projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\STgSharpTest\\StgSharpTest.csproj", - "packagesPath": "C:\\Users\\Youmu\\.nuget\\packages\\", - "outputPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\STgSharpTest\\obj\\", - "projectStyle": "PackageReference", - "fallbackFolders": [ - "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" - ], - "configFilePaths": [ - "C:\\Users\\Youmu\\AppData\\Roaming\\NuGet\\NuGet.Config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" - ], - "originalTargetFrameworks": [ - "net8.0" - ], - "sources": { - "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, - "C:\\Program Files\\dotnet\\library-packs": {}, - "D:\\Programmer\\NugetLocal": {}, - "https://api.nuget.org/v3/index.json": {} - }, - "frameworks": { - "net8.0": { - "targetAlias": "net8.0", - "projectReferences": { - "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj": { - "projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj" - }, - "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Model\\StgSharp.Model.csproj": { - "projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Model\\StgSharp.Model.csproj" - }, - "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj": { - "projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj" - }, - "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.TerminalDialogue\\StgSharp.TerminalDialogue.csproj": { - "projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.TerminalDialogue\\StgSharp.TerminalDialogue.csproj" - } - } - } - }, - "warningProperties": { - "warnAsError": [ - "NU1605" - ] - }, - "restoreAuditProperties": { - "enableAudit": "true", - "auditLevel": "low", - "auditMode": "direct" - } - }, - "frameworks": { - "net8.0": { - "targetAlias": "net8.0", - "dependencies": { - "MSTest.TestAdapter": { - "target": "Package", - "version": "[3.1.1, )" - }, - "MSTest.TestFramework": { - "target": "Package", - "version": "[3.1.1, )" - }, - "Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.MSTest": { - "target": "Package", - "version": "[1.1.2, )" - }, - "Microsoft.NET.Test.Sdk": { - "target": "Package", - "version": "[17.8.0, )" - }, - "coverlet.collector": { - "target": "Package", - "version": "[6.0.0, )" - } - }, - "imports": [ - "net461", - "net462", - "net47", - "net471", - "net472", - "net48", - "net481" - ], - "assetTargetFallback": true, - "warn": true, - "frameworkReferences": { - "Microsoft.NETCore.App": { - "privateAssets": "all" - } - }, - "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.400/PortableRuntimeIdentifierGraph.json" - } - } - } - } -} \ No newline at end of file diff --git a/STgSharpTest/obj/StgSharpTest.csproj.nuget.g.props b/STgSharpTest/obj/StgSharpTest.csproj.nuget.g.props deleted file mode 100644 index d41be24b..00000000 --- a/STgSharpTest/obj/StgSharpTest.csproj.nuget.g.props +++ /dev/null @@ -1,27 +0,0 @@ - - - - False - NuGet - $(MSBuildThisFileDirectory)project.assets.json - $(UserProfile)\.nuget\packages\ - C:\Users\Youmu\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages - PackageReference - 6.11.0 - - - - - - - - - - - - - - C:\Users\Youmu\.nuget\packages\microsoft.codeanalysis.analyzers\3.11.0 - C:\Users\Youmu\.nuget\packages\microsoft.visualstudio.validation\15.0.82 - - \ No newline at end of file diff --git a/STgSharpTest/obj/StgSharpTest.csproj.nuget.g.targets b/STgSharpTest/obj/StgSharpTest.csproj.nuget.g.targets deleted file mode 100644 index 37c22740..00000000 --- a/STgSharpTest/obj/StgSharpTest.csproj.nuget.g.targets +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/STgSharpTest/obj/project.assets.json b/STgSharpTest/obj/project.assets.json deleted file mode 100644 index 2aabf507..00000000 --- a/STgSharpTest/obj/project.assets.json +++ /dev/null @@ -1,9101 +0,0 @@ -{ - "version": 3, - "targets": { - "net8.0": { - "ColorHelper/1.8.1": { - "type": "package", - "compile": { - "lib/netstandard2.0/ColorHelper.dll": {} - }, - "runtime": { - "lib/netstandard2.0/ColorHelper.dll": {} - } - }, - "CommunityToolkit.HighPerformance/8.4.0": { - "type": "package", - "compile": { - "lib/net8.0/CommunityToolkit.HighPerformance.dll": { - "related": ".pdb;.xml" - } - }, - "runtime": { - "lib/net8.0/CommunityToolkit.HighPerformance.dll": { - "related": ".pdb;.xml" - } - } - }, - "coverlet.collector/6.0.0": { - "type": "package", - "build": { - "build/netstandard1.0/coverlet.collector.targets": {} - } - }, - "DiffPlex/1.7.2": { - "type": "package", - "compile": { - "lib/net6.0/_._": { - "related": ".xml" - } - }, - "runtime": { - "lib/net6.0/DiffPlex.dll": { - "related": ".xml" - } - } - }, - "Humanizer.Core/2.2.0": { - "type": "package", - "dependencies": { - "NETStandard.Library": "1.6.1" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/Humanizer.dll": {} - } - }, - "Microsoft.Bcl.AsyncInterfaces/1.1.1": { - "type": "package", - "compile": { - "ref/netstandard2.1/Microsoft.Bcl.AsyncInterfaces.dll": {} - }, - "runtime": { - "lib/netstandard2.1/Microsoft.Bcl.AsyncInterfaces.dll": { - "related": ".xml" - } - } - }, - "Microsoft.CodeAnalysis.Analyzer.Testing/1.1.2": { - "type": "package", - "dependencies": { - "DiffPlex": "1.7.2", - "Microsoft.CodeAnalysis.Workspaces.Common": "1.0.1", - "Microsoft.VisualStudio.Composition": "16.1.8", - "NuGet.Common": "6.3.4", - "NuGet.Packaging": "6.3.4", - "NuGet.Protocol": "6.3.4", - "NuGet.Resolver": "6.3.4" - }, - "compile": { - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.Analyzer.Testing.dll": { - "related": ".xml" - } - }, - "runtime": { - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.Analyzer.Testing.dll": { - "related": ".xml" - } - } - }, - "Microsoft.CodeAnalysis.Analyzers/3.11.0": { - "type": "package", - "build": { - "buildTransitive/Microsoft.CodeAnalysis.Analyzers.props": {}, - "buildTransitive/Microsoft.CodeAnalysis.Analyzers.targets": {} - } - }, - "Microsoft.CodeAnalysis.Common/4.13.0": { - "type": "package", - "dependencies": { - "Microsoft.CodeAnalysis.Analyzers": "3.11.0", - "System.Collections.Immutable": "8.0.0", - "System.Reflection.Metadata": "8.0.0" - }, - "compile": { - "lib/net8.0/Microsoft.CodeAnalysis.dll": { - "related": ".pdb;.xml" - } - }, - "runtime": { - "lib/net8.0/Microsoft.CodeAnalysis.dll": { - "related": ".pdb;.xml" - } - }, - "resource": { - "lib/net8.0/cs/Microsoft.CodeAnalysis.resources.dll": { - "locale": "cs" - }, - "lib/net8.0/de/Microsoft.CodeAnalysis.resources.dll": { - "locale": "de" - }, - "lib/net8.0/es/Microsoft.CodeAnalysis.resources.dll": { - "locale": "es" - }, - "lib/net8.0/fr/Microsoft.CodeAnalysis.resources.dll": { - "locale": "fr" - }, - "lib/net8.0/it/Microsoft.CodeAnalysis.resources.dll": { - "locale": "it" - }, - "lib/net8.0/ja/Microsoft.CodeAnalysis.resources.dll": { - "locale": "ja" - }, - "lib/net8.0/ko/Microsoft.CodeAnalysis.resources.dll": { - "locale": "ko" - }, - "lib/net8.0/pl/Microsoft.CodeAnalysis.resources.dll": { - "locale": "pl" - }, - "lib/net8.0/pt-BR/Microsoft.CodeAnalysis.resources.dll": { - "locale": "pt-BR" - }, - "lib/net8.0/ru/Microsoft.CodeAnalysis.resources.dll": { - "locale": "ru" - }, - "lib/net8.0/tr/Microsoft.CodeAnalysis.resources.dll": { - "locale": "tr" - }, - "lib/net8.0/zh-Hans/Microsoft.CodeAnalysis.resources.dll": { - "locale": "zh-Hans" - }, - "lib/net8.0/zh-Hant/Microsoft.CodeAnalysis.resources.dll": { - "locale": "zh-Hant" - } - } - }, - "Microsoft.CodeAnalysis.CSharp/4.13.0": { - "type": "package", - "dependencies": { - "Microsoft.CodeAnalysis.Analyzers": "3.11.0", - "Microsoft.CodeAnalysis.Common": "[4.13.0]", - "System.Collections.Immutable": "8.0.0", - "System.Reflection.Metadata": "8.0.0" - }, - "compile": { - "lib/net8.0/Microsoft.CodeAnalysis.CSharp.dll": { - "related": ".pdb;.xml" - } - }, - "runtime": { - "lib/net8.0/Microsoft.CodeAnalysis.CSharp.dll": { - "related": ".pdb;.xml" - } - }, - "resource": { - "lib/net8.0/cs/Microsoft.CodeAnalysis.CSharp.resources.dll": { - "locale": "cs" - }, - "lib/net8.0/de/Microsoft.CodeAnalysis.CSharp.resources.dll": { - "locale": "de" - }, - "lib/net8.0/es/Microsoft.CodeAnalysis.CSharp.resources.dll": { - "locale": "es" - }, - "lib/net8.0/fr/Microsoft.CodeAnalysis.CSharp.resources.dll": { - "locale": "fr" - }, - "lib/net8.0/it/Microsoft.CodeAnalysis.CSharp.resources.dll": { - "locale": "it" - }, - "lib/net8.0/ja/Microsoft.CodeAnalysis.CSharp.resources.dll": { - "locale": "ja" - }, - "lib/net8.0/ko/Microsoft.CodeAnalysis.CSharp.resources.dll": { - "locale": "ko" - }, - "lib/net8.0/pl/Microsoft.CodeAnalysis.CSharp.resources.dll": { - "locale": "pl" - }, - "lib/net8.0/pt-BR/Microsoft.CodeAnalysis.CSharp.resources.dll": { - "locale": "pt-BR" - }, - "lib/net8.0/ru/Microsoft.CodeAnalysis.CSharp.resources.dll": { - "locale": "ru" - }, - "lib/net8.0/tr/Microsoft.CodeAnalysis.CSharp.resources.dll": { - "locale": "tr" - }, - "lib/net8.0/zh-Hans/Microsoft.CodeAnalysis.CSharp.resources.dll": { - "locale": "zh-Hans" - }, - "lib/net8.0/zh-Hant/Microsoft.CodeAnalysis.CSharp.resources.dll": { - "locale": "zh-Hant" - } - } - }, - "Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing/1.1.2": { - "type": "package", - "dependencies": { - "Microsoft.CodeAnalysis.CSharp.Workspaces": "3.8.0", - "Microsoft.CodeAnalysis.SourceGenerators.Testing": "[1.1.2]" - }, - "compile": { - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.dll": { - "related": ".xml" - } - }, - "runtime": { - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.dll": { - "related": ".xml" - } - } - }, - "Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.MSTest/1.1.2": { - "type": "package", - "dependencies": { - "Microsoft.CodeAnalysis.Analyzer.Testing": "[1.1.2]", - "Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing": "[1.1.2]", - "Microsoft.CodeAnalysis.CSharp.Workspaces": "3.8.0", - "Microsoft.CodeAnalysis.SourceGenerators.Testing": "[1.1.2]", - "Microsoft.CodeAnalysis.Testing.Verifiers.MSTest": "[1.1.2]" - }, - "compile": { - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.MSTest.dll": { - "related": ".xml" - } - }, - "runtime": { - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.MSTest.dll": { - "related": ".xml" - } - } - }, - "Microsoft.CodeAnalysis.CSharp.Workspaces/3.8.0": { - "type": "package", - "dependencies": { - "Humanizer.Core": "2.2.0", - "Microsoft.CodeAnalysis.CSharp": "[3.8.0]", - "Microsoft.CodeAnalysis.Common": "[3.8.0]", - "Microsoft.CodeAnalysis.Workspaces.Common": "[3.8.0]" - }, - "compile": { - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.CSharp.Workspaces.dll": { - "related": ".pdb;.xml" - } - }, - "runtime": { - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.CSharp.Workspaces.dll": { - "related": ".pdb;.xml" - } - }, - "resource": { - "lib/netcoreapp3.1/cs/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": { - "locale": "cs" - }, - "lib/netcoreapp3.1/de/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": { - "locale": "de" - }, - "lib/netcoreapp3.1/es/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": { - "locale": "es" - }, - "lib/netcoreapp3.1/fr/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": { - "locale": "fr" - }, - "lib/netcoreapp3.1/it/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": { - "locale": "it" - }, - "lib/netcoreapp3.1/ja/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": { - "locale": "ja" - }, - "lib/netcoreapp3.1/ko/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": { - "locale": "ko" - }, - "lib/netcoreapp3.1/pl/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": { - "locale": "pl" - }, - "lib/netcoreapp3.1/pt-BR/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": { - "locale": "pt-BR" - }, - "lib/netcoreapp3.1/ru/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": { - "locale": "ru" - }, - "lib/netcoreapp3.1/tr/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": { - "locale": "tr" - }, - "lib/netcoreapp3.1/zh-Hans/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": { - "locale": "zh-Hans" - }, - "lib/netcoreapp3.1/zh-Hant/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll": { - "locale": "zh-Hant" - } - } - }, - "Microsoft.CodeAnalysis.SourceGenerators.Testing/1.1.2": { - "type": "package", - "dependencies": { - "DiffPlex": "1.7.2", - "Microsoft.CodeAnalysis.Analyzer.Testing": "[1.1.2]", - "Microsoft.CodeAnalysis.Workspaces.Common": "3.8.0" - }, - "compile": { - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.SourceGenerators.Testing.dll": { - "related": ".xml" - } - }, - "runtime": { - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.SourceGenerators.Testing.dll": { - "related": ".xml" - } - } - }, - "Microsoft.CodeAnalysis.Testing.Verifiers.MSTest/1.1.2": { - "type": "package", - "dependencies": { - "MSTest.TestFramework": "1.1.17", - "Microsoft.CodeAnalysis.Analyzer.Testing": "[1.1.2]" - }, - "compile": { - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.Testing.Verifiers.MSTest.dll": { - "related": ".xml" - } - }, - "runtime": { - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.Testing.Verifiers.MSTest.dll": { - "related": ".xml" - } - } - }, - "Microsoft.CodeAnalysis.Workspaces.Common/3.8.0": { - "type": "package", - "dependencies": { - "Microsoft.Bcl.AsyncInterfaces": "1.1.1", - "Microsoft.CodeAnalysis.Common": "[3.8.0]", - "System.Composition": "1.0.31" - }, - "compile": { - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.Workspaces.dll": { - "related": ".pdb;.xml" - } - }, - "runtime": { - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.Workspaces.dll": { - "related": ".pdb;.xml" - } - }, - "resource": { - "lib/netcoreapp3.1/cs/Microsoft.CodeAnalysis.Workspaces.resources.dll": { - "locale": "cs" - }, - "lib/netcoreapp3.1/de/Microsoft.CodeAnalysis.Workspaces.resources.dll": { - "locale": "de" - }, - "lib/netcoreapp3.1/es/Microsoft.CodeAnalysis.Workspaces.resources.dll": { - "locale": "es" - }, - "lib/netcoreapp3.1/fr/Microsoft.CodeAnalysis.Workspaces.resources.dll": { - "locale": "fr" - }, - "lib/netcoreapp3.1/it/Microsoft.CodeAnalysis.Workspaces.resources.dll": { - "locale": "it" - }, - "lib/netcoreapp3.1/ja/Microsoft.CodeAnalysis.Workspaces.resources.dll": { - "locale": "ja" - }, - "lib/netcoreapp3.1/ko/Microsoft.CodeAnalysis.Workspaces.resources.dll": { - "locale": "ko" - }, - "lib/netcoreapp3.1/pl/Microsoft.CodeAnalysis.Workspaces.resources.dll": { - "locale": "pl" - }, - "lib/netcoreapp3.1/pt-BR/Microsoft.CodeAnalysis.Workspaces.resources.dll": { - "locale": "pt-BR" - }, - "lib/netcoreapp3.1/ru/Microsoft.CodeAnalysis.Workspaces.resources.dll": { - "locale": "ru" - }, - "lib/netcoreapp3.1/tr/Microsoft.CodeAnalysis.Workspaces.resources.dll": { - "locale": "tr" - }, - "lib/netcoreapp3.1/zh-Hans/Microsoft.CodeAnalysis.Workspaces.resources.dll": { - "locale": "zh-Hans" - }, - "lib/netcoreapp3.1/zh-Hant/Microsoft.CodeAnalysis.Workspaces.resources.dll": { - "locale": "zh-Hant" - } - } - }, - "Microsoft.CodeCoverage/17.8.0": { - "type": "package", - "compile": { - "lib/netcoreapp3.1/Microsoft.VisualStudio.CodeCoverage.Shim.dll": {} - }, - "runtime": { - "lib/netcoreapp3.1/Microsoft.VisualStudio.CodeCoverage.Shim.dll": {} - }, - "build": { - "build/netstandard2.0/Microsoft.CodeCoverage.props": {}, - "build/netstandard2.0/Microsoft.CodeCoverage.targets": {} - } - }, - "Microsoft.CSharp/4.7.0": { - "type": "package", - "compile": { - "ref/netcoreapp2.0/_._": {} - }, - "runtime": { - "lib/netcoreapp2.0/_._": {} - } - }, - "Microsoft.NET.Test.Sdk/17.8.0": { - "type": "package", - "dependencies": { - "Microsoft.CodeCoverage": "17.8.0", - "Microsoft.TestPlatform.TestHost": "17.8.0" - }, - "compile": { - "lib/netcoreapp3.1/_._": {} - }, - "runtime": { - "lib/netcoreapp3.1/_._": {} - }, - "build": { - "build/netcoreapp3.1/Microsoft.NET.Test.Sdk.props": {}, - "build/netcoreapp3.1/Microsoft.NET.Test.Sdk.targets": {} - }, - "buildMultiTargeting": { - "buildMultiTargeting/Microsoft.NET.Test.Sdk.props": {} - } - }, - "Microsoft.NETCore.Platforms/2.0.0": { - "type": "package", - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "Microsoft.NETCore.Targets/1.1.0": { - "type": "package", - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "Microsoft.TestPlatform.ObjectModel/17.8.0": { - "type": "package", - "dependencies": { - "NuGet.Frameworks": "6.5.0", - "System.Reflection.Metadata": "1.6.0" - }, - "compile": { - "lib/netcoreapp3.1/Microsoft.TestPlatform.CoreUtilities.dll": {}, - "lib/netcoreapp3.1/Microsoft.TestPlatform.PlatformAbstractions.dll": {}, - "lib/netcoreapp3.1/Microsoft.VisualStudio.TestPlatform.ObjectModel.dll": {} - }, - "runtime": { - "lib/netcoreapp3.1/Microsoft.TestPlatform.CoreUtilities.dll": {}, - "lib/netcoreapp3.1/Microsoft.TestPlatform.PlatformAbstractions.dll": {}, - "lib/netcoreapp3.1/Microsoft.VisualStudio.TestPlatform.ObjectModel.dll": {} - }, - "resource": { - "lib/netcoreapp3.1/cs/Microsoft.TestPlatform.CoreUtilities.resources.dll": { - "locale": "cs" - }, - "lib/netcoreapp3.1/cs/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll": { - "locale": "cs" - }, - "lib/netcoreapp3.1/de/Microsoft.TestPlatform.CoreUtilities.resources.dll": { - "locale": "de" - }, - "lib/netcoreapp3.1/de/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll": { - "locale": "de" - }, - "lib/netcoreapp3.1/es/Microsoft.TestPlatform.CoreUtilities.resources.dll": { - "locale": "es" - }, - "lib/netcoreapp3.1/es/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll": { - "locale": "es" - }, - "lib/netcoreapp3.1/fr/Microsoft.TestPlatform.CoreUtilities.resources.dll": { - "locale": "fr" - }, - "lib/netcoreapp3.1/fr/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll": { - "locale": "fr" - }, - "lib/netcoreapp3.1/it/Microsoft.TestPlatform.CoreUtilities.resources.dll": { - "locale": "it" - }, - "lib/netcoreapp3.1/it/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll": { - "locale": "it" - }, - "lib/netcoreapp3.1/ja/Microsoft.TestPlatform.CoreUtilities.resources.dll": { - "locale": "ja" - }, - "lib/netcoreapp3.1/ja/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll": { - "locale": "ja" - }, - "lib/netcoreapp3.1/ko/Microsoft.TestPlatform.CoreUtilities.resources.dll": { - "locale": "ko" - }, - "lib/netcoreapp3.1/ko/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll": { - "locale": "ko" - }, - "lib/netcoreapp3.1/pl/Microsoft.TestPlatform.CoreUtilities.resources.dll": { - "locale": "pl" - }, - "lib/netcoreapp3.1/pl/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll": { - "locale": "pl" - }, - "lib/netcoreapp3.1/pt-BR/Microsoft.TestPlatform.CoreUtilities.resources.dll": { - "locale": "pt-BR" - }, - "lib/netcoreapp3.1/pt-BR/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll": { - "locale": "pt-BR" - }, - "lib/netcoreapp3.1/ru/Microsoft.TestPlatform.CoreUtilities.resources.dll": { - "locale": "ru" - }, - "lib/netcoreapp3.1/ru/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll": { - "locale": "ru" - }, - "lib/netcoreapp3.1/tr/Microsoft.TestPlatform.CoreUtilities.resources.dll": { - "locale": "tr" - }, - "lib/netcoreapp3.1/tr/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll": { - "locale": "tr" - }, - "lib/netcoreapp3.1/zh-Hans/Microsoft.TestPlatform.CoreUtilities.resources.dll": { - "locale": "zh-Hans" - }, - "lib/netcoreapp3.1/zh-Hans/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll": { - "locale": "zh-Hans" - }, - "lib/netcoreapp3.1/zh-Hant/Microsoft.TestPlatform.CoreUtilities.resources.dll": { - "locale": "zh-Hant" - }, - "lib/netcoreapp3.1/zh-Hant/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll": { - "locale": "zh-Hant" - } - } - }, - "Microsoft.TestPlatform.TestHost/17.8.0": { - "type": "package", - "dependencies": { - "Microsoft.TestPlatform.ObjectModel": "17.8.0", - "Newtonsoft.Json": "13.0.1" - }, - "compile": { - "lib/netcoreapp3.1/Microsoft.TestPlatform.CommunicationUtilities.dll": {}, - "lib/netcoreapp3.1/Microsoft.TestPlatform.CoreUtilities.dll": {}, - "lib/netcoreapp3.1/Microsoft.TestPlatform.CrossPlatEngine.dll": {}, - "lib/netcoreapp3.1/Microsoft.TestPlatform.PlatformAbstractions.dll": {}, - "lib/netcoreapp3.1/Microsoft.TestPlatform.Utilities.dll": {}, - "lib/netcoreapp3.1/Microsoft.VisualStudio.TestPlatform.Common.dll": {}, - "lib/netcoreapp3.1/Microsoft.VisualStudio.TestPlatform.ObjectModel.dll": {}, - "lib/netcoreapp3.1/testhost.dll": { - "related": ".deps.json" - } - }, - "runtime": { - "lib/netcoreapp3.1/Microsoft.TestPlatform.CommunicationUtilities.dll": {}, - "lib/netcoreapp3.1/Microsoft.TestPlatform.CoreUtilities.dll": {}, - "lib/netcoreapp3.1/Microsoft.TestPlatform.CrossPlatEngine.dll": {}, - "lib/netcoreapp3.1/Microsoft.TestPlatform.PlatformAbstractions.dll": {}, - "lib/netcoreapp3.1/Microsoft.TestPlatform.Utilities.dll": {}, - "lib/netcoreapp3.1/Microsoft.VisualStudio.TestPlatform.Common.dll": {}, - "lib/netcoreapp3.1/Microsoft.VisualStudio.TestPlatform.ObjectModel.dll": {}, - "lib/netcoreapp3.1/testhost.dll": { - "related": ".deps.json" - } - }, - "resource": { - "lib/netcoreapp3.1/cs/Microsoft.TestPlatform.CommunicationUtilities.resources.dll": { - "locale": "cs" - }, - "lib/netcoreapp3.1/cs/Microsoft.TestPlatform.CrossPlatEngine.resources.dll": { - "locale": "cs" - }, - "lib/netcoreapp3.1/cs/Microsoft.VisualStudio.TestPlatform.Common.resources.dll": { - "locale": "cs" - }, - "lib/netcoreapp3.1/de/Microsoft.TestPlatform.CommunicationUtilities.resources.dll": { - "locale": "de" - }, - "lib/netcoreapp3.1/de/Microsoft.TestPlatform.CrossPlatEngine.resources.dll": { - "locale": "de" - }, - "lib/netcoreapp3.1/de/Microsoft.VisualStudio.TestPlatform.Common.resources.dll": { - "locale": "de" - }, - "lib/netcoreapp3.1/es/Microsoft.TestPlatform.CommunicationUtilities.resources.dll": { - "locale": "es" - }, - "lib/netcoreapp3.1/es/Microsoft.TestPlatform.CrossPlatEngine.resources.dll": { - "locale": "es" - }, - "lib/netcoreapp3.1/es/Microsoft.VisualStudio.TestPlatform.Common.resources.dll": { - "locale": "es" - }, - "lib/netcoreapp3.1/fr/Microsoft.TestPlatform.CommunicationUtilities.resources.dll": { - "locale": "fr" - }, - "lib/netcoreapp3.1/fr/Microsoft.TestPlatform.CrossPlatEngine.resources.dll": { - "locale": "fr" - }, - "lib/netcoreapp3.1/fr/Microsoft.VisualStudio.TestPlatform.Common.resources.dll": { - "locale": "fr" - }, - "lib/netcoreapp3.1/it/Microsoft.TestPlatform.CommunicationUtilities.resources.dll": { - "locale": "it" - }, - "lib/netcoreapp3.1/it/Microsoft.TestPlatform.CrossPlatEngine.resources.dll": { - "locale": "it" - }, - "lib/netcoreapp3.1/it/Microsoft.VisualStudio.TestPlatform.Common.resources.dll": { - "locale": "it" - }, - "lib/netcoreapp3.1/ja/Microsoft.TestPlatform.CommunicationUtilities.resources.dll": { - "locale": "ja" - }, - "lib/netcoreapp3.1/ja/Microsoft.TestPlatform.CrossPlatEngine.resources.dll": { - "locale": "ja" - }, - "lib/netcoreapp3.1/ja/Microsoft.VisualStudio.TestPlatform.Common.resources.dll": { - "locale": "ja" - }, - "lib/netcoreapp3.1/ko/Microsoft.TestPlatform.CommunicationUtilities.resources.dll": { - "locale": "ko" - }, - "lib/netcoreapp3.1/ko/Microsoft.TestPlatform.CrossPlatEngine.resources.dll": { - "locale": "ko" - }, - "lib/netcoreapp3.1/ko/Microsoft.VisualStudio.TestPlatform.Common.resources.dll": { - "locale": "ko" - }, - "lib/netcoreapp3.1/pl/Microsoft.TestPlatform.CommunicationUtilities.resources.dll": { - "locale": "pl" - }, - "lib/netcoreapp3.1/pl/Microsoft.TestPlatform.CrossPlatEngine.resources.dll": { - "locale": "pl" - }, - "lib/netcoreapp3.1/pl/Microsoft.VisualStudio.TestPlatform.Common.resources.dll": { - "locale": "pl" - }, - "lib/netcoreapp3.1/pt-BR/Microsoft.TestPlatform.CommunicationUtilities.resources.dll": { - "locale": "pt-BR" - }, - "lib/netcoreapp3.1/pt-BR/Microsoft.TestPlatform.CrossPlatEngine.resources.dll": { - "locale": "pt-BR" - }, - "lib/netcoreapp3.1/pt-BR/Microsoft.VisualStudio.TestPlatform.Common.resources.dll": { - "locale": "pt-BR" - }, - "lib/netcoreapp3.1/ru/Microsoft.TestPlatform.CommunicationUtilities.resources.dll": { - "locale": "ru" - }, - "lib/netcoreapp3.1/ru/Microsoft.TestPlatform.CrossPlatEngine.resources.dll": { - "locale": "ru" - }, - "lib/netcoreapp3.1/ru/Microsoft.VisualStudio.TestPlatform.Common.resources.dll": { - "locale": "ru" - }, - "lib/netcoreapp3.1/tr/Microsoft.TestPlatform.CommunicationUtilities.resources.dll": { - "locale": "tr" - }, - "lib/netcoreapp3.1/tr/Microsoft.TestPlatform.CrossPlatEngine.resources.dll": { - "locale": "tr" - }, - "lib/netcoreapp3.1/tr/Microsoft.VisualStudio.TestPlatform.Common.resources.dll": { - "locale": "tr" - }, - "lib/netcoreapp3.1/zh-Hans/Microsoft.TestPlatform.CommunicationUtilities.resources.dll": { - "locale": "zh-Hans" - }, - "lib/netcoreapp3.1/zh-Hans/Microsoft.TestPlatform.CrossPlatEngine.resources.dll": { - "locale": "zh-Hans" - }, - "lib/netcoreapp3.1/zh-Hans/Microsoft.VisualStudio.TestPlatform.Common.resources.dll": { - "locale": "zh-Hans" - }, - "lib/netcoreapp3.1/zh-Hant/Microsoft.TestPlatform.CommunicationUtilities.resources.dll": { - "locale": "zh-Hant" - }, - "lib/netcoreapp3.1/zh-Hant/Microsoft.TestPlatform.CrossPlatEngine.resources.dll": { - "locale": "zh-Hant" - }, - "lib/netcoreapp3.1/zh-Hant/Microsoft.VisualStudio.TestPlatform.Common.resources.dll": { - "locale": "zh-Hant" - } - }, - "build": { - "build/netcoreapp3.1/Microsoft.TestPlatform.TestHost.props": {} - } - }, - "Microsoft.VisualStudio.Composition/16.1.8": { - "type": "package", - "dependencies": { - "Microsoft.VisualStudio.Composition.NetFxAttributes": "16.1.8", - "Microsoft.VisualStudio.Validation": "15.0.82", - "System.Composition": "1.0.31", - "System.Reflection.Emit": "4.3.0", - "System.Reflection.Metadata": "1.3.0", - "System.Reflection.TypeExtensions": "4.3.0", - "System.Threading.Tasks.Dataflow": "4.6.0" - }, - "compile": { - "lib/netcoreapp2.0/Microsoft.VisualStudio.Composition.dll": { - "related": ".pdb;.xml" - } - }, - "runtime": { - "lib/netcoreapp2.0/Microsoft.VisualStudio.Composition.dll": { - "related": ".pdb;.xml" - } - }, - "resource": { - "lib/netcoreapp2.0/cs/Microsoft.VisualStudio.Composition.resources.dll": { - "locale": "cs" - }, - "lib/netcoreapp2.0/de/Microsoft.VisualStudio.Composition.resources.dll": { - "locale": "de" - }, - "lib/netcoreapp2.0/es/Microsoft.VisualStudio.Composition.resources.dll": { - "locale": "es" - }, - "lib/netcoreapp2.0/fr/Microsoft.VisualStudio.Composition.resources.dll": { - "locale": "fr" - }, - "lib/netcoreapp2.0/it/Microsoft.VisualStudio.Composition.resources.dll": { - "locale": "it" - }, - "lib/netcoreapp2.0/ja/Microsoft.VisualStudio.Composition.resources.dll": { - "locale": "ja" - }, - "lib/netcoreapp2.0/ko/Microsoft.VisualStudio.Composition.resources.dll": { - "locale": "ko" - }, - "lib/netcoreapp2.0/pl/Microsoft.VisualStudio.Composition.resources.dll": { - "locale": "pl" - }, - "lib/netcoreapp2.0/pt-BR/Microsoft.VisualStudio.Composition.resources.dll": { - "locale": "pt-BR" - }, - "lib/netcoreapp2.0/ru/Microsoft.VisualStudio.Composition.resources.dll": { - "locale": "ru" - }, - "lib/netcoreapp2.0/tr/Microsoft.VisualStudio.Composition.resources.dll": { - "locale": "tr" - }, - "lib/netcoreapp2.0/zh-Hans/Microsoft.VisualStudio.Composition.resources.dll": { - "locale": "zh-Hans" - }, - "lib/netcoreapp2.0/zh-Hant/Microsoft.VisualStudio.Composition.resources.dll": { - "locale": "zh-Hant" - } - } - }, - "Microsoft.VisualStudio.Composition.NetFxAttributes/16.1.8": { - "type": "package", - "dependencies": { - "System.ComponentModel.Composition": "4.5.0" - }, - "compile": { - "lib/netstandard2.0/Microsoft.VisualStudio.Composition.NetFxAttributes.dll": { - "related": ".pdb;.xml" - } - }, - "runtime": { - "lib/netstandard2.0/Microsoft.VisualStudio.Composition.NetFxAttributes.dll": { - "related": ".pdb;.xml" - } - } - }, - "Microsoft.VisualStudio.Validation/15.0.82": { - "type": "package", - "compile": { - "lib/netstandard1.0/Microsoft.VisualStudio.Validation.dll": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard1.0/Microsoft.VisualStudio.Validation.dll": { - "related": ".xml" - } - }, - "resource": { - "lib/netstandard1.0/cs/Microsoft.VisualStudio.Validation.resources.dll": { - "locale": "cs" - }, - "lib/netstandard1.0/de/Microsoft.VisualStudio.Validation.resources.dll": { - "locale": "de" - }, - "lib/netstandard1.0/es/Microsoft.VisualStudio.Validation.resources.dll": { - "locale": "es" - }, - "lib/netstandard1.0/fr/Microsoft.VisualStudio.Validation.resources.dll": { - "locale": "fr" - }, - "lib/netstandard1.0/it/Microsoft.VisualStudio.Validation.resources.dll": { - "locale": "it" - }, - "lib/netstandard1.0/ja/Microsoft.VisualStudio.Validation.resources.dll": { - "locale": "ja" - }, - "lib/netstandard1.0/ko/Microsoft.VisualStudio.Validation.resources.dll": { - "locale": "ko" - }, - "lib/netstandard1.0/pl/Microsoft.VisualStudio.Validation.resources.dll": { - "locale": "pl" - }, - "lib/netstandard1.0/pt-BR/Microsoft.VisualStudio.Validation.resources.dll": { - "locale": "pt-BR" - }, - "lib/netstandard1.0/ru/Microsoft.VisualStudio.Validation.resources.dll": { - "locale": "ru" - }, - "lib/netstandard1.0/tr/Microsoft.VisualStudio.Validation.resources.dll": { - "locale": "tr" - }, - "lib/netstandard1.0/zh-Hans/Microsoft.VisualStudio.Validation.resources.dll": { - "locale": "zh-Hans" - }, - "lib/netstandard1.0/zh-Hant/Microsoft.VisualStudio.Validation.resources.dll": { - "locale": "zh-Hant" - } - } - }, - "Microsoft.Win32.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": { - "related": ".xml" - } - } - }, - "MSTest.TestAdapter/3.1.1": { - "type": "package", - "build": { - "build/net6.0/MSTest.TestAdapter.props": {}, - "build/net6.0/MSTest.TestAdapter.targets": {} - } - }, - "MSTest.TestFramework/3.1.1": { - "type": "package", - "compile": { - "lib/net6.0/Microsoft.VisualStudio.TestPlatform.TestFramework.dll": { - "related": ".xml" - } - }, - "runtime": { - "lib/net6.0/Microsoft.VisualStudio.TestPlatform.TestFramework.dll": { - "related": ".xml" - } - }, - "resource": { - "lib/net6.0/cs/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll": { - "locale": "cs" - }, - "lib/net6.0/de/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll": { - "locale": "de" - }, - "lib/net6.0/es/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll": { - "locale": "es" - }, - "lib/net6.0/fr/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll": { - "locale": "fr" - }, - "lib/net6.0/it/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll": { - "locale": "it" - }, - "lib/net6.0/ja/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll": { - "locale": "ja" - }, - "lib/net6.0/ko/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll": { - "locale": "ko" - }, - "lib/net6.0/pl/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll": { - "locale": "pl" - }, - "lib/net6.0/pt-BR/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll": { - "locale": "pt-BR" - }, - "lib/net6.0/ru/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll": { - "locale": "ru" - }, - "lib/net6.0/tr/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll": { - "locale": "tr" - }, - "lib/net6.0/zh-Hans/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll": { - "locale": "zh-Hans" - }, - "lib/net6.0/zh-Hant/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll": { - "locale": "zh-Hant" - } - }, - "build": { - "build/net6.0/MSTest.TestFramework.targets": {} - } - }, - "NETStandard.Library/1.6.1": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.Win32.Primitives": "4.3.0", - "System.AppContext": "4.3.0", - "System.Collections": "4.3.0", - "System.Collections.Concurrent": "4.3.0", - "System.Console": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Calendars": "4.3.0", - "System.IO": "4.3.0", - "System.IO.Compression": "4.3.0", - "System.IO.Compression.ZipFile": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Linq": "4.3.0", - "System.Linq.Expressions": "4.3.0", - "System.Net.Http": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Net.Sockets": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.InteropServices.RuntimeInformation": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Security.Cryptography.X509Certificates": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Text.RegularExpressions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "System.Threading.Timer": "4.3.0", - "System.Xml.ReaderWriter": "4.3.0", - "System.Xml.XDocument": "4.3.0" - } - }, - "Newtonsoft.Json/13.0.1": { - "type": "package", - "compile": { - "lib/netstandard2.0/Newtonsoft.Json.dll": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard2.0/Newtonsoft.Json.dll": { - "related": ".xml" - } - } - }, - "NuGet.Common/6.3.4": { - "type": "package", - "dependencies": { - "NuGet.Frameworks": "6.3.4" - }, - "compile": { - "lib/netstandard2.0/_._": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard2.0/NuGet.Common.dll": { - "related": ".xml" - } - } - }, - "NuGet.Configuration/6.3.4": { - "type": "package", - "dependencies": { - "NuGet.Common": "6.3.4", - "System.Security.Cryptography.ProtectedData": "4.4.0" - }, - "compile": { - "lib/netstandard2.0/_._": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard2.0/NuGet.Configuration.dll": { - "related": ".xml" - } - } - }, - "NuGet.Frameworks/6.5.0": { - "type": "package", - "compile": { - "lib/netstandard2.0/NuGet.Frameworks.dll": {} - }, - "runtime": { - "lib/netstandard2.0/NuGet.Frameworks.dll": {} - } - }, - "NuGet.Packaging/6.3.4": { - "type": "package", - "dependencies": { - "Newtonsoft.Json": "13.0.1", - "NuGet.Configuration": "6.3.4", - "NuGet.Versioning": "6.3.4", - "System.Security.Cryptography.Cng": "5.0.0", - "System.Security.Cryptography.Pkcs": "5.0.0" - }, - "compile": { - "lib/net5.0/_._": { - "related": ".xml" - } - }, - "runtime": { - "lib/net5.0/NuGet.Packaging.dll": { - "related": ".xml" - } - } - }, - "NuGet.Protocol/6.3.4": { - "type": "package", - "dependencies": { - "NuGet.Packaging": "6.3.4" - }, - "compile": { - "lib/net5.0/_._": { - "related": ".xml" - } - }, - "runtime": { - "lib/net5.0/NuGet.Protocol.dll": { - "related": ".xml" - } - } - }, - "NuGet.Resolver/6.3.4": { - "type": "package", - "dependencies": { - "NuGet.Protocol": "6.3.4" - }, - "compile": { - "lib/net5.0/_._": { - "related": ".xml" - } - }, - "runtime": { - "lib/net5.0/NuGet.Resolver.dll": { - "related": ".xml" - } - } - }, - "NuGet.Versioning/6.3.4": { - "type": "package", - "compile": { - "lib/netstandard2.0/_._": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard2.0/NuGet.Versioning.dll": { - "related": ".xml" - } - } - }, - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/debian.8-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "debian.8-x64" - } - } - }, - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/fedora.23-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "fedora.23-x64" - } - } - }, - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/fedora.24-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "fedora.24-x64" - } - } - }, - "runtime.native.System/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.IO.Compression/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Net.Http/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "type": "package", - "dependencies": { - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "dependencies": { - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0", - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/_._": {} - }, - "runtime": { - "lib/netstandard1.0/_._": {} - } - }, - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/opensuse.13.2-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "opensuse.13.2-x64" - } - } - }, - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/opensuse.42.1-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "opensuse.42.1-x64" - } - } - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/osx.10.10-x64/native/System.Security.Cryptography.Native.Apple.dylib": { - "assetType": "native", - "rid": "osx.10.10-x64" - } - } - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/osx.10.10-x64/native/System.Security.Cryptography.Native.OpenSsl.dylib": { - "assetType": "native", - "rid": "osx.10.10-x64" - } - } - }, - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/rhel.7-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "rhel.7-x64" - } - } - }, - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/ubuntu.14.04-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "ubuntu.14.04-x64" - } - } - }, - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/ubuntu.16.04-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "ubuntu.16.04-x64" - } - } - }, - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "runtimeTargets": { - "runtimes/ubuntu.16.10-x64/native/System.Security.Cryptography.Native.OpenSsl.so": { - "assetType": "native", - "rid": "ubuntu.16.10-x64" - } - } - }, - "System.AppContext/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/_._": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard1.6/System.AppContext.dll": {} - } - }, - "System.Buffers/4.3.0": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "lib/netstandard1.1/_._": {} - }, - "runtime": { - "lib/netstandard1.1/System.Buffers.dll": {} - } - }, - "System.Collections/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Collections.dll": { - "related": ".xml" - } - } - }, - "System.Collections.Concurrent/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Collections.Concurrent.dll": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard1.3/System.Collections.Concurrent.dll": {} - } - }, - "System.Collections.Immutable/8.0.0": { - "type": "package", - "compile": { - "lib/net8.0/System.Collections.Immutable.dll": { - "related": ".xml" - } - }, - "runtime": { - "lib/net8.0/System.Collections.Immutable.dll": { - "related": ".xml" - } - }, - "build": { - "buildTransitive/net6.0/_._": {} - } - }, - "System.ComponentModel.Composition/4.5.0": { - "type": "package", - "dependencies": { - "System.Security.Permissions": "4.5.0" - }, - "compile": { - "ref/netstandard2.0/System.ComponentModel.Composition.dll": {} - }, - "runtime": { - "lib/netcoreapp2.0/System.ComponentModel.Composition.dll": {} - } - }, - "System.Composition/1.0.31": { - "type": "package", - "dependencies": { - "System.Composition.AttributedModel": "1.0.31", - "System.Composition.Convention": "1.0.31", - "System.Composition.Hosting": "1.0.31", - "System.Composition.Runtime": "1.0.31", - "System.Composition.TypedParts": "1.0.31" - } - }, - "System.Composition.AttributedModel/1.0.31": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/System.Composition.AttributedModel.dll": {} - }, - "runtime": { - "lib/netstandard1.0/System.Composition.AttributedModel.dll": {} - } - }, - "System.Composition.Convention/1.0.31": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Composition.AttributedModel": "1.0.31", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Globalization": "4.3.0", - "System.Linq": "4.3.0", - "System.Linq.Expressions": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/System.Composition.Convention.dll": {} - }, - "runtime": { - "lib/netstandard1.0/System.Composition.Convention.dll": {} - } - }, - "System.Composition.Hosting/1.0.31": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Composition.Runtime": "1.0.31", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Globalization": "4.3.0", - "System.Linq": "4.3.0", - "System.Linq.Expressions": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/System.Composition.Hosting.dll": {} - }, - "runtime": { - "lib/netstandard1.0/System.Composition.Hosting.dll": {} - } - }, - "System.Composition.Runtime/1.0.31": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Globalization": "4.3.0", - "System.Linq": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/System.Composition.Runtime.dll": {} - }, - "runtime": { - "lib/netstandard1.0/System.Composition.Runtime.dll": {} - } - }, - "System.Composition.TypedParts/1.0.31": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Composition.AttributedModel": "1.0.31", - "System.Composition.Hosting": "1.0.31", - "System.Composition.Runtime": "1.0.31", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Globalization": "4.3.0", - "System.Linq": "4.3.0", - "System.Linq.Expressions": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/System.Composition.TypedParts.dll": {} - }, - "runtime": { - "lib/netstandard1.0/System.Composition.TypedParts.dll": {} - } - }, - "System.Console/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": { - "related": ".xml" - } - } - }, - "System.Diagnostics.Debug/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Diagnostics.Debug.dll": { - "related": ".xml" - } - } - }, - "System.Diagnostics.DiagnosticSource/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "lib/netstandard1.3/_._": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard1.3/System.Diagnostics.DiagnosticSource.dll": { - "related": ".xml" - } - } - }, - "System.Diagnostics.Tools/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Diagnostics.Tools.dll": { - "related": ".xml" - } - } - }, - "System.Diagnostics.Tracing/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Diagnostics.Tracing.dll": { - "related": ".xml" - } - } - }, - "System.Dynamic.Runtime/4.0.11": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Diagnostics.Debug": "4.0.11", - "System.Globalization": "4.0.11", - "System.Linq": "4.1.0", - "System.Linq.Expressions": "4.1.0", - "System.ObjectModel": "4.0.12", - "System.Reflection": "4.1.0", - "System.Reflection.Emit": "4.0.1", - "System.Reflection.Emit.ILGeneration": "4.0.1", - "System.Reflection.Primitives": "4.0.1", - "System.Reflection.TypeExtensions": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11" - }, - "compile": { - "ref/netstandard1.3/System.Dynamic.Runtime.dll": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard1.3/System.Dynamic.Runtime.dll": {} - } - }, - "System.Formats.Asn1/5.0.0": { - "type": "package", - "compile": { - "lib/netstandard2.0/_._": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard2.0/System.Formats.Asn1.dll": { - "related": ".xml" - } - } - }, - "System.Globalization/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Globalization.dll": { - "related": ".xml" - } - } - }, - "System.Globalization.Calendars/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Globalization": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": { - "related": ".xml" - } - } - }, - "System.Globalization.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.InteropServices": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": { - "related": ".xml" - } - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.Globalization.Extensions.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Globalization.Extensions.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.IO/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.IO.dll": { - "related": ".xml" - } - } - }, - "System.IO.Abstractions/21.0.22": { - "type": "package", - "dependencies": { - "TestableIO.System.IO.Abstractions": "21.0.22", - "TestableIO.System.IO.Abstractions.Wrappers": "21.0.22" - }, - "compile": { - "lib/net8.0/System.IO.Abstractions.dll": { - "related": ".xml" - } - }, - "runtime": { - "lib/net8.0/System.IO.Abstractions.dll": { - "related": ".xml" - } - } - }, - "System.IO.Compression/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Buffers": "4.3.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.IO.Compression": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": { - "related": ".xml" - } - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.IO.Compression.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.IO.Compression.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.IO.Compression.ZipFile/4.3.0": { - "type": "package", - "dependencies": { - "System.Buffers": "4.3.0", - "System.IO": "4.3.0", - "System.IO.Compression": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard1.3/System.IO.Compression.ZipFile.dll": {} - } - }, - "System.IO.FileSystem/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": { - "related": ".xml" - } - } - }, - "System.IO.FileSystem.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard1.3/System.IO.FileSystem.Primitives.dll": {} - } - }, - "System.Linq/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Linq.dll": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard1.6/System.Linq.dll": {} - } - }, - "System.Linq.Expressions/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Linq": "4.3.0", - "System.ObjectModel": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Emit": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Emit.Lightweight": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Reflection.TypeExtensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/System.Linq.Expressions.dll": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard1.6/System.Linq.Expressions.dll": {} - } - }, - "System.Net.Http/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.DiagnosticSource": "4.3.0", - "System.Diagnostics.Tracing": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Extensions": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.OpenSsl": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Security.Cryptography.X509Certificates": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.Net.Http": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": { - "related": ".xml" - } - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.6/System.Net.Http.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Net.Http.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Net.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": { - "related": ".xml" - } - } - }, - "System.Net.Sockets/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Net.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": { - "related": ".xml" - } - } - }, - "System.ObjectModel/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.ObjectModel.dll": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard1.3/System.ObjectModel.dll": {} - } - }, - "System.Reflection/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.IO": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Reflection.dll": { - "related": ".xml" - } - } - }, - "System.Reflection.Emit/4.3.0": { - "type": "package", - "dependencies": { - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.1/System.Reflection.Emit.dll": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.dll": {} - } - }, - "System.Reflection.Emit.ILGeneration/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Reflection.Emit.ILGeneration.dll": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.ILGeneration.dll": {} - } - }, - "System.Reflection.Emit.Lightweight/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Emit.ILGeneration": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/_._": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard1.3/System.Reflection.Emit.Lightweight.dll": {} - } - }, - "System.Reflection.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Reflection.Extensions.dll": { - "related": ".xml" - } - } - }, - "System.Reflection.Metadata/8.0.0": { - "type": "package", - "dependencies": { - "System.Collections.Immutable": "8.0.0" - }, - "compile": { - "lib/net8.0/System.Reflection.Metadata.dll": { - "related": ".xml" - } - }, - "runtime": { - "lib/net8.0/System.Reflection.Metadata.dll": { - "related": ".xml" - } - }, - "build": { - "buildTransitive/net6.0/_._": {} - } - }, - "System.Reflection.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Reflection.Primitives.dll": { - "related": ".xml" - } - } - }, - "System.Reflection.TypeExtensions/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Reflection.TypeExtensions.dll": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard1.5/System.Reflection.TypeExtensions.dll": {} - } - }, - "System.Resources.ResourceManager/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Globalization": "4.3.0", - "System.Reflection": "4.3.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.0/System.Resources.ResourceManager.dll": { - "related": ".xml" - } - } - }, - "System.Runtime/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.dll": { - "related": ".xml" - } - } - }, - "System.Runtime.CompilerServices.Unsafe/6.1.0": { - "type": "package", - "compile": { - "lib/net7.0/_._": {} - }, - "runtime": { - "lib/net7.0/_._": {} - }, - "build": { - "buildTransitive/net6.0/_._": {} - } - }, - "System.Runtime.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.5/System.Runtime.Extensions.dll": { - "related": ".xml" - } - } - }, - "System.Runtime.Handles/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": { - "related": ".xml" - } - } - }, - "System.Runtime.InteropServices/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Reflection": "4.3.0", - "System.Reflection.Primitives": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Handles": "4.3.0" - }, - "compile": { - "ref/netcoreapp1.1/_._": {} - } - }, - "System.Runtime.InteropServices.RuntimeInformation/4.3.0": { - "type": "package", - "dependencies": { - "System.Reflection": "4.3.0", - "System.Reflection.Extensions": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Threading": "4.3.0", - "runtime.native.System": "4.3.0" - }, - "compile": { - "ref/netstandard1.1/_._": {} - }, - "runtime": { - "lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Runtime.Numerics/4.3.0": { - "type": "package", - "dependencies": { - "System.Globalization": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.1/_._": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard1.3/System.Runtime.Numerics.dll": {} - } - }, - "System.Security.AccessControl/4.5.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "2.0.0", - "System.Security.Principal.Windows": "4.5.0" - }, - "compile": { - "ref/netstandard2.0/_._": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard2.0/System.Security.AccessControl.dll": {} - }, - "runtimeTargets": { - "runtimes/win/lib/netcoreapp2.0/System.Security.AccessControl.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.Algorithms/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.Apple": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/_._": {} - }, - "runtimeTargets": { - "runtimes/osx/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll": { - "assetType": "runtime", - "rid": "osx" - }, - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.Cng/5.0.0": { - "type": "package", - "dependencies": { - "System.Formats.Asn1": "5.0.0" - }, - "compile": { - "ref/netcoreapp3.0/_._": { - "related": ".xml" - } - }, - "runtime": { - "lib/netcoreapp3.0/System.Security.Cryptography.Cng.dll": { - "related": ".xml" - } - }, - "runtimeTargets": { - "runtimes/win/lib/netcoreapp3.0/System.Security.Cryptography.Cng.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.Csp/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.Security.Cryptography.Csp.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Csp.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.Encoding/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Collections.Concurrent": "4.3.0", - "System.Linq": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": { - "related": ".xml" - } - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.OpenSsl/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.6/_._": {} - }, - "runtime": { - "lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll": { - "assetType": "runtime", - "rid": "unix" - } - } - }, - "System.Security.Cryptography.Pkcs/5.0.0": { - "type": "package", - "dependencies": { - "System.Formats.Asn1": "5.0.0", - "System.Security.Cryptography.Cng": "5.0.0" - }, - "compile": { - "ref/netcoreapp3.0/_._": { - "related": ".xml" - } - }, - "runtime": { - "lib/netcoreapp3.0/System.Security.Cryptography.Pkcs.dll": { - "related": ".xml" - } - }, - "runtimeTargets": { - "runtimes/win/lib/netcoreapp3.0/System.Security.Cryptography.Pkcs.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.Primitives/4.3.0": { - "type": "package", - "dependencies": { - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": {} - }, - "runtime": { - "lib/netstandard1.3/System.Security.Cryptography.Primitives.dll": {} - } - }, - "System.Security.Cryptography.ProtectedData/4.4.0": { - "type": "package", - "compile": { - "ref/netstandard2.0/_._": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard2.0/System.Security.Cryptography.ProtectedData.dll": {} - }, - "runtimeTargets": { - "runtimes/win/lib/netstandard2.0/System.Security.Cryptography.ProtectedData.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Cryptography.X509Certificates/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.Globalization.Calendars": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.Handles": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Runtime.Numerics": "4.3.0", - "System.Security.Cryptography.Algorithms": "4.3.0", - "System.Security.Cryptography.Cng": "4.3.0", - "System.Security.Cryptography.Csp": "4.3.0", - "System.Security.Cryptography.Encoding": "4.3.0", - "System.Security.Cryptography.OpenSsl": "4.3.0", - "System.Security.Cryptography.Primitives": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "runtime.native.System": "4.3.0", - "runtime.native.System.Net.Http": "4.3.0", - "runtime.native.System.Security.Cryptography.OpenSsl": "4.3.0" - }, - "compile": { - "ref/netstandard1.4/_._": { - "related": ".xml" - } - }, - "runtimeTargets": { - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Security.Permissions/4.5.0": { - "type": "package", - "dependencies": { - "System.Security.AccessControl": "4.5.0" - }, - "compile": { - "ref/netstandard2.0/_._": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard2.0/System.Security.Permissions.dll": {} - } - }, - "System.Security.Principal.Windows/4.5.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "2.0.0" - }, - "compile": { - "ref/netstandard2.0/_._": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard2.0/System.Security.Principal.Windows.dll": {} - }, - "runtimeTargets": { - "runtimes/unix/lib/netcoreapp2.0/System.Security.Principal.Windows.dll": { - "assetType": "runtime", - "rid": "unix" - }, - "runtimes/win/lib/netcoreapp2.0/System.Security.Principal.Windows.dll": { - "assetType": "runtime", - "rid": "win" - } - } - }, - "System.Text.Encoding/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Text.Encoding.dll": { - "related": ".xml" - } - } - }, - "System.Text.Encoding.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0", - "System.Text.Encoding": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": { - "related": ".xml" - } - } - }, - "System.Text.Encodings.Web/8.0.0": { - "type": "package", - "compile": { - "lib/net8.0/System.Text.Encodings.Web.dll": { - "related": ".xml" - } - }, - "runtime": { - "lib/net8.0/System.Text.Encodings.Web.dll": { - "related": ".xml" - } - }, - "build": { - "buildTransitive/net6.0/_._": {} - }, - "runtimeTargets": { - "runtimes/browser/lib/net8.0/System.Text.Encodings.Web.dll": { - "assetType": "runtime", - "rid": "browser" - } - } - }, - "System.Text.Json/8.0.4": { - "type": "package", - "dependencies": { - "System.Text.Encodings.Web": "8.0.0" - }, - "compile": { - "lib/net8.0/System.Text.Json.dll": { - "related": ".xml" - } - }, - "runtime": { - "lib/net8.0/System.Text.Json.dll": { - "related": ".xml" - } - }, - "build": { - "buildTransitive/net6.0/System.Text.Json.targets": {} - } - }, - "System.Text.RegularExpressions/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netcoreapp1.1/_._": {} - }, - "runtime": { - "lib/netstandard1.6/System.Text.RegularExpressions.dll": {} - } - }, - "System.Threading/4.3.0": { - "type": "package", - "dependencies": { - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Threading.dll": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard1.3/System.Threading.dll": {} - } - }, - "System.Threading.Tasks/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/System.Threading.Tasks.dll": { - "related": ".xml" - } - } - }, - "System.Threading.Tasks.Dataflow/4.6.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.0.11", - "System.Collections.Concurrent": "4.0.12", - "System.Diagnostics.Debug": "4.0.11", - "System.Diagnostics.Tracing": "4.1.0", - "System.Dynamic.Runtime": "4.0.11", - "System.Linq": "4.1.0", - "System.Resources.ResourceManager": "4.0.1", - "System.Runtime": "4.1.0", - "System.Runtime.Extensions": "4.1.0", - "System.Threading": "4.0.11", - "System.Threading.Tasks": "4.0.11" - }, - "compile": { - "lib/netstandard1.1/System.Threading.Tasks.Dataflow.dll": { - "related": ".XML" - } - }, - "runtime": { - "lib/netstandard1.1/System.Threading.Tasks.Dataflow.dll": { - "related": ".XML" - } - } - }, - "System.Threading.Tasks.Extensions/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Runtime": "4.3.0", - "System.Threading.Tasks": "4.3.0" - }, - "compile": { - "lib/netstandard1.0/_._": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard1.0/System.Threading.Tasks.Extensions.dll": { - "related": ".xml" - } - } - }, - "System.Threading.Timer/4.3.0": { - "type": "package", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0", - "Microsoft.NETCore.Targets": "1.1.0", - "System.Runtime": "4.3.0" - }, - "compile": { - "ref/netstandard1.2/_._": { - "related": ".xml" - } - } - }, - "System.Xml.ReaderWriter/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.IO.FileSystem": "4.3.0", - "System.IO.FileSystem.Primitives": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Runtime.InteropServices": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Text.Encoding.Extensions": "4.3.0", - "System.Text.RegularExpressions": "4.3.0", - "System.Threading.Tasks": "4.3.0", - "System.Threading.Tasks.Extensions": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard1.3/System.Xml.ReaderWriter.dll": {} - } - }, - "System.Xml.XDocument/4.3.0": { - "type": "package", - "dependencies": { - "System.Collections": "4.3.0", - "System.Diagnostics.Debug": "4.3.0", - "System.Diagnostics.Tools": "4.3.0", - "System.Globalization": "4.3.0", - "System.IO": "4.3.0", - "System.Reflection": "4.3.0", - "System.Resources.ResourceManager": "4.3.0", - "System.Runtime": "4.3.0", - "System.Runtime.Extensions": "4.3.0", - "System.Text.Encoding": "4.3.0", - "System.Threading": "4.3.0", - "System.Xml.ReaderWriter": "4.3.0" - }, - "compile": { - "ref/netstandard1.3/_._": { - "related": ".xml" - } - }, - "runtime": { - "lib/netstandard1.3/System.Xml.XDocument.dll": {} - } - }, - "Terminal.Gui/2.0.0-v2-develop.2329": { - "type": "package", - "dependencies": { - "ColorHelper": "[1.8.1, 2.0.0)", - "System.IO.Abstractions": "[21.0.22, 22.0.0)", - "System.Text.Json": "[8.0.4, 9.0.0)", - "Wcwidth": "[2.0.0, 3.0.0)" - }, - "compile": { - "lib/net8.0/Terminal.Gui.dll": { - "related": ".xml" - } - }, - "runtime": { - "lib/net8.0/Terminal.Gui.dll": { - "related": ".xml" - } - }, - "resource": { - "lib/net8.0/fr-FR/Terminal.Gui.resources.dll": { - "locale": "fr-FR" - }, - "lib/net8.0/ja-JP/Terminal.Gui.resources.dll": { - "locale": "ja-JP" - }, - "lib/net8.0/pt-PT/Terminal.Gui.resources.dll": { - "locale": "pt-PT" - }, - "lib/net8.0/zh-Hans/Terminal.Gui.resources.dll": { - "locale": "zh-Hans" - } - } - }, - "TestableIO.System.IO.Abstractions/21.0.22": { - "type": "package", - "compile": { - "lib/net8.0/TestableIO.System.IO.Abstractions.dll": { - "related": ".xml" - } - }, - "runtime": { - "lib/net8.0/TestableIO.System.IO.Abstractions.dll": { - "related": ".xml" - } - } - }, - "TestableIO.System.IO.Abstractions.Wrappers/21.0.22": { - "type": "package", - "dependencies": { - "TestableIO.System.IO.Abstractions": "21.0.22" - }, - "compile": { - "lib/net8.0/TestableIO.System.IO.Abstractions.Wrappers.dll": { - "related": ".xml" - } - }, - "runtime": { - "lib/net8.0/TestableIO.System.IO.Abstractions.Wrappers.dll": { - "related": ".xml" - } - } - }, - "Wcwidth/2.0.0": { - "type": "package", - "compile": { - "lib/net8.0/Wcwidth.dll": { - "related": ".xml" - } - }, - "runtime": { - "lib/net8.0/Wcwidth.dll": { - "related": ".xml" - } - } - }, - "StgSharp.Common/1.0.0": { - "type": "project", - "framework": ".NETCoreApp,Version=v8.0", - "dependencies": { - "Microsoft.CSharp": "4.7.0", - "System.Runtime.CompilerServices.Unsafe": "6.1.0" - }, - "compile": { - "bin/placeholder/StgSharp.Common.dll": {} - }, - "runtime": { - "bin/placeholder/StgSharp.Common.dll": {} - } - }, - "StgSharp.Model/1.0.0": { - "type": "project", - "framework": ".NETCoreApp,Version=v8.0", - "dependencies": { - "StgSharp.Common": "1.0.0", - "StgSharp.Script": "1.0.0" - }, - "compile": { - "bin/placeholder/StgSharp.Model.dll": {} - }, - "runtime": { - "bin/placeholder/StgSharp.Model.dll": {} - } - }, - "StgSharp.Script/1.0.0": { - "type": "project", - "framework": ".NETCoreApp,Version=v8.0", - "dependencies": { - "CommunityToolkit.HighPerformance": "8.4.0", - "Microsoft.CodeAnalysis.CSharp": "4.13.0", - "StgSharp.Common": "1.0.0" - }, - "compile": { - "bin/placeholder/StgSharp.Script.dll": {} - }, - "runtime": { - "bin/placeholder/StgSharp.Script.dll": {} - } - }, - "StgSharp.TerminalDialogue/1.0.0": { - "type": "project", - "framework": ".NETCoreApp,Version=v8.0", - "dependencies": { - "Terminal.Gui": "2.0.0-v2-develop.2329" - }, - "compile": { - "bin/placeholder/StgSharp.TerminalDialogue.dll": {} - }, - "runtime": { - "bin/placeholder/StgSharp.TerminalDialogue.dll": {} - } - } - } - }, - "libraries": { - "ColorHelper/1.8.1": { - "sha512": "rblWXd/02TfwJjX53xEfQnbnDRKxCm09VtavV8JaIcmIFWt9efNf6xTQ3WeXgy/she5R31eRTtnizFoUoDrs5w==", - "type": "package", - "path": "colorhelper/1.8.1", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "colorhelper.1.8.1.nupkg.sha512", - "colorhelper.nuspec", - "lib/netstandard2.0/ColorHelper.dll", - "logo.jpg" - ] - }, - "CommunityToolkit.HighPerformance/8.4.0": { - "sha512": "flxspiBs0G/0GMp7IK2J2ijV9bTG6hEwFc/z6ekHqB6nwRJ4Ry2yLdx+TkbCUYFCl4XhABkAwomeKbT6zM2Zlg==", - "type": "package", - "path": "communitytoolkit.highperformance/8.4.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "License.md", - "ThirdPartyNotices.txt", - "communitytoolkit.highperformance.8.4.0.nupkg.sha512", - "communitytoolkit.highperformance.nuspec", - "lib/net7.0/CommunityToolkit.HighPerformance.dll", - "lib/net7.0/CommunityToolkit.HighPerformance.pdb", - "lib/net7.0/CommunityToolkit.HighPerformance.xml", - "lib/net8.0/CommunityToolkit.HighPerformance.dll", - "lib/net8.0/CommunityToolkit.HighPerformance.pdb", - "lib/net8.0/CommunityToolkit.HighPerformance.xml", - "lib/netstandard2.0/CommunityToolkit.HighPerformance.dll", - "lib/netstandard2.0/CommunityToolkit.HighPerformance.pdb", - "lib/netstandard2.0/CommunityToolkit.HighPerformance.xml", - "lib/netstandard2.1/CommunityToolkit.HighPerformance.dll", - "lib/netstandard2.1/CommunityToolkit.HighPerformance.pdb", - "lib/netstandard2.1/CommunityToolkit.HighPerformance.xml" - ] - }, - "coverlet.collector/6.0.0": { - "sha512": "tW3lsNS+dAEII6YGUX/VMoJjBS1QvsxqJeqLaJXub08y1FSjasFPtQ4UBUsudE9PNrzLjooClMsPtY2cZLdXpQ==", - "type": "package", - "path": "coverlet.collector/6.0.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "build/netstandard1.0/Microsoft.Bcl.AsyncInterfaces.dll", - "build/netstandard1.0/Microsoft.CSharp.dll", - "build/netstandard1.0/Microsoft.DotNet.PlatformAbstractions.dll", - "build/netstandard1.0/Microsoft.Extensions.DependencyInjection.Abstractions.dll", - "build/netstandard1.0/Microsoft.Extensions.DependencyInjection.dll", - "build/netstandard1.0/Microsoft.Extensions.DependencyModel.dll", - "build/netstandard1.0/Microsoft.Extensions.FileSystemGlobbing.dll", - "build/netstandard1.0/Microsoft.TestPlatform.CoreUtilities.dll", - "build/netstandard1.0/Microsoft.TestPlatform.PlatformAbstractions.dll", - "build/netstandard1.0/Microsoft.VisualStudio.TestPlatform.ObjectModel.dll", - "build/netstandard1.0/Mono.Cecil.Mdb.dll", - "build/netstandard1.0/Mono.Cecil.Pdb.dll", - "build/netstandard1.0/Mono.Cecil.Rocks.dll", - "build/netstandard1.0/Mono.Cecil.dll", - "build/netstandard1.0/Newtonsoft.Json.dll", - "build/netstandard1.0/NuGet.Frameworks.dll", - "build/netstandard1.0/System.AppContext.dll", - "build/netstandard1.0/System.Collections.Immutable.dll", - "build/netstandard1.0/System.Dynamic.Runtime.dll", - "build/netstandard1.0/System.IO.FileSystem.Primitives.dll", - "build/netstandard1.0/System.Linq.Expressions.dll", - "build/netstandard1.0/System.Linq.dll", - "build/netstandard1.0/System.ObjectModel.dll", - "build/netstandard1.0/System.Reflection.Emit.ILGeneration.dll", - "build/netstandard1.0/System.Reflection.Emit.Lightweight.dll", - "build/netstandard1.0/System.Reflection.Emit.dll", - "build/netstandard1.0/System.Reflection.Metadata.dll", - "build/netstandard1.0/System.Reflection.TypeExtensions.dll", - "build/netstandard1.0/System.Runtime.CompilerServices.Unsafe.dll", - "build/netstandard1.0/System.Runtime.Serialization.Primitives.dll", - "build/netstandard1.0/System.Text.RegularExpressions.dll", - "build/netstandard1.0/System.Threading.Tasks.Extensions.dll", - "build/netstandard1.0/System.Threading.dll", - "build/netstandard1.0/System.Xml.ReaderWriter.dll", - "build/netstandard1.0/System.Xml.XDocument.dll", - "build/netstandard1.0/coverlet.collector.deps.json", - "build/netstandard1.0/coverlet.collector.dll", - "build/netstandard1.0/coverlet.collector.pdb", - "build/netstandard1.0/coverlet.collector.targets", - "build/netstandard1.0/coverlet.core.dll", - "build/netstandard1.0/coverlet.core.pdb", - "coverlet-icon.png", - "coverlet.collector.6.0.0.nupkg.sha512", - "coverlet.collector.nuspec" - ] - }, - "DiffPlex/1.7.2": { - "sha512": "qJEjdxEDBWSFZGB8paBB9HDeJXHGlHlOXeGX3kbTuXWuOsgv2iSAEOOzo5V1/B39Vcxr9IVVrNKewRcX+rsn4g==", - "type": "package", - "path": "diffplex/1.7.2", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "README.md", - "diffplex.1.7.2.nupkg.sha512", - "diffplex.nuspec", - "diffplex_icon.png", - "lib/net35/DiffPlex.dll", - "lib/net35/DiffPlex.xml", - "lib/net40/DiffPlex.dll", - "lib/net40/DiffPlex.xml", - "lib/net6.0/DiffPlex.dll", - "lib/net6.0/DiffPlex.xml", - "lib/netstandard1.0/DiffPlex.dll", - "lib/netstandard1.0/DiffPlex.xml", - "lib/netstandard2.0/DiffPlex.dll", - "lib/netstandard2.0/DiffPlex.xml" - ] - }, - "Humanizer.Core/2.2.0": { - "sha512": "rsYXB7+iUPP8AHgQ8JP2UZI2xK2KhjcdGr9E6zX3CsZaTLCaw8M35vaAJRo1rfxeaZEVMuXeaquLVCkZ7JcZ5Q==", - "type": "package", - "path": "humanizer.core/2.2.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "humanizer.core.2.2.0.nupkg.sha512", - "humanizer.core.nuspec", - "lib/netstandard1.0/Humanizer.dll" - ] - }, - "Microsoft.Bcl.AsyncInterfaces/1.1.1": { - "sha512": "yuvf07qFWFqtK3P/MRkEKLhn5r2UbSpVueRziSqj0yJQIKFwG1pq9mOayK3zE5qZCTs0CbrwL9M6R8VwqyGy2w==", - "type": "package", - "path": "microsoft.bcl.asyncinterfaces/1.1.1", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "LICENSE.TXT", - "THIRD-PARTY-NOTICES.TXT", - "lib/net461/Microsoft.Bcl.AsyncInterfaces.dll", - "lib/net461/Microsoft.Bcl.AsyncInterfaces.xml", - "lib/netstandard2.0/Microsoft.Bcl.AsyncInterfaces.dll", - "lib/netstandard2.0/Microsoft.Bcl.AsyncInterfaces.xml", - "lib/netstandard2.1/Microsoft.Bcl.AsyncInterfaces.dll", - "lib/netstandard2.1/Microsoft.Bcl.AsyncInterfaces.xml", - "microsoft.bcl.asyncinterfaces.1.1.1.nupkg.sha512", - "microsoft.bcl.asyncinterfaces.nuspec", - "ref/net461/Microsoft.Bcl.AsyncInterfaces.dll", - "ref/netstandard2.0/Microsoft.Bcl.AsyncInterfaces.dll", - "ref/netstandard2.1/Microsoft.Bcl.AsyncInterfaces.dll", - "useSharedDesignerContext.txt", - "version.txt" - ] - }, - "Microsoft.CodeAnalysis.Analyzer.Testing/1.1.2": { - "sha512": "g6cSJMPlmTiEHakCKaTobNISbf4jfjNF38YK8V4azAgcV9CE4BxuGQSWW6eftHs43q7mhKOr1lioKsTVQmUc1g==", - "type": "package", - "path": "microsoft.codeanalysis.analyzer.testing/1.1.2", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "lib/net452/Microsoft.CodeAnalysis.Analyzer.Testing.dll", - "lib/net452/Microsoft.CodeAnalysis.Analyzer.Testing.xml", - "lib/net46/Microsoft.CodeAnalysis.Analyzer.Testing.dll", - "lib/net46/Microsoft.CodeAnalysis.Analyzer.Testing.xml", - "lib/net472/Microsoft.CodeAnalysis.Analyzer.Testing.dll", - "lib/net472/Microsoft.CodeAnalysis.Analyzer.Testing.xml", - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.Analyzer.Testing.dll", - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.Analyzer.Testing.xml", - "lib/netstandard1.6/Microsoft.CodeAnalysis.Analyzer.Testing.dll", - "lib/netstandard1.6/Microsoft.CodeAnalysis.Analyzer.Testing.xml", - "lib/netstandard2.0/Microsoft.CodeAnalysis.Analyzer.Testing.dll", - "lib/netstandard2.0/Microsoft.CodeAnalysis.Analyzer.Testing.xml", - "microsoft.codeanalysis.analyzer.testing.1.1.2.nupkg.sha512", - "microsoft.codeanalysis.analyzer.testing.nuspec" - ] - }, - "Microsoft.CodeAnalysis.Analyzers/3.11.0": { - "sha512": "v/EW3UE8/lbEYHoC2Qq7AR/DnmvpgdtAMndfQNmpuIMx/Mto8L5JnuCfdBYtgvalQOtfNCnxFejxuRrryvUTsg==", - "type": "package", - "path": "microsoft.codeanalysis.analyzers/3.11.0", - "hasTools": true, - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "ThirdPartyNotices.txt", - "analyzers/dotnet/cs/Microsoft.CodeAnalysis.Analyzers.dll", - "analyzers/dotnet/cs/Microsoft.CodeAnalysis.CSharp.Analyzers.dll", - "analyzers/dotnet/cs/cs/Microsoft.CodeAnalysis.Analyzers.resources.dll", - "analyzers/dotnet/cs/de/Microsoft.CodeAnalysis.Analyzers.resources.dll", - "analyzers/dotnet/cs/es/Microsoft.CodeAnalysis.Analyzers.resources.dll", - "analyzers/dotnet/cs/fr/Microsoft.CodeAnalysis.Analyzers.resources.dll", - "analyzers/dotnet/cs/it/Microsoft.CodeAnalysis.Analyzers.resources.dll", - "analyzers/dotnet/cs/ja/Microsoft.CodeAnalysis.Analyzers.resources.dll", - "analyzers/dotnet/cs/ko/Microsoft.CodeAnalysis.Analyzers.resources.dll", - "analyzers/dotnet/cs/pl/Microsoft.CodeAnalysis.Analyzers.resources.dll", - "analyzers/dotnet/cs/pt-BR/Microsoft.CodeAnalysis.Analyzers.resources.dll", - "analyzers/dotnet/cs/ru/Microsoft.CodeAnalysis.Analyzers.resources.dll", - "analyzers/dotnet/cs/tr/Microsoft.CodeAnalysis.Analyzers.resources.dll", - "analyzers/dotnet/cs/zh-Hans/Microsoft.CodeAnalysis.Analyzers.resources.dll", - "analyzers/dotnet/cs/zh-Hant/Microsoft.CodeAnalysis.Analyzers.resources.dll", - "analyzers/dotnet/vb/Microsoft.CodeAnalysis.Analyzers.dll", - "analyzers/dotnet/vb/Microsoft.CodeAnalysis.VisualBasic.Analyzers.dll", - "analyzers/dotnet/vb/cs/Microsoft.CodeAnalysis.Analyzers.resources.dll", - "analyzers/dotnet/vb/de/Microsoft.CodeAnalysis.Analyzers.resources.dll", - "analyzers/dotnet/vb/es/Microsoft.CodeAnalysis.Analyzers.resources.dll", - "analyzers/dotnet/vb/fr/Microsoft.CodeAnalysis.Analyzers.resources.dll", - "analyzers/dotnet/vb/it/Microsoft.CodeAnalysis.Analyzers.resources.dll", - "analyzers/dotnet/vb/ja/Microsoft.CodeAnalysis.Analyzers.resources.dll", - "analyzers/dotnet/vb/ko/Microsoft.CodeAnalysis.Analyzers.resources.dll", - "analyzers/dotnet/vb/pl/Microsoft.CodeAnalysis.Analyzers.resources.dll", - "analyzers/dotnet/vb/pt-BR/Microsoft.CodeAnalysis.Analyzers.resources.dll", - "analyzers/dotnet/vb/ru/Microsoft.CodeAnalysis.Analyzers.resources.dll", - "analyzers/dotnet/vb/tr/Microsoft.CodeAnalysis.Analyzers.resources.dll", - "analyzers/dotnet/vb/zh-Hans/Microsoft.CodeAnalysis.Analyzers.resources.dll", - "analyzers/dotnet/vb/zh-Hant/Microsoft.CodeAnalysis.Analyzers.resources.dll", - "buildTransitive/Microsoft.CodeAnalysis.Analyzers.props", - "buildTransitive/Microsoft.CodeAnalysis.Analyzers.targets", - "buildTransitive/config/analysislevel_2_9_8_all.globalconfig", - "buildTransitive/config/analysislevel_2_9_8_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_2_9_8_default.globalconfig", - "buildTransitive/config/analysislevel_2_9_8_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_2_9_8_minimum.globalconfig", - "buildTransitive/config/analysislevel_2_9_8_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_2_9_8_none.globalconfig", - "buildTransitive/config/analysislevel_2_9_8_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_2_9_8_recommended.globalconfig", - "buildTransitive/config/analysislevel_2_9_8_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_3_3_3_all.globalconfig", - "buildTransitive/config/analysislevel_3_3_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_3_3_3_default.globalconfig", - "buildTransitive/config/analysislevel_3_3_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_3_3_3_minimum.globalconfig", - "buildTransitive/config/analysislevel_3_3_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_3_3_3_none.globalconfig", - "buildTransitive/config/analysislevel_3_3_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_3_3_3_recommended.globalconfig", - "buildTransitive/config/analysislevel_3_3_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_3_3_4_all.globalconfig", - "buildTransitive/config/analysislevel_3_3_4_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_3_3_4_default.globalconfig", - "buildTransitive/config/analysislevel_3_3_4_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_3_3_4_minimum.globalconfig", - "buildTransitive/config/analysislevel_3_3_4_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_3_3_4_none.globalconfig", - "buildTransitive/config/analysislevel_3_3_4_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_3_3_4_recommended.globalconfig", - "buildTransitive/config/analysislevel_3_3_4_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_3_3_all.globalconfig", - "buildTransitive/config/analysislevel_3_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_3_3_default.globalconfig", - "buildTransitive/config/analysislevel_3_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_3_3_minimum.globalconfig", - "buildTransitive/config/analysislevel_3_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_3_3_none.globalconfig", - "buildTransitive/config/analysislevel_3_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_3_3_recommended.globalconfig", - "buildTransitive/config/analysislevel_3_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_3_all.globalconfig", - "buildTransitive/config/analysislevel_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_3_default.globalconfig", - "buildTransitive/config/analysislevel_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_3_minimum.globalconfig", - "buildTransitive/config/analysislevel_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_3_none.globalconfig", - "buildTransitive/config/analysislevel_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_3_recommended.globalconfig", - "buildTransitive/config/analysislevel_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_4_3_all.globalconfig", - "buildTransitive/config/analysislevel_4_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_4_3_default.globalconfig", - "buildTransitive/config/analysislevel_4_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_4_3_minimum.globalconfig", - "buildTransitive/config/analysislevel_4_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_4_3_none.globalconfig", - "buildTransitive/config/analysislevel_4_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevel_4_3_recommended.globalconfig", - "buildTransitive/config/analysislevel_4_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_2_9_8_all.globalconfig", - "buildTransitive/config/analysislevelcorrectness_2_9_8_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_2_9_8_default.globalconfig", - "buildTransitive/config/analysislevelcorrectness_2_9_8_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_2_9_8_minimum.globalconfig", - "buildTransitive/config/analysislevelcorrectness_2_9_8_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_2_9_8_none.globalconfig", - "buildTransitive/config/analysislevelcorrectness_2_9_8_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_2_9_8_recommended.globalconfig", - "buildTransitive/config/analysislevelcorrectness_2_9_8_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_3_all.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_3_default.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_3_minimum.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_3_none.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_3_recommended.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_4_all.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_4_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_4_default.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_4_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_4_minimum.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_4_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_4_none.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_4_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_4_recommended.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_4_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_all.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_default.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_minimum.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_none.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_recommended.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_all.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_default.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_minimum.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_none.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_recommended.globalconfig", - "buildTransitive/config/analysislevelcorrectness_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_4_3_all.globalconfig", - "buildTransitive/config/analysislevelcorrectness_4_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_4_3_default.globalconfig", - "buildTransitive/config/analysislevelcorrectness_4_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_4_3_minimum.globalconfig", - "buildTransitive/config/analysislevelcorrectness_4_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_4_3_none.globalconfig", - "buildTransitive/config/analysislevelcorrectness_4_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelcorrectness_4_3_recommended.globalconfig", - "buildTransitive/config/analysislevelcorrectness_4_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_2_9_8_all.globalconfig", - "buildTransitive/config/analysislevellibrary_2_9_8_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_2_9_8_default.globalconfig", - "buildTransitive/config/analysislevellibrary_2_9_8_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_2_9_8_minimum.globalconfig", - "buildTransitive/config/analysislevellibrary_2_9_8_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_2_9_8_none.globalconfig", - "buildTransitive/config/analysislevellibrary_2_9_8_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_2_9_8_recommended.globalconfig", - "buildTransitive/config/analysislevellibrary_2_9_8_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_3_all.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_3_default.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_3_minimum.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_3_none.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_3_recommended.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_4_all.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_4_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_4_default.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_4_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_4_minimum.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_4_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_4_none.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_4_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_4_recommended.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_4_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_all.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_default.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_minimum.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_none.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_recommended.globalconfig", - "buildTransitive/config/analysislevellibrary_3_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_3_all.globalconfig", - "buildTransitive/config/analysislevellibrary_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_3_default.globalconfig", - "buildTransitive/config/analysislevellibrary_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_3_minimum.globalconfig", - "buildTransitive/config/analysislevellibrary_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_3_none.globalconfig", - "buildTransitive/config/analysislevellibrary_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_3_recommended.globalconfig", - "buildTransitive/config/analysislevellibrary_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_4_3_all.globalconfig", - "buildTransitive/config/analysislevellibrary_4_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_4_3_default.globalconfig", - "buildTransitive/config/analysislevellibrary_4_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_4_3_minimum.globalconfig", - "buildTransitive/config/analysislevellibrary_4_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_4_3_none.globalconfig", - "buildTransitive/config/analysislevellibrary_4_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevellibrary_4_3_recommended.globalconfig", - "buildTransitive/config/analysislevellibrary_4_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_2_9_8_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_2_9_8_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_2_9_8_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_2_9_8_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_2_9_8_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_2_9_8_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_2_9_8_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_2_9_8_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_2_9_8_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_2_9_8_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_4_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_4_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_4_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_4_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_4_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_4_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_4_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_4_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_4_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_4_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_4_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_4_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_4_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_4_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_4_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_4_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_4_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_4_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_4_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscompatibility_4_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_2_9_8_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_2_9_8_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_2_9_8_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_2_9_8_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_2_9_8_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_2_9_8_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_2_9_8_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_2_9_8_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_2_9_8_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_2_9_8_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_4_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_4_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_4_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_4_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_4_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_4_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_4_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_4_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_4_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_4_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_4_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_4_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_4_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_4_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_4_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_4_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_4_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_4_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_4_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysiscorrectness_4_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_2_9_8_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_2_9_8_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_2_9_8_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_2_9_8_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_2_9_8_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_2_9_8_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_2_9_8_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_2_9_8_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_2_9_8_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_2_9_8_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_4_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_4_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_4_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_4_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_4_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_4_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_4_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_4_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_4_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_4_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_4_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_4_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_4_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_4_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_4_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_4_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_4_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_4_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_4_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdesign_4_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_2_9_8_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_2_9_8_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_2_9_8_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_2_9_8_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_2_9_8_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_2_9_8_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_2_9_8_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_2_9_8_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_2_9_8_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_2_9_8_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_4_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_4_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_4_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_4_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_4_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_4_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_4_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_4_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_4_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_4_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_4_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_4_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_4_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_4_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_4_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_4_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_4_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_4_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_4_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisdocumentation_4_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_2_9_8_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_2_9_8_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_2_9_8_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_2_9_8_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_2_9_8_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_2_9_8_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_2_9_8_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_2_9_8_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_2_9_8_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_2_9_8_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_4_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_4_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_4_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_4_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_4_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_4_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_4_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_4_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_4_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_4_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_4_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_4_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_4_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_4_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_4_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_4_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_4_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_4_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_4_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysislocalization_4_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_2_9_8_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_2_9_8_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_2_9_8_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_2_9_8_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_2_9_8_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_2_9_8_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_2_9_8_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_2_9_8_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_2_9_8_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_2_9_8_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_4_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_4_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_4_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_4_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_4_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_4_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_4_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_4_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_4_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_4_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_4_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_4_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_4_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_4_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_4_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_4_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_4_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_4_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_4_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisperformance_4_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_2_9_8_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_2_9_8_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_2_9_8_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_2_9_8_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_2_9_8_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_2_9_8_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_2_9_8_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_2_9_8_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_2_9_8_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_2_9_8_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_4_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_4_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_4_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_4_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_4_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_4_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_4_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_4_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_4_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_4_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_3_recommended_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_4_3_all.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_4_3_all_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_4_3_default.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_4_3_default_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_4_3_minimum.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_4_3_minimum_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_4_3_none.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_4_3_none_warnaserror.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_4_3_recommended.globalconfig", - "buildTransitive/config/analysislevelmicrosoftcodeanalysisreleasetracking_4_3_recommended_warnaserror.globalconfig", - "documentation/Analyzer Configuration.md", - "documentation/Microsoft.CodeAnalysis.Analyzers.md", - "documentation/Microsoft.CodeAnalysis.Analyzers.sarif", - "documentation/readme.md", - "editorconfig/AllRulesDefault/.editorconfig", - "editorconfig/AllRulesDisabled/.editorconfig", - "editorconfig/AllRulesEnabled/.editorconfig", - "editorconfig/CorrectnessRulesDefault/.editorconfig", - "editorconfig/CorrectnessRulesEnabled/.editorconfig", - "editorconfig/DataflowRulesDefault/.editorconfig", - "editorconfig/DataflowRulesEnabled/.editorconfig", - "editorconfig/LibraryRulesDefault/.editorconfig", - "editorconfig/LibraryRulesEnabled/.editorconfig", - "editorconfig/MicrosoftCodeAnalysisCompatibilityRulesDefault/.editorconfig", - "editorconfig/MicrosoftCodeAnalysisCompatibilityRulesEnabled/.editorconfig", - "editorconfig/MicrosoftCodeAnalysisCorrectnessRulesDefault/.editorconfig", - "editorconfig/MicrosoftCodeAnalysisCorrectnessRulesEnabled/.editorconfig", - "editorconfig/MicrosoftCodeAnalysisDesignRulesDefault/.editorconfig", - "editorconfig/MicrosoftCodeAnalysisDesignRulesEnabled/.editorconfig", - "editorconfig/MicrosoftCodeAnalysisDocumentationRulesDefault/.editorconfig", - "editorconfig/MicrosoftCodeAnalysisDocumentationRulesEnabled/.editorconfig", - "editorconfig/MicrosoftCodeAnalysisLocalizationRulesDefault/.editorconfig", - "editorconfig/MicrosoftCodeAnalysisLocalizationRulesEnabled/.editorconfig", - "editorconfig/MicrosoftCodeAnalysisPerformanceRulesDefault/.editorconfig", - "editorconfig/MicrosoftCodeAnalysisPerformanceRulesEnabled/.editorconfig", - "editorconfig/MicrosoftCodeAnalysisReleaseTrackingRulesDefault/.editorconfig", - "editorconfig/MicrosoftCodeAnalysisReleaseTrackingRulesEnabled/.editorconfig", - "editorconfig/PortedFromFxCopRulesDefault/.editorconfig", - "editorconfig/PortedFromFxCopRulesEnabled/.editorconfig", - "microsoft.codeanalysis.analyzers.3.11.0.nupkg.sha512", - "microsoft.codeanalysis.analyzers.nuspec", - "rulesets/AllRulesDefault.ruleset", - "rulesets/AllRulesDisabled.ruleset", - "rulesets/AllRulesEnabled.ruleset", - "rulesets/CorrectnessRulesDefault.ruleset", - "rulesets/CorrectnessRulesEnabled.ruleset", - "rulesets/DataflowRulesDefault.ruleset", - "rulesets/DataflowRulesEnabled.ruleset", - "rulesets/LibraryRulesDefault.ruleset", - "rulesets/LibraryRulesEnabled.ruleset", - "rulesets/MicrosoftCodeAnalysisCompatibilityRulesDefault.ruleset", - "rulesets/MicrosoftCodeAnalysisCompatibilityRulesEnabled.ruleset", - "rulesets/MicrosoftCodeAnalysisCorrectnessRulesDefault.ruleset", - "rulesets/MicrosoftCodeAnalysisCorrectnessRulesEnabled.ruleset", - "rulesets/MicrosoftCodeAnalysisDesignRulesDefault.ruleset", - "rulesets/MicrosoftCodeAnalysisDesignRulesEnabled.ruleset", - "rulesets/MicrosoftCodeAnalysisDocumentationRulesDefault.ruleset", - "rulesets/MicrosoftCodeAnalysisDocumentationRulesEnabled.ruleset", - "rulesets/MicrosoftCodeAnalysisLocalizationRulesDefault.ruleset", - "rulesets/MicrosoftCodeAnalysisLocalizationRulesEnabled.ruleset", - "rulesets/MicrosoftCodeAnalysisPerformanceRulesDefault.ruleset", - "rulesets/MicrosoftCodeAnalysisPerformanceRulesEnabled.ruleset", - "rulesets/MicrosoftCodeAnalysisReleaseTrackingRulesDefault.ruleset", - "rulesets/MicrosoftCodeAnalysisReleaseTrackingRulesEnabled.ruleset", - "rulesets/PortedFromFxCopRulesDefault.ruleset", - "rulesets/PortedFromFxCopRulesEnabled.ruleset", - "tools/install.ps1", - "tools/uninstall.ps1" - ] - }, - "Microsoft.CodeAnalysis.Common/4.13.0": { - "sha512": "T8nRl4mAUY4mhdYM4U2ra2vP2EL+ol8Yqwo0gwC/V55vmlXq9NxdIkZJynTpTL1uX/jHijJ90AeOEx4lf7OwzQ==", - "type": "package", - "path": "microsoft.codeanalysis.common/4.13.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "ThirdPartyNotices.rtf", - "lib/net8.0/Microsoft.CodeAnalysis.dll", - "lib/net8.0/Microsoft.CodeAnalysis.pdb", - "lib/net8.0/Microsoft.CodeAnalysis.xml", - "lib/net8.0/cs/Microsoft.CodeAnalysis.resources.dll", - "lib/net8.0/de/Microsoft.CodeAnalysis.resources.dll", - "lib/net8.0/es/Microsoft.CodeAnalysis.resources.dll", - "lib/net8.0/fr/Microsoft.CodeAnalysis.resources.dll", - "lib/net8.0/it/Microsoft.CodeAnalysis.resources.dll", - "lib/net8.0/ja/Microsoft.CodeAnalysis.resources.dll", - "lib/net8.0/ko/Microsoft.CodeAnalysis.resources.dll", - "lib/net8.0/pl/Microsoft.CodeAnalysis.resources.dll", - "lib/net8.0/pt-BR/Microsoft.CodeAnalysis.resources.dll", - "lib/net8.0/ru/Microsoft.CodeAnalysis.resources.dll", - "lib/net8.0/tr/Microsoft.CodeAnalysis.resources.dll", - "lib/net8.0/zh-Hans/Microsoft.CodeAnalysis.resources.dll", - "lib/net8.0/zh-Hant/Microsoft.CodeAnalysis.resources.dll", - "lib/net9.0/Microsoft.CodeAnalysis.dll", - "lib/net9.0/Microsoft.CodeAnalysis.pdb", - "lib/net9.0/Microsoft.CodeAnalysis.xml", - "lib/net9.0/cs/Microsoft.CodeAnalysis.resources.dll", - "lib/net9.0/de/Microsoft.CodeAnalysis.resources.dll", - "lib/net9.0/es/Microsoft.CodeAnalysis.resources.dll", - "lib/net9.0/fr/Microsoft.CodeAnalysis.resources.dll", - "lib/net9.0/it/Microsoft.CodeAnalysis.resources.dll", - "lib/net9.0/ja/Microsoft.CodeAnalysis.resources.dll", - "lib/net9.0/ko/Microsoft.CodeAnalysis.resources.dll", - "lib/net9.0/pl/Microsoft.CodeAnalysis.resources.dll", - "lib/net9.0/pt-BR/Microsoft.CodeAnalysis.resources.dll", - "lib/net9.0/ru/Microsoft.CodeAnalysis.resources.dll", - "lib/net9.0/tr/Microsoft.CodeAnalysis.resources.dll", - "lib/net9.0/zh-Hans/Microsoft.CodeAnalysis.resources.dll", - "lib/net9.0/zh-Hant/Microsoft.CodeAnalysis.resources.dll", - "lib/netstandard2.0/Microsoft.CodeAnalysis.dll", - "lib/netstandard2.0/Microsoft.CodeAnalysis.pdb", - "lib/netstandard2.0/Microsoft.CodeAnalysis.xml", - "lib/netstandard2.0/cs/Microsoft.CodeAnalysis.resources.dll", - "lib/netstandard2.0/de/Microsoft.CodeAnalysis.resources.dll", - "lib/netstandard2.0/es/Microsoft.CodeAnalysis.resources.dll", - "lib/netstandard2.0/fr/Microsoft.CodeAnalysis.resources.dll", - "lib/netstandard2.0/it/Microsoft.CodeAnalysis.resources.dll", - "lib/netstandard2.0/ja/Microsoft.CodeAnalysis.resources.dll", - "lib/netstandard2.0/ko/Microsoft.CodeAnalysis.resources.dll", - "lib/netstandard2.0/pl/Microsoft.CodeAnalysis.resources.dll", - "lib/netstandard2.0/pt-BR/Microsoft.CodeAnalysis.resources.dll", - "lib/netstandard2.0/ru/Microsoft.CodeAnalysis.resources.dll", - "lib/netstandard2.0/tr/Microsoft.CodeAnalysis.resources.dll", - "lib/netstandard2.0/zh-Hans/Microsoft.CodeAnalysis.resources.dll", - "lib/netstandard2.0/zh-Hant/Microsoft.CodeAnalysis.resources.dll", - "microsoft.codeanalysis.common.4.13.0.nupkg.sha512", - "microsoft.codeanalysis.common.nuspec" - ] - }, - "Microsoft.CodeAnalysis.CSharp/4.13.0": { - "sha512": "BsH7Vijbj9IL7Fj4k/ysZSVyLGFqr75wmdFGwCKWJvSjnA1xwPaQ3hkB2BQdHOt5CpEYA6Q0I6Oo5sDTDHqHsg==", - "type": "package", - "path": "microsoft.codeanalysis.csharp/4.13.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "ThirdPartyNotices.rtf", - "lib/net8.0/Microsoft.CodeAnalysis.CSharp.dll", - "lib/net8.0/Microsoft.CodeAnalysis.CSharp.pdb", - "lib/net8.0/Microsoft.CodeAnalysis.CSharp.xml", - "lib/net8.0/cs/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/net8.0/de/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/net8.0/es/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/net8.0/fr/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/net8.0/it/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/net8.0/ja/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/net8.0/ko/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/net8.0/pl/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/net8.0/pt-BR/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/net8.0/ru/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/net8.0/tr/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/net8.0/zh-Hans/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/net8.0/zh-Hant/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/net9.0/Microsoft.CodeAnalysis.CSharp.dll", - "lib/net9.0/Microsoft.CodeAnalysis.CSharp.pdb", - "lib/net9.0/Microsoft.CodeAnalysis.CSharp.xml", - "lib/net9.0/cs/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/net9.0/de/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/net9.0/es/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/net9.0/fr/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/net9.0/it/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/net9.0/ja/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/net9.0/ko/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/net9.0/pl/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/net9.0/pt-BR/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/net9.0/ru/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/net9.0/tr/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/net9.0/zh-Hans/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/net9.0/zh-Hant/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/netstandard2.0/Microsoft.CodeAnalysis.CSharp.dll", - "lib/netstandard2.0/Microsoft.CodeAnalysis.CSharp.pdb", - "lib/netstandard2.0/Microsoft.CodeAnalysis.CSharp.xml", - "lib/netstandard2.0/cs/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/netstandard2.0/de/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/netstandard2.0/es/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/netstandard2.0/fr/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/netstandard2.0/it/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/netstandard2.0/ja/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/netstandard2.0/ko/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/netstandard2.0/pl/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/netstandard2.0/pt-BR/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/netstandard2.0/ru/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/netstandard2.0/tr/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/netstandard2.0/zh-Hans/Microsoft.CodeAnalysis.CSharp.resources.dll", - "lib/netstandard2.0/zh-Hant/Microsoft.CodeAnalysis.CSharp.resources.dll", - "microsoft.codeanalysis.csharp.4.13.0.nupkg.sha512", - "microsoft.codeanalysis.csharp.nuspec" - ] - }, - "Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing/1.1.2": { - "sha512": "mzi4VHeskAZ7KzORK9xuK/fEAMWS0UfQJ+HbbDVaIiG8khJWIZkMka5a6X5lHW/cOq51sxHv40Ggy95jgEDVgw==", - "type": "package", - "path": "microsoft.codeanalysis.csharp.sourcegenerators.testing/1.1.2", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "lib/net472/Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.dll", - "lib/net472/Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.xml", - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.dll", - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.xml", - "lib/netstandard2.0/Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.dll", - "lib/netstandard2.0/Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.xml", - "microsoft.codeanalysis.csharp.sourcegenerators.testing.1.1.2.nupkg.sha512", - "microsoft.codeanalysis.csharp.sourcegenerators.testing.nuspec" - ] - }, - "Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.MSTest/1.1.2": { - "sha512": "PmvKTrqZ4CNzWsqoUgR1225JO6Z3JIXOuQeYk9OSeCaZgPo04ph4jMnMkXnd9Skrrq+gDMDhEI9lGAgXsFmu2A==", - "type": "package", - "path": "microsoft.codeanalysis.csharp.sourcegenerators.testing.mstest/1.1.2", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "lib/net472/Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.MSTest.dll", - "lib/net472/Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.MSTest.xml", - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.MSTest.dll", - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.MSTest.xml", - "lib/netstandard2.0/Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.MSTest.dll", - "lib/netstandard2.0/Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.MSTest.xml", - "microsoft.codeanalysis.csharp.sourcegenerators.testing.mstest.1.1.2.nupkg.sha512", - "microsoft.codeanalysis.csharp.sourcegenerators.testing.mstest.nuspec" - ] - }, - "Microsoft.CodeAnalysis.CSharp.Workspaces/3.8.0": { - "sha512": "rdEBvPWqe/IIscsnp7OkZ4tQin8khxBcSLyV9tU+sHdw9uW9U0GKL+Dv2rD4voC1bZBaO18Hp+m4Vkyfmaz0OA==", - "type": "package", - "path": "microsoft.codeanalysis.csharp.workspaces/3.8.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "ThirdPartyNotices.rtf", - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.CSharp.Workspaces.dll", - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.CSharp.Workspaces.pdb", - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.CSharp.Workspaces.xml", - "lib/netcoreapp3.1/cs/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", - "lib/netcoreapp3.1/de/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", - "lib/netcoreapp3.1/es/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", - "lib/netcoreapp3.1/fr/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", - "lib/netcoreapp3.1/it/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", - "lib/netcoreapp3.1/ja/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", - "lib/netcoreapp3.1/ko/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", - "lib/netcoreapp3.1/pl/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", - "lib/netcoreapp3.1/pt-BR/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", - "lib/netcoreapp3.1/ru/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", - "lib/netcoreapp3.1/tr/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", - "lib/netcoreapp3.1/zh-Hans/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", - "lib/netcoreapp3.1/zh-Hant/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", - "lib/netstandard2.0/Microsoft.CodeAnalysis.CSharp.Workspaces.dll", - "lib/netstandard2.0/Microsoft.CodeAnalysis.CSharp.Workspaces.pdb", - "lib/netstandard2.0/Microsoft.CodeAnalysis.CSharp.Workspaces.xml", - "lib/netstandard2.0/cs/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", - "lib/netstandard2.0/de/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", - "lib/netstandard2.0/es/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", - "lib/netstandard2.0/fr/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", - "lib/netstandard2.0/it/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", - "lib/netstandard2.0/ja/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", - "lib/netstandard2.0/ko/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", - "lib/netstandard2.0/pl/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", - "lib/netstandard2.0/pt-BR/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", - "lib/netstandard2.0/ru/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", - "lib/netstandard2.0/tr/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", - "lib/netstandard2.0/zh-Hans/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", - "lib/netstandard2.0/zh-Hant/Microsoft.CodeAnalysis.CSharp.Workspaces.resources.dll", - "microsoft.codeanalysis.csharp.workspaces.3.8.0.nupkg.sha512", - "microsoft.codeanalysis.csharp.workspaces.nuspec" - ] - }, - "Microsoft.CodeAnalysis.SourceGenerators.Testing/1.1.2": { - "sha512": "m+E8+ovSIYUVXMijWKdPhvnWpOBB/ms+3hunlPiWY8iJkyrT5GKFtRUPevEUKuL75t5+I3SnEAwvsHL29WJSGQ==", - "type": "package", - "path": "microsoft.codeanalysis.sourcegenerators.testing/1.1.2", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "lib/net472/Microsoft.CodeAnalysis.SourceGenerators.Testing.dll", - "lib/net472/Microsoft.CodeAnalysis.SourceGenerators.Testing.xml", - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.SourceGenerators.Testing.dll", - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.SourceGenerators.Testing.xml", - "lib/netstandard2.0/Microsoft.CodeAnalysis.SourceGenerators.Testing.dll", - "lib/netstandard2.0/Microsoft.CodeAnalysis.SourceGenerators.Testing.xml", - "microsoft.codeanalysis.sourcegenerators.testing.1.1.2.nupkg.sha512", - "microsoft.codeanalysis.sourcegenerators.testing.nuspec" - ] - }, - "Microsoft.CodeAnalysis.Testing.Verifiers.MSTest/1.1.2": { - "sha512": "P+bkTk1+0fLPMRFdQjOxzA7WN77CjFVgMTxYC1S+sLlbm2kr1ShVvTmuFIVCDQLSZLjOiEPcuUcxKSMKufUzqg==", - "type": "package", - "path": "microsoft.codeanalysis.testing.verifiers.mstest/1.1.2", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "lib/net452/Microsoft.CodeAnalysis.Testing.Verifiers.MSTest.dll", - "lib/net452/Microsoft.CodeAnalysis.Testing.Verifiers.MSTest.xml", - "lib/net46/Microsoft.CodeAnalysis.Testing.Verifiers.MSTest.dll", - "lib/net46/Microsoft.CodeAnalysis.Testing.Verifiers.MSTest.xml", - "lib/net472/Microsoft.CodeAnalysis.Testing.Verifiers.MSTest.dll", - "lib/net472/Microsoft.CodeAnalysis.Testing.Verifiers.MSTest.xml", - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.Testing.Verifiers.MSTest.dll", - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.Testing.Verifiers.MSTest.xml", - "lib/netstandard1.6/Microsoft.CodeAnalysis.Testing.Verifiers.MSTest.dll", - "lib/netstandard1.6/Microsoft.CodeAnalysis.Testing.Verifiers.MSTest.xml", - "lib/netstandard2.0/Microsoft.CodeAnalysis.Testing.Verifiers.MSTest.dll", - "lib/netstandard2.0/Microsoft.CodeAnalysis.Testing.Verifiers.MSTest.xml", - "microsoft.codeanalysis.testing.verifiers.mstest.1.1.2.nupkg.sha512", - "microsoft.codeanalysis.testing.verifiers.mstest.nuspec" - ] - }, - "Microsoft.CodeAnalysis.Workspaces.Common/3.8.0": { - "sha512": "GPYVydsmOmScOWDJA1LFky7/MkoXpx1JI3lZJShxC+bvVUvL9zVKE8WDZMLsYJ5MAbry2xkZftdfeMpZ+kvLDQ==", - "type": "package", - "path": "microsoft.codeanalysis.workspaces.common/3.8.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "ThirdPartyNotices.rtf", - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.Workspaces.dll", - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.Workspaces.pdb", - "lib/netcoreapp3.1/Microsoft.CodeAnalysis.Workspaces.xml", - "lib/netcoreapp3.1/cs/Microsoft.CodeAnalysis.Workspaces.resources.dll", - "lib/netcoreapp3.1/de/Microsoft.CodeAnalysis.Workspaces.resources.dll", - "lib/netcoreapp3.1/es/Microsoft.CodeAnalysis.Workspaces.resources.dll", - "lib/netcoreapp3.1/fr/Microsoft.CodeAnalysis.Workspaces.resources.dll", - "lib/netcoreapp3.1/it/Microsoft.CodeAnalysis.Workspaces.resources.dll", - "lib/netcoreapp3.1/ja/Microsoft.CodeAnalysis.Workspaces.resources.dll", - "lib/netcoreapp3.1/ko/Microsoft.CodeAnalysis.Workspaces.resources.dll", - "lib/netcoreapp3.1/pl/Microsoft.CodeAnalysis.Workspaces.resources.dll", - "lib/netcoreapp3.1/pt-BR/Microsoft.CodeAnalysis.Workspaces.resources.dll", - "lib/netcoreapp3.1/ru/Microsoft.CodeAnalysis.Workspaces.resources.dll", - "lib/netcoreapp3.1/tr/Microsoft.CodeAnalysis.Workspaces.resources.dll", - "lib/netcoreapp3.1/zh-Hans/Microsoft.CodeAnalysis.Workspaces.resources.dll", - "lib/netcoreapp3.1/zh-Hant/Microsoft.CodeAnalysis.Workspaces.resources.dll", - "lib/netstandard2.0/Microsoft.CodeAnalysis.Workspaces.dll", - "lib/netstandard2.0/Microsoft.CodeAnalysis.Workspaces.pdb", - "lib/netstandard2.0/Microsoft.CodeAnalysis.Workspaces.xml", - "lib/netstandard2.0/cs/Microsoft.CodeAnalysis.Workspaces.resources.dll", - "lib/netstandard2.0/de/Microsoft.CodeAnalysis.Workspaces.resources.dll", - "lib/netstandard2.0/es/Microsoft.CodeAnalysis.Workspaces.resources.dll", - "lib/netstandard2.0/fr/Microsoft.CodeAnalysis.Workspaces.resources.dll", - "lib/netstandard2.0/it/Microsoft.CodeAnalysis.Workspaces.resources.dll", - "lib/netstandard2.0/ja/Microsoft.CodeAnalysis.Workspaces.resources.dll", - "lib/netstandard2.0/ko/Microsoft.CodeAnalysis.Workspaces.resources.dll", - "lib/netstandard2.0/pl/Microsoft.CodeAnalysis.Workspaces.resources.dll", - "lib/netstandard2.0/pt-BR/Microsoft.CodeAnalysis.Workspaces.resources.dll", - "lib/netstandard2.0/ru/Microsoft.CodeAnalysis.Workspaces.resources.dll", - "lib/netstandard2.0/tr/Microsoft.CodeAnalysis.Workspaces.resources.dll", - "lib/netstandard2.0/zh-Hans/Microsoft.CodeAnalysis.Workspaces.resources.dll", - "lib/netstandard2.0/zh-Hant/Microsoft.CodeAnalysis.Workspaces.resources.dll", - "microsoft.codeanalysis.workspaces.common.3.8.0.nupkg.sha512", - "microsoft.codeanalysis.workspaces.common.nuspec" - ] - }, - "Microsoft.CodeCoverage/17.8.0": { - "sha512": "KC8SXWbGIdoFVdlxKk9WHccm0llm9HypcHMLUUFabRiTS3SO2fQXNZfdiF3qkEdTJhbRrxhdRxjL4jbtwPq4Ew==", - "type": "package", - "path": "microsoft.codecoverage/17.8.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "LICENSE_MIT.txt", - "ThirdPartyNotices.txt", - "build/netstandard2.0/CodeCoverage/CodeCoverage.config", - "build/netstandard2.0/CodeCoverage/CodeCoverage.exe", - "build/netstandard2.0/CodeCoverage/VanguardInstrumentationProfiler_x86.config", - "build/netstandard2.0/CodeCoverage/amd64/CodeCoverage.exe", - "build/netstandard2.0/CodeCoverage/amd64/VanguardInstrumentationProfiler_x64.config", - "build/netstandard2.0/CodeCoverage/amd64/covrun64.dll", - "build/netstandard2.0/CodeCoverage/amd64/msdia140.dll", - "build/netstandard2.0/CodeCoverage/arm64/VanguardInstrumentationProfiler_arm64.config", - "build/netstandard2.0/CodeCoverage/arm64/covrunarm64.dll", - "build/netstandard2.0/CodeCoverage/arm64/msdia140.dll", - "build/netstandard2.0/CodeCoverage/codecoveragemessages.dll", - "build/netstandard2.0/CodeCoverage/coreclr/Microsoft.VisualStudio.CodeCoverage.Shim.dll", - "build/netstandard2.0/CodeCoverage/covrun32.dll", - "build/netstandard2.0/CodeCoverage/msdia140.dll", - "build/netstandard2.0/InstrumentationEngine/alpine/x64/VanguardInstrumentationProfiler_x64.config", - "build/netstandard2.0/InstrumentationEngine/alpine/x64/libCoverageInstrumentationMethod.so", - "build/netstandard2.0/InstrumentationEngine/alpine/x64/libInstrumentationEngine.so", - "build/netstandard2.0/InstrumentationEngine/arm64/MicrosoftInstrumentationEngine_arm64.dll", - "build/netstandard2.0/InstrumentationEngine/macos/x64/VanguardInstrumentationProfiler_x64.config", - "build/netstandard2.0/InstrumentationEngine/macos/x64/libCoverageInstrumentationMethod.dylib", - "build/netstandard2.0/InstrumentationEngine/macos/x64/libInstrumentationEngine.dylib", - "build/netstandard2.0/InstrumentationEngine/ubuntu/x64/VanguardInstrumentationProfiler_x64.config", - "build/netstandard2.0/InstrumentationEngine/ubuntu/x64/libCoverageInstrumentationMethod.so", - "build/netstandard2.0/InstrumentationEngine/ubuntu/x64/libInstrumentationEngine.so", - "build/netstandard2.0/InstrumentationEngine/x64/MicrosoftInstrumentationEngine_x64.dll", - "build/netstandard2.0/InstrumentationEngine/x86/MicrosoftInstrumentationEngine_x86.dll", - "build/netstandard2.0/Microsoft.CodeCoverage.Core.dll", - "build/netstandard2.0/Microsoft.CodeCoverage.Instrumentation.dll", - "build/netstandard2.0/Microsoft.CodeCoverage.Interprocess.dll", - "build/netstandard2.0/Microsoft.CodeCoverage.props", - "build/netstandard2.0/Microsoft.CodeCoverage.targets", - "build/netstandard2.0/Microsoft.DiaSymReader.dll", - "build/netstandard2.0/Microsoft.VisualStudio.TraceDataCollector.dll", - "build/netstandard2.0/Mono.Cecil.Pdb.dll", - "build/netstandard2.0/Mono.Cecil.Rocks.dll", - "build/netstandard2.0/Mono.Cecil.dll", - "build/netstandard2.0/ThirdPartyNotices.txt", - "build/netstandard2.0/cs/Microsoft.VisualStudio.TraceDataCollector.resources.dll", - "build/netstandard2.0/de/Microsoft.VisualStudio.TraceDataCollector.resources.dll", - "build/netstandard2.0/es/Microsoft.VisualStudio.TraceDataCollector.resources.dll", - "build/netstandard2.0/fr/Microsoft.VisualStudio.TraceDataCollector.resources.dll", - "build/netstandard2.0/it/Microsoft.VisualStudio.TraceDataCollector.resources.dll", - "build/netstandard2.0/ja/Microsoft.VisualStudio.TraceDataCollector.resources.dll", - "build/netstandard2.0/ko/Microsoft.VisualStudio.TraceDataCollector.resources.dll", - "build/netstandard2.0/pl/Microsoft.VisualStudio.TraceDataCollector.resources.dll", - "build/netstandard2.0/pt-BR/Microsoft.VisualStudio.TraceDataCollector.resources.dll", - "build/netstandard2.0/ru/Microsoft.VisualStudio.TraceDataCollector.resources.dll", - "build/netstandard2.0/tr/Microsoft.VisualStudio.TraceDataCollector.resources.dll", - "build/netstandard2.0/zh-Hans/Microsoft.VisualStudio.TraceDataCollector.resources.dll", - "build/netstandard2.0/zh-Hant/Microsoft.VisualStudio.TraceDataCollector.resources.dll", - "lib/net462/Microsoft.VisualStudio.CodeCoverage.Shim.dll", - "lib/netcoreapp3.1/Microsoft.VisualStudio.CodeCoverage.Shim.dll", - "microsoft.codecoverage.17.8.0.nupkg.sha512", - "microsoft.codecoverage.nuspec" - ] - }, - "Microsoft.CSharp/4.7.0": { - "sha512": "pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==", - "type": "package", - "path": "microsoft.csharp/4.7.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "LICENSE.TXT", - "THIRD-PARTY-NOTICES.TXT", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/Microsoft.CSharp.dll", - "lib/netcoreapp2.0/_._", - "lib/netstandard1.3/Microsoft.CSharp.dll", - "lib/netstandard2.0/Microsoft.CSharp.dll", - "lib/netstandard2.0/Microsoft.CSharp.xml", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/uap10.0.16299/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "microsoft.csharp.4.7.0.nupkg.sha512", - "microsoft.csharp.nuspec", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/Microsoft.CSharp.dll", - "ref/netcore50/Microsoft.CSharp.xml", - "ref/netcore50/de/Microsoft.CSharp.xml", - "ref/netcore50/es/Microsoft.CSharp.xml", - "ref/netcore50/fr/Microsoft.CSharp.xml", - "ref/netcore50/it/Microsoft.CSharp.xml", - "ref/netcore50/ja/Microsoft.CSharp.xml", - "ref/netcore50/ko/Microsoft.CSharp.xml", - "ref/netcore50/ru/Microsoft.CSharp.xml", - "ref/netcore50/zh-hans/Microsoft.CSharp.xml", - "ref/netcore50/zh-hant/Microsoft.CSharp.xml", - "ref/netcoreapp2.0/_._", - "ref/netstandard1.0/Microsoft.CSharp.dll", - "ref/netstandard1.0/Microsoft.CSharp.xml", - "ref/netstandard1.0/de/Microsoft.CSharp.xml", - "ref/netstandard1.0/es/Microsoft.CSharp.xml", - "ref/netstandard1.0/fr/Microsoft.CSharp.xml", - "ref/netstandard1.0/it/Microsoft.CSharp.xml", - "ref/netstandard1.0/ja/Microsoft.CSharp.xml", - "ref/netstandard1.0/ko/Microsoft.CSharp.xml", - "ref/netstandard1.0/ru/Microsoft.CSharp.xml", - "ref/netstandard1.0/zh-hans/Microsoft.CSharp.xml", - "ref/netstandard1.0/zh-hant/Microsoft.CSharp.xml", - "ref/netstandard2.0/Microsoft.CSharp.dll", - "ref/netstandard2.0/Microsoft.CSharp.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/uap10.0.16299/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "useSharedDesignerContext.txt", - "version.txt" - ] - }, - "Microsoft.NET.Test.Sdk/17.8.0": { - "sha512": "BmTYGbD/YuDHmApIENdoyN1jCk0Rj1fJB0+B/fVekyTdVidr91IlzhqzytiUgaEAzL1ZJcYCme0MeBMYvJVzvw==", - "type": "package", - "path": "microsoft.net.test.sdk/17.8.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "LICENSE_MIT.txt", - "build/net462/Microsoft.NET.Test.Sdk.props", - "build/net462/Microsoft.NET.Test.Sdk.targets", - "build/netcoreapp3.1/Microsoft.NET.Test.Sdk.Program.cs", - "build/netcoreapp3.1/Microsoft.NET.Test.Sdk.Program.fs", - "build/netcoreapp3.1/Microsoft.NET.Test.Sdk.Program.vb", - "build/netcoreapp3.1/Microsoft.NET.Test.Sdk.props", - "build/netcoreapp3.1/Microsoft.NET.Test.Sdk.targets", - "buildMultiTargeting/Microsoft.NET.Test.Sdk.props", - "lib/net462/_._", - "lib/netcoreapp3.1/_._", - "microsoft.net.test.sdk.17.8.0.nupkg.sha512", - "microsoft.net.test.sdk.nuspec" - ] - }, - "Microsoft.NETCore.Platforms/2.0.0": { - "sha512": "VdLJOCXhZaEMY7Hm2GKiULmn7IEPFE4XC5LPSfBVCUIA8YLZVh846gtfBJalsPQF2PlzdD7ecX7DZEulJ402ZQ==", - "type": "package", - "path": "microsoft.netcore.platforms/2.0.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "LICENSE.TXT", - "THIRD-PARTY-NOTICES.TXT", - "lib/netstandard1.0/_._", - "microsoft.netcore.platforms.2.0.0.nupkg.sha512", - "microsoft.netcore.platforms.nuspec", - "runtime.json", - "useSharedDesignerContext.txt", - "version.txt" - ] - }, - "Microsoft.NETCore.Targets/1.1.0": { - "sha512": "aOZA3BWfz9RXjpzt0sRJJMjAscAUm3Hoa4UWAfceV9UTYxgwZ1lZt5nO2myFf+/jetYQo4uTP7zS8sJY67BBxg==", - "type": "package", - "path": "microsoft.netcore.targets/1.1.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "microsoft.netcore.targets.1.1.0.nupkg.sha512", - "microsoft.netcore.targets.nuspec", - "runtime.json" - ] - }, - "Microsoft.TestPlatform.ObjectModel/17.8.0": { - "sha512": "AYy6vlpGMfz5kOFq99L93RGbqftW/8eQTqjT9iGXW6s9MRP3UdtY8idJ8rJcjeSja8A18IhIro5YnH3uv1nz4g==", - "type": "package", - "path": "microsoft.testplatform.objectmodel/17.8.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "LICENSE_MIT.txt", - "lib/net462/Microsoft.TestPlatform.CoreUtilities.dll", - "lib/net462/Microsoft.TestPlatform.PlatformAbstractions.dll", - "lib/net462/Microsoft.VisualStudio.TestPlatform.ObjectModel.dll", - "lib/net462/cs/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/net462/cs/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/net462/de/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/net462/de/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/net462/es/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/net462/es/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/net462/fr/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/net462/fr/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/net462/it/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/net462/it/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/net462/ja/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/net462/ja/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/net462/ko/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/net462/ko/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/net462/pl/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/net462/pl/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/net462/pt-BR/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/net462/pt-BR/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/net462/ru/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/net462/ru/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/net462/tr/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/net462/tr/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/net462/zh-Hans/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/net462/zh-Hans/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/net462/zh-Hant/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/net462/zh-Hant/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/netcoreapp3.1/Microsoft.TestPlatform.CoreUtilities.dll", - "lib/netcoreapp3.1/Microsoft.TestPlatform.PlatformAbstractions.dll", - "lib/netcoreapp3.1/Microsoft.VisualStudio.TestPlatform.ObjectModel.dll", - "lib/netcoreapp3.1/cs/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/netcoreapp3.1/cs/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/netcoreapp3.1/de/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/netcoreapp3.1/de/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/netcoreapp3.1/es/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/netcoreapp3.1/es/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/netcoreapp3.1/fr/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/netcoreapp3.1/fr/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/netcoreapp3.1/it/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/netcoreapp3.1/it/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/netcoreapp3.1/ja/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/netcoreapp3.1/ja/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/netcoreapp3.1/ko/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/netcoreapp3.1/ko/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/netcoreapp3.1/pl/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/netcoreapp3.1/pl/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/netcoreapp3.1/pt-BR/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/netcoreapp3.1/pt-BR/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/netcoreapp3.1/ru/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/netcoreapp3.1/ru/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/netcoreapp3.1/tr/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/netcoreapp3.1/tr/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/netcoreapp3.1/zh-Hans/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/netcoreapp3.1/zh-Hans/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/netcoreapp3.1/zh-Hant/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/netcoreapp3.1/zh-Hant/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/netstandard2.0/Microsoft.TestPlatform.CoreUtilities.dll", - "lib/netstandard2.0/Microsoft.TestPlatform.PlatformAbstractions.dll", - "lib/netstandard2.0/Microsoft.VisualStudio.TestPlatform.ObjectModel.dll", - "lib/netstandard2.0/cs/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/netstandard2.0/cs/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/netstandard2.0/de/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/netstandard2.0/de/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/netstandard2.0/es/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/netstandard2.0/es/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/netstandard2.0/fr/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/netstandard2.0/fr/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/netstandard2.0/it/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/netstandard2.0/it/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/netstandard2.0/ja/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/netstandard2.0/ja/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/netstandard2.0/ko/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/netstandard2.0/ko/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/netstandard2.0/pl/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/netstandard2.0/pl/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/netstandard2.0/pt-BR/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/netstandard2.0/pt-BR/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/netstandard2.0/ru/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/netstandard2.0/ru/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/netstandard2.0/tr/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/netstandard2.0/tr/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/netstandard2.0/zh-Hans/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/netstandard2.0/zh-Hans/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "lib/netstandard2.0/zh-Hant/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "lib/netstandard2.0/zh-Hant/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "microsoft.testplatform.objectmodel.17.8.0.nupkg.sha512", - "microsoft.testplatform.objectmodel.nuspec" - ] - }, - "Microsoft.TestPlatform.TestHost/17.8.0": { - "sha512": "9ivcl/7SGRmOT0YYrHQGohWiT5YCpkmy/UEzldfVisLm6QxbLaK3FAJqZXI34rnRLmqqDCeMQxKINwmKwAPiDw==", - "type": "package", - "path": "microsoft.testplatform.testhost/17.8.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "LICENSE_MIT.txt", - "ThirdPartyNotices.txt", - "build/netcoreapp3.1/Microsoft.TestPlatform.TestHost.props", - "build/netcoreapp3.1/x64/testhost.dll", - "build/netcoreapp3.1/x64/testhost.exe", - "build/netcoreapp3.1/x86/testhost.x86.dll", - "build/netcoreapp3.1/x86/testhost.x86.exe", - "lib/net462/_._", - "lib/netcoreapp3.1/Microsoft.TestPlatform.CommunicationUtilities.dll", - "lib/netcoreapp3.1/Microsoft.TestPlatform.CoreUtilities.dll", - "lib/netcoreapp3.1/Microsoft.TestPlatform.CrossPlatEngine.dll", - "lib/netcoreapp3.1/Microsoft.TestPlatform.PlatformAbstractions.dll", - "lib/netcoreapp3.1/Microsoft.TestPlatform.Utilities.dll", - "lib/netcoreapp3.1/Microsoft.VisualStudio.TestPlatform.Common.dll", - "lib/netcoreapp3.1/Microsoft.VisualStudio.TestPlatform.ObjectModel.dll", - "lib/netcoreapp3.1/cs/Microsoft.TestPlatform.CommunicationUtilities.resources.dll", - "lib/netcoreapp3.1/cs/Microsoft.TestPlatform.CrossPlatEngine.resources.dll", - "lib/netcoreapp3.1/cs/Microsoft.VisualStudio.TestPlatform.Common.resources.dll", - "lib/netcoreapp3.1/de/Microsoft.TestPlatform.CommunicationUtilities.resources.dll", - "lib/netcoreapp3.1/de/Microsoft.TestPlatform.CrossPlatEngine.resources.dll", - "lib/netcoreapp3.1/de/Microsoft.VisualStudio.TestPlatform.Common.resources.dll", - "lib/netcoreapp3.1/es/Microsoft.TestPlatform.CommunicationUtilities.resources.dll", - "lib/netcoreapp3.1/es/Microsoft.TestPlatform.CrossPlatEngine.resources.dll", - "lib/netcoreapp3.1/es/Microsoft.VisualStudio.TestPlatform.Common.resources.dll", - "lib/netcoreapp3.1/fr/Microsoft.TestPlatform.CommunicationUtilities.resources.dll", - "lib/netcoreapp3.1/fr/Microsoft.TestPlatform.CrossPlatEngine.resources.dll", - "lib/netcoreapp3.1/fr/Microsoft.VisualStudio.TestPlatform.Common.resources.dll", - "lib/netcoreapp3.1/it/Microsoft.TestPlatform.CommunicationUtilities.resources.dll", - "lib/netcoreapp3.1/it/Microsoft.TestPlatform.CrossPlatEngine.resources.dll", - "lib/netcoreapp3.1/it/Microsoft.VisualStudio.TestPlatform.Common.resources.dll", - "lib/netcoreapp3.1/ja/Microsoft.TestPlatform.CommunicationUtilities.resources.dll", - "lib/netcoreapp3.1/ja/Microsoft.TestPlatform.CrossPlatEngine.resources.dll", - "lib/netcoreapp3.1/ja/Microsoft.VisualStudio.TestPlatform.Common.resources.dll", - "lib/netcoreapp3.1/ko/Microsoft.TestPlatform.CommunicationUtilities.resources.dll", - "lib/netcoreapp3.1/ko/Microsoft.TestPlatform.CrossPlatEngine.resources.dll", - "lib/netcoreapp3.1/ko/Microsoft.VisualStudio.TestPlatform.Common.resources.dll", - "lib/netcoreapp3.1/pl/Microsoft.TestPlatform.CommunicationUtilities.resources.dll", - "lib/netcoreapp3.1/pl/Microsoft.TestPlatform.CrossPlatEngine.resources.dll", - "lib/netcoreapp3.1/pl/Microsoft.VisualStudio.TestPlatform.Common.resources.dll", - "lib/netcoreapp3.1/pt-BR/Microsoft.TestPlatform.CommunicationUtilities.resources.dll", - "lib/netcoreapp3.1/pt-BR/Microsoft.TestPlatform.CrossPlatEngine.resources.dll", - "lib/netcoreapp3.1/pt-BR/Microsoft.VisualStudio.TestPlatform.Common.resources.dll", - "lib/netcoreapp3.1/ru/Microsoft.TestPlatform.CommunicationUtilities.resources.dll", - "lib/netcoreapp3.1/ru/Microsoft.TestPlatform.CrossPlatEngine.resources.dll", - "lib/netcoreapp3.1/ru/Microsoft.VisualStudio.TestPlatform.Common.resources.dll", - "lib/netcoreapp3.1/testhost.deps.json", - "lib/netcoreapp3.1/testhost.dll", - "lib/netcoreapp3.1/tr/Microsoft.TestPlatform.CommunicationUtilities.resources.dll", - "lib/netcoreapp3.1/tr/Microsoft.TestPlatform.CrossPlatEngine.resources.dll", - "lib/netcoreapp3.1/tr/Microsoft.VisualStudio.TestPlatform.Common.resources.dll", - "lib/netcoreapp3.1/x64/msdia140.dll", - "lib/netcoreapp3.1/x86/msdia140.dll", - "lib/netcoreapp3.1/zh-Hans/Microsoft.TestPlatform.CommunicationUtilities.resources.dll", - "lib/netcoreapp3.1/zh-Hans/Microsoft.TestPlatform.CrossPlatEngine.resources.dll", - "lib/netcoreapp3.1/zh-Hans/Microsoft.VisualStudio.TestPlatform.Common.resources.dll", - "lib/netcoreapp3.1/zh-Hant/Microsoft.TestPlatform.CommunicationUtilities.resources.dll", - "lib/netcoreapp3.1/zh-Hant/Microsoft.TestPlatform.CrossPlatEngine.resources.dll", - "lib/netcoreapp3.1/zh-Hant/Microsoft.VisualStudio.TestPlatform.Common.resources.dll", - "microsoft.testplatform.testhost.17.8.0.nupkg.sha512", - "microsoft.testplatform.testhost.nuspec" - ] - }, - "Microsoft.VisualStudio.Composition/16.1.8": { - "sha512": "N+thv3dcT7kjn0Xz3U0uBm2CH4uoaMvH8wC6Gy2HWx7HLNdEpqGoMraLyoBdizmypD1owLCJQIa2uKmWe4/o8A==", - "type": "package", - "path": "microsoft.visualstudio.composition/16.1.8", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "lib/net45/Microsoft.VisualStudio.Composition.dll", - "lib/net45/Microsoft.VisualStudio.Composition.pdb", - "lib/net45/Microsoft.VisualStudio.Composition.xml", - "lib/net45/cs/Microsoft.VisualStudio.Composition.resources.dll", - "lib/net45/de/Microsoft.VisualStudio.Composition.resources.dll", - "lib/net45/es/Microsoft.VisualStudio.Composition.resources.dll", - "lib/net45/fr/Microsoft.VisualStudio.Composition.resources.dll", - "lib/net45/it/Microsoft.VisualStudio.Composition.resources.dll", - "lib/net45/ja/Microsoft.VisualStudio.Composition.resources.dll", - "lib/net45/ko/Microsoft.VisualStudio.Composition.resources.dll", - "lib/net45/pl/Microsoft.VisualStudio.Composition.resources.dll", - "lib/net45/pt-BR/Microsoft.VisualStudio.Composition.resources.dll", - "lib/net45/ru/Microsoft.VisualStudio.Composition.resources.dll", - "lib/net45/tr/Microsoft.VisualStudio.Composition.resources.dll", - "lib/net45/zh-Hans/Microsoft.VisualStudio.Composition.resources.dll", - "lib/net45/zh-Hant/Microsoft.VisualStudio.Composition.resources.dll", - "lib/net46/Microsoft.VisualStudio.Composition.dll", - "lib/net46/Microsoft.VisualStudio.Composition.pdb", - "lib/net46/Microsoft.VisualStudio.Composition.xml", - "lib/net46/cs/Microsoft.VisualStudio.Composition.resources.dll", - "lib/net46/de/Microsoft.VisualStudio.Composition.resources.dll", - "lib/net46/es/Microsoft.VisualStudio.Composition.resources.dll", - "lib/net46/fr/Microsoft.VisualStudio.Composition.resources.dll", - "lib/net46/it/Microsoft.VisualStudio.Composition.resources.dll", - "lib/net46/ja/Microsoft.VisualStudio.Composition.resources.dll", - "lib/net46/ko/Microsoft.VisualStudio.Composition.resources.dll", - "lib/net46/pl/Microsoft.VisualStudio.Composition.resources.dll", - "lib/net46/pt-BR/Microsoft.VisualStudio.Composition.resources.dll", - "lib/net46/ru/Microsoft.VisualStudio.Composition.resources.dll", - "lib/net46/tr/Microsoft.VisualStudio.Composition.resources.dll", - "lib/net46/zh-Hans/Microsoft.VisualStudio.Composition.resources.dll", - "lib/net46/zh-Hant/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netcoreapp1.0/Microsoft.VisualStudio.Composition.dll", - "lib/netcoreapp1.0/Microsoft.VisualStudio.Composition.pdb", - "lib/netcoreapp1.0/Microsoft.VisualStudio.Composition.xml", - "lib/netcoreapp1.0/cs/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netcoreapp1.0/de/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netcoreapp1.0/es/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netcoreapp1.0/fr/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netcoreapp1.0/it/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netcoreapp1.0/ja/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netcoreapp1.0/ko/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netcoreapp1.0/pl/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netcoreapp1.0/pt-BR/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netcoreapp1.0/ru/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netcoreapp1.0/tr/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netcoreapp1.0/zh-Hans/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netcoreapp1.0/zh-Hant/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netcoreapp2.0/Microsoft.VisualStudio.Composition.dll", - "lib/netcoreapp2.0/Microsoft.VisualStudio.Composition.pdb", - "lib/netcoreapp2.0/Microsoft.VisualStudio.Composition.xml", - "lib/netcoreapp2.0/cs/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netcoreapp2.0/de/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netcoreapp2.0/es/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netcoreapp2.0/fr/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netcoreapp2.0/it/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netcoreapp2.0/ja/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netcoreapp2.0/ko/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netcoreapp2.0/pl/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netcoreapp2.0/pt-BR/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netcoreapp2.0/ru/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netcoreapp2.0/tr/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netcoreapp2.0/zh-Hans/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netcoreapp2.0/zh-Hant/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netstandard1.5/Microsoft.VisualStudio.Composition.dll", - "lib/netstandard1.5/Microsoft.VisualStudio.Composition.pdb", - "lib/netstandard1.5/Microsoft.VisualStudio.Composition.xml", - "lib/netstandard1.5/cs/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netstandard1.5/de/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netstandard1.5/es/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netstandard1.5/fr/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netstandard1.5/it/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netstandard1.5/ja/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netstandard1.5/ko/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netstandard1.5/pl/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netstandard1.5/pt-BR/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netstandard1.5/ru/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netstandard1.5/tr/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netstandard1.5/zh-Hans/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netstandard1.5/zh-Hant/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netstandard2.0/Microsoft.VisualStudio.Composition.dll", - "lib/netstandard2.0/Microsoft.VisualStudio.Composition.pdb", - "lib/netstandard2.0/Microsoft.VisualStudio.Composition.xml", - "lib/netstandard2.0/cs/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netstandard2.0/de/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netstandard2.0/es/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netstandard2.0/fr/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netstandard2.0/it/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netstandard2.0/ja/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netstandard2.0/ko/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netstandard2.0/pl/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netstandard2.0/pt-BR/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netstandard2.0/ru/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netstandard2.0/tr/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netstandard2.0/zh-Hans/Microsoft.VisualStudio.Composition.resources.dll", - "lib/netstandard2.0/zh-Hant/Microsoft.VisualStudio.Composition.resources.dll", - "microsoft.visualstudio.composition.16.1.8.nupkg.sha512", - "microsoft.visualstudio.composition.nuspec" - ] - }, - "Microsoft.VisualStudio.Composition.NetFxAttributes/16.1.8": { - "sha512": "EbwZWTvdzit68qZSuTI8nd1PZ87pYjhpCwtsis8lrUKJ7XLdbE5rxY6YrY7OFze+YUsguzqZlNjX4Yn5nL9qBw==", - "type": "package", - "path": "microsoft.visualstudio.composition.netfxattributes/16.1.8", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "lib/net40/Microsoft.VisualStudio.Composition.NetFxAttributes.dll", - "lib/net40/Microsoft.VisualStudio.Composition.NetFxAttributes.pdb", - "lib/net40/Microsoft.VisualStudio.Composition.NetFxAttributes.xml", - "lib/net45/Microsoft.VisualStudio.Composition.NetFxAttributes.dll", - "lib/net45/Microsoft.VisualStudio.Composition.NetFxAttributes.pdb", - "lib/net45/Microsoft.VisualStudio.Composition.NetFxAttributes.xml", - "lib/netstandard1.0/Microsoft.VisualStudio.Composition.NetFxAttributes.dll", - "lib/netstandard1.0/Microsoft.VisualStudio.Composition.NetFxAttributes.pdb", - "lib/netstandard1.0/Microsoft.VisualStudio.Composition.NetFxAttributes.xml", - "lib/netstandard2.0/Microsoft.VisualStudio.Composition.NetFxAttributes.dll", - "lib/netstandard2.0/Microsoft.VisualStudio.Composition.NetFxAttributes.pdb", - "lib/netstandard2.0/Microsoft.VisualStudio.Composition.NetFxAttributes.xml", - "microsoft.visualstudio.composition.netfxattributes.16.1.8.nupkg.sha512", - "microsoft.visualstudio.composition.netfxattributes.nuspec" - ] - }, - "Microsoft.VisualStudio.Validation/15.0.82": { - "sha512": "XwZyVCsHuEtnd6nYScJnA8XkXPzy4Ok0DV5/hqqAe5ccgOhJ6yap7Qh/sU/i6QxEzuYyECPYDQ7IOyEQ3yRQgQ==", - "type": "package", - "path": "microsoft.visualstudio.validation/15.0.82", - "hasTools": true, - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "README.txt", - "lib/dotnet/Microsoft.VisualStudio.Validation.dll", - "lib/dotnet/Microsoft.VisualStudio.Validation.xml", - "lib/dotnet/cs/Microsoft.VisualStudio.Validation.resources.dll", - "lib/dotnet/de/Microsoft.VisualStudio.Validation.resources.dll", - "lib/dotnet/es/Microsoft.VisualStudio.Validation.resources.dll", - "lib/dotnet/fr/Microsoft.VisualStudio.Validation.resources.dll", - "lib/dotnet/it/Microsoft.VisualStudio.Validation.resources.dll", - "lib/dotnet/ja/Microsoft.VisualStudio.Validation.resources.dll", - "lib/dotnet/ko/Microsoft.VisualStudio.Validation.resources.dll", - "lib/dotnet/pl/Microsoft.VisualStudio.Validation.resources.dll", - "lib/dotnet/pt-BR/Microsoft.VisualStudio.Validation.resources.dll", - "lib/dotnet/ru/Microsoft.VisualStudio.Validation.resources.dll", - "lib/dotnet/tr/Microsoft.VisualStudio.Validation.resources.dll", - "lib/dotnet/zh-Hans/Microsoft.VisualStudio.Validation.resources.dll", - "lib/dotnet/zh-Hant/Microsoft.VisualStudio.Validation.resources.dll", - "lib/net45/Microsoft.VisualStudio.Validation.dll", - "lib/net45/Microsoft.VisualStudio.Validation.xml", - "lib/net45/cs/Microsoft.VisualStudio.Validation.resources.dll", - "lib/net45/de/Microsoft.VisualStudio.Validation.resources.dll", - "lib/net45/es/Microsoft.VisualStudio.Validation.resources.dll", - "lib/net45/fr/Microsoft.VisualStudio.Validation.resources.dll", - "lib/net45/it/Microsoft.VisualStudio.Validation.resources.dll", - "lib/net45/ja/Microsoft.VisualStudio.Validation.resources.dll", - "lib/net45/ko/Microsoft.VisualStudio.Validation.resources.dll", - "lib/net45/pl/Microsoft.VisualStudio.Validation.resources.dll", - "lib/net45/pt-BR/Microsoft.VisualStudio.Validation.resources.dll", - "lib/net45/ru/Microsoft.VisualStudio.Validation.resources.dll", - "lib/net45/tr/Microsoft.VisualStudio.Validation.resources.dll", - "lib/net45/zh-Hans/Microsoft.VisualStudio.Validation.resources.dll", - "lib/net45/zh-Hant/Microsoft.VisualStudio.Validation.resources.dll", - "lib/netstandard1.0/Microsoft.VisualStudio.Validation.dll", - "lib/netstandard1.0/Microsoft.VisualStudio.Validation.xml", - "lib/netstandard1.0/cs/Microsoft.VisualStudio.Validation.resources.dll", - "lib/netstandard1.0/de/Microsoft.VisualStudio.Validation.resources.dll", - "lib/netstandard1.0/es/Microsoft.VisualStudio.Validation.resources.dll", - "lib/netstandard1.0/fr/Microsoft.VisualStudio.Validation.resources.dll", - "lib/netstandard1.0/it/Microsoft.VisualStudio.Validation.resources.dll", - "lib/netstandard1.0/ja/Microsoft.VisualStudio.Validation.resources.dll", - "lib/netstandard1.0/ko/Microsoft.VisualStudio.Validation.resources.dll", - "lib/netstandard1.0/pl/Microsoft.VisualStudio.Validation.resources.dll", - "lib/netstandard1.0/pt-BR/Microsoft.VisualStudio.Validation.resources.dll", - "lib/netstandard1.0/ru/Microsoft.VisualStudio.Validation.resources.dll", - "lib/netstandard1.0/tr/Microsoft.VisualStudio.Validation.resources.dll", - "lib/netstandard1.0/zh-Hans/Microsoft.VisualStudio.Validation.resources.dll", - "lib/netstandard1.0/zh-Hant/Microsoft.VisualStudio.Validation.resources.dll", - "lib/portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10/Microsoft.VisualStudio.Validation.dll", - "lib/portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10/Microsoft.VisualStudio.Validation.xml", - "lib/portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10/cs/Microsoft.VisualStudio.Validation.resources.dll", - "lib/portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10/de/Microsoft.VisualStudio.Validation.resources.dll", - "lib/portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10/es/Microsoft.VisualStudio.Validation.resources.dll", - "lib/portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10/fr/Microsoft.VisualStudio.Validation.resources.dll", - "lib/portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10/it/Microsoft.VisualStudio.Validation.resources.dll", - "lib/portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10/ja/Microsoft.VisualStudio.Validation.resources.dll", - "lib/portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10/ko/Microsoft.VisualStudio.Validation.resources.dll", - "lib/portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10/pl/Microsoft.VisualStudio.Validation.resources.dll", - "lib/portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10/pt-BR/Microsoft.VisualStudio.Validation.resources.dll", - "lib/portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10/ru/Microsoft.VisualStudio.Validation.resources.dll", - "lib/portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10/tr/Microsoft.VisualStudio.Validation.resources.dll", - "lib/portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10/zh-Hans/Microsoft.VisualStudio.Validation.resources.dll", - "lib/portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10/zh-Hant/Microsoft.VisualStudio.Validation.resources.dll", - "microsoft.visualstudio.validation.15.0.82.nupkg.sha512", - "microsoft.visualstudio.validation.nuspec", - "tools/2013/RequiresNotNull.snippet", - "tools/2013/RequiresNotNullOrEmpty.snippet", - "tools/2015/RequiresNotNull.snippet", - "tools/2015/RequiresNotNullOrEmpty.snippet", - "tools/install-snippets.cmd", - "tools/uninstall-snippets.cmd" - ] - }, - "Microsoft.Win32.Primitives/4.3.0": { - "sha512": "9ZQKCWxH7Ijp9BfahvL2Zyf1cJIk8XYLF6Yjzr2yi0b2cOut/HQ31qf1ThHAgCc3WiZMdnWcfJCgN82/0UunxA==", - "type": "package", - "path": "microsoft.win32.primitives/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/Microsoft.Win32.Primitives.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "microsoft.win32.primitives.4.3.0.nupkg.sha512", - "microsoft.win32.primitives.nuspec", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/Microsoft.Win32.Primitives.dll", - "ref/netstandard1.3/Microsoft.Win32.Primitives.dll", - "ref/netstandard1.3/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/de/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/es/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/fr/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/it/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/ja/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/ko/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/ru/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/zh-hans/Microsoft.Win32.Primitives.xml", - "ref/netstandard1.3/zh-hant/Microsoft.Win32.Primitives.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._" - ] - }, - "MSTest.TestAdapter/3.1.1": { - "sha512": "kMvdO5dhrUR3o1qk0fzS0St0prlKyMQAfz1ChVAUdGGobTU5ehR60szOFto0+Q7rFG5iXMvTlVIthXM9EcNYnw==", - "type": "package", - "path": "mstest.testadapter/3.1.1", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "build/_localization/cs/Microsoft.TestPlatform.AdapterUtilities.resources.dll", - "build/_localization/cs/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "build/_localization/cs/Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll", - "build/_localization/cs/Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll", - "build/_localization/cs/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "build/_localization/cs/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "build/_localization/de/Microsoft.TestPlatform.AdapterUtilities.resources.dll", - "build/_localization/de/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "build/_localization/de/Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll", - "build/_localization/de/Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll", - "build/_localization/de/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "build/_localization/de/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "build/_localization/es/Microsoft.TestPlatform.AdapterUtilities.resources.dll", - "build/_localization/es/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "build/_localization/es/Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll", - "build/_localization/es/Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll", - "build/_localization/es/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "build/_localization/es/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "build/_localization/fr/Microsoft.TestPlatform.AdapterUtilities.resources.dll", - "build/_localization/fr/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "build/_localization/fr/Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll", - "build/_localization/fr/Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll", - "build/_localization/fr/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "build/_localization/fr/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "build/_localization/it/Microsoft.TestPlatform.AdapterUtilities.resources.dll", - "build/_localization/it/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "build/_localization/it/Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll", - "build/_localization/it/Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll", - "build/_localization/it/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "build/_localization/it/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "build/_localization/ja/Microsoft.TestPlatform.AdapterUtilities.resources.dll", - "build/_localization/ja/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "build/_localization/ja/Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll", - "build/_localization/ja/Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll", - "build/_localization/ja/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "build/_localization/ja/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "build/_localization/ko/Microsoft.TestPlatform.AdapterUtilities.resources.dll", - "build/_localization/ko/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "build/_localization/ko/Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll", - "build/_localization/ko/Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll", - "build/_localization/ko/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "build/_localization/ko/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "build/_localization/pl/Microsoft.TestPlatform.AdapterUtilities.resources.dll", - "build/_localization/pl/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "build/_localization/pl/Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll", - "build/_localization/pl/Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll", - "build/_localization/pl/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "build/_localization/pl/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "build/_localization/pt-BR/Microsoft.TestPlatform.AdapterUtilities.resources.dll", - "build/_localization/pt-BR/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "build/_localization/pt-BR/Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll", - "build/_localization/pt-BR/Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll", - "build/_localization/pt-BR/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "build/_localization/pt-BR/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "build/_localization/ru/Microsoft.TestPlatform.AdapterUtilities.resources.dll", - "build/_localization/ru/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "build/_localization/ru/Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll", - "build/_localization/ru/Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll", - "build/_localization/ru/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "build/_localization/ru/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "build/_localization/tr/Microsoft.TestPlatform.AdapterUtilities.resources.dll", - "build/_localization/tr/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "build/_localization/tr/Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll", - "build/_localization/tr/Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll", - "build/_localization/tr/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "build/_localization/tr/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "build/_localization/zh-Hans/Microsoft.TestPlatform.AdapterUtilities.resources.dll", - "build/_localization/zh-Hans/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "build/_localization/zh-Hans/Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll", - "build/_localization/zh-Hans/Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll", - "build/_localization/zh-Hans/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "build/_localization/zh-Hans/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "build/_localization/zh-Hant/Microsoft.TestPlatform.AdapterUtilities.resources.dll", - "build/_localization/zh-Hant/Microsoft.TestPlatform.CoreUtilities.resources.dll", - "build/_localization/zh-Hant/Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.resources.dll", - "build/_localization/zh-Hant/Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.resources.dll", - "build/_localization/zh-Hant/Microsoft.VisualStudio.TestPlatform.ObjectModel.resources.dll", - "build/_localization/zh-Hant/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "build/net462/MSTest.TestAdapter.props", - "build/net462/MSTest.TestAdapter.targets", - "build/net462/Microsoft.TestPlatform.AdapterUtilities.dll", - "build/net462/Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll", - "build/net462/Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll", - "build/net462/Microsoft.VisualStudio.TestPlatform.TestFramework.dll", - "build/net6.0/MSTest.TestAdapter.props", - "build/net6.0/MSTest.TestAdapter.targets", - "build/net6.0/Microsoft.TestPlatform.AdapterUtilities.dll", - "build/net6.0/Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll", - "build/net6.0/Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll", - "build/net6.0/Microsoft.VisualStudio.TestPlatform.TestFramework.dll", - "build/net6.0/winui/Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll", - "build/netcoreapp3.1/MSTest.TestAdapter.props", - "build/netcoreapp3.1/Microsoft.TestPlatform.AdapterUtilities.dll", - "build/netcoreapp3.1/Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll", - "build/netcoreapp3.1/Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll", - "build/netcoreapp3.1/Microsoft.VisualStudio.TestPlatform.TestFramework.dll", - "build/netstandard2.0/MSTest.TestAdapter.props", - "build/netstandard2.0/Microsoft.TestPlatform.AdapterUtilities.dll", - "build/netstandard2.0/Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll", - "build/netstandard2.0/Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll", - "build/netstandard2.0/Microsoft.VisualStudio.TestPlatform.TestFramework.dll", - "build/uap10.0/MSTest.TestAdapter.props", - "build/uap10.0/MSTest.TestAdapter.targets", - "build/uap10.0/Microsoft.TestPlatform.AdapterUtilities.dll", - "build/uap10.0/Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll", - "build/uap10.0/Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices.dll", - "build/uap10.0/Microsoft.VisualStudio.TestPlatform.TestFramework.dll", - "mstest.testadapter.3.1.1.nupkg.sha512", - "mstest.testadapter.nuspec" - ] - }, - "MSTest.TestFramework/3.1.1": { - "sha512": "3rjkGxciNHHmPW8cl1/QVIYjOpfptjmAH5JrLBw+dnMTYDoweg3I579N7OIbar3Zd3q9dfWFrCy2LEV/AmPn3A==", - "type": "package", - "path": "mstest.testframework/3.1.1", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "build/net6.0/MSTest.TestFramework.targets", - "build/net6.0/Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll", - "build/net6.0/Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.xml", - "build/net6.0/winui/Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll", - "build/net6.0/winui/Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.xml", - "lib/net462/Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll", - "lib/net462/Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.xml", - "lib/net462/Microsoft.VisualStudio.TestPlatform.TestFramework.dll", - "lib/net462/Microsoft.VisualStudio.TestPlatform.TestFramework.xml", - "lib/net462/cs/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/net462/de/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/net462/es/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/net462/fr/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/net462/it/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/net462/ja/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/net462/ko/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/net462/pl/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/net462/pt-BR/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/net462/ru/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/net462/tr/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/net462/zh-Hans/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/net462/zh-Hant/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/net6.0/Microsoft.VisualStudio.TestPlatform.TestFramework.dll", - "lib/net6.0/Microsoft.VisualStudio.TestPlatform.TestFramework.xml", - "lib/net6.0/cs/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/net6.0/de/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/net6.0/es/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/net6.0/fr/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/net6.0/it/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/net6.0/ja/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/net6.0/ko/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/net6.0/pl/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/net6.0/pt-BR/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/net6.0/ru/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/net6.0/tr/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/net6.0/zh-Hans/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/net6.0/zh-Hant/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/netcoreapp3.1/Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll", - "lib/netcoreapp3.1/Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.xml", - "lib/netcoreapp3.1/Microsoft.VisualStudio.TestPlatform.TestFramework.dll", - "lib/netcoreapp3.1/Microsoft.VisualStudio.TestPlatform.TestFramework.xml", - "lib/netcoreapp3.1/cs/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/netcoreapp3.1/de/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/netcoreapp3.1/es/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/netcoreapp3.1/fr/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/netcoreapp3.1/it/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/netcoreapp3.1/ja/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/netcoreapp3.1/ko/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/netcoreapp3.1/pl/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/netcoreapp3.1/pt-BR/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/netcoreapp3.1/ru/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/netcoreapp3.1/tr/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/netcoreapp3.1/zh-Hans/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/netcoreapp3.1/zh-Hant/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/netstandard2.0/Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll", - "lib/netstandard2.0/Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.xml", - "lib/netstandard2.0/Microsoft.VisualStudio.TestPlatform.TestFramework.dll", - "lib/netstandard2.0/Microsoft.VisualStudio.TestPlatform.TestFramework.xml", - "lib/netstandard2.0/cs/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/netstandard2.0/de/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/netstandard2.0/es/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/netstandard2.0/fr/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/netstandard2.0/it/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/netstandard2.0/ja/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/netstandard2.0/ko/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/netstandard2.0/pl/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/netstandard2.0/pt-BR/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/netstandard2.0/ru/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/netstandard2.0/tr/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/netstandard2.0/zh-Hans/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/netstandard2.0/zh-Hant/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/uap10.0/Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll", - "lib/uap10.0/Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.xml", - "lib/uap10.0/Microsoft.VisualStudio.TestPlatform.TestFramework.dll", - "lib/uap10.0/Microsoft.VisualStudio.TestPlatform.TestFramework.xml", - "lib/uap10.0/cs/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/uap10.0/de/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/uap10.0/es/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/uap10.0/fr/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/uap10.0/it/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/uap10.0/ja/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/uap10.0/ko/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/uap10.0/pl/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/uap10.0/pt-BR/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/uap10.0/ru/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/uap10.0/tr/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/uap10.0/zh-Hans/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "lib/uap10.0/zh-Hant/Microsoft.VisualStudio.TestPlatform.TestFramework.resources.dll", - "mstest.testframework.3.1.1.nupkg.sha512", - "mstest.testframework.nuspec" - ] - }, - "NETStandard.Library/1.6.1": { - "sha512": "WcSp3+vP+yHNgS8EV5J7pZ9IRpeDuARBPN28by8zqff1wJQXm26PVU8L3/fYLBJVU7BtDyqNVWq2KlCVvSSR4A==", - "type": "package", - "path": "netstandard.library/1.6.1", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "netstandard.library.1.6.1.nupkg.sha512", - "netstandard.library.nuspec" - ] - }, - "Newtonsoft.Json/13.0.1": { - "sha512": "ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==", - "type": "package", - "path": "newtonsoft.json/13.0.1", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "LICENSE.md", - "lib/net20/Newtonsoft.Json.dll", - "lib/net20/Newtonsoft.Json.xml", - "lib/net35/Newtonsoft.Json.dll", - "lib/net35/Newtonsoft.Json.xml", - "lib/net40/Newtonsoft.Json.dll", - "lib/net40/Newtonsoft.Json.xml", - "lib/net45/Newtonsoft.Json.dll", - "lib/net45/Newtonsoft.Json.xml", - "lib/netstandard1.0/Newtonsoft.Json.dll", - "lib/netstandard1.0/Newtonsoft.Json.xml", - "lib/netstandard1.3/Newtonsoft.Json.dll", - "lib/netstandard1.3/Newtonsoft.Json.xml", - "lib/netstandard2.0/Newtonsoft.Json.dll", - "lib/netstandard2.0/Newtonsoft.Json.xml", - "newtonsoft.json.13.0.1.nupkg.sha512", - "newtonsoft.json.nuspec", - "packageIcon.png" - ] - }, - "NuGet.Common/6.3.4": { - "sha512": "wKuTiB3RBjbvzB/BhW8+Cu+TTPsABJr91I2Guu/FuM0SXtYRIM26v1NJdwm5rLw59CqB7bamqpWpJKU8bLAdwQ==", - "type": "package", - "path": "nuget.common/6.3.4", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "README.md", - "icon.png", - "lib/net472/NuGet.Common.dll", - "lib/net472/NuGet.Common.xml", - "lib/netstandard2.0/NuGet.Common.dll", - "lib/netstandard2.0/NuGet.Common.xml", - "nuget.common.6.3.4.nupkg.sha512", - "nuget.common.nuspec" - ] - }, - "NuGet.Configuration/6.3.4": { - "sha512": "b+/g6sdnR2128KLn+6qO1MrB8j0goO4kYCFly2RDi/BsLilK+MzKJRHWGYqfMn/YnLmMrgNNJ2sSr4GX7rMEQw==", - "type": "package", - "path": "nuget.configuration/6.3.4", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "README.md", - "icon.png", - "lib/net472/NuGet.Configuration.dll", - "lib/net472/NuGet.Configuration.xml", - "lib/netstandard2.0/NuGet.Configuration.dll", - "lib/netstandard2.0/NuGet.Configuration.xml", - "nuget.configuration.6.3.4.nupkg.sha512", - "nuget.configuration.nuspec" - ] - }, - "NuGet.Frameworks/6.5.0": { - "sha512": "QWINE2x3MbTODsWT1Gh71GaGb5icBz4chS8VYvTgsBnsi8esgN6wtHhydd7fvToWECYGq7T4cgBBDiKD/363fg==", - "type": "package", - "path": "nuget.frameworks/6.5.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "README.md", - "icon.png", - "lib/net472/NuGet.Frameworks.dll", - "lib/netstandard2.0/NuGet.Frameworks.dll", - "nuget.frameworks.6.5.0.nupkg.sha512", - "nuget.frameworks.nuspec" - ] - }, - "NuGet.Packaging/6.3.4": { - "sha512": "0HtJXNCes0443jKeFErjhYxJ08BjyoDrIvw/uWyonoTBQ3B//+H2nztviSUyv0+ydfgKyhwshAjsr0efUT8PRA==", - "type": "package", - "path": "nuget.packaging/6.3.4", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "README.md", - "icon.png", - "lib/net472/NuGet.Packaging.dll", - "lib/net472/NuGet.Packaging.xml", - "lib/net5.0/NuGet.Packaging.dll", - "lib/net5.0/NuGet.Packaging.xml", - "lib/netstandard2.0/NuGet.Packaging.dll", - "lib/netstandard2.0/NuGet.Packaging.xml", - "nuget.packaging.6.3.4.nupkg.sha512", - "nuget.packaging.nuspec" - ] - }, - "NuGet.Protocol/6.3.4": { - "sha512": "Gmvnz7RoN6UG3POw0F4t9mWM4sIdmHiuutvR9c2pLCJCUiYBN8QvbO/ZvkOuQNNM/aGdYExx/Tm84Zx9iVjOSA==", - "type": "package", - "path": "nuget.protocol/6.3.4", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "README.md", - "icon.png", - "lib/net472/NuGet.Protocol.dll", - "lib/net472/NuGet.Protocol.xml", - "lib/net5.0/NuGet.Protocol.dll", - "lib/net5.0/NuGet.Protocol.xml", - "lib/netstandard2.0/NuGet.Protocol.dll", - "lib/netstandard2.0/NuGet.Protocol.xml", - "nuget.protocol.6.3.4.nupkg.sha512", - "nuget.protocol.nuspec" - ] - }, - "NuGet.Resolver/6.3.4": { - "sha512": "cO/QqtGqCIUf/e6EncIQ/ORJDco9UOtxooDL0IZhf18x1l0xFJ/nrcLCyAjZeznE9RAIqaNv1+YFobht4u0Lsw==", - "type": "package", - "path": "nuget.resolver/6.3.4", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "README.md", - "icon.png", - "lib/net472/NuGet.Resolver.dll", - "lib/net472/NuGet.Resolver.xml", - "lib/net5.0/NuGet.Resolver.dll", - "lib/net5.0/NuGet.Resolver.xml", - "lib/netstandard2.0/NuGet.Resolver.dll", - "lib/netstandard2.0/NuGet.Resolver.xml", - "nuget.resolver.6.3.4.nupkg.sha512", - "nuget.resolver.nuspec" - ] - }, - "NuGet.Versioning/6.3.4": { - "sha512": "mQW9bwsWJq30lacl33MMVLBlrit5ClNEpGzKryIuLfP1UTL6feQK1yzA/5IQXdtjXvUEoI5bo1Axjen5lOm7Bg==", - "type": "package", - "path": "nuget.versioning/6.3.4", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "README.md", - "icon.png", - "lib/net472/NuGet.Versioning.dll", - "lib/net472/NuGet.Versioning.xml", - "lib/netstandard2.0/NuGet.Versioning.dll", - "lib/netstandard2.0/NuGet.Versioning.xml", - "nuget.versioning.6.3.4.nupkg.sha512", - "nuget.versioning.nuspec" - ] - }, - "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "HdSSp5MnJSsg08KMfZThpuLPJpPwE5hBXvHwoKWosyHHfe8Mh5WKT0ylEOf6yNzX6Ngjxe4Whkafh5q7Ymac4Q==", - "type": "package", - "path": "runtime.debian.8-x64.runtime.native.system.security.cryptography.openssl/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.debian.8-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "runtime.debian.8-x64.runtime.native.system.security.cryptography.openssl.nuspec", - "runtimes/debian.8-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "+yH1a49wJMy8Zt4yx5RhJrxO/DBDByAiCzNwiETI+1S4mPdCu0OY4djdciC7Vssk0l22wQaDLrXxXkp+3+7bVA==", - "type": "package", - "path": "runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl.nuspec", - "runtimes/fedora.23-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "c3YNH1GQJbfIPJeCnr4avseugSqPrxwIqzthYyZDN6EuOyNOzq+y2KSUfRcXauya1sF4foESTgwM5e1A8arAKw==", - "type": "package", - "path": "runtime.fedora.24-x64.runtime.native.system.security.cryptography.openssl/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.fedora.24-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "runtime.fedora.24-x64.runtime.native.system.security.cryptography.openssl.nuspec", - "runtimes/fedora.24-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.native.System/4.3.0": { - "sha512": "c/qWt2LieNZIj1jGnVNsE2Kl23Ya2aSTBuXMD6V7k9KWr6l16Tqdwq+hJScEpWER9753NWC8h96PaVNY5Ld7Jw==", - "type": "package", - "path": "runtime.native.system/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.system.4.3.0.nupkg.sha512", - "runtime.native.system.nuspec" - ] - }, - "runtime.native.System.IO.Compression/4.3.0": { - "sha512": "INBPonS5QPEgn7naufQFXJEp3zX6L4bwHgJ/ZH78aBTpeNfQMtf7C6VrAFhlq2xxWBveIOWyFzQjJ8XzHMhdOQ==", - "type": "package", - "path": "runtime.native.system.io.compression/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.system.io.compression.4.3.0.nupkg.sha512", - "runtime.native.system.io.compression.nuspec" - ] - }, - "runtime.native.System.Net.Http/4.3.0": { - "sha512": "ZVuZJqnnegJhd2k/PtAbbIcZ3aZeITq3sj06oKfMBSfphW3HDmk/t4ObvbOk/JA/swGR0LNqMksAh/f7gpTROg==", - "type": "package", - "path": "runtime.native.system.net.http/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.system.net.http.4.3.0.nupkg.sha512", - "runtime.native.system.net.http.nuspec" - ] - }, - "runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "sha512": "DloMk88juo0OuOWr56QG7MNchmafTLYWvABy36izkrLI5VledI0rq28KGs1i9wbpeT9NPQrx/wTf8U2vazqQ3Q==", - "type": "package", - "path": "runtime.native.system.security.cryptography.apple/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.system.security.cryptography.apple.4.3.0.nupkg.sha512", - "runtime.native.system.security.cryptography.apple.nuspec" - ] - }, - "runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "NS1U+700m4KFRHR5o4vo9DSlTmlCKu/u7dtE5sUHVIPB+xpXxYQvgBgA6wEIeCz6Yfn0Z52/72WYsToCEPJnrw==", - "type": "package", - "path": "runtime.native.system.security.cryptography.openssl/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/_._", - "runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "runtime.native.system.security.cryptography.openssl.nuspec" - ] - }, - "runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "b3pthNgxxFcD+Pc0WSEoC0+md3MyhRS6aCEeenvNE3Fdw1HyJ18ZhRFVJJzIeR/O/jpxPboB805Ho0T3Ul7w8A==", - "type": "package", - "path": "runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl.nuspec", - "runtimes/opensuse.13.2-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "KeLz4HClKf+nFS7p/6Fi/CqyLXh81FpiGzcmuS8DGi9lUqSnZ6Es23/gv2O+1XVGfrbNmviF7CckBpavkBoIFQ==", - "type": "package", - "path": "runtime.opensuse.42.1-x64.runtime.native.system.security.cryptography.openssl/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.opensuse.42.1-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "runtime.opensuse.42.1-x64.runtime.native.system.security.cryptography.openssl.nuspec", - "runtimes/opensuse.42.1-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple/4.3.0": { - "sha512": "kVXCuMTrTlxq4XOOMAysuNwsXWpYeboGddNGpIgNSZmv1b6r/s/DPk0fYMB7Q5Qo4bY68o48jt4T4y5BVecbCQ==", - "type": "package", - "path": "runtime.osx.10.10-x64.runtime.native.system.security.cryptography.apple/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.osx.10.10-x64.runtime.native.system.security.cryptography.apple.4.3.0.nupkg.sha512", - "runtime.osx.10.10-x64.runtime.native.system.security.cryptography.apple.nuspec", - "runtimes/osx.10.10-x64/native/System.Security.Cryptography.Native.Apple.dylib" - ] - }, - "runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "X7IdhILzr4ROXd8mI1BUCQMSHSQwelUlBjF1JyTKCjXaOGn2fB4EKBxQbCK2VjO3WaWIdlXZL3W6TiIVnrhX4g==", - "type": "package", - "path": "runtime.osx.10.10-x64.runtime.native.system.security.cryptography.openssl/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.osx.10.10-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "runtime.osx.10.10-x64.runtime.native.system.security.cryptography.openssl.nuspec", - "runtimes/osx.10.10-x64/native/System.Security.Cryptography.Native.OpenSsl.dylib" - ] - }, - "runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "nyFNiCk/r+VOiIqreLix8yN+q3Wga9+SE8BCgkf+2BwEKiNx6DyvFjCgkfV743/grxv8jHJ8gUK4XEQw7yzRYg==", - "type": "package", - "path": "runtime.rhel.7-x64.runtime.native.system.security.cryptography.openssl/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.rhel.7-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "runtime.rhel.7-x64.runtime.native.system.security.cryptography.openssl.nuspec", - "runtimes/rhel.7-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "ytoewC6wGorL7KoCAvRfsgoJPJbNq+64k2SqW6JcOAebWsFUvCCYgfzQMrnpvPiEl4OrblUlhF2ji+Q1+SVLrQ==", - "type": "package", - "path": "runtime.ubuntu.14.04-x64.runtime.native.system.security.cryptography.openssl/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.ubuntu.14.04-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "runtime.ubuntu.14.04-x64.runtime.native.system.security.cryptography.openssl.nuspec", - "runtimes/ubuntu.14.04-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "I8bKw2I8k58Wx7fMKQJn2R8lamboCAiHfHeV/pS65ScKWMMI0+wJkLYlEKvgW1D/XvSl/221clBoR2q9QNNM7A==", - "type": "package", - "path": "runtime.ubuntu.16.04-x64.runtime.native.system.security.cryptography.openssl/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.ubuntu.16.04-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "runtime.ubuntu.16.04-x64.runtime.native.system.security.cryptography.openssl.nuspec", - "runtimes/ubuntu.16.04-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "VB5cn/7OzUfzdnC8tqAIMQciVLiq2epm2NrAm1E9OjNRyG4lVhfR61SMcLizejzQP8R8Uf/0l5qOIbUEi+RdEg==", - "type": "package", - "path": "runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl.nuspec", - "runtimes/ubuntu.16.10-x64/native/System.Security.Cryptography.Native.OpenSsl.so" - ] - }, - "System.AppContext/4.3.0": { - "sha512": "fKC+rmaLfeIzUhagxY17Q9siv/sPrjjKcfNg1Ic8IlQkZLipo8ljcaZQu4VtI4Jqbzjc2VTjzGLF6WmsRXAEgA==", - "type": "package", - "path": "system.appcontext/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.AppContext.dll", - "lib/net463/System.AppContext.dll", - "lib/netcore50/System.AppContext.dll", - "lib/netstandard1.6/System.AppContext.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.AppContext.dll", - "ref/net463/System.AppContext.dll", - "ref/netstandard/_._", - "ref/netstandard1.3/System.AppContext.dll", - "ref/netstandard1.3/System.AppContext.xml", - "ref/netstandard1.3/de/System.AppContext.xml", - "ref/netstandard1.3/es/System.AppContext.xml", - "ref/netstandard1.3/fr/System.AppContext.xml", - "ref/netstandard1.3/it/System.AppContext.xml", - "ref/netstandard1.3/ja/System.AppContext.xml", - "ref/netstandard1.3/ko/System.AppContext.xml", - "ref/netstandard1.3/ru/System.AppContext.xml", - "ref/netstandard1.3/zh-hans/System.AppContext.xml", - "ref/netstandard1.3/zh-hant/System.AppContext.xml", - "ref/netstandard1.6/System.AppContext.dll", - "ref/netstandard1.6/System.AppContext.xml", - "ref/netstandard1.6/de/System.AppContext.xml", - "ref/netstandard1.6/es/System.AppContext.xml", - "ref/netstandard1.6/fr/System.AppContext.xml", - "ref/netstandard1.6/it/System.AppContext.xml", - "ref/netstandard1.6/ja/System.AppContext.xml", - "ref/netstandard1.6/ko/System.AppContext.xml", - "ref/netstandard1.6/ru/System.AppContext.xml", - "ref/netstandard1.6/zh-hans/System.AppContext.xml", - "ref/netstandard1.6/zh-hant/System.AppContext.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.AppContext.dll", - "system.appcontext.4.3.0.nupkg.sha512", - "system.appcontext.nuspec" - ] - }, - "System.Buffers/4.3.0": { - "sha512": "ratu44uTIHgeBeI0dE8DWvmXVBSo4u7ozRZZHOMmK/JPpYyo0dAfgSiHlpiObMQ5lEtEyIXA40sKRYg5J6A8uQ==", - "type": "package", - "path": "system.buffers/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.1/.xml", - "lib/netstandard1.1/System.Buffers.dll", - "system.buffers.4.3.0.nupkg.sha512", - "system.buffers.nuspec" - ] - }, - "System.Collections/4.3.0": { - "sha512": "3Dcj85/TBdVpL5Zr+gEEBUuFe2icOnLalmEh9hfck1PTYbbyWuZgh4fmm2ysCLTrqLQw6t3TgTyJ+VLp+Qb+Lw==", - "type": "package", - "path": "system.collections/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Collections.dll", - "ref/netcore50/System.Collections.xml", - "ref/netcore50/de/System.Collections.xml", - "ref/netcore50/es/System.Collections.xml", - "ref/netcore50/fr/System.Collections.xml", - "ref/netcore50/it/System.Collections.xml", - "ref/netcore50/ja/System.Collections.xml", - "ref/netcore50/ko/System.Collections.xml", - "ref/netcore50/ru/System.Collections.xml", - "ref/netcore50/zh-hans/System.Collections.xml", - "ref/netcore50/zh-hant/System.Collections.xml", - "ref/netstandard1.0/System.Collections.dll", - "ref/netstandard1.0/System.Collections.xml", - "ref/netstandard1.0/de/System.Collections.xml", - "ref/netstandard1.0/es/System.Collections.xml", - "ref/netstandard1.0/fr/System.Collections.xml", - "ref/netstandard1.0/it/System.Collections.xml", - "ref/netstandard1.0/ja/System.Collections.xml", - "ref/netstandard1.0/ko/System.Collections.xml", - "ref/netstandard1.0/ru/System.Collections.xml", - "ref/netstandard1.0/zh-hans/System.Collections.xml", - "ref/netstandard1.0/zh-hant/System.Collections.xml", - "ref/netstandard1.3/System.Collections.dll", - "ref/netstandard1.3/System.Collections.xml", - "ref/netstandard1.3/de/System.Collections.xml", - "ref/netstandard1.3/es/System.Collections.xml", - "ref/netstandard1.3/fr/System.Collections.xml", - "ref/netstandard1.3/it/System.Collections.xml", - "ref/netstandard1.3/ja/System.Collections.xml", - "ref/netstandard1.3/ko/System.Collections.xml", - "ref/netstandard1.3/ru/System.Collections.xml", - "ref/netstandard1.3/zh-hans/System.Collections.xml", - "ref/netstandard1.3/zh-hant/System.Collections.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.collections.4.3.0.nupkg.sha512", - "system.collections.nuspec" - ] - }, - "System.Collections.Concurrent/4.3.0": { - "sha512": "ztl69Xp0Y/UXCL+3v3tEU+lIy+bvjKNUmopn1wep/a291pVPK7dxBd6T7WnlQqRog+d1a/hSsgRsmFnIBKTPLQ==", - "type": "package", - "path": "system.collections.concurrent/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Collections.Concurrent.dll", - "lib/netstandard1.3/System.Collections.Concurrent.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Collections.Concurrent.dll", - "ref/netcore50/System.Collections.Concurrent.xml", - "ref/netcore50/de/System.Collections.Concurrent.xml", - "ref/netcore50/es/System.Collections.Concurrent.xml", - "ref/netcore50/fr/System.Collections.Concurrent.xml", - "ref/netcore50/it/System.Collections.Concurrent.xml", - "ref/netcore50/ja/System.Collections.Concurrent.xml", - "ref/netcore50/ko/System.Collections.Concurrent.xml", - "ref/netcore50/ru/System.Collections.Concurrent.xml", - "ref/netcore50/zh-hans/System.Collections.Concurrent.xml", - "ref/netcore50/zh-hant/System.Collections.Concurrent.xml", - "ref/netstandard1.1/System.Collections.Concurrent.dll", - "ref/netstandard1.1/System.Collections.Concurrent.xml", - "ref/netstandard1.1/de/System.Collections.Concurrent.xml", - "ref/netstandard1.1/es/System.Collections.Concurrent.xml", - "ref/netstandard1.1/fr/System.Collections.Concurrent.xml", - "ref/netstandard1.1/it/System.Collections.Concurrent.xml", - "ref/netstandard1.1/ja/System.Collections.Concurrent.xml", - "ref/netstandard1.1/ko/System.Collections.Concurrent.xml", - "ref/netstandard1.1/ru/System.Collections.Concurrent.xml", - "ref/netstandard1.1/zh-hans/System.Collections.Concurrent.xml", - "ref/netstandard1.1/zh-hant/System.Collections.Concurrent.xml", - "ref/netstandard1.3/System.Collections.Concurrent.dll", - "ref/netstandard1.3/System.Collections.Concurrent.xml", - "ref/netstandard1.3/de/System.Collections.Concurrent.xml", - "ref/netstandard1.3/es/System.Collections.Concurrent.xml", - "ref/netstandard1.3/fr/System.Collections.Concurrent.xml", - "ref/netstandard1.3/it/System.Collections.Concurrent.xml", - "ref/netstandard1.3/ja/System.Collections.Concurrent.xml", - "ref/netstandard1.3/ko/System.Collections.Concurrent.xml", - "ref/netstandard1.3/ru/System.Collections.Concurrent.xml", - "ref/netstandard1.3/zh-hans/System.Collections.Concurrent.xml", - "ref/netstandard1.3/zh-hant/System.Collections.Concurrent.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.collections.concurrent.4.3.0.nupkg.sha512", - "system.collections.concurrent.nuspec" - ] - }, - "System.Collections.Immutable/8.0.0": { - "sha512": "AurL6Y5BA1WotzlEvVaIDpqzpIPvYnnldxru8oXJU2yFxFUy3+pNXjXd1ymO+RA0rq0+590Q8gaz2l3Sr7fmqg==", - "type": "package", - "path": "system.collections.immutable/8.0.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "LICENSE.TXT", - "PACKAGE.md", - "THIRD-PARTY-NOTICES.TXT", - "buildTransitive/net461/System.Collections.Immutable.targets", - "buildTransitive/net462/_._", - "buildTransitive/net6.0/_._", - "buildTransitive/netcoreapp2.0/System.Collections.Immutable.targets", - "lib/net462/System.Collections.Immutable.dll", - "lib/net462/System.Collections.Immutable.xml", - "lib/net6.0/System.Collections.Immutable.dll", - "lib/net6.0/System.Collections.Immutable.xml", - "lib/net7.0/System.Collections.Immutable.dll", - "lib/net7.0/System.Collections.Immutable.xml", - "lib/net8.0/System.Collections.Immutable.dll", - "lib/net8.0/System.Collections.Immutable.xml", - "lib/netstandard2.0/System.Collections.Immutable.dll", - "lib/netstandard2.0/System.Collections.Immutable.xml", - "system.collections.immutable.8.0.0.nupkg.sha512", - "system.collections.immutable.nuspec", - "useSharedDesignerContext.txt" - ] - }, - "System.ComponentModel.Composition/4.5.0": { - "sha512": "+iB9FoZnfdqMEGq6np28X6YNSUrse16CakmIhV3h6PxEWt7jYxUN3Txs1D8MZhhf4QmyvK0F/EcIN0f4gGN0dA==", - "type": "package", - "path": "system.componentmodel.composition/4.5.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "LICENSE.TXT", - "THIRD-PARTY-NOTICES.TXT", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcoreapp2.0/System.ComponentModel.Composition.dll", - "lib/netstandard2.0/System.ComponentModel.Composition.dll", - "lib/uap10.0.16299/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netstandard2.0/System.ComponentModel.Composition.dll", - "ref/uap10.0.16299/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.componentmodel.composition.4.5.0.nupkg.sha512", - "system.componentmodel.composition.nuspec", - "useSharedDesignerContext.txt", - "version.txt" - ] - }, - "System.Composition/1.0.31": { - "sha512": "I+D26qpYdoklyAVUdqwUBrEIckMNjAYnuPJy/h9dsQItpQwVREkDFs4b4tkBza0kT2Yk48Lcfsv2QQ9hWsh9Iw==", - "type": "package", - "path": "system.composition/1.0.31", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "system.composition.1.0.31.nupkg.sha512", - "system.composition.nuspec" - ] - }, - "System.Composition.AttributedModel/1.0.31": { - "sha512": "NHWhkM3ZkspmA0XJEsKdtTt1ViDYuojgSND3yHhTzwxepiwqZf+BCWuvCbjUt4fe0NxxQhUDGJ5km6sLjo9qnQ==", - "type": "package", - "path": "system.composition.attributedmodel/1.0.31", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/System.Composition.AttributedModel.dll", - "lib/portable-net45+win8+wp8+wpa81/System.Composition.AttributedModel.dll", - "system.composition.attributedmodel.1.0.31.nupkg.sha512", - "system.composition.attributedmodel.nuspec" - ] - }, - "System.Composition.Convention/1.0.31": { - "sha512": "GLjh2Ju71k6C0qxMMtl4efHa68NmWeIUYh4fkUI8xbjQrEBvFmRwMDFcylT8/PR9SQbeeL48IkFxU/+gd0nYEQ==", - "type": "package", - "path": "system.composition.convention/1.0.31", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/System.Composition.Convention.dll", - "lib/portable-net45+win8+wp8+wpa81/System.Composition.Convention.dll", - "system.composition.convention.1.0.31.nupkg.sha512", - "system.composition.convention.nuspec" - ] - }, - "System.Composition.Hosting/1.0.31": { - "sha512": "fN1bT4RX4vUqjbgoyuJFVUizAl2mYF5VAb+bVIxIYZSSc0BdnX+yGAxcavxJuDDCQ1K+/mdpgyEFc8e9ikjvrg==", - "type": "package", - "path": "system.composition.hosting/1.0.31", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/System.Composition.Hosting.dll", - "lib/portable-net45+win8+wp8+wpa81/System.Composition.Hosting.dll", - "system.composition.hosting.1.0.31.nupkg.sha512", - "system.composition.hosting.nuspec" - ] - }, - "System.Composition.Runtime/1.0.31": { - "sha512": "0LEJN+2NVM89CE4SekDrrk5tHV5LeATltkp+9WNYrR+Huiyt0vaCqHbbHtVAjPyeLWIc8dOz/3kthRBj32wGQg==", - "type": "package", - "path": "system.composition.runtime/1.0.31", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/System.Composition.Runtime.dll", - "lib/portable-net45+win8+wp8+wpa81/System.Composition.Runtime.dll", - "system.composition.runtime.1.0.31.nupkg.sha512", - "system.composition.runtime.nuspec" - ] - }, - "System.Composition.TypedParts/1.0.31": { - "sha512": "0Zae/FtzeFgDBBuILeIbC/T9HMYbW4olAmi8XqqAGosSOWvXfiQLfARZEhiGd0LVXaYgXr0NhxiU1LldRP1fpQ==", - "type": "package", - "path": "system.composition.typedparts/1.0.31", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/System.Composition.TypedParts.dll", - "lib/portable-net45+win8+wp8+wpa81/System.Composition.TypedParts.dll", - "system.composition.typedparts.1.0.31.nupkg.sha512", - "system.composition.typedparts.nuspec" - ] - }, - "System.Console/4.3.0": { - "sha512": "DHDrIxiqk1h03m6khKWV2X8p/uvN79rgSqpilL6uzpmSfxfU5ng8VcPtW4qsDsQDHiTv6IPV9TmD5M/vElPNLg==", - "type": "package", - "path": "system.console/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Console.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Console.dll", - "ref/netstandard1.3/System.Console.dll", - "ref/netstandard1.3/System.Console.xml", - "ref/netstandard1.3/de/System.Console.xml", - "ref/netstandard1.3/es/System.Console.xml", - "ref/netstandard1.3/fr/System.Console.xml", - "ref/netstandard1.3/it/System.Console.xml", - "ref/netstandard1.3/ja/System.Console.xml", - "ref/netstandard1.3/ko/System.Console.xml", - "ref/netstandard1.3/ru/System.Console.xml", - "ref/netstandard1.3/zh-hans/System.Console.xml", - "ref/netstandard1.3/zh-hant/System.Console.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.console.4.3.0.nupkg.sha512", - "system.console.nuspec" - ] - }, - "System.Diagnostics.Debug/4.3.0": { - "sha512": "ZUhUOdqmaG5Jk3Xdb8xi5kIyQYAA4PnTNlHx1mu9ZY3qv4ELIdKbnL/akbGaKi2RnNUWaZsAs31rvzFdewTj2g==", - "type": "package", - "path": "system.diagnostics.debug/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Diagnostics.Debug.dll", - "ref/netcore50/System.Diagnostics.Debug.xml", - "ref/netcore50/de/System.Diagnostics.Debug.xml", - "ref/netcore50/es/System.Diagnostics.Debug.xml", - "ref/netcore50/fr/System.Diagnostics.Debug.xml", - "ref/netcore50/it/System.Diagnostics.Debug.xml", - "ref/netcore50/ja/System.Diagnostics.Debug.xml", - "ref/netcore50/ko/System.Diagnostics.Debug.xml", - "ref/netcore50/ru/System.Diagnostics.Debug.xml", - "ref/netcore50/zh-hans/System.Diagnostics.Debug.xml", - "ref/netcore50/zh-hant/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/System.Diagnostics.Debug.dll", - "ref/netstandard1.0/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/de/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/es/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/fr/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/it/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/ja/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/ko/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/ru/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/zh-hans/System.Diagnostics.Debug.xml", - "ref/netstandard1.0/zh-hant/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/System.Diagnostics.Debug.dll", - "ref/netstandard1.3/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/de/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/es/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/fr/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/it/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/ja/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/ko/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/ru/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/zh-hans/System.Diagnostics.Debug.xml", - "ref/netstandard1.3/zh-hant/System.Diagnostics.Debug.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.diagnostics.debug.4.3.0.nupkg.sha512", - "system.diagnostics.debug.nuspec" - ] - }, - "System.Diagnostics.DiagnosticSource/4.3.0": { - "sha512": "tD6kosZnTAGdrEa0tZSuFyunMbt/5KYDnHdndJYGqZoNy00XVXyACd5d6KnE1YgYv3ne2CjtAfNXo/fwEhnKUA==", - "type": "package", - "path": "system.diagnostics.diagnosticsource/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/net46/System.Diagnostics.DiagnosticSource.dll", - "lib/net46/System.Diagnostics.DiagnosticSource.xml", - "lib/netstandard1.1/System.Diagnostics.DiagnosticSource.dll", - "lib/netstandard1.1/System.Diagnostics.DiagnosticSource.xml", - "lib/netstandard1.3/System.Diagnostics.DiagnosticSource.dll", - "lib/netstandard1.3/System.Diagnostics.DiagnosticSource.xml", - "lib/portable-net45+win8+wpa81/System.Diagnostics.DiagnosticSource.dll", - "lib/portable-net45+win8+wpa81/System.Diagnostics.DiagnosticSource.xml", - "system.diagnostics.diagnosticsource.4.3.0.nupkg.sha512", - "system.diagnostics.diagnosticsource.nuspec" - ] - }, - "System.Diagnostics.Tools/4.3.0": { - "sha512": "UUvkJfSYJMM6x527dJg2VyWPSRqIVB0Z7dbjHst1zmwTXz5CcXSYJFWRpuigfbO1Lf7yfZiIaEUesfnl/g5EyA==", - "type": "package", - "path": "system.diagnostics.tools/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Diagnostics.Tools.dll", - "ref/netcore50/System.Diagnostics.Tools.xml", - "ref/netcore50/de/System.Diagnostics.Tools.xml", - "ref/netcore50/es/System.Diagnostics.Tools.xml", - "ref/netcore50/fr/System.Diagnostics.Tools.xml", - "ref/netcore50/it/System.Diagnostics.Tools.xml", - "ref/netcore50/ja/System.Diagnostics.Tools.xml", - "ref/netcore50/ko/System.Diagnostics.Tools.xml", - "ref/netcore50/ru/System.Diagnostics.Tools.xml", - "ref/netcore50/zh-hans/System.Diagnostics.Tools.xml", - "ref/netcore50/zh-hant/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/System.Diagnostics.Tools.dll", - "ref/netstandard1.0/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/de/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/es/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/fr/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/it/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/ja/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/ko/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/ru/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/zh-hans/System.Diagnostics.Tools.xml", - "ref/netstandard1.0/zh-hant/System.Diagnostics.Tools.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.diagnostics.tools.4.3.0.nupkg.sha512", - "system.diagnostics.tools.nuspec" - ] - }, - "System.Diagnostics.Tracing/4.3.0": { - "sha512": "rswfv0f/Cqkh78rA5S8eN8Neocz234+emGCtTF3lxPY96F+mmmUen6tbn0glN6PMvlKQb9bPAY5e9u7fgPTkKw==", - "type": "package", - "path": "system.diagnostics.tracing/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Diagnostics.Tracing.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Diagnostics.Tracing.dll", - "ref/netcore50/System.Diagnostics.Tracing.dll", - "ref/netcore50/System.Diagnostics.Tracing.xml", - "ref/netcore50/de/System.Diagnostics.Tracing.xml", - "ref/netcore50/es/System.Diagnostics.Tracing.xml", - "ref/netcore50/fr/System.Diagnostics.Tracing.xml", - "ref/netcore50/it/System.Diagnostics.Tracing.xml", - "ref/netcore50/ja/System.Diagnostics.Tracing.xml", - "ref/netcore50/ko/System.Diagnostics.Tracing.xml", - "ref/netcore50/ru/System.Diagnostics.Tracing.xml", - "ref/netcore50/zh-hans/System.Diagnostics.Tracing.xml", - "ref/netcore50/zh-hant/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/System.Diagnostics.Tracing.dll", - "ref/netstandard1.1/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/de/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/es/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/fr/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/it/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/ja/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/ko/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/ru/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/zh-hans/System.Diagnostics.Tracing.xml", - "ref/netstandard1.1/zh-hant/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/System.Diagnostics.Tracing.dll", - "ref/netstandard1.2/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/de/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/es/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/fr/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/it/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/ja/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/ko/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/ru/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/zh-hans/System.Diagnostics.Tracing.xml", - "ref/netstandard1.2/zh-hant/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/System.Diagnostics.Tracing.dll", - "ref/netstandard1.3/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/de/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/es/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/fr/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/it/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/ja/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/ko/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/ru/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/zh-hans/System.Diagnostics.Tracing.xml", - "ref/netstandard1.3/zh-hant/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/System.Diagnostics.Tracing.dll", - "ref/netstandard1.5/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/de/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/es/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/fr/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/it/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/ja/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/ko/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/ru/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/zh-hans/System.Diagnostics.Tracing.xml", - "ref/netstandard1.5/zh-hant/System.Diagnostics.Tracing.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.diagnostics.tracing.4.3.0.nupkg.sha512", - "system.diagnostics.tracing.nuspec" - ] - }, - "System.Dynamic.Runtime/4.0.11": { - "sha512": "db34f6LHYM0U0JpE+sOmjar27BnqTVkbLJhgfwMpTdgTigG/Hna3m2MYVwnFzGGKnEJk2UXFuoVTr8WUbU91/A==", - "type": "package", - "path": "system.dynamic.runtime/4.0.11", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Dynamic.Runtime.dll", - "lib/netstandard1.3/System.Dynamic.Runtime.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Dynamic.Runtime.dll", - "ref/netcore50/System.Dynamic.Runtime.xml", - "ref/netcore50/de/System.Dynamic.Runtime.xml", - "ref/netcore50/es/System.Dynamic.Runtime.xml", - "ref/netcore50/fr/System.Dynamic.Runtime.xml", - "ref/netcore50/it/System.Dynamic.Runtime.xml", - "ref/netcore50/ja/System.Dynamic.Runtime.xml", - "ref/netcore50/ko/System.Dynamic.Runtime.xml", - "ref/netcore50/ru/System.Dynamic.Runtime.xml", - "ref/netcore50/zh-hans/System.Dynamic.Runtime.xml", - "ref/netcore50/zh-hant/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/System.Dynamic.Runtime.dll", - "ref/netstandard1.0/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/de/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/es/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/fr/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/it/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/ja/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/ko/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/ru/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/zh-hans/System.Dynamic.Runtime.xml", - "ref/netstandard1.0/zh-hant/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/System.Dynamic.Runtime.dll", - "ref/netstandard1.3/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/de/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/es/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/fr/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/it/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/ja/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/ko/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/ru/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/zh-hans/System.Dynamic.Runtime.xml", - "ref/netstandard1.3/zh-hant/System.Dynamic.Runtime.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Dynamic.Runtime.dll", - "system.dynamic.runtime.4.0.11.nupkg.sha512", - "system.dynamic.runtime.nuspec" - ] - }, - "System.Formats.Asn1/5.0.0": { - "sha512": "MTvUIktmemNB+El0Fgw9egyqT9AYSIk6DTJeoDSpc3GIHxHCMo8COqkWT1mptX5tZ1SlQ6HJZ0OsSvMth1c12w==", - "type": "package", - "path": "system.formats.asn1/5.0.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "LICENSE.TXT", - "THIRD-PARTY-NOTICES.TXT", - "lib/net461/System.Formats.Asn1.dll", - "lib/net461/System.Formats.Asn1.xml", - "lib/netstandard2.0/System.Formats.Asn1.dll", - "lib/netstandard2.0/System.Formats.Asn1.xml", - "system.formats.asn1.5.0.0.nupkg.sha512", - "system.formats.asn1.nuspec", - "useSharedDesignerContext.txt", - "version.txt" - ] - }, - "System.Globalization/4.3.0": { - "sha512": "kYdVd2f2PAdFGblzFswE4hkNANJBKRmsfa2X5LG2AcWE1c7/4t0pYae1L8vfZ5xvE2nK/R9JprtToA61OSHWIg==", - "type": "package", - "path": "system.globalization/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Globalization.dll", - "ref/netcore50/System.Globalization.xml", - "ref/netcore50/de/System.Globalization.xml", - "ref/netcore50/es/System.Globalization.xml", - "ref/netcore50/fr/System.Globalization.xml", - "ref/netcore50/it/System.Globalization.xml", - "ref/netcore50/ja/System.Globalization.xml", - "ref/netcore50/ko/System.Globalization.xml", - "ref/netcore50/ru/System.Globalization.xml", - "ref/netcore50/zh-hans/System.Globalization.xml", - "ref/netcore50/zh-hant/System.Globalization.xml", - "ref/netstandard1.0/System.Globalization.dll", - "ref/netstandard1.0/System.Globalization.xml", - "ref/netstandard1.0/de/System.Globalization.xml", - "ref/netstandard1.0/es/System.Globalization.xml", - "ref/netstandard1.0/fr/System.Globalization.xml", - "ref/netstandard1.0/it/System.Globalization.xml", - "ref/netstandard1.0/ja/System.Globalization.xml", - "ref/netstandard1.0/ko/System.Globalization.xml", - "ref/netstandard1.0/ru/System.Globalization.xml", - "ref/netstandard1.0/zh-hans/System.Globalization.xml", - "ref/netstandard1.0/zh-hant/System.Globalization.xml", - "ref/netstandard1.3/System.Globalization.dll", - "ref/netstandard1.3/System.Globalization.xml", - "ref/netstandard1.3/de/System.Globalization.xml", - "ref/netstandard1.3/es/System.Globalization.xml", - "ref/netstandard1.3/fr/System.Globalization.xml", - "ref/netstandard1.3/it/System.Globalization.xml", - "ref/netstandard1.3/ja/System.Globalization.xml", - "ref/netstandard1.3/ko/System.Globalization.xml", - "ref/netstandard1.3/ru/System.Globalization.xml", - "ref/netstandard1.3/zh-hans/System.Globalization.xml", - "ref/netstandard1.3/zh-hant/System.Globalization.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.globalization.4.3.0.nupkg.sha512", - "system.globalization.nuspec" - ] - }, - "System.Globalization.Calendars/4.3.0": { - "sha512": "GUlBtdOWT4LTV3I+9/PJW+56AnnChTaOqqTLFtdmype/L500M2LIyXgmtd9X2P2VOkmJd5c67H5SaC2QcL1bFA==", - "type": "package", - "path": "system.globalization.calendars/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Globalization.Calendars.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Globalization.Calendars.dll", - "ref/netstandard1.3/System.Globalization.Calendars.dll", - "ref/netstandard1.3/System.Globalization.Calendars.xml", - "ref/netstandard1.3/de/System.Globalization.Calendars.xml", - "ref/netstandard1.3/es/System.Globalization.Calendars.xml", - "ref/netstandard1.3/fr/System.Globalization.Calendars.xml", - "ref/netstandard1.3/it/System.Globalization.Calendars.xml", - "ref/netstandard1.3/ja/System.Globalization.Calendars.xml", - "ref/netstandard1.3/ko/System.Globalization.Calendars.xml", - "ref/netstandard1.3/ru/System.Globalization.Calendars.xml", - "ref/netstandard1.3/zh-hans/System.Globalization.Calendars.xml", - "ref/netstandard1.3/zh-hant/System.Globalization.Calendars.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.globalization.calendars.4.3.0.nupkg.sha512", - "system.globalization.calendars.nuspec" - ] - }, - "System.Globalization.Extensions/4.3.0": { - "sha512": "FhKmdR6MPG+pxow6wGtNAWdZh7noIOpdD5TwQ3CprzgIE1bBBoim0vbR1+AWsWjQmU7zXHgQo4TWSP6lCeiWcQ==", - "type": "package", - "path": "system.globalization.extensions/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Globalization.Extensions.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Globalization.Extensions.dll", - "ref/netstandard1.3/System.Globalization.Extensions.dll", - "ref/netstandard1.3/System.Globalization.Extensions.xml", - "ref/netstandard1.3/de/System.Globalization.Extensions.xml", - "ref/netstandard1.3/es/System.Globalization.Extensions.xml", - "ref/netstandard1.3/fr/System.Globalization.Extensions.xml", - "ref/netstandard1.3/it/System.Globalization.Extensions.xml", - "ref/netstandard1.3/ja/System.Globalization.Extensions.xml", - "ref/netstandard1.3/ko/System.Globalization.Extensions.xml", - "ref/netstandard1.3/ru/System.Globalization.Extensions.xml", - "ref/netstandard1.3/zh-hans/System.Globalization.Extensions.xml", - "ref/netstandard1.3/zh-hant/System.Globalization.Extensions.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.Globalization.Extensions.dll", - "runtimes/win/lib/net46/System.Globalization.Extensions.dll", - "runtimes/win/lib/netstandard1.3/System.Globalization.Extensions.dll", - "system.globalization.extensions.4.3.0.nupkg.sha512", - "system.globalization.extensions.nuspec" - ] - }, - "System.IO/4.3.0": { - "sha512": "3qjaHvxQPDpSOYICjUoTsmoq5u6QJAFRUITgeT/4gqkF1bajbSmb1kwSxEA8AHlofqgcKJcM8udgieRNhaJ5Cg==", - "type": "package", - "path": "system.io/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.IO.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.IO.dll", - "ref/netcore50/System.IO.dll", - "ref/netcore50/System.IO.xml", - "ref/netcore50/de/System.IO.xml", - "ref/netcore50/es/System.IO.xml", - "ref/netcore50/fr/System.IO.xml", - "ref/netcore50/it/System.IO.xml", - "ref/netcore50/ja/System.IO.xml", - "ref/netcore50/ko/System.IO.xml", - "ref/netcore50/ru/System.IO.xml", - "ref/netcore50/zh-hans/System.IO.xml", - "ref/netcore50/zh-hant/System.IO.xml", - "ref/netstandard1.0/System.IO.dll", - "ref/netstandard1.0/System.IO.xml", - "ref/netstandard1.0/de/System.IO.xml", - "ref/netstandard1.0/es/System.IO.xml", - "ref/netstandard1.0/fr/System.IO.xml", - "ref/netstandard1.0/it/System.IO.xml", - "ref/netstandard1.0/ja/System.IO.xml", - "ref/netstandard1.0/ko/System.IO.xml", - "ref/netstandard1.0/ru/System.IO.xml", - "ref/netstandard1.0/zh-hans/System.IO.xml", - "ref/netstandard1.0/zh-hant/System.IO.xml", - "ref/netstandard1.3/System.IO.dll", - "ref/netstandard1.3/System.IO.xml", - "ref/netstandard1.3/de/System.IO.xml", - "ref/netstandard1.3/es/System.IO.xml", - "ref/netstandard1.3/fr/System.IO.xml", - "ref/netstandard1.3/it/System.IO.xml", - "ref/netstandard1.3/ja/System.IO.xml", - "ref/netstandard1.3/ko/System.IO.xml", - "ref/netstandard1.3/ru/System.IO.xml", - "ref/netstandard1.3/zh-hans/System.IO.xml", - "ref/netstandard1.3/zh-hant/System.IO.xml", - "ref/netstandard1.5/System.IO.dll", - "ref/netstandard1.5/System.IO.xml", - "ref/netstandard1.5/de/System.IO.xml", - "ref/netstandard1.5/es/System.IO.xml", - "ref/netstandard1.5/fr/System.IO.xml", - "ref/netstandard1.5/it/System.IO.xml", - "ref/netstandard1.5/ja/System.IO.xml", - "ref/netstandard1.5/ko/System.IO.xml", - "ref/netstandard1.5/ru/System.IO.xml", - "ref/netstandard1.5/zh-hans/System.IO.xml", - "ref/netstandard1.5/zh-hant/System.IO.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.io.4.3.0.nupkg.sha512", - "system.io.nuspec" - ] - }, - "System.IO.Abstractions/21.0.22": { - "sha512": "DRnFyMIjO1KG9fqUPKV7XDPgECEwrNpsb3OLD0mImViVpRZ5747o7vqrOYbn9AMaQ8eajLeKH0fXQglgH7v42A==", - "type": "package", - "path": "system.io.abstractions/21.0.22", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "README.md", - "icon_256x256.png", - "lib/net462/System.IO.Abstractions.dll", - "lib/net462/System.IO.Abstractions.xml", - "lib/net6.0/System.IO.Abstractions.dll", - "lib/net6.0/System.IO.Abstractions.xml", - "lib/net7.0/System.IO.Abstractions.dll", - "lib/net7.0/System.IO.Abstractions.xml", - "lib/net8.0/System.IO.Abstractions.dll", - "lib/net8.0/System.IO.Abstractions.xml", - "lib/netstandard2.0/System.IO.Abstractions.dll", - "lib/netstandard2.0/System.IO.Abstractions.xml", - "lib/netstandard2.1/System.IO.Abstractions.dll", - "lib/netstandard2.1/System.IO.Abstractions.xml", - "system.io.abstractions.21.0.22.nupkg.sha512", - "system.io.abstractions.nuspec" - ] - }, - "System.IO.Compression/4.3.0": { - "sha512": "YHndyoiV90iu4iKG115ibkhrG+S3jBm8Ap9OwoUAzO5oPDAWcr0SFwQFm0HjM8WkEZWo0zvLTyLmbvTkW1bXgg==", - "type": "package", - "path": "system.io.compression/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net46/System.IO.Compression.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net46/System.IO.Compression.dll", - "ref/netcore50/System.IO.Compression.dll", - "ref/netcore50/System.IO.Compression.xml", - "ref/netcore50/de/System.IO.Compression.xml", - "ref/netcore50/es/System.IO.Compression.xml", - "ref/netcore50/fr/System.IO.Compression.xml", - "ref/netcore50/it/System.IO.Compression.xml", - "ref/netcore50/ja/System.IO.Compression.xml", - "ref/netcore50/ko/System.IO.Compression.xml", - "ref/netcore50/ru/System.IO.Compression.xml", - "ref/netcore50/zh-hans/System.IO.Compression.xml", - "ref/netcore50/zh-hant/System.IO.Compression.xml", - "ref/netstandard1.1/System.IO.Compression.dll", - "ref/netstandard1.1/System.IO.Compression.xml", - "ref/netstandard1.1/de/System.IO.Compression.xml", - "ref/netstandard1.1/es/System.IO.Compression.xml", - "ref/netstandard1.1/fr/System.IO.Compression.xml", - "ref/netstandard1.1/it/System.IO.Compression.xml", - "ref/netstandard1.1/ja/System.IO.Compression.xml", - "ref/netstandard1.1/ko/System.IO.Compression.xml", - "ref/netstandard1.1/ru/System.IO.Compression.xml", - "ref/netstandard1.1/zh-hans/System.IO.Compression.xml", - "ref/netstandard1.1/zh-hant/System.IO.Compression.xml", - "ref/netstandard1.3/System.IO.Compression.dll", - "ref/netstandard1.3/System.IO.Compression.xml", - "ref/netstandard1.3/de/System.IO.Compression.xml", - "ref/netstandard1.3/es/System.IO.Compression.xml", - "ref/netstandard1.3/fr/System.IO.Compression.xml", - "ref/netstandard1.3/it/System.IO.Compression.xml", - "ref/netstandard1.3/ja/System.IO.Compression.xml", - "ref/netstandard1.3/ko/System.IO.Compression.xml", - "ref/netstandard1.3/ru/System.IO.Compression.xml", - "ref/netstandard1.3/zh-hans/System.IO.Compression.xml", - "ref/netstandard1.3/zh-hant/System.IO.Compression.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.IO.Compression.dll", - "runtimes/win/lib/net46/System.IO.Compression.dll", - "runtimes/win/lib/netstandard1.3/System.IO.Compression.dll", - "system.io.compression.4.3.0.nupkg.sha512", - "system.io.compression.nuspec" - ] - }, - "System.IO.Compression.ZipFile/4.3.0": { - "sha512": "G4HwjEsgIwy3JFBduZ9quBkAu+eUwjIdJleuNSgmUojbH6O3mlvEIme+GHx/cLlTAPcrnnL7GqvB9pTlWRfhOg==", - "type": "package", - "path": "system.io.compression.zipfile/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.IO.Compression.ZipFile.dll", - "lib/netstandard1.3/System.IO.Compression.ZipFile.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.IO.Compression.ZipFile.dll", - "ref/netstandard1.3/System.IO.Compression.ZipFile.dll", - "ref/netstandard1.3/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/de/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/es/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/fr/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/it/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/ja/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/ko/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/ru/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/zh-hans/System.IO.Compression.ZipFile.xml", - "ref/netstandard1.3/zh-hant/System.IO.Compression.ZipFile.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.io.compression.zipfile.4.3.0.nupkg.sha512", - "system.io.compression.zipfile.nuspec" - ] - }, - "System.IO.FileSystem/4.3.0": { - "sha512": "3wEMARTnuio+ulnvi+hkRNROYwa1kylvYahhcLk4HSoVdl+xxTFVeVlYOfLwrDPImGls0mDqbMhrza8qnWPTdA==", - "type": "package", - "path": "system.io.filesystem/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.IO.FileSystem.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.IO.FileSystem.dll", - "ref/netstandard1.3/System.IO.FileSystem.dll", - "ref/netstandard1.3/System.IO.FileSystem.xml", - "ref/netstandard1.3/de/System.IO.FileSystem.xml", - "ref/netstandard1.3/es/System.IO.FileSystem.xml", - "ref/netstandard1.3/fr/System.IO.FileSystem.xml", - "ref/netstandard1.3/it/System.IO.FileSystem.xml", - "ref/netstandard1.3/ja/System.IO.FileSystem.xml", - "ref/netstandard1.3/ko/System.IO.FileSystem.xml", - "ref/netstandard1.3/ru/System.IO.FileSystem.xml", - "ref/netstandard1.3/zh-hans/System.IO.FileSystem.xml", - "ref/netstandard1.3/zh-hant/System.IO.FileSystem.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.io.filesystem.4.3.0.nupkg.sha512", - "system.io.filesystem.nuspec" - ] - }, - "System.IO.FileSystem.Primitives/4.3.0": { - "sha512": "6QOb2XFLch7bEc4lIcJH49nJN2HV+OC3fHDgsLVsBVBk3Y4hFAnOBGzJ2lUu7CyDDFo9IBWkSsnbkT6IBwwiMw==", - "type": "package", - "path": "system.io.filesystem.primitives/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.IO.FileSystem.Primitives.dll", - "lib/netstandard1.3/System.IO.FileSystem.Primitives.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.IO.FileSystem.Primitives.dll", - "ref/netstandard1.3/System.IO.FileSystem.Primitives.dll", - "ref/netstandard1.3/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/de/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/es/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/fr/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/it/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/ja/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/ko/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/ru/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/zh-hans/System.IO.FileSystem.Primitives.xml", - "ref/netstandard1.3/zh-hant/System.IO.FileSystem.Primitives.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.io.filesystem.primitives.4.3.0.nupkg.sha512", - "system.io.filesystem.primitives.nuspec" - ] - }, - "System.Linq/4.3.0": { - "sha512": "5DbqIUpsDp0dFftytzuMmc0oeMdQwjcP/EWxsksIz/w1TcFRkZ3yKKz0PqiYFMmEwPSWw+qNVqD7PJ889JzHbw==", - "type": "package", - "path": "system.linq/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net463/System.Linq.dll", - "lib/netcore50/System.Linq.dll", - "lib/netstandard1.6/System.Linq.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net463/System.Linq.dll", - "ref/netcore50/System.Linq.dll", - "ref/netcore50/System.Linq.xml", - "ref/netcore50/de/System.Linq.xml", - "ref/netcore50/es/System.Linq.xml", - "ref/netcore50/fr/System.Linq.xml", - "ref/netcore50/it/System.Linq.xml", - "ref/netcore50/ja/System.Linq.xml", - "ref/netcore50/ko/System.Linq.xml", - "ref/netcore50/ru/System.Linq.xml", - "ref/netcore50/zh-hans/System.Linq.xml", - "ref/netcore50/zh-hant/System.Linq.xml", - "ref/netstandard1.0/System.Linq.dll", - "ref/netstandard1.0/System.Linq.xml", - "ref/netstandard1.0/de/System.Linq.xml", - "ref/netstandard1.0/es/System.Linq.xml", - "ref/netstandard1.0/fr/System.Linq.xml", - "ref/netstandard1.0/it/System.Linq.xml", - "ref/netstandard1.0/ja/System.Linq.xml", - "ref/netstandard1.0/ko/System.Linq.xml", - "ref/netstandard1.0/ru/System.Linq.xml", - "ref/netstandard1.0/zh-hans/System.Linq.xml", - "ref/netstandard1.0/zh-hant/System.Linq.xml", - "ref/netstandard1.6/System.Linq.dll", - "ref/netstandard1.6/System.Linq.xml", - "ref/netstandard1.6/de/System.Linq.xml", - "ref/netstandard1.6/es/System.Linq.xml", - "ref/netstandard1.6/fr/System.Linq.xml", - "ref/netstandard1.6/it/System.Linq.xml", - "ref/netstandard1.6/ja/System.Linq.xml", - "ref/netstandard1.6/ko/System.Linq.xml", - "ref/netstandard1.6/ru/System.Linq.xml", - "ref/netstandard1.6/zh-hans/System.Linq.xml", - "ref/netstandard1.6/zh-hant/System.Linq.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.linq.4.3.0.nupkg.sha512", - "system.linq.nuspec" - ] - }, - "System.Linq.Expressions/4.3.0": { - "sha512": "PGKkrd2khG4CnlyJwxwwaWWiSiWFNBGlgXvJpeO0xCXrZ89ODrQ6tjEWS/kOqZ8GwEOUATtKtzp1eRgmYNfclg==", - "type": "package", - "path": "system.linq.expressions/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net463/System.Linq.Expressions.dll", - "lib/netcore50/System.Linq.Expressions.dll", - "lib/netstandard1.6/System.Linq.Expressions.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net463/System.Linq.Expressions.dll", - "ref/netcore50/System.Linq.Expressions.dll", - "ref/netcore50/System.Linq.Expressions.xml", - "ref/netcore50/de/System.Linq.Expressions.xml", - "ref/netcore50/es/System.Linq.Expressions.xml", - "ref/netcore50/fr/System.Linq.Expressions.xml", - "ref/netcore50/it/System.Linq.Expressions.xml", - "ref/netcore50/ja/System.Linq.Expressions.xml", - "ref/netcore50/ko/System.Linq.Expressions.xml", - "ref/netcore50/ru/System.Linq.Expressions.xml", - "ref/netcore50/zh-hans/System.Linq.Expressions.xml", - "ref/netcore50/zh-hant/System.Linq.Expressions.xml", - "ref/netstandard1.0/System.Linq.Expressions.dll", - "ref/netstandard1.0/System.Linq.Expressions.xml", - "ref/netstandard1.0/de/System.Linq.Expressions.xml", - "ref/netstandard1.0/es/System.Linq.Expressions.xml", - "ref/netstandard1.0/fr/System.Linq.Expressions.xml", - "ref/netstandard1.0/it/System.Linq.Expressions.xml", - "ref/netstandard1.0/ja/System.Linq.Expressions.xml", - "ref/netstandard1.0/ko/System.Linq.Expressions.xml", - "ref/netstandard1.0/ru/System.Linq.Expressions.xml", - "ref/netstandard1.0/zh-hans/System.Linq.Expressions.xml", - "ref/netstandard1.0/zh-hant/System.Linq.Expressions.xml", - "ref/netstandard1.3/System.Linq.Expressions.dll", - "ref/netstandard1.3/System.Linq.Expressions.xml", - "ref/netstandard1.3/de/System.Linq.Expressions.xml", - "ref/netstandard1.3/es/System.Linq.Expressions.xml", - "ref/netstandard1.3/fr/System.Linq.Expressions.xml", - "ref/netstandard1.3/it/System.Linq.Expressions.xml", - "ref/netstandard1.3/ja/System.Linq.Expressions.xml", - "ref/netstandard1.3/ko/System.Linq.Expressions.xml", - "ref/netstandard1.3/ru/System.Linq.Expressions.xml", - "ref/netstandard1.3/zh-hans/System.Linq.Expressions.xml", - "ref/netstandard1.3/zh-hant/System.Linq.Expressions.xml", - "ref/netstandard1.6/System.Linq.Expressions.dll", - "ref/netstandard1.6/System.Linq.Expressions.xml", - "ref/netstandard1.6/de/System.Linq.Expressions.xml", - "ref/netstandard1.6/es/System.Linq.Expressions.xml", - "ref/netstandard1.6/fr/System.Linq.Expressions.xml", - "ref/netstandard1.6/it/System.Linq.Expressions.xml", - "ref/netstandard1.6/ja/System.Linq.Expressions.xml", - "ref/netstandard1.6/ko/System.Linq.Expressions.xml", - "ref/netstandard1.6/ru/System.Linq.Expressions.xml", - "ref/netstandard1.6/zh-hans/System.Linq.Expressions.xml", - "ref/netstandard1.6/zh-hant/System.Linq.Expressions.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Linq.Expressions.dll", - "system.linq.expressions.4.3.0.nupkg.sha512", - "system.linq.expressions.nuspec" - ] - }, - "System.Net.Http/4.3.0": { - "sha512": "sYg+FtILtRQuYWSIAuNOELwVuVsxVyJGWQyOnlAzhV4xvhyFnON1bAzYYC+jjRW8JREM45R0R5Dgi8MTC5sEwA==", - "type": "package", - "path": "system.net.http/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/Xamarinmac20/_._", - "lib/monoandroid10/_._", - "lib/monotouch10/_._", - "lib/net45/_._", - "lib/net46/System.Net.Http.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/Xamarinmac20/_._", - "ref/monoandroid10/_._", - "ref/monotouch10/_._", - "ref/net45/_._", - "ref/net46/System.Net.Http.dll", - "ref/net46/System.Net.Http.xml", - "ref/net46/de/System.Net.Http.xml", - "ref/net46/es/System.Net.Http.xml", - "ref/net46/fr/System.Net.Http.xml", - "ref/net46/it/System.Net.Http.xml", - "ref/net46/ja/System.Net.Http.xml", - "ref/net46/ko/System.Net.Http.xml", - "ref/net46/ru/System.Net.Http.xml", - "ref/net46/zh-hans/System.Net.Http.xml", - "ref/net46/zh-hant/System.Net.Http.xml", - "ref/netcore50/System.Net.Http.dll", - "ref/netcore50/System.Net.Http.xml", - "ref/netcore50/de/System.Net.Http.xml", - "ref/netcore50/es/System.Net.Http.xml", - "ref/netcore50/fr/System.Net.Http.xml", - "ref/netcore50/it/System.Net.Http.xml", - "ref/netcore50/ja/System.Net.Http.xml", - "ref/netcore50/ko/System.Net.Http.xml", - "ref/netcore50/ru/System.Net.Http.xml", - "ref/netcore50/zh-hans/System.Net.Http.xml", - "ref/netcore50/zh-hant/System.Net.Http.xml", - "ref/netstandard1.1/System.Net.Http.dll", - "ref/netstandard1.1/System.Net.Http.xml", - "ref/netstandard1.1/de/System.Net.Http.xml", - "ref/netstandard1.1/es/System.Net.Http.xml", - "ref/netstandard1.1/fr/System.Net.Http.xml", - "ref/netstandard1.1/it/System.Net.Http.xml", - "ref/netstandard1.1/ja/System.Net.Http.xml", - "ref/netstandard1.1/ko/System.Net.Http.xml", - "ref/netstandard1.1/ru/System.Net.Http.xml", - "ref/netstandard1.1/zh-hans/System.Net.Http.xml", - "ref/netstandard1.1/zh-hant/System.Net.Http.xml", - "ref/netstandard1.3/System.Net.Http.dll", - "ref/netstandard1.3/System.Net.Http.xml", - "ref/netstandard1.3/de/System.Net.Http.xml", - "ref/netstandard1.3/es/System.Net.Http.xml", - "ref/netstandard1.3/fr/System.Net.Http.xml", - "ref/netstandard1.3/it/System.Net.Http.xml", - "ref/netstandard1.3/ja/System.Net.Http.xml", - "ref/netstandard1.3/ko/System.Net.Http.xml", - "ref/netstandard1.3/ru/System.Net.Http.xml", - "ref/netstandard1.3/zh-hans/System.Net.Http.xml", - "ref/netstandard1.3/zh-hant/System.Net.Http.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.6/System.Net.Http.dll", - "runtimes/win/lib/net46/System.Net.Http.dll", - "runtimes/win/lib/netcore50/System.Net.Http.dll", - "runtimes/win/lib/netstandard1.3/System.Net.Http.dll", - "system.net.http.4.3.0.nupkg.sha512", - "system.net.http.nuspec" - ] - }, - "System.Net.Primitives/4.3.0": { - "sha512": "qOu+hDwFwoZPbzPvwut2qATe3ygjeQBDQj91xlsaqGFQUI5i4ZnZb8yyQuLGpDGivEPIt8EJkd1BVzVoP31FXA==", - "type": "package", - "path": "system.net.primitives/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Net.Primitives.dll", - "ref/netcore50/System.Net.Primitives.xml", - "ref/netcore50/de/System.Net.Primitives.xml", - "ref/netcore50/es/System.Net.Primitives.xml", - "ref/netcore50/fr/System.Net.Primitives.xml", - "ref/netcore50/it/System.Net.Primitives.xml", - "ref/netcore50/ja/System.Net.Primitives.xml", - "ref/netcore50/ko/System.Net.Primitives.xml", - "ref/netcore50/ru/System.Net.Primitives.xml", - "ref/netcore50/zh-hans/System.Net.Primitives.xml", - "ref/netcore50/zh-hant/System.Net.Primitives.xml", - "ref/netstandard1.0/System.Net.Primitives.dll", - "ref/netstandard1.0/System.Net.Primitives.xml", - "ref/netstandard1.0/de/System.Net.Primitives.xml", - "ref/netstandard1.0/es/System.Net.Primitives.xml", - "ref/netstandard1.0/fr/System.Net.Primitives.xml", - "ref/netstandard1.0/it/System.Net.Primitives.xml", - "ref/netstandard1.0/ja/System.Net.Primitives.xml", - "ref/netstandard1.0/ko/System.Net.Primitives.xml", - "ref/netstandard1.0/ru/System.Net.Primitives.xml", - "ref/netstandard1.0/zh-hans/System.Net.Primitives.xml", - "ref/netstandard1.0/zh-hant/System.Net.Primitives.xml", - "ref/netstandard1.1/System.Net.Primitives.dll", - "ref/netstandard1.1/System.Net.Primitives.xml", - "ref/netstandard1.1/de/System.Net.Primitives.xml", - "ref/netstandard1.1/es/System.Net.Primitives.xml", - "ref/netstandard1.1/fr/System.Net.Primitives.xml", - "ref/netstandard1.1/it/System.Net.Primitives.xml", - "ref/netstandard1.1/ja/System.Net.Primitives.xml", - "ref/netstandard1.1/ko/System.Net.Primitives.xml", - "ref/netstandard1.1/ru/System.Net.Primitives.xml", - "ref/netstandard1.1/zh-hans/System.Net.Primitives.xml", - "ref/netstandard1.1/zh-hant/System.Net.Primitives.xml", - "ref/netstandard1.3/System.Net.Primitives.dll", - "ref/netstandard1.3/System.Net.Primitives.xml", - "ref/netstandard1.3/de/System.Net.Primitives.xml", - "ref/netstandard1.3/es/System.Net.Primitives.xml", - "ref/netstandard1.3/fr/System.Net.Primitives.xml", - "ref/netstandard1.3/it/System.Net.Primitives.xml", - "ref/netstandard1.3/ja/System.Net.Primitives.xml", - "ref/netstandard1.3/ko/System.Net.Primitives.xml", - "ref/netstandard1.3/ru/System.Net.Primitives.xml", - "ref/netstandard1.3/zh-hans/System.Net.Primitives.xml", - "ref/netstandard1.3/zh-hant/System.Net.Primitives.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.net.primitives.4.3.0.nupkg.sha512", - "system.net.primitives.nuspec" - ] - }, - "System.Net.Sockets/4.3.0": { - "sha512": "m6icV6TqQOAdgt5N/9I5KNpjom/5NFtkmGseEH+AK/hny8XrytLH3+b5M8zL/Ycg3fhIocFpUMyl/wpFnVRvdw==", - "type": "package", - "path": "system.net.sockets/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Net.Sockets.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Net.Sockets.dll", - "ref/netstandard1.3/System.Net.Sockets.dll", - "ref/netstandard1.3/System.Net.Sockets.xml", - "ref/netstandard1.3/de/System.Net.Sockets.xml", - "ref/netstandard1.3/es/System.Net.Sockets.xml", - "ref/netstandard1.3/fr/System.Net.Sockets.xml", - "ref/netstandard1.3/it/System.Net.Sockets.xml", - "ref/netstandard1.3/ja/System.Net.Sockets.xml", - "ref/netstandard1.3/ko/System.Net.Sockets.xml", - "ref/netstandard1.3/ru/System.Net.Sockets.xml", - "ref/netstandard1.3/zh-hans/System.Net.Sockets.xml", - "ref/netstandard1.3/zh-hant/System.Net.Sockets.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.net.sockets.4.3.0.nupkg.sha512", - "system.net.sockets.nuspec" - ] - }, - "System.ObjectModel/4.3.0": { - "sha512": "bdX+80eKv9bN6K4N+d77OankKHGn6CH711a6fcOpMQu2Fckp/Ft4L/kW9WznHpyR0NRAvJutzOMHNNlBGvxQzQ==", - "type": "package", - "path": "system.objectmodel/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.ObjectModel.dll", - "lib/netstandard1.3/System.ObjectModel.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.ObjectModel.dll", - "ref/netcore50/System.ObjectModel.xml", - "ref/netcore50/de/System.ObjectModel.xml", - "ref/netcore50/es/System.ObjectModel.xml", - "ref/netcore50/fr/System.ObjectModel.xml", - "ref/netcore50/it/System.ObjectModel.xml", - "ref/netcore50/ja/System.ObjectModel.xml", - "ref/netcore50/ko/System.ObjectModel.xml", - "ref/netcore50/ru/System.ObjectModel.xml", - "ref/netcore50/zh-hans/System.ObjectModel.xml", - "ref/netcore50/zh-hant/System.ObjectModel.xml", - "ref/netstandard1.0/System.ObjectModel.dll", - "ref/netstandard1.0/System.ObjectModel.xml", - "ref/netstandard1.0/de/System.ObjectModel.xml", - "ref/netstandard1.0/es/System.ObjectModel.xml", - "ref/netstandard1.0/fr/System.ObjectModel.xml", - "ref/netstandard1.0/it/System.ObjectModel.xml", - "ref/netstandard1.0/ja/System.ObjectModel.xml", - "ref/netstandard1.0/ko/System.ObjectModel.xml", - "ref/netstandard1.0/ru/System.ObjectModel.xml", - "ref/netstandard1.0/zh-hans/System.ObjectModel.xml", - "ref/netstandard1.0/zh-hant/System.ObjectModel.xml", - "ref/netstandard1.3/System.ObjectModel.dll", - "ref/netstandard1.3/System.ObjectModel.xml", - "ref/netstandard1.3/de/System.ObjectModel.xml", - "ref/netstandard1.3/es/System.ObjectModel.xml", - "ref/netstandard1.3/fr/System.ObjectModel.xml", - "ref/netstandard1.3/it/System.ObjectModel.xml", - "ref/netstandard1.3/ja/System.ObjectModel.xml", - "ref/netstandard1.3/ko/System.ObjectModel.xml", - "ref/netstandard1.3/ru/System.ObjectModel.xml", - "ref/netstandard1.3/zh-hans/System.ObjectModel.xml", - "ref/netstandard1.3/zh-hant/System.ObjectModel.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.objectmodel.4.3.0.nupkg.sha512", - "system.objectmodel.nuspec" - ] - }, - "System.Reflection/4.3.0": { - "sha512": "KMiAFoW7MfJGa9nDFNcfu+FpEdiHpWgTcS2HdMpDvt9saK3y/G4GwprPyzqjFH9NTaGPQeWNHU+iDlDILj96aQ==", - "type": "package", - "path": "system.reflection/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Reflection.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Reflection.dll", - "ref/netcore50/System.Reflection.dll", - "ref/netcore50/System.Reflection.xml", - "ref/netcore50/de/System.Reflection.xml", - "ref/netcore50/es/System.Reflection.xml", - "ref/netcore50/fr/System.Reflection.xml", - "ref/netcore50/it/System.Reflection.xml", - "ref/netcore50/ja/System.Reflection.xml", - "ref/netcore50/ko/System.Reflection.xml", - "ref/netcore50/ru/System.Reflection.xml", - "ref/netcore50/zh-hans/System.Reflection.xml", - "ref/netcore50/zh-hant/System.Reflection.xml", - "ref/netstandard1.0/System.Reflection.dll", - "ref/netstandard1.0/System.Reflection.xml", - "ref/netstandard1.0/de/System.Reflection.xml", - "ref/netstandard1.0/es/System.Reflection.xml", - "ref/netstandard1.0/fr/System.Reflection.xml", - "ref/netstandard1.0/it/System.Reflection.xml", - "ref/netstandard1.0/ja/System.Reflection.xml", - "ref/netstandard1.0/ko/System.Reflection.xml", - "ref/netstandard1.0/ru/System.Reflection.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.xml", - "ref/netstandard1.3/System.Reflection.dll", - "ref/netstandard1.3/System.Reflection.xml", - "ref/netstandard1.3/de/System.Reflection.xml", - "ref/netstandard1.3/es/System.Reflection.xml", - "ref/netstandard1.3/fr/System.Reflection.xml", - "ref/netstandard1.3/it/System.Reflection.xml", - "ref/netstandard1.3/ja/System.Reflection.xml", - "ref/netstandard1.3/ko/System.Reflection.xml", - "ref/netstandard1.3/ru/System.Reflection.xml", - "ref/netstandard1.3/zh-hans/System.Reflection.xml", - "ref/netstandard1.3/zh-hant/System.Reflection.xml", - "ref/netstandard1.5/System.Reflection.dll", - "ref/netstandard1.5/System.Reflection.xml", - "ref/netstandard1.5/de/System.Reflection.xml", - "ref/netstandard1.5/es/System.Reflection.xml", - "ref/netstandard1.5/fr/System.Reflection.xml", - "ref/netstandard1.5/it/System.Reflection.xml", - "ref/netstandard1.5/ja/System.Reflection.xml", - "ref/netstandard1.5/ko/System.Reflection.xml", - "ref/netstandard1.5/ru/System.Reflection.xml", - "ref/netstandard1.5/zh-hans/System.Reflection.xml", - "ref/netstandard1.5/zh-hant/System.Reflection.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.reflection.4.3.0.nupkg.sha512", - "system.reflection.nuspec" - ] - }, - "System.Reflection.Emit/4.3.0": { - "sha512": "228FG0jLcIwTVJyz8CLFKueVqQK36ANazUManGaJHkO0icjiIypKW7YLWLIWahyIkdh5M7mV2dJepllLyA1SKg==", - "type": "package", - "path": "system.reflection.emit/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/monotouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Reflection.Emit.dll", - "lib/netstandard1.3/System.Reflection.Emit.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/net45/_._", - "ref/netstandard1.1/System.Reflection.Emit.dll", - "ref/netstandard1.1/System.Reflection.Emit.xml", - "ref/netstandard1.1/de/System.Reflection.Emit.xml", - "ref/netstandard1.1/es/System.Reflection.Emit.xml", - "ref/netstandard1.1/fr/System.Reflection.Emit.xml", - "ref/netstandard1.1/it/System.Reflection.Emit.xml", - "ref/netstandard1.1/ja/System.Reflection.Emit.xml", - "ref/netstandard1.1/ko/System.Reflection.Emit.xml", - "ref/netstandard1.1/ru/System.Reflection.Emit.xml", - "ref/netstandard1.1/zh-hans/System.Reflection.Emit.xml", - "ref/netstandard1.1/zh-hant/System.Reflection.Emit.xml", - "ref/xamarinmac20/_._", - "system.reflection.emit.4.3.0.nupkg.sha512", - "system.reflection.emit.nuspec" - ] - }, - "System.Reflection.Emit.ILGeneration/4.3.0": { - "sha512": "59tBslAk9733NXLrUJrwNZEzbMAcu8k344OYo+wfSVygcgZ9lgBdGIzH/nrg3LYhXceynyvTc8t5/GD4Ri0/ng==", - "type": "package", - "path": "system.reflection.emit.ilgeneration/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Reflection.Emit.ILGeneration.dll", - "lib/netstandard1.3/System.Reflection.Emit.ILGeneration.dll", - "lib/portable-net45+wp8/_._", - "lib/wp80/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netstandard1.0/System.Reflection.Emit.ILGeneration.dll", - "ref/netstandard1.0/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/de/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/es/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/fr/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/it/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/ja/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/ko/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/ru/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.Emit.ILGeneration.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.Emit.ILGeneration.xml", - "ref/portable-net45+wp8/_._", - "ref/wp80/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/_._", - "system.reflection.emit.ilgeneration.4.3.0.nupkg.sha512", - "system.reflection.emit.ilgeneration.nuspec" - ] - }, - "System.Reflection.Emit.Lightweight/4.3.0": { - "sha512": "oadVHGSMsTmZsAF864QYN1t1QzZjIcuKU3l2S9cZOwDdDueNTrqq1yRj7koFfIGEnKpt6NjpL3rOzRhs4ryOgA==", - "type": "package", - "path": "system.reflection.emit.lightweight/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Reflection.Emit.Lightweight.dll", - "lib/netstandard1.3/System.Reflection.Emit.Lightweight.dll", - "lib/portable-net45+wp8/_._", - "lib/wp80/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netstandard1.0/System.Reflection.Emit.Lightweight.dll", - "ref/netstandard1.0/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/de/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/es/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/fr/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/it/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/ja/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/ko/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/ru/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.Emit.Lightweight.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.Emit.Lightweight.xml", - "ref/portable-net45+wp8/_._", - "ref/wp80/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/_._", - "system.reflection.emit.lightweight.4.3.0.nupkg.sha512", - "system.reflection.emit.lightweight.nuspec" - ] - }, - "System.Reflection.Extensions/4.3.0": { - "sha512": "rJkrJD3kBI5B712aRu4DpSIiHRtr6QlfZSQsb0hYHrDCZORXCFjQfoipo2LaMUHoT9i1B7j7MnfaEKWDFmFQNQ==", - "type": "package", - "path": "system.reflection.extensions/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Reflection.Extensions.dll", - "ref/netcore50/System.Reflection.Extensions.xml", - "ref/netcore50/de/System.Reflection.Extensions.xml", - "ref/netcore50/es/System.Reflection.Extensions.xml", - "ref/netcore50/fr/System.Reflection.Extensions.xml", - "ref/netcore50/it/System.Reflection.Extensions.xml", - "ref/netcore50/ja/System.Reflection.Extensions.xml", - "ref/netcore50/ko/System.Reflection.Extensions.xml", - "ref/netcore50/ru/System.Reflection.Extensions.xml", - "ref/netcore50/zh-hans/System.Reflection.Extensions.xml", - "ref/netcore50/zh-hant/System.Reflection.Extensions.xml", - "ref/netstandard1.0/System.Reflection.Extensions.dll", - "ref/netstandard1.0/System.Reflection.Extensions.xml", - "ref/netstandard1.0/de/System.Reflection.Extensions.xml", - "ref/netstandard1.0/es/System.Reflection.Extensions.xml", - "ref/netstandard1.0/fr/System.Reflection.Extensions.xml", - "ref/netstandard1.0/it/System.Reflection.Extensions.xml", - "ref/netstandard1.0/ja/System.Reflection.Extensions.xml", - "ref/netstandard1.0/ko/System.Reflection.Extensions.xml", - "ref/netstandard1.0/ru/System.Reflection.Extensions.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.Extensions.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.Extensions.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.reflection.extensions.4.3.0.nupkg.sha512", - "system.reflection.extensions.nuspec" - ] - }, - "System.Reflection.Metadata/8.0.0": { - "sha512": "ptvgrFh7PvWI8bcVqG5rsA/weWM09EnthFHR5SCnS6IN+P4mj6rE1lBDC4U8HL9/57htKAqy4KQ3bBj84cfYyQ==", - "type": "package", - "path": "system.reflection.metadata/8.0.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "LICENSE.TXT", - "PACKAGE.md", - "THIRD-PARTY-NOTICES.TXT", - "buildTransitive/net461/System.Reflection.Metadata.targets", - "buildTransitive/net462/_._", - "buildTransitive/net6.0/_._", - "buildTransitive/netcoreapp2.0/System.Reflection.Metadata.targets", - "lib/net462/System.Reflection.Metadata.dll", - "lib/net462/System.Reflection.Metadata.xml", - "lib/net6.0/System.Reflection.Metadata.dll", - "lib/net6.0/System.Reflection.Metadata.xml", - "lib/net7.0/System.Reflection.Metadata.dll", - "lib/net7.0/System.Reflection.Metadata.xml", - "lib/net8.0/System.Reflection.Metadata.dll", - "lib/net8.0/System.Reflection.Metadata.xml", - "lib/netstandard2.0/System.Reflection.Metadata.dll", - "lib/netstandard2.0/System.Reflection.Metadata.xml", - "system.reflection.metadata.8.0.0.nupkg.sha512", - "system.reflection.metadata.nuspec", - "useSharedDesignerContext.txt" - ] - }, - "System.Reflection.Primitives/4.3.0": { - "sha512": "5RXItQz5As4xN2/YUDxdpsEkMhvw3e6aNveFXUn4Hl/udNTCNhnKp8lT9fnc3MhvGKh1baak5CovpuQUXHAlIA==", - "type": "package", - "path": "system.reflection.primitives/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Reflection.Primitives.dll", - "ref/netcore50/System.Reflection.Primitives.xml", - "ref/netcore50/de/System.Reflection.Primitives.xml", - "ref/netcore50/es/System.Reflection.Primitives.xml", - "ref/netcore50/fr/System.Reflection.Primitives.xml", - "ref/netcore50/it/System.Reflection.Primitives.xml", - "ref/netcore50/ja/System.Reflection.Primitives.xml", - "ref/netcore50/ko/System.Reflection.Primitives.xml", - "ref/netcore50/ru/System.Reflection.Primitives.xml", - "ref/netcore50/zh-hans/System.Reflection.Primitives.xml", - "ref/netcore50/zh-hant/System.Reflection.Primitives.xml", - "ref/netstandard1.0/System.Reflection.Primitives.dll", - "ref/netstandard1.0/System.Reflection.Primitives.xml", - "ref/netstandard1.0/de/System.Reflection.Primitives.xml", - "ref/netstandard1.0/es/System.Reflection.Primitives.xml", - "ref/netstandard1.0/fr/System.Reflection.Primitives.xml", - "ref/netstandard1.0/it/System.Reflection.Primitives.xml", - "ref/netstandard1.0/ja/System.Reflection.Primitives.xml", - "ref/netstandard1.0/ko/System.Reflection.Primitives.xml", - "ref/netstandard1.0/ru/System.Reflection.Primitives.xml", - "ref/netstandard1.0/zh-hans/System.Reflection.Primitives.xml", - "ref/netstandard1.0/zh-hant/System.Reflection.Primitives.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.reflection.primitives.4.3.0.nupkg.sha512", - "system.reflection.primitives.nuspec" - ] - }, - "System.Reflection.TypeExtensions/4.3.0": { - "sha512": "7u6ulLcZbyxB5Gq0nMkQttcdBTx57ibzw+4IOXEfR+sXYQoHvjW5LTLyNr8O22UIMrqYbchJQJnos4eooYzYJA==", - "type": "package", - "path": "system.reflection.typeextensions/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Reflection.TypeExtensions.dll", - "lib/net462/System.Reflection.TypeExtensions.dll", - "lib/netcore50/System.Reflection.TypeExtensions.dll", - "lib/netstandard1.5/System.Reflection.TypeExtensions.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Reflection.TypeExtensions.dll", - "ref/net462/System.Reflection.TypeExtensions.dll", - "ref/netstandard1.3/System.Reflection.TypeExtensions.dll", - "ref/netstandard1.3/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/de/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/es/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/fr/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/it/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/ja/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/ko/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/ru/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/zh-hans/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.3/zh-hant/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/System.Reflection.TypeExtensions.dll", - "ref/netstandard1.5/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/de/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/es/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/fr/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/it/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/ja/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/ko/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/ru/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/zh-hans/System.Reflection.TypeExtensions.xml", - "ref/netstandard1.5/zh-hant/System.Reflection.TypeExtensions.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Reflection.TypeExtensions.dll", - "system.reflection.typeextensions.4.3.0.nupkg.sha512", - "system.reflection.typeextensions.nuspec" - ] - }, - "System.Resources.ResourceManager/4.3.0": { - "sha512": "/zrcPkkWdZmI4F92gL/TPumP98AVDu/Wxr3CSJGQQ+XN6wbRZcyfSKVoPo17ilb3iOr0cCRqJInGwNMolqhS8A==", - "type": "package", - "path": "system.resources.resourcemanager/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Resources.ResourceManager.dll", - "ref/netcore50/System.Resources.ResourceManager.xml", - "ref/netcore50/de/System.Resources.ResourceManager.xml", - "ref/netcore50/es/System.Resources.ResourceManager.xml", - "ref/netcore50/fr/System.Resources.ResourceManager.xml", - "ref/netcore50/it/System.Resources.ResourceManager.xml", - "ref/netcore50/ja/System.Resources.ResourceManager.xml", - "ref/netcore50/ko/System.Resources.ResourceManager.xml", - "ref/netcore50/ru/System.Resources.ResourceManager.xml", - "ref/netcore50/zh-hans/System.Resources.ResourceManager.xml", - "ref/netcore50/zh-hant/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/System.Resources.ResourceManager.dll", - "ref/netstandard1.0/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/de/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/es/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/fr/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/it/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/ja/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/ko/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/ru/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/zh-hans/System.Resources.ResourceManager.xml", - "ref/netstandard1.0/zh-hant/System.Resources.ResourceManager.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.resources.resourcemanager.4.3.0.nupkg.sha512", - "system.resources.resourcemanager.nuspec" - ] - }, - "System.Runtime/4.3.0": { - "sha512": "JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==", - "type": "package", - "path": "system.runtime/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Runtime.dll", - "lib/portable-net45+win8+wp80+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Runtime.dll", - "ref/netcore50/System.Runtime.dll", - "ref/netcore50/System.Runtime.xml", - "ref/netcore50/de/System.Runtime.xml", - "ref/netcore50/es/System.Runtime.xml", - "ref/netcore50/fr/System.Runtime.xml", - "ref/netcore50/it/System.Runtime.xml", - "ref/netcore50/ja/System.Runtime.xml", - "ref/netcore50/ko/System.Runtime.xml", - "ref/netcore50/ru/System.Runtime.xml", - "ref/netcore50/zh-hans/System.Runtime.xml", - "ref/netcore50/zh-hant/System.Runtime.xml", - "ref/netstandard1.0/System.Runtime.dll", - "ref/netstandard1.0/System.Runtime.xml", - "ref/netstandard1.0/de/System.Runtime.xml", - "ref/netstandard1.0/es/System.Runtime.xml", - "ref/netstandard1.0/fr/System.Runtime.xml", - "ref/netstandard1.0/it/System.Runtime.xml", - "ref/netstandard1.0/ja/System.Runtime.xml", - "ref/netstandard1.0/ko/System.Runtime.xml", - "ref/netstandard1.0/ru/System.Runtime.xml", - "ref/netstandard1.0/zh-hans/System.Runtime.xml", - "ref/netstandard1.0/zh-hant/System.Runtime.xml", - "ref/netstandard1.2/System.Runtime.dll", - "ref/netstandard1.2/System.Runtime.xml", - "ref/netstandard1.2/de/System.Runtime.xml", - "ref/netstandard1.2/es/System.Runtime.xml", - "ref/netstandard1.2/fr/System.Runtime.xml", - "ref/netstandard1.2/it/System.Runtime.xml", - "ref/netstandard1.2/ja/System.Runtime.xml", - "ref/netstandard1.2/ko/System.Runtime.xml", - "ref/netstandard1.2/ru/System.Runtime.xml", - "ref/netstandard1.2/zh-hans/System.Runtime.xml", - "ref/netstandard1.2/zh-hant/System.Runtime.xml", - "ref/netstandard1.3/System.Runtime.dll", - "ref/netstandard1.3/System.Runtime.xml", - "ref/netstandard1.3/de/System.Runtime.xml", - "ref/netstandard1.3/es/System.Runtime.xml", - "ref/netstandard1.3/fr/System.Runtime.xml", - "ref/netstandard1.3/it/System.Runtime.xml", - "ref/netstandard1.3/ja/System.Runtime.xml", - "ref/netstandard1.3/ko/System.Runtime.xml", - "ref/netstandard1.3/ru/System.Runtime.xml", - "ref/netstandard1.3/zh-hans/System.Runtime.xml", - "ref/netstandard1.3/zh-hant/System.Runtime.xml", - "ref/netstandard1.5/System.Runtime.dll", - "ref/netstandard1.5/System.Runtime.xml", - "ref/netstandard1.5/de/System.Runtime.xml", - "ref/netstandard1.5/es/System.Runtime.xml", - "ref/netstandard1.5/fr/System.Runtime.xml", - "ref/netstandard1.5/it/System.Runtime.xml", - "ref/netstandard1.5/ja/System.Runtime.xml", - "ref/netstandard1.5/ko/System.Runtime.xml", - "ref/netstandard1.5/ru/System.Runtime.xml", - "ref/netstandard1.5/zh-hans/System.Runtime.xml", - "ref/netstandard1.5/zh-hant/System.Runtime.xml", - "ref/portable-net45+win8+wp80+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.runtime.4.3.0.nupkg.sha512", - "system.runtime.nuspec" - ] - }, - "System.Runtime.CompilerServices.Unsafe/6.1.0": { - "sha512": "5o/HZxx6RVqYlhKSq8/zronDkALJZUT2Vz0hx43f0gwe8mwlM0y2nYlqdBwLMzr262Bwvpikeb/yEwkAa5PADg==", - "type": "package", - "path": "system.runtime.compilerservices.unsafe/6.1.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "PACKAGE.md", - "buildTransitive/net461/System.Runtime.CompilerServices.Unsafe.targets", - "buildTransitive/net462/_._", - "buildTransitive/net6.0/_._", - "buildTransitive/netcoreapp2.0/System.Runtime.CompilerServices.Unsafe.targets", - "lib/net462/System.Runtime.CompilerServices.Unsafe.dll", - "lib/net462/System.Runtime.CompilerServices.Unsafe.xml", - "lib/net7.0/_._", - "lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll", - "lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.xml", - "system.runtime.compilerservices.unsafe.6.1.0.nupkg.sha512", - "system.runtime.compilerservices.unsafe.nuspec" - ] - }, - "System.Runtime.Extensions/4.3.0": { - "sha512": "guW0uK0fn5fcJJ1tJVXYd7/1h5F+pea1r7FLSOz/f8vPEqbR2ZAknuRDvTQ8PzAilDveOxNjSfr0CHfIQfFk8g==", - "type": "package", - "path": "system.runtime.extensions/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Runtime.Extensions.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Runtime.Extensions.dll", - "ref/netcore50/System.Runtime.Extensions.dll", - "ref/netcore50/System.Runtime.Extensions.xml", - "ref/netcore50/de/System.Runtime.Extensions.xml", - "ref/netcore50/es/System.Runtime.Extensions.xml", - "ref/netcore50/fr/System.Runtime.Extensions.xml", - "ref/netcore50/it/System.Runtime.Extensions.xml", - "ref/netcore50/ja/System.Runtime.Extensions.xml", - "ref/netcore50/ko/System.Runtime.Extensions.xml", - "ref/netcore50/ru/System.Runtime.Extensions.xml", - "ref/netcore50/zh-hans/System.Runtime.Extensions.xml", - "ref/netcore50/zh-hant/System.Runtime.Extensions.xml", - "ref/netstandard1.0/System.Runtime.Extensions.dll", - "ref/netstandard1.0/System.Runtime.Extensions.xml", - "ref/netstandard1.0/de/System.Runtime.Extensions.xml", - "ref/netstandard1.0/es/System.Runtime.Extensions.xml", - "ref/netstandard1.0/fr/System.Runtime.Extensions.xml", - "ref/netstandard1.0/it/System.Runtime.Extensions.xml", - "ref/netstandard1.0/ja/System.Runtime.Extensions.xml", - "ref/netstandard1.0/ko/System.Runtime.Extensions.xml", - "ref/netstandard1.0/ru/System.Runtime.Extensions.xml", - "ref/netstandard1.0/zh-hans/System.Runtime.Extensions.xml", - "ref/netstandard1.0/zh-hant/System.Runtime.Extensions.xml", - "ref/netstandard1.3/System.Runtime.Extensions.dll", - "ref/netstandard1.3/System.Runtime.Extensions.xml", - "ref/netstandard1.3/de/System.Runtime.Extensions.xml", - "ref/netstandard1.3/es/System.Runtime.Extensions.xml", - "ref/netstandard1.3/fr/System.Runtime.Extensions.xml", - "ref/netstandard1.3/it/System.Runtime.Extensions.xml", - "ref/netstandard1.3/ja/System.Runtime.Extensions.xml", - "ref/netstandard1.3/ko/System.Runtime.Extensions.xml", - "ref/netstandard1.3/ru/System.Runtime.Extensions.xml", - "ref/netstandard1.3/zh-hans/System.Runtime.Extensions.xml", - "ref/netstandard1.3/zh-hant/System.Runtime.Extensions.xml", - "ref/netstandard1.5/System.Runtime.Extensions.dll", - "ref/netstandard1.5/System.Runtime.Extensions.xml", - "ref/netstandard1.5/de/System.Runtime.Extensions.xml", - "ref/netstandard1.5/es/System.Runtime.Extensions.xml", - "ref/netstandard1.5/fr/System.Runtime.Extensions.xml", - "ref/netstandard1.5/it/System.Runtime.Extensions.xml", - "ref/netstandard1.5/ja/System.Runtime.Extensions.xml", - "ref/netstandard1.5/ko/System.Runtime.Extensions.xml", - "ref/netstandard1.5/ru/System.Runtime.Extensions.xml", - "ref/netstandard1.5/zh-hans/System.Runtime.Extensions.xml", - "ref/netstandard1.5/zh-hant/System.Runtime.Extensions.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.runtime.extensions.4.3.0.nupkg.sha512", - "system.runtime.extensions.nuspec" - ] - }, - "System.Runtime.Handles/4.3.0": { - "sha512": "OKiSUN7DmTWeYb3l51A7EYaeNMnvxwE249YtZz7yooT4gOZhmTjIn48KgSsw2k2lYdLgTKNJw/ZIfSElwDRVgg==", - "type": "package", - "path": "system.runtime.handles/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/_._", - "ref/netstandard1.3/System.Runtime.Handles.dll", - "ref/netstandard1.3/System.Runtime.Handles.xml", - "ref/netstandard1.3/de/System.Runtime.Handles.xml", - "ref/netstandard1.3/es/System.Runtime.Handles.xml", - "ref/netstandard1.3/fr/System.Runtime.Handles.xml", - "ref/netstandard1.3/it/System.Runtime.Handles.xml", - "ref/netstandard1.3/ja/System.Runtime.Handles.xml", - "ref/netstandard1.3/ko/System.Runtime.Handles.xml", - "ref/netstandard1.3/ru/System.Runtime.Handles.xml", - "ref/netstandard1.3/zh-hans/System.Runtime.Handles.xml", - "ref/netstandard1.3/zh-hant/System.Runtime.Handles.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.runtime.handles.4.3.0.nupkg.sha512", - "system.runtime.handles.nuspec" - ] - }, - "System.Runtime.InteropServices/4.3.0": { - "sha512": "uv1ynXqiMK8mp1GM3jDqPCFN66eJ5w5XNomaK2XD+TuCroNTLFGeZ+WCmBMcBDyTFKou3P6cR6J/QsaqDp7fGQ==", - "type": "package", - "path": "system.runtime.interopservices/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net462/System.Runtime.InteropServices.dll", - "lib/net463/System.Runtime.InteropServices.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net462/System.Runtime.InteropServices.dll", - "ref/net463/System.Runtime.InteropServices.dll", - "ref/netcore50/System.Runtime.InteropServices.dll", - "ref/netcore50/System.Runtime.InteropServices.xml", - "ref/netcore50/de/System.Runtime.InteropServices.xml", - "ref/netcore50/es/System.Runtime.InteropServices.xml", - "ref/netcore50/fr/System.Runtime.InteropServices.xml", - "ref/netcore50/it/System.Runtime.InteropServices.xml", - "ref/netcore50/ja/System.Runtime.InteropServices.xml", - "ref/netcore50/ko/System.Runtime.InteropServices.xml", - "ref/netcore50/ru/System.Runtime.InteropServices.xml", - "ref/netcore50/zh-hans/System.Runtime.InteropServices.xml", - "ref/netcore50/zh-hant/System.Runtime.InteropServices.xml", - "ref/netcoreapp1.1/System.Runtime.InteropServices.dll", - "ref/netstandard1.1/System.Runtime.InteropServices.dll", - "ref/netstandard1.1/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/de/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/es/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/fr/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/it/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/ja/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/ko/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/ru/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/zh-hans/System.Runtime.InteropServices.xml", - "ref/netstandard1.1/zh-hant/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/System.Runtime.InteropServices.dll", - "ref/netstandard1.2/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/de/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/es/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/fr/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/it/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/ja/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/ko/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/ru/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/zh-hans/System.Runtime.InteropServices.xml", - "ref/netstandard1.2/zh-hant/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/System.Runtime.InteropServices.dll", - "ref/netstandard1.3/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/de/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/es/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/fr/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/it/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/ja/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/ko/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/ru/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/zh-hans/System.Runtime.InteropServices.xml", - "ref/netstandard1.3/zh-hant/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/System.Runtime.InteropServices.dll", - "ref/netstandard1.5/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/de/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/es/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/fr/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/it/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/ja/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/ko/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/ru/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/zh-hans/System.Runtime.InteropServices.xml", - "ref/netstandard1.5/zh-hant/System.Runtime.InteropServices.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.runtime.interopservices.4.3.0.nupkg.sha512", - "system.runtime.interopservices.nuspec" - ] - }, - "System.Runtime.InteropServices.RuntimeInformation/4.3.0": { - "sha512": "cbz4YJMqRDR7oLeMRbdYv7mYzc++17lNhScCX0goO2XpGWdvAt60CGN+FHdePUEHCe/Jy9jUlvNAiNdM+7jsOw==", - "type": "package", - "path": "system.runtime.interopservices.runtimeinformation/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/System.Runtime.InteropServices.RuntimeInformation.dll", - "lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll", - "lib/win8/System.Runtime.InteropServices.RuntimeInformation.dll", - "lib/wpa81/System.Runtime.InteropServices.RuntimeInformation.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Runtime.InteropServices.RuntimeInformation.dll", - "runtimes/unix/lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll", - "runtimes/win/lib/net45/System.Runtime.InteropServices.RuntimeInformation.dll", - "runtimes/win/lib/netcore50/System.Runtime.InteropServices.RuntimeInformation.dll", - "runtimes/win/lib/netstandard1.1/System.Runtime.InteropServices.RuntimeInformation.dll", - "system.runtime.interopservices.runtimeinformation.4.3.0.nupkg.sha512", - "system.runtime.interopservices.runtimeinformation.nuspec" - ] - }, - "System.Runtime.Numerics/4.3.0": { - "sha512": "yMH+MfdzHjy17l2KESnPiF2dwq7T+xLnSJar7slyimAkUh/gTrS9/UQOtv7xarskJ2/XDSNvfLGOBQPjL7PaHQ==", - "type": "package", - "path": "system.runtime.numerics/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Runtime.Numerics.dll", - "lib/netstandard1.3/System.Runtime.Numerics.dll", - "lib/portable-net45+win8+wpa81/_._", - "lib/win8/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Runtime.Numerics.dll", - "ref/netcore50/System.Runtime.Numerics.xml", - "ref/netcore50/de/System.Runtime.Numerics.xml", - "ref/netcore50/es/System.Runtime.Numerics.xml", - "ref/netcore50/fr/System.Runtime.Numerics.xml", - "ref/netcore50/it/System.Runtime.Numerics.xml", - "ref/netcore50/ja/System.Runtime.Numerics.xml", - "ref/netcore50/ko/System.Runtime.Numerics.xml", - "ref/netcore50/ru/System.Runtime.Numerics.xml", - "ref/netcore50/zh-hans/System.Runtime.Numerics.xml", - "ref/netcore50/zh-hant/System.Runtime.Numerics.xml", - "ref/netstandard1.1/System.Runtime.Numerics.dll", - "ref/netstandard1.1/System.Runtime.Numerics.xml", - "ref/netstandard1.1/de/System.Runtime.Numerics.xml", - "ref/netstandard1.1/es/System.Runtime.Numerics.xml", - "ref/netstandard1.1/fr/System.Runtime.Numerics.xml", - "ref/netstandard1.1/it/System.Runtime.Numerics.xml", - "ref/netstandard1.1/ja/System.Runtime.Numerics.xml", - "ref/netstandard1.1/ko/System.Runtime.Numerics.xml", - "ref/netstandard1.1/ru/System.Runtime.Numerics.xml", - "ref/netstandard1.1/zh-hans/System.Runtime.Numerics.xml", - "ref/netstandard1.1/zh-hant/System.Runtime.Numerics.xml", - "ref/portable-net45+win8+wpa81/_._", - "ref/win8/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.runtime.numerics.4.3.0.nupkg.sha512", - "system.runtime.numerics.nuspec" - ] - }, - "System.Security.AccessControl/4.5.0": { - "sha512": "vW8Eoq0TMyz5vAG/6ce483x/CP83fgm4SJe5P8Tb1tZaobcvPrbMEL7rhH1DRdrYbbb6F0vq3OlzmK0Pkwks5A==", - "type": "package", - "path": "system.security.accesscontrol/4.5.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "LICENSE.TXT", - "THIRD-PARTY-NOTICES.TXT", - "lib/net46/System.Security.AccessControl.dll", - "lib/net461/System.Security.AccessControl.dll", - "lib/netstandard1.3/System.Security.AccessControl.dll", - "lib/netstandard2.0/System.Security.AccessControl.dll", - "lib/uap10.0.16299/_._", - "ref/net46/System.Security.AccessControl.dll", - "ref/net461/System.Security.AccessControl.dll", - "ref/net461/System.Security.AccessControl.xml", - "ref/netstandard1.3/System.Security.AccessControl.dll", - "ref/netstandard1.3/System.Security.AccessControl.xml", - "ref/netstandard1.3/de/System.Security.AccessControl.xml", - "ref/netstandard1.3/es/System.Security.AccessControl.xml", - "ref/netstandard1.3/fr/System.Security.AccessControl.xml", - "ref/netstandard1.3/it/System.Security.AccessControl.xml", - "ref/netstandard1.3/ja/System.Security.AccessControl.xml", - "ref/netstandard1.3/ko/System.Security.AccessControl.xml", - "ref/netstandard1.3/ru/System.Security.AccessControl.xml", - "ref/netstandard1.3/zh-hans/System.Security.AccessControl.xml", - "ref/netstandard1.3/zh-hant/System.Security.AccessControl.xml", - "ref/netstandard2.0/System.Security.AccessControl.dll", - "ref/netstandard2.0/System.Security.AccessControl.xml", - "ref/uap10.0.16299/_._", - "runtimes/win/lib/net46/System.Security.AccessControl.dll", - "runtimes/win/lib/net461/System.Security.AccessControl.dll", - "runtimes/win/lib/netcoreapp2.0/System.Security.AccessControl.dll", - "runtimes/win/lib/netstandard1.3/System.Security.AccessControl.dll", - "runtimes/win/lib/uap10.0.16299/_._", - "system.security.accesscontrol.4.5.0.nupkg.sha512", - "system.security.accesscontrol.nuspec", - "useSharedDesignerContext.txt", - "version.txt" - ] - }, - "System.Security.Cryptography.Algorithms/4.3.0": { - "sha512": "W1kd2Y8mYSCgc3ULTAZ0hOP2dSdG5YauTb1089T0/kRcN2MpSAW1izOFROrJgxSlMn3ArsgHXagigyi+ibhevg==", - "type": "package", - "path": "system.security.cryptography.algorithms/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.Algorithms.dll", - "lib/net461/System.Security.Cryptography.Algorithms.dll", - "lib/net463/System.Security.Cryptography.Algorithms.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.Algorithms.dll", - "ref/net461/System.Security.Cryptography.Algorithms.dll", - "ref/net463/System.Security.Cryptography.Algorithms.dll", - "ref/netstandard1.3/System.Security.Cryptography.Algorithms.dll", - "ref/netstandard1.4/System.Security.Cryptography.Algorithms.dll", - "ref/netstandard1.6/System.Security.Cryptography.Algorithms.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/osx/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll", - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll", - "runtimes/win/lib/net46/System.Security.Cryptography.Algorithms.dll", - "runtimes/win/lib/net461/System.Security.Cryptography.Algorithms.dll", - "runtimes/win/lib/net463/System.Security.Cryptography.Algorithms.dll", - "runtimes/win/lib/netcore50/System.Security.Cryptography.Algorithms.dll", - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.Algorithms.dll", - "system.security.cryptography.algorithms.4.3.0.nupkg.sha512", - "system.security.cryptography.algorithms.nuspec" - ] - }, - "System.Security.Cryptography.Cng/5.0.0": { - "sha512": "jIMXsKn94T9JY7PvPq/tMfqa6GAaHpElRDpmG+SuL+D3+sTw2M8VhnibKnN8Tq+4JqbPJ/f+BwtLeDMEnzAvRg==", - "type": "package", - "path": "system.security.cryptography.cng/5.0.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "LICENSE.TXT", - "THIRD-PARTY-NOTICES.TXT", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.Cng.dll", - "lib/net461/System.Security.Cryptography.Cng.dll", - "lib/net461/System.Security.Cryptography.Cng.xml", - "lib/net462/System.Security.Cryptography.Cng.dll", - "lib/net462/System.Security.Cryptography.Cng.xml", - "lib/net47/System.Security.Cryptography.Cng.dll", - "lib/net47/System.Security.Cryptography.Cng.xml", - "lib/netcoreapp2.1/System.Security.Cryptography.Cng.dll", - "lib/netcoreapp3.0/System.Security.Cryptography.Cng.dll", - "lib/netcoreapp3.0/System.Security.Cryptography.Cng.xml", - "lib/netstandard1.3/System.Security.Cryptography.Cng.dll", - "lib/netstandard1.4/System.Security.Cryptography.Cng.dll", - "lib/netstandard1.6/System.Security.Cryptography.Cng.dll", - "lib/netstandard2.0/System.Security.Cryptography.Cng.dll", - "lib/netstandard2.0/System.Security.Cryptography.Cng.xml", - "lib/netstandard2.1/System.Security.Cryptography.Cng.dll", - "lib/netstandard2.1/System.Security.Cryptography.Cng.xml", - "lib/uap10.0.16299/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.Cng.dll", - "ref/net461/System.Security.Cryptography.Cng.dll", - "ref/net461/System.Security.Cryptography.Cng.xml", - "ref/net462/System.Security.Cryptography.Cng.dll", - "ref/net462/System.Security.Cryptography.Cng.xml", - "ref/net47/System.Security.Cryptography.Cng.dll", - "ref/net47/System.Security.Cryptography.Cng.xml", - "ref/netcoreapp2.0/System.Security.Cryptography.Cng.dll", - "ref/netcoreapp2.0/System.Security.Cryptography.Cng.xml", - "ref/netcoreapp2.1/System.Security.Cryptography.Cng.dll", - "ref/netcoreapp2.1/System.Security.Cryptography.Cng.xml", - "ref/netcoreapp3.0/System.Security.Cryptography.Cng.dll", - "ref/netcoreapp3.0/System.Security.Cryptography.Cng.xml", - "ref/netstandard1.3/System.Security.Cryptography.Cng.dll", - "ref/netstandard1.4/System.Security.Cryptography.Cng.dll", - "ref/netstandard1.6/System.Security.Cryptography.Cng.dll", - "ref/netstandard2.0/System.Security.Cryptography.Cng.dll", - "ref/netstandard2.0/System.Security.Cryptography.Cng.xml", - "ref/netstandard2.1/System.Security.Cryptography.Cng.dll", - "ref/netstandard2.1/System.Security.Cryptography.Cng.xml", - "ref/uap10.0.16299/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/win/lib/net46/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/net461/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/net461/System.Security.Cryptography.Cng.xml", - "runtimes/win/lib/net462/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/net462/System.Security.Cryptography.Cng.xml", - "runtimes/win/lib/net47/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/net47/System.Security.Cryptography.Cng.xml", - "runtimes/win/lib/netcoreapp2.0/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/netcoreapp2.1/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/netcoreapp3.0/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/netcoreapp3.0/System.Security.Cryptography.Cng.xml", - "runtimes/win/lib/netstandard1.4/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.Cng.dll", - "runtimes/win/lib/uap10.0.16299/_._", - "system.security.cryptography.cng.5.0.0.nupkg.sha512", - "system.security.cryptography.cng.nuspec", - "useSharedDesignerContext.txt", - "version.txt" - ] - }, - "System.Security.Cryptography.Csp/4.3.0": { - "sha512": "X4s/FCkEUnRGnwR3aSfVIkldBmtURMhmexALNTwpjklzxWU7yjMk7GHLKOZTNkgnWnE0q7+BCf9N2LVRWxewaA==", - "type": "package", - "path": "system.security.cryptography.csp/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.Csp.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.Csp.dll", - "ref/netstandard1.3/System.Security.Cryptography.Csp.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.Security.Cryptography.Csp.dll", - "runtimes/win/lib/net46/System.Security.Cryptography.Csp.dll", - "runtimes/win/lib/netcore50/_._", - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Csp.dll", - "system.security.cryptography.csp.4.3.0.nupkg.sha512", - "system.security.cryptography.csp.nuspec" - ] - }, - "System.Security.Cryptography.Encoding/4.3.0": { - "sha512": "1DEWjZZly9ae9C79vFwqaO5kaOlI5q+3/55ohmq/7dpDyDfc8lYe7YVxJUZ5MF/NtbkRjwFRo14yM4OEo9EmDw==", - "type": "package", - "path": "system.security.cryptography.encoding/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.Encoding.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.Encoding.dll", - "ref/netstandard1.3/System.Security.Cryptography.Encoding.dll", - "ref/netstandard1.3/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/de/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/es/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/fr/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/it/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/ja/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/ko/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/ru/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/zh-hans/System.Security.Cryptography.Encoding.xml", - "ref/netstandard1.3/zh-hant/System.Security.Cryptography.Encoding.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll", - "runtimes/win/lib/net46/System.Security.Cryptography.Encoding.dll", - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Encoding.dll", - "system.security.cryptography.encoding.4.3.0.nupkg.sha512", - "system.security.cryptography.encoding.nuspec" - ] - }, - "System.Security.Cryptography.OpenSsl/4.3.0": { - "sha512": "h4CEgOgv5PKVF/HwaHzJRiVboL2THYCou97zpmhjghx5frc7fIvlkY1jL+lnIQyChrJDMNEXS6r7byGif8Cy4w==", - "type": "package", - "path": "system.security.cryptography.openssl/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll", - "ref/netstandard1.6/System.Security.Cryptography.OpenSsl.dll", - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.OpenSsl.dll", - "system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "system.security.cryptography.openssl.nuspec" - ] - }, - "System.Security.Cryptography.Pkcs/5.0.0": { - "sha512": "9TPLGjBCGKmNvG8pjwPeuYy0SMVmGZRwlTZvyPHDbYv/DRkoeumJdfumaaDNQzVGMEmbWtg07zUpSW9q70IlDQ==", - "type": "package", - "path": "system.security.cryptography.pkcs/5.0.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "LICENSE.TXT", - "THIRD-PARTY-NOTICES.TXT", - "lib/net46/System.Security.Cryptography.Pkcs.dll", - "lib/net461/System.Security.Cryptography.Pkcs.dll", - "lib/net461/System.Security.Cryptography.Pkcs.xml", - "lib/netcoreapp2.1/System.Security.Cryptography.Pkcs.dll", - "lib/netcoreapp3.0/System.Security.Cryptography.Pkcs.dll", - "lib/netcoreapp3.0/System.Security.Cryptography.Pkcs.xml", - "lib/netstandard1.3/System.Security.Cryptography.Pkcs.dll", - "lib/netstandard2.0/System.Security.Cryptography.Pkcs.dll", - "lib/netstandard2.0/System.Security.Cryptography.Pkcs.xml", - "lib/netstandard2.1/System.Security.Cryptography.Pkcs.dll", - "lib/netstandard2.1/System.Security.Cryptography.Pkcs.xml", - "ref/net46/System.Security.Cryptography.Pkcs.dll", - "ref/net461/System.Security.Cryptography.Pkcs.dll", - "ref/net461/System.Security.Cryptography.Pkcs.xml", - "ref/netcoreapp2.1/System.Security.Cryptography.Pkcs.dll", - "ref/netcoreapp2.1/System.Security.Cryptography.Pkcs.xml", - "ref/netcoreapp3.0/System.Security.Cryptography.Pkcs.dll", - "ref/netcoreapp3.0/System.Security.Cryptography.Pkcs.xml", - "ref/netstandard1.3/System.Security.Cryptography.Pkcs.dll", - "ref/netstandard2.0/System.Security.Cryptography.Pkcs.dll", - "ref/netstandard2.0/System.Security.Cryptography.Pkcs.xml", - "ref/netstandard2.1/System.Security.Cryptography.Pkcs.dll", - "ref/netstandard2.1/System.Security.Cryptography.Pkcs.xml", - "runtimes/win/lib/net46/System.Security.Cryptography.Pkcs.dll", - "runtimes/win/lib/net461/System.Security.Cryptography.Pkcs.dll", - "runtimes/win/lib/net461/System.Security.Cryptography.Pkcs.xml", - "runtimes/win/lib/netcoreapp2.1/System.Security.Cryptography.Pkcs.dll", - "runtimes/win/lib/netcoreapp3.0/System.Security.Cryptography.Pkcs.dll", - "runtimes/win/lib/netcoreapp3.0/System.Security.Cryptography.Pkcs.xml", - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.Pkcs.dll", - "runtimes/win/lib/netstandard2.0/System.Security.Cryptography.Pkcs.dll", - "runtimes/win/lib/netstandard2.0/System.Security.Cryptography.Pkcs.xml", - "runtimes/win/lib/netstandard2.1/System.Security.Cryptography.Pkcs.dll", - "runtimes/win/lib/netstandard2.1/System.Security.Cryptography.Pkcs.xml", - "system.security.cryptography.pkcs.5.0.0.nupkg.sha512", - "system.security.cryptography.pkcs.nuspec", - "useSharedDesignerContext.txt", - "version.txt" - ] - }, - "System.Security.Cryptography.Primitives/4.3.0": { - "sha512": "7bDIyVFNL/xKeFHjhobUAQqSpJq9YTOpbEs6mR233Et01STBMXNAc/V+BM6dwYGc95gVh/Zf+iVXWzj3mE8DWg==", - "type": "package", - "path": "system.security.cryptography.primitives/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.Primitives.dll", - "lib/netstandard1.3/System.Security.Cryptography.Primitives.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.Primitives.dll", - "ref/netstandard1.3/System.Security.Cryptography.Primitives.dll", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.security.cryptography.primitives.4.3.0.nupkg.sha512", - "system.security.cryptography.primitives.nuspec" - ] - }, - "System.Security.Cryptography.ProtectedData/4.4.0": { - "sha512": "cJV7ScGW7EhatRsjehfvvYVBvtiSMKgN8bOVI0bQhnF5bU7vnHVIsH49Kva7i7GWaWYvmEzkYVk1TC+gZYBEog==", - "type": "package", - "path": "system.security.cryptography.protecteddata/4.4.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "LICENSE.TXT", - "THIRD-PARTY-NOTICES.TXT", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.ProtectedData.dll", - "lib/net461/System.Security.Cryptography.ProtectedData.dll", - "lib/netstandard1.3/System.Security.Cryptography.ProtectedData.dll", - "lib/netstandard2.0/System.Security.Cryptography.ProtectedData.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.ProtectedData.dll", - "ref/net461/System.Security.Cryptography.ProtectedData.dll", - "ref/net461/System.Security.Cryptography.ProtectedData.xml", - "ref/netstandard1.3/System.Security.Cryptography.ProtectedData.dll", - "ref/netstandard2.0/System.Security.Cryptography.ProtectedData.dll", - "ref/netstandard2.0/System.Security.Cryptography.ProtectedData.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/win/lib/net46/System.Security.Cryptography.ProtectedData.dll", - "runtimes/win/lib/net461/System.Security.Cryptography.ProtectedData.dll", - "runtimes/win/lib/netstandard1.3/System.Security.Cryptography.ProtectedData.dll", - "runtimes/win/lib/netstandard2.0/System.Security.Cryptography.ProtectedData.dll", - "system.security.cryptography.protecteddata.4.4.0.nupkg.sha512", - "system.security.cryptography.protecteddata.nuspec", - "useSharedDesignerContext.txt", - "version.txt" - ] - }, - "System.Security.Cryptography.X509Certificates/4.3.0": { - "sha512": "t2Tmu6Y2NtJ2um0RtcuhP7ZdNNxXEgUm2JeoA/0NvlMjAhKCnM1NX07TDl3244mVp3QU6LPEhT3HTtH1uF7IYw==", - "type": "package", - "path": "system.security.cryptography.x509certificates/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net46/System.Security.Cryptography.X509Certificates.dll", - "lib/net461/System.Security.Cryptography.X509Certificates.dll", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net46/System.Security.Cryptography.X509Certificates.dll", - "ref/net461/System.Security.Cryptography.X509Certificates.dll", - "ref/netstandard1.3/System.Security.Cryptography.X509Certificates.dll", - "ref/netstandard1.3/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/de/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/es/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/fr/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/it/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/ja/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/ko/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/ru/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/zh-hans/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.3/zh-hant/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/System.Security.Cryptography.X509Certificates.dll", - "ref/netstandard1.4/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/de/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/es/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/fr/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/it/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/ja/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/ko/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/ru/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/zh-hans/System.Security.Cryptography.X509Certificates.xml", - "ref/netstandard1.4/zh-hant/System.Security.Cryptography.X509Certificates.xml", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/unix/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll", - "runtimes/win/lib/net46/System.Security.Cryptography.X509Certificates.dll", - "runtimes/win/lib/net461/System.Security.Cryptography.X509Certificates.dll", - "runtimes/win/lib/netcore50/System.Security.Cryptography.X509Certificates.dll", - "runtimes/win/lib/netstandard1.6/System.Security.Cryptography.X509Certificates.dll", - "system.security.cryptography.x509certificates.4.3.0.nupkg.sha512", - "system.security.cryptography.x509certificates.nuspec" - ] - }, - "System.Security.Permissions/4.5.0": { - "sha512": "9gdyuARhUR7H+p5CjyUB/zPk7/Xut3wUSP8NJQB6iZr8L3XUXTMdoLeVAg9N4rqF8oIpE7MpdqHdDHQ7XgJe0g==", - "type": "package", - "path": "system.security.permissions/4.5.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "LICENSE.TXT", - "THIRD-PARTY-NOTICES.TXT", - "lib/net461/System.Security.Permissions.dll", - "lib/netstandard2.0/System.Security.Permissions.dll", - "ref/net461/System.Security.Permissions.dll", - "ref/net461/System.Security.Permissions.xml", - "ref/netstandard2.0/System.Security.Permissions.dll", - "ref/netstandard2.0/System.Security.Permissions.xml", - "system.security.permissions.4.5.0.nupkg.sha512", - "system.security.permissions.nuspec", - "useSharedDesignerContext.txt", - "version.txt" - ] - }, - "System.Security.Principal.Windows/4.5.0": { - "sha512": "U77HfRXlZlOeIXd//Yoj6Jnk8AXlbeisf1oq1os+hxOGVnuG+lGSfGqTwTZBoORFF6j/0q7HXIl8cqwQ9aUGqQ==", - "type": "package", - "path": "system.security.principal.windows/4.5.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "LICENSE.TXT", - "THIRD-PARTY-NOTICES.TXT", - "lib/net46/System.Security.Principal.Windows.dll", - "lib/net461/System.Security.Principal.Windows.dll", - "lib/netstandard1.3/System.Security.Principal.Windows.dll", - "lib/netstandard2.0/System.Security.Principal.Windows.dll", - "lib/uap10.0.16299/_._", - "ref/net46/System.Security.Principal.Windows.dll", - "ref/net461/System.Security.Principal.Windows.dll", - "ref/net461/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/System.Security.Principal.Windows.dll", - "ref/netstandard1.3/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/de/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/es/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/fr/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/it/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/ja/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/ko/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/ru/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/zh-hans/System.Security.Principal.Windows.xml", - "ref/netstandard1.3/zh-hant/System.Security.Principal.Windows.xml", - "ref/netstandard2.0/System.Security.Principal.Windows.dll", - "ref/netstandard2.0/System.Security.Principal.Windows.xml", - "ref/uap10.0.16299/_._", - "runtimes/unix/lib/netcoreapp2.0/System.Security.Principal.Windows.dll", - "runtimes/win/lib/net46/System.Security.Principal.Windows.dll", - "runtimes/win/lib/net461/System.Security.Principal.Windows.dll", - "runtimes/win/lib/netcoreapp2.0/System.Security.Principal.Windows.dll", - "runtimes/win/lib/netstandard1.3/System.Security.Principal.Windows.dll", - "runtimes/win/lib/uap10.0.16299/_._", - "system.security.principal.windows.4.5.0.nupkg.sha512", - "system.security.principal.windows.nuspec", - "useSharedDesignerContext.txt", - "version.txt" - ] - }, - "System.Text.Encoding/4.3.0": { - "sha512": "BiIg+KWaSDOITze6jGQynxg64naAPtqGHBwDrLaCtixsa5bKiR8dpPOHA7ge3C0JJQizJE+sfkz1wV+BAKAYZw==", - "type": "package", - "path": "system.text.encoding/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Text.Encoding.dll", - "ref/netcore50/System.Text.Encoding.xml", - "ref/netcore50/de/System.Text.Encoding.xml", - "ref/netcore50/es/System.Text.Encoding.xml", - "ref/netcore50/fr/System.Text.Encoding.xml", - "ref/netcore50/it/System.Text.Encoding.xml", - "ref/netcore50/ja/System.Text.Encoding.xml", - "ref/netcore50/ko/System.Text.Encoding.xml", - "ref/netcore50/ru/System.Text.Encoding.xml", - "ref/netcore50/zh-hans/System.Text.Encoding.xml", - "ref/netcore50/zh-hant/System.Text.Encoding.xml", - "ref/netstandard1.0/System.Text.Encoding.dll", - "ref/netstandard1.0/System.Text.Encoding.xml", - "ref/netstandard1.0/de/System.Text.Encoding.xml", - "ref/netstandard1.0/es/System.Text.Encoding.xml", - "ref/netstandard1.0/fr/System.Text.Encoding.xml", - "ref/netstandard1.0/it/System.Text.Encoding.xml", - "ref/netstandard1.0/ja/System.Text.Encoding.xml", - "ref/netstandard1.0/ko/System.Text.Encoding.xml", - "ref/netstandard1.0/ru/System.Text.Encoding.xml", - "ref/netstandard1.0/zh-hans/System.Text.Encoding.xml", - "ref/netstandard1.0/zh-hant/System.Text.Encoding.xml", - "ref/netstandard1.3/System.Text.Encoding.dll", - "ref/netstandard1.3/System.Text.Encoding.xml", - "ref/netstandard1.3/de/System.Text.Encoding.xml", - "ref/netstandard1.3/es/System.Text.Encoding.xml", - "ref/netstandard1.3/fr/System.Text.Encoding.xml", - "ref/netstandard1.3/it/System.Text.Encoding.xml", - "ref/netstandard1.3/ja/System.Text.Encoding.xml", - "ref/netstandard1.3/ko/System.Text.Encoding.xml", - "ref/netstandard1.3/ru/System.Text.Encoding.xml", - "ref/netstandard1.3/zh-hans/System.Text.Encoding.xml", - "ref/netstandard1.3/zh-hant/System.Text.Encoding.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.text.encoding.4.3.0.nupkg.sha512", - "system.text.encoding.nuspec" - ] - }, - "System.Text.Encoding.Extensions/4.3.0": { - "sha512": "YVMK0Bt/A43RmwizJoZ22ei2nmrhobgeiYwFzC4YAN+nue8RF6djXDMog0UCn+brerQoYVyaS+ghy9P/MUVcmw==", - "type": "package", - "path": "system.text.encoding.extensions/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Text.Encoding.Extensions.dll", - "ref/netcore50/System.Text.Encoding.Extensions.xml", - "ref/netcore50/de/System.Text.Encoding.Extensions.xml", - "ref/netcore50/es/System.Text.Encoding.Extensions.xml", - "ref/netcore50/fr/System.Text.Encoding.Extensions.xml", - "ref/netcore50/it/System.Text.Encoding.Extensions.xml", - "ref/netcore50/ja/System.Text.Encoding.Extensions.xml", - "ref/netcore50/ko/System.Text.Encoding.Extensions.xml", - "ref/netcore50/ru/System.Text.Encoding.Extensions.xml", - "ref/netcore50/zh-hans/System.Text.Encoding.Extensions.xml", - "ref/netcore50/zh-hant/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/System.Text.Encoding.Extensions.dll", - "ref/netstandard1.0/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/de/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/es/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/fr/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/it/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/ja/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/ko/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/ru/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/zh-hans/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.0/zh-hant/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/System.Text.Encoding.Extensions.dll", - "ref/netstandard1.3/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/de/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/es/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/fr/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/it/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/ja/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/ko/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/ru/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/zh-hans/System.Text.Encoding.Extensions.xml", - "ref/netstandard1.3/zh-hant/System.Text.Encoding.Extensions.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.text.encoding.extensions.4.3.0.nupkg.sha512", - "system.text.encoding.extensions.nuspec" - ] - }, - "System.Text.Encodings.Web/8.0.0": { - "sha512": "yev/k9GHAEGx2Rg3/tU6MQh4HGBXJs70y7j1LaM1i/ER9po+6nnQ6RRqTJn1E7Xu0fbIFK80Nh5EoODxrbxwBQ==", - "type": "package", - "path": "system.text.encodings.web/8.0.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "LICENSE.TXT", - "THIRD-PARTY-NOTICES.TXT", - "buildTransitive/net461/System.Text.Encodings.Web.targets", - "buildTransitive/net462/_._", - "buildTransitive/net6.0/_._", - "buildTransitive/netcoreapp2.0/System.Text.Encodings.Web.targets", - "lib/net462/System.Text.Encodings.Web.dll", - "lib/net462/System.Text.Encodings.Web.xml", - "lib/net6.0/System.Text.Encodings.Web.dll", - "lib/net6.0/System.Text.Encodings.Web.xml", - "lib/net7.0/System.Text.Encodings.Web.dll", - "lib/net7.0/System.Text.Encodings.Web.xml", - "lib/net8.0/System.Text.Encodings.Web.dll", - "lib/net8.0/System.Text.Encodings.Web.xml", - "lib/netstandard2.0/System.Text.Encodings.Web.dll", - "lib/netstandard2.0/System.Text.Encodings.Web.xml", - "runtimes/browser/lib/net6.0/System.Text.Encodings.Web.dll", - "runtimes/browser/lib/net6.0/System.Text.Encodings.Web.xml", - "runtimes/browser/lib/net7.0/System.Text.Encodings.Web.dll", - "runtimes/browser/lib/net7.0/System.Text.Encodings.Web.xml", - "runtimes/browser/lib/net8.0/System.Text.Encodings.Web.dll", - "runtimes/browser/lib/net8.0/System.Text.Encodings.Web.xml", - "system.text.encodings.web.8.0.0.nupkg.sha512", - "system.text.encodings.web.nuspec", - "useSharedDesignerContext.txt" - ] - }, - "System.Text.Json/8.0.4": { - "sha512": "bAkhgDJ88XTsqczoxEMliSrpijKZHhbJQldhAmObj/RbrN3sU5dcokuXmWJWsdQAhiMJ9bTayWsL1C9fbbCRhw==", - "type": "package", - "path": "system.text.json/8.0.4", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "LICENSE.TXT", - "PACKAGE.md", - "THIRD-PARTY-NOTICES.TXT", - "analyzers/dotnet/roslyn3.11/cs/System.Text.Json.SourceGeneration.dll", - "analyzers/dotnet/roslyn3.11/cs/cs/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn3.11/cs/de/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn3.11/cs/es/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn3.11/cs/fr/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn3.11/cs/it/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn3.11/cs/ja/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn3.11/cs/ko/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn3.11/cs/pl/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn3.11/cs/pt-BR/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn3.11/cs/ru/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn3.11/cs/tr/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn3.11/cs/zh-Hans/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn3.11/cs/zh-Hant/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn4.0/cs/System.Text.Json.SourceGeneration.dll", - "analyzers/dotnet/roslyn4.0/cs/cs/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn4.0/cs/de/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn4.0/cs/es/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn4.0/cs/fr/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn4.0/cs/it/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn4.0/cs/ja/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn4.0/cs/ko/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn4.0/cs/pl/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn4.0/cs/pt-BR/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn4.0/cs/ru/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn4.0/cs/tr/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn4.0/cs/zh-Hans/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn4.0/cs/zh-Hant/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn4.4/cs/System.Text.Json.SourceGeneration.dll", - "analyzers/dotnet/roslyn4.4/cs/cs/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn4.4/cs/de/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn4.4/cs/es/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn4.4/cs/fr/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn4.4/cs/it/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn4.4/cs/ja/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn4.4/cs/ko/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn4.4/cs/pl/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn4.4/cs/pt-BR/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn4.4/cs/ru/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn4.4/cs/tr/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn4.4/cs/zh-Hans/System.Text.Json.SourceGeneration.resources.dll", - "analyzers/dotnet/roslyn4.4/cs/zh-Hant/System.Text.Json.SourceGeneration.resources.dll", - "buildTransitive/net461/System.Text.Json.targets", - "buildTransitive/net462/System.Text.Json.targets", - "buildTransitive/net6.0/System.Text.Json.targets", - "buildTransitive/netcoreapp2.0/System.Text.Json.targets", - "buildTransitive/netstandard2.0/System.Text.Json.targets", - "lib/net462/System.Text.Json.dll", - "lib/net462/System.Text.Json.xml", - "lib/net6.0/System.Text.Json.dll", - "lib/net6.0/System.Text.Json.xml", - "lib/net7.0/System.Text.Json.dll", - "lib/net7.0/System.Text.Json.xml", - "lib/net8.0/System.Text.Json.dll", - "lib/net8.0/System.Text.Json.xml", - "lib/netstandard2.0/System.Text.Json.dll", - "lib/netstandard2.0/System.Text.Json.xml", - "system.text.json.8.0.4.nupkg.sha512", - "system.text.json.nuspec", - "useSharedDesignerContext.txt" - ] - }, - "System.Text.RegularExpressions/4.3.0": { - "sha512": "RpT2DA+L660cBt1FssIE9CAGpLFdFPuheB7pLpKpn6ZXNby7jDERe8Ua/Ne2xGiwLVG2JOqziiaVCGDon5sKFA==", - "type": "package", - "path": "system.text.regularexpressions/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net463/System.Text.RegularExpressions.dll", - "lib/netcore50/System.Text.RegularExpressions.dll", - "lib/netstandard1.6/System.Text.RegularExpressions.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net463/System.Text.RegularExpressions.dll", - "ref/netcore50/System.Text.RegularExpressions.dll", - "ref/netcore50/System.Text.RegularExpressions.xml", - "ref/netcore50/de/System.Text.RegularExpressions.xml", - "ref/netcore50/es/System.Text.RegularExpressions.xml", - "ref/netcore50/fr/System.Text.RegularExpressions.xml", - "ref/netcore50/it/System.Text.RegularExpressions.xml", - "ref/netcore50/ja/System.Text.RegularExpressions.xml", - "ref/netcore50/ko/System.Text.RegularExpressions.xml", - "ref/netcore50/ru/System.Text.RegularExpressions.xml", - "ref/netcore50/zh-hans/System.Text.RegularExpressions.xml", - "ref/netcore50/zh-hant/System.Text.RegularExpressions.xml", - "ref/netcoreapp1.1/System.Text.RegularExpressions.dll", - "ref/netstandard1.0/System.Text.RegularExpressions.dll", - "ref/netstandard1.0/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/de/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/es/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/fr/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/it/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/ja/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/ko/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/ru/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/zh-hans/System.Text.RegularExpressions.xml", - "ref/netstandard1.0/zh-hant/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/System.Text.RegularExpressions.dll", - "ref/netstandard1.3/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/de/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/es/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/fr/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/it/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/ja/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/ko/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/ru/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/zh-hans/System.Text.RegularExpressions.xml", - "ref/netstandard1.3/zh-hant/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/System.Text.RegularExpressions.dll", - "ref/netstandard1.6/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/de/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/es/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/fr/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/it/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/ja/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/ko/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/ru/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/zh-hans/System.Text.RegularExpressions.xml", - "ref/netstandard1.6/zh-hant/System.Text.RegularExpressions.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.text.regularexpressions.4.3.0.nupkg.sha512", - "system.text.regularexpressions.nuspec" - ] - }, - "System.Threading/4.3.0": { - "sha512": "VkUS0kOBcUf3Wwm0TSbrevDDZ6BlM+b/HRiapRFWjM5O0NS0LviG0glKmFK+hhPDd1XFeSdU1GmlLhb2CoVpIw==", - "type": "package", - "path": "system.threading/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Threading.dll", - "lib/netstandard1.3/System.Threading.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Threading.dll", - "ref/netcore50/System.Threading.xml", - "ref/netcore50/de/System.Threading.xml", - "ref/netcore50/es/System.Threading.xml", - "ref/netcore50/fr/System.Threading.xml", - "ref/netcore50/it/System.Threading.xml", - "ref/netcore50/ja/System.Threading.xml", - "ref/netcore50/ko/System.Threading.xml", - "ref/netcore50/ru/System.Threading.xml", - "ref/netcore50/zh-hans/System.Threading.xml", - "ref/netcore50/zh-hant/System.Threading.xml", - "ref/netstandard1.0/System.Threading.dll", - "ref/netstandard1.0/System.Threading.xml", - "ref/netstandard1.0/de/System.Threading.xml", - "ref/netstandard1.0/es/System.Threading.xml", - "ref/netstandard1.0/fr/System.Threading.xml", - "ref/netstandard1.0/it/System.Threading.xml", - "ref/netstandard1.0/ja/System.Threading.xml", - "ref/netstandard1.0/ko/System.Threading.xml", - "ref/netstandard1.0/ru/System.Threading.xml", - "ref/netstandard1.0/zh-hans/System.Threading.xml", - "ref/netstandard1.0/zh-hant/System.Threading.xml", - "ref/netstandard1.3/System.Threading.dll", - "ref/netstandard1.3/System.Threading.xml", - "ref/netstandard1.3/de/System.Threading.xml", - "ref/netstandard1.3/es/System.Threading.xml", - "ref/netstandard1.3/fr/System.Threading.xml", - "ref/netstandard1.3/it/System.Threading.xml", - "ref/netstandard1.3/ja/System.Threading.xml", - "ref/netstandard1.3/ko/System.Threading.xml", - "ref/netstandard1.3/ru/System.Threading.xml", - "ref/netstandard1.3/zh-hans/System.Threading.xml", - "ref/netstandard1.3/zh-hant/System.Threading.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "runtimes/aot/lib/netcore50/System.Threading.dll", - "system.threading.4.3.0.nupkg.sha512", - "system.threading.nuspec" - ] - }, - "System.Threading.Tasks/4.3.0": { - "sha512": "LbSxKEdOUhVe8BezB/9uOGGppt+nZf6e1VFyw6v3DN6lqitm0OSn2uXMOdtP0M3W4iMcqcivm2J6UgqiwwnXiA==", - "type": "package", - "path": "system.threading.tasks/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Threading.Tasks.dll", - "ref/netcore50/System.Threading.Tasks.xml", - "ref/netcore50/de/System.Threading.Tasks.xml", - "ref/netcore50/es/System.Threading.Tasks.xml", - "ref/netcore50/fr/System.Threading.Tasks.xml", - "ref/netcore50/it/System.Threading.Tasks.xml", - "ref/netcore50/ja/System.Threading.Tasks.xml", - "ref/netcore50/ko/System.Threading.Tasks.xml", - "ref/netcore50/ru/System.Threading.Tasks.xml", - "ref/netcore50/zh-hans/System.Threading.Tasks.xml", - "ref/netcore50/zh-hant/System.Threading.Tasks.xml", - "ref/netstandard1.0/System.Threading.Tasks.dll", - "ref/netstandard1.0/System.Threading.Tasks.xml", - "ref/netstandard1.0/de/System.Threading.Tasks.xml", - "ref/netstandard1.0/es/System.Threading.Tasks.xml", - "ref/netstandard1.0/fr/System.Threading.Tasks.xml", - "ref/netstandard1.0/it/System.Threading.Tasks.xml", - "ref/netstandard1.0/ja/System.Threading.Tasks.xml", - "ref/netstandard1.0/ko/System.Threading.Tasks.xml", - "ref/netstandard1.0/ru/System.Threading.Tasks.xml", - "ref/netstandard1.0/zh-hans/System.Threading.Tasks.xml", - "ref/netstandard1.0/zh-hant/System.Threading.Tasks.xml", - "ref/netstandard1.3/System.Threading.Tasks.dll", - "ref/netstandard1.3/System.Threading.Tasks.xml", - "ref/netstandard1.3/de/System.Threading.Tasks.xml", - "ref/netstandard1.3/es/System.Threading.Tasks.xml", - "ref/netstandard1.3/fr/System.Threading.Tasks.xml", - "ref/netstandard1.3/it/System.Threading.Tasks.xml", - "ref/netstandard1.3/ja/System.Threading.Tasks.xml", - "ref/netstandard1.3/ko/System.Threading.Tasks.xml", - "ref/netstandard1.3/ru/System.Threading.Tasks.xml", - "ref/netstandard1.3/zh-hans/System.Threading.Tasks.xml", - "ref/netstandard1.3/zh-hant/System.Threading.Tasks.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.threading.tasks.4.3.0.nupkg.sha512", - "system.threading.tasks.nuspec" - ] - }, - "System.Threading.Tasks.Dataflow/4.6.0": { - "sha512": "2hRjGu2r2jxRZ55wmcHO/WbdX+YAOz9x6FE8xqkHZgPaoFMKQZRe9dk8xTZIas8fRjxRmzawnTEWIrhlM+Un7w==", - "type": "package", - "path": "system.threading.tasks.dataflow/4.6.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/System.Threading.Tasks.Dataflow.XML", - "lib/netstandard1.0/System.Threading.Tasks.Dataflow.dll", - "lib/netstandard1.1/System.Threading.Tasks.Dataflow.XML", - "lib/netstandard1.1/System.Threading.Tasks.Dataflow.dll", - "system.threading.tasks.dataflow.4.6.0.nupkg.sha512", - "system.threading.tasks.dataflow.nuspec" - ] - }, - "System.Threading.Tasks.Extensions/4.3.0": { - "sha512": "npvJkVKl5rKXrtl1Kkm6OhOUaYGEiF9wFbppFRWSMoApKzt2PiPHT2Bb8a5sAWxprvdOAtvaARS9QYMznEUtug==", - "type": "package", - "path": "system.threading.tasks.extensions/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/netstandard1.0/System.Threading.Tasks.Extensions.dll", - "lib/netstandard1.0/System.Threading.Tasks.Extensions.xml", - "lib/portable-net45+win8+wp8+wpa81/System.Threading.Tasks.Extensions.dll", - "lib/portable-net45+win8+wp8+wpa81/System.Threading.Tasks.Extensions.xml", - "system.threading.tasks.extensions.4.3.0.nupkg.sha512", - "system.threading.tasks.extensions.nuspec" - ] - }, - "System.Threading.Timer/4.3.0": { - "sha512": "Z6YfyYTCg7lOZjJzBjONJTFKGN9/NIYKSxhU5GRd+DTwHSZyvWp1xuI5aR+dLg+ayyC5Xv57KiY4oJ0tMO89fQ==", - "type": "package", - "path": "system.threading.timer/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net451/_._", - "lib/portable-net451+win81+wpa81/_._", - "lib/win81/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net451/_._", - "ref/netcore50/System.Threading.Timer.dll", - "ref/netcore50/System.Threading.Timer.xml", - "ref/netcore50/de/System.Threading.Timer.xml", - "ref/netcore50/es/System.Threading.Timer.xml", - "ref/netcore50/fr/System.Threading.Timer.xml", - "ref/netcore50/it/System.Threading.Timer.xml", - "ref/netcore50/ja/System.Threading.Timer.xml", - "ref/netcore50/ko/System.Threading.Timer.xml", - "ref/netcore50/ru/System.Threading.Timer.xml", - "ref/netcore50/zh-hans/System.Threading.Timer.xml", - "ref/netcore50/zh-hant/System.Threading.Timer.xml", - "ref/netstandard1.2/System.Threading.Timer.dll", - "ref/netstandard1.2/System.Threading.Timer.xml", - "ref/netstandard1.2/de/System.Threading.Timer.xml", - "ref/netstandard1.2/es/System.Threading.Timer.xml", - "ref/netstandard1.2/fr/System.Threading.Timer.xml", - "ref/netstandard1.2/it/System.Threading.Timer.xml", - "ref/netstandard1.2/ja/System.Threading.Timer.xml", - "ref/netstandard1.2/ko/System.Threading.Timer.xml", - "ref/netstandard1.2/ru/System.Threading.Timer.xml", - "ref/netstandard1.2/zh-hans/System.Threading.Timer.xml", - "ref/netstandard1.2/zh-hant/System.Threading.Timer.xml", - "ref/portable-net451+win81+wpa81/_._", - "ref/win81/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.threading.timer.4.3.0.nupkg.sha512", - "system.threading.timer.nuspec" - ] - }, - "System.Xml.ReaderWriter/4.3.0": { - "sha512": "GrprA+Z0RUXaR4N7/eW71j1rgMnEnEVlgii49GZyAjTH7uliMnrOU3HNFBr6fEDBCJCIdlVNq9hHbaDR621XBA==", - "type": "package", - "path": "system.xml.readerwriter/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/net46/System.Xml.ReaderWriter.dll", - "lib/netcore50/System.Xml.ReaderWriter.dll", - "lib/netstandard1.3/System.Xml.ReaderWriter.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/net46/System.Xml.ReaderWriter.dll", - "ref/netcore50/System.Xml.ReaderWriter.dll", - "ref/netcore50/System.Xml.ReaderWriter.xml", - "ref/netcore50/de/System.Xml.ReaderWriter.xml", - "ref/netcore50/es/System.Xml.ReaderWriter.xml", - "ref/netcore50/fr/System.Xml.ReaderWriter.xml", - "ref/netcore50/it/System.Xml.ReaderWriter.xml", - "ref/netcore50/ja/System.Xml.ReaderWriter.xml", - "ref/netcore50/ko/System.Xml.ReaderWriter.xml", - "ref/netcore50/ru/System.Xml.ReaderWriter.xml", - "ref/netcore50/zh-hans/System.Xml.ReaderWriter.xml", - "ref/netcore50/zh-hant/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/System.Xml.ReaderWriter.dll", - "ref/netstandard1.0/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/de/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/es/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/fr/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/it/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/ja/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/ko/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/ru/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/zh-hans/System.Xml.ReaderWriter.xml", - "ref/netstandard1.0/zh-hant/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/System.Xml.ReaderWriter.dll", - "ref/netstandard1.3/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/de/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/es/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/fr/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/it/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/ja/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/ko/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/ru/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/zh-hans/System.Xml.ReaderWriter.xml", - "ref/netstandard1.3/zh-hant/System.Xml.ReaderWriter.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.xml.readerwriter.4.3.0.nupkg.sha512", - "system.xml.readerwriter.nuspec" - ] - }, - "System.Xml.XDocument/4.3.0": { - "sha512": "5zJ0XDxAIg8iy+t4aMnQAu0MqVbqyvfoUVl1yDV61xdo3Vth45oA2FoY4pPkxYAH5f8ixpmTqXeEIya95x0aCQ==", - "type": "package", - "path": "system.xml.xdocument/4.3.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "ThirdPartyNotices.txt", - "dotnet_library_license.txt", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/System.Xml.XDocument.dll", - "lib/netstandard1.3/System.Xml.XDocument.dll", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/System.Xml.XDocument.dll", - "ref/netcore50/System.Xml.XDocument.xml", - "ref/netcore50/de/System.Xml.XDocument.xml", - "ref/netcore50/es/System.Xml.XDocument.xml", - "ref/netcore50/fr/System.Xml.XDocument.xml", - "ref/netcore50/it/System.Xml.XDocument.xml", - "ref/netcore50/ja/System.Xml.XDocument.xml", - "ref/netcore50/ko/System.Xml.XDocument.xml", - "ref/netcore50/ru/System.Xml.XDocument.xml", - "ref/netcore50/zh-hans/System.Xml.XDocument.xml", - "ref/netcore50/zh-hant/System.Xml.XDocument.xml", - "ref/netstandard1.0/System.Xml.XDocument.dll", - "ref/netstandard1.0/System.Xml.XDocument.xml", - "ref/netstandard1.0/de/System.Xml.XDocument.xml", - "ref/netstandard1.0/es/System.Xml.XDocument.xml", - "ref/netstandard1.0/fr/System.Xml.XDocument.xml", - "ref/netstandard1.0/it/System.Xml.XDocument.xml", - "ref/netstandard1.0/ja/System.Xml.XDocument.xml", - "ref/netstandard1.0/ko/System.Xml.XDocument.xml", - "ref/netstandard1.0/ru/System.Xml.XDocument.xml", - "ref/netstandard1.0/zh-hans/System.Xml.XDocument.xml", - "ref/netstandard1.0/zh-hant/System.Xml.XDocument.xml", - "ref/netstandard1.3/System.Xml.XDocument.dll", - "ref/netstandard1.3/System.Xml.XDocument.xml", - "ref/netstandard1.3/de/System.Xml.XDocument.xml", - "ref/netstandard1.3/es/System.Xml.XDocument.xml", - "ref/netstandard1.3/fr/System.Xml.XDocument.xml", - "ref/netstandard1.3/it/System.Xml.XDocument.xml", - "ref/netstandard1.3/ja/System.Xml.XDocument.xml", - "ref/netstandard1.3/ko/System.Xml.XDocument.xml", - "ref/netstandard1.3/ru/System.Xml.XDocument.xml", - "ref/netstandard1.3/zh-hans/System.Xml.XDocument.xml", - "ref/netstandard1.3/zh-hant/System.Xml.XDocument.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "system.xml.xdocument.4.3.0.nupkg.sha512", - "system.xml.xdocument.nuspec" - ] - }, - "Terminal.Gui/2.0.0-v2-develop.2329": { - "sha512": "1WRHeZKN5tnF8DUu0vHz5pGZIY9ETwufKbUHCoH3UTcIeOlduhRCpBhTyJWri/fePsUkij2euFMGX2yHfk4h/A==", - "type": "package", - "path": "terminal.gui/2.0.0-v2-develop.2329", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "README.md", - "lib/net8.0/Terminal.Gui.dll", - "lib/net8.0/Terminal.Gui.xml", - "lib/net8.0/fr-FR/Terminal.Gui.resources.dll", - "lib/net8.0/ja-JP/Terminal.Gui.resources.dll", - "lib/net8.0/pt-PT/Terminal.Gui.resources.dll", - "lib/net8.0/zh-Hans/Terminal.Gui.resources.dll", - "logo.png", - "terminal.gui.2.0.0-v2-develop.2329.nupkg.sha512", - "terminal.gui.nuspec" - ] - }, - "TestableIO.System.IO.Abstractions/21.0.22": { - "sha512": "yq3I8rUjNoo4JTOT3jbGfTM5VfowaSYiooDO2bfvQe6XGVyZiSIzaKyCmSnuUEyuktw6zzuVE1lJnUeDhJWtyQ==", - "type": "package", - "path": "testableio.system.io.abstractions/21.0.22", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "README.md", - "icon_256x256.png", - "lib/net462/TestableIO.System.IO.Abstractions.dll", - "lib/net462/TestableIO.System.IO.Abstractions.xml", - "lib/net6.0/TestableIO.System.IO.Abstractions.dll", - "lib/net6.0/TestableIO.System.IO.Abstractions.xml", - "lib/net7.0/TestableIO.System.IO.Abstractions.dll", - "lib/net7.0/TestableIO.System.IO.Abstractions.xml", - "lib/net8.0/TestableIO.System.IO.Abstractions.dll", - "lib/net8.0/TestableIO.System.IO.Abstractions.xml", - "lib/netstandard2.0/TestableIO.System.IO.Abstractions.dll", - "lib/netstandard2.0/TestableIO.System.IO.Abstractions.xml", - "lib/netstandard2.1/TestableIO.System.IO.Abstractions.dll", - "lib/netstandard2.1/TestableIO.System.IO.Abstractions.xml", - "testableio.system.io.abstractions.21.0.22.nupkg.sha512", - "testableio.system.io.abstractions.nuspec" - ] - }, - "TestableIO.System.IO.Abstractions.Wrappers/21.0.22": { - "sha512": "ETpw1B6VOsQ5zbfqxqLKjITnMvB9M0K5/bK8qJc6jih+tnlKQmtnnOPSS+OeKCqsZDYeHxPNp4ytQPJS3R+WXA==", - "type": "package", - "path": "testableio.system.io.abstractions.wrappers/21.0.22", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "README.md", - "icon_256x256.png", - "lib/net462/TestableIO.System.IO.Abstractions.Wrappers.dll", - "lib/net462/TestableIO.System.IO.Abstractions.Wrappers.xml", - "lib/net6.0/TestableIO.System.IO.Abstractions.Wrappers.dll", - "lib/net6.0/TestableIO.System.IO.Abstractions.Wrappers.xml", - "lib/net7.0/TestableIO.System.IO.Abstractions.Wrappers.dll", - "lib/net7.0/TestableIO.System.IO.Abstractions.Wrappers.xml", - "lib/net8.0/TestableIO.System.IO.Abstractions.Wrappers.dll", - "lib/net8.0/TestableIO.System.IO.Abstractions.Wrappers.xml", - "lib/netstandard2.0/TestableIO.System.IO.Abstractions.Wrappers.dll", - "lib/netstandard2.0/TestableIO.System.IO.Abstractions.Wrappers.xml", - "lib/netstandard2.1/TestableIO.System.IO.Abstractions.Wrappers.dll", - "lib/netstandard2.1/TestableIO.System.IO.Abstractions.Wrappers.xml", - "testableio.system.io.abstractions.wrappers.21.0.22.nupkg.sha512", - "testableio.system.io.abstractions.wrappers.nuspec" - ] - }, - "Wcwidth/2.0.0": { - "sha512": "eGZYH/V+X1DwEXrPUlUcAp8pU5a38d8IvaQzq4pclJxF1x8bizssIo4uWc3qxmS64BNGK5WnDxyBYJz84+Msqg==", - "type": "package", - "path": "wcwidth/2.0.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "lib/net6.0/Wcwidth.dll", - "lib/net6.0/Wcwidth.xml", - "lib/net7.0/Wcwidth.dll", - "lib/net7.0/Wcwidth.xml", - "lib/net8.0/Wcwidth.dll", - "lib/net8.0/Wcwidth.xml", - "lib/netstandard2.0/Wcwidth.dll", - "lib/netstandard2.0/Wcwidth.xml", - "wcwidth.2.0.0.nupkg.sha512", - "wcwidth.nuspec" - ] - }, - "StgSharp.Common/1.0.0": { - "type": "project", - "path": "../StgSharp.Common/StgSharp.Common.csproj", - "msbuildProject": "../StgSharp.Common/StgSharp.Common.csproj" - }, - "StgSharp.Model/1.0.0": { - "type": "project", - "path": "../StgSharp.Model/StgSharp.Model.csproj", - "msbuildProject": "../StgSharp.Model/StgSharp.Model.csproj" - }, - "StgSharp.Script/1.0.0": { - "type": "project", - "path": "../StgSharp.Script/StgSharp.Script.csproj", - "msbuildProject": "../StgSharp.Script/StgSharp.Script.csproj" - }, - "StgSharp.TerminalDialogue/1.0.0": { - "type": "project", - "path": "../StgSharp.TerminalDialogue/StgSharp.TerminalDialogue.csproj", - "msbuildProject": "../StgSharp.TerminalDialogue/StgSharp.TerminalDialogue.csproj" - } - }, - "projectFileDependencyGroups": { - "net8.0": [ - "MSTest.TestAdapter >= 3.1.1", - "MSTest.TestFramework >= 3.1.1", - "Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.MSTest >= 1.1.2", - "Microsoft.NET.Test.Sdk >= 17.8.0", - "StgSharp.Common >= 1.0.0", - "StgSharp.Model >= 1.0.0", - "StgSharp.Script >= 1.0.0", - "StgSharp.TerminalDialogue >= 1.0.0", - "coverlet.collector >= 6.0.0" - ] - }, - "packageFolders": { - "C:\\Users\\Youmu\\.nuget\\packages\\": {}, - "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {} - }, - "project": { - "version": "1.0.0", - "restore": { - "projectUniqueName": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\STgSharpTest\\StgSharpTest.csproj", - "projectName": "StgSharpTest", - "projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\STgSharpTest\\StgSharpTest.csproj", - "packagesPath": "C:\\Users\\Youmu\\.nuget\\packages\\", - "outputPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\STgSharpTest\\obj\\", - "projectStyle": "PackageReference", - "fallbackFolders": [ - "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" - ], - "configFilePaths": [ - "C:\\Users\\Youmu\\AppData\\Roaming\\NuGet\\NuGet.Config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" - ], - "originalTargetFrameworks": [ - "net8.0" - ], - "sources": { - "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, - "C:\\Program Files\\dotnet\\library-packs": {}, - "D:\\Programmer\\NugetLocal": {}, - "https://api.nuget.org/v3/index.json": {} - }, - "frameworks": { - "net8.0": { - "targetAlias": "net8.0", - "projectReferences": { - "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj": { - "projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Common\\StgSharp.Common.csproj" - }, - "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Model\\StgSharp.Model.csproj": { - "projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Model\\StgSharp.Model.csproj" - }, - "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj": { - "projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.Script\\StgSharp.Script.csproj" - }, - "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.TerminalDialogue\\StgSharp.TerminalDialogue.csproj": { - "projectPath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\StgSharp.TerminalDialogue\\StgSharp.TerminalDialogue.csproj" - } - } - } - }, - "warningProperties": { - "warnAsError": [ - "NU1605" - ] - }, - "restoreAuditProperties": { - "enableAudit": "true", - "auditLevel": "low", - "auditMode": "direct" - } - }, - "frameworks": { - "net8.0": { - "targetAlias": "net8.0", - "dependencies": { - "MSTest.TestAdapter": { - "target": "Package", - "version": "[3.1.1, )" - }, - "MSTest.TestFramework": { - "target": "Package", - "version": "[3.1.1, )" - }, - "Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.MSTest": { - "target": "Package", - "version": "[1.1.2, )" - }, - "Microsoft.NET.Test.Sdk": { - "target": "Package", - "version": "[17.8.0, )" - }, - "coverlet.collector": { - "target": "Package", - "version": "[6.0.0, )" - } - }, - "imports": [ - "net461", - "net462", - "net47", - "net471", - "net472", - "net48", - "net481" - ], - "assetTargetFallback": true, - "warn": true, - "frameworkReferences": { - "Microsoft.NETCore.App": { - "privateAssets": "all" - } - }, - "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.400/PortableRuntimeIdentifierGraph.json" - } - } - }, - "logs": [ - { - "code": "NU1107", - "level": "Error", - "message": "Microsoft.CodeAnalysis.Common 中检测到版本冲突。直接安装/引用 Microsoft.CodeAnalysis.Common 4.13.0 到项目 StgSharpTest 可解决此问题。 \r\n StgSharpTest -> StgSharp.Script -> Microsoft.CodeAnalysis.CSharp 4.13.0 -> Microsoft.CodeAnalysis.Common (= 4.13.0) \r\n StgSharpTest -> Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.MSTest 1.1.2 -> Microsoft.CodeAnalysis.CSharp.Workspaces 3.8.0 -> Microsoft.CodeAnalysis.Common (= 3.8.0).", - "libraryId": "Microsoft.CodeAnalysis.Common", - "targetGraphs": [ - "net8.0" - ] - } - ] -} \ No newline at end of file diff --git a/STgSharpTest/obj/project.nuget.cache b/STgSharpTest/obj/project.nuget.cache deleted file mode 100644 index 040580ff..00000000 --- a/STgSharpTest/obj/project.nuget.cache +++ /dev/null @@ -1,151 +0,0 @@ -{ - "version": 2, - "dgSpecHash": "/UfKUghidbI=", - "success": false, - "projectFilePath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\内核源代码\\STgSharpTest\\StgSharpTest.csproj", - "expectedPackageFiles": [ - "C:\\Users\\Youmu\\.nuget\\packages\\colorhelper\\1.8.1\\colorhelper.1.8.1.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\communitytoolkit.highperformance\\8.4.0\\communitytoolkit.highperformance.8.4.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\coverlet.collector\\6.0.0\\coverlet.collector.6.0.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\diffplex\\1.7.2\\diffplex.1.7.2.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\humanizer.core\\2.2.0\\humanizer.core.2.2.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\microsoft.bcl.asyncinterfaces\\1.1.1\\microsoft.bcl.asyncinterfaces.1.1.1.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\microsoft.codeanalysis.analyzer.testing\\1.1.2\\microsoft.codeanalysis.analyzer.testing.1.1.2.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\microsoft.codeanalysis.analyzers\\3.11.0\\microsoft.codeanalysis.analyzers.3.11.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\microsoft.codeanalysis.common\\4.13.0\\microsoft.codeanalysis.common.4.13.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\microsoft.codeanalysis.csharp\\4.13.0\\microsoft.codeanalysis.csharp.4.13.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\microsoft.codeanalysis.csharp.sourcegenerators.testing\\1.1.2\\microsoft.codeanalysis.csharp.sourcegenerators.testing.1.1.2.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\microsoft.codeanalysis.csharp.sourcegenerators.testing.mstest\\1.1.2\\microsoft.codeanalysis.csharp.sourcegenerators.testing.mstest.1.1.2.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\microsoft.codeanalysis.csharp.workspaces\\3.8.0\\microsoft.codeanalysis.csharp.workspaces.3.8.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\microsoft.codeanalysis.sourcegenerators.testing\\1.1.2\\microsoft.codeanalysis.sourcegenerators.testing.1.1.2.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\microsoft.codeanalysis.testing.verifiers.mstest\\1.1.2\\microsoft.codeanalysis.testing.verifiers.mstest.1.1.2.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\microsoft.codeanalysis.workspaces.common\\3.8.0\\microsoft.codeanalysis.workspaces.common.3.8.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\microsoft.codecoverage\\17.8.0\\microsoft.codecoverage.17.8.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\microsoft.csharp\\4.7.0\\microsoft.csharp.4.7.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\microsoft.net.test.sdk\\17.8.0\\microsoft.net.test.sdk.17.8.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\microsoft.netcore.platforms\\2.0.0\\microsoft.netcore.platforms.2.0.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\microsoft.netcore.targets\\1.1.0\\microsoft.netcore.targets.1.1.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\microsoft.testplatform.objectmodel\\17.8.0\\microsoft.testplatform.objectmodel.17.8.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\microsoft.testplatform.testhost\\17.8.0\\microsoft.testplatform.testhost.17.8.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\microsoft.visualstudio.composition\\16.1.8\\microsoft.visualstudio.composition.16.1.8.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\microsoft.visualstudio.composition.netfxattributes\\16.1.8\\microsoft.visualstudio.composition.netfxattributes.16.1.8.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\microsoft.visualstudio.validation\\15.0.82\\microsoft.visualstudio.validation.15.0.82.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\microsoft.win32.primitives\\4.3.0\\microsoft.win32.primitives.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\mstest.testadapter\\3.1.1\\mstest.testadapter.3.1.1.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\mstest.testframework\\3.1.1\\mstest.testframework.3.1.1.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\netstandard.library\\1.6.1\\netstandard.library.1.6.1.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\newtonsoft.json\\13.0.1\\newtonsoft.json.13.0.1.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\nuget.common\\6.3.4\\nuget.common.6.3.4.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\nuget.configuration\\6.3.4\\nuget.configuration.6.3.4.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\nuget.frameworks\\6.5.0\\nuget.frameworks.6.5.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\nuget.packaging\\6.3.4\\nuget.packaging.6.3.4.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\nuget.protocol\\6.3.4\\nuget.protocol.6.3.4.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\nuget.resolver\\6.3.4\\nuget.resolver.6.3.4.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\nuget.versioning\\6.3.4\\nuget.versioning.6.3.4.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\runtime.debian.8-x64.runtime.native.system.security.cryptography.openssl\\4.3.0\\runtime.debian.8-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl\\4.3.0\\runtime.fedora.23-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\runtime.fedora.24-x64.runtime.native.system.security.cryptography.openssl\\4.3.0\\runtime.fedora.24-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\runtime.native.system\\4.3.0\\runtime.native.system.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\runtime.native.system.io.compression\\4.3.0\\runtime.native.system.io.compression.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\runtime.native.system.net.http\\4.3.0\\runtime.native.system.net.http.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\runtime.native.system.security.cryptography.apple\\4.3.0\\runtime.native.system.security.cryptography.apple.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\runtime.native.system.security.cryptography.openssl\\4.3.0\\runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl\\4.3.0\\runtime.opensuse.13.2-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\runtime.opensuse.42.1-x64.runtime.native.system.security.cryptography.openssl\\4.3.0\\runtime.opensuse.42.1-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\runtime.osx.10.10-x64.runtime.native.system.security.cryptography.apple\\4.3.0\\runtime.osx.10.10-x64.runtime.native.system.security.cryptography.apple.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\runtime.osx.10.10-x64.runtime.native.system.security.cryptography.openssl\\4.3.0\\runtime.osx.10.10-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\runtime.rhel.7-x64.runtime.native.system.security.cryptography.openssl\\4.3.0\\runtime.rhel.7-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\runtime.ubuntu.14.04-x64.runtime.native.system.security.cryptography.openssl\\4.3.0\\runtime.ubuntu.14.04-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\runtime.ubuntu.16.04-x64.runtime.native.system.security.cryptography.openssl\\4.3.0\\runtime.ubuntu.16.04-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl\\4.3.0\\runtime.ubuntu.16.10-x64.runtime.native.system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.appcontext\\4.3.0\\system.appcontext.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.buffers\\4.3.0\\system.buffers.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.collections\\4.3.0\\system.collections.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.collections.concurrent\\4.3.0\\system.collections.concurrent.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.collections.immutable\\8.0.0\\system.collections.immutable.8.0.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.componentmodel.composition\\4.5.0\\system.componentmodel.composition.4.5.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.composition\\1.0.31\\system.composition.1.0.31.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.composition.attributedmodel\\1.0.31\\system.composition.attributedmodel.1.0.31.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.composition.convention\\1.0.31\\system.composition.convention.1.0.31.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.composition.hosting\\1.0.31\\system.composition.hosting.1.0.31.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.composition.runtime\\1.0.31\\system.composition.runtime.1.0.31.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.composition.typedparts\\1.0.31\\system.composition.typedparts.1.0.31.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.console\\4.3.0\\system.console.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.diagnostics.debug\\4.3.0\\system.diagnostics.debug.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.diagnostics.diagnosticsource\\4.3.0\\system.diagnostics.diagnosticsource.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.diagnostics.tools\\4.3.0\\system.diagnostics.tools.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.diagnostics.tracing\\4.3.0\\system.diagnostics.tracing.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.dynamic.runtime\\4.0.11\\system.dynamic.runtime.4.0.11.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.formats.asn1\\5.0.0\\system.formats.asn1.5.0.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.globalization\\4.3.0\\system.globalization.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.globalization.calendars\\4.3.0\\system.globalization.calendars.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.globalization.extensions\\4.3.0\\system.globalization.extensions.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.io\\4.3.0\\system.io.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.io.abstractions\\21.0.22\\system.io.abstractions.21.0.22.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.io.compression\\4.3.0\\system.io.compression.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.io.compression.zipfile\\4.3.0\\system.io.compression.zipfile.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.io.filesystem\\4.3.0\\system.io.filesystem.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.io.filesystem.primitives\\4.3.0\\system.io.filesystem.primitives.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.linq\\4.3.0\\system.linq.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.linq.expressions\\4.3.0\\system.linq.expressions.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.net.http\\4.3.0\\system.net.http.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.net.primitives\\4.3.0\\system.net.primitives.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.net.sockets\\4.3.0\\system.net.sockets.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.objectmodel\\4.3.0\\system.objectmodel.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.reflection\\4.3.0\\system.reflection.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.reflection.emit\\4.3.0\\system.reflection.emit.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.reflection.emit.ilgeneration\\4.3.0\\system.reflection.emit.ilgeneration.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.reflection.emit.lightweight\\4.3.0\\system.reflection.emit.lightweight.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.reflection.extensions\\4.3.0\\system.reflection.extensions.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.reflection.metadata\\8.0.0\\system.reflection.metadata.8.0.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.reflection.primitives\\4.3.0\\system.reflection.primitives.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.reflection.typeextensions\\4.3.0\\system.reflection.typeextensions.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.resources.resourcemanager\\4.3.0\\system.resources.resourcemanager.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.runtime\\4.3.0\\system.runtime.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.runtime.compilerservices.unsafe\\6.1.0\\system.runtime.compilerservices.unsafe.6.1.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.runtime.extensions\\4.3.0\\system.runtime.extensions.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.runtime.handles\\4.3.0\\system.runtime.handles.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.runtime.interopservices\\4.3.0\\system.runtime.interopservices.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.runtime.interopservices.runtimeinformation\\4.3.0\\system.runtime.interopservices.runtimeinformation.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.runtime.numerics\\4.3.0\\system.runtime.numerics.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.security.accesscontrol\\4.5.0\\system.security.accesscontrol.4.5.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.security.cryptography.algorithms\\4.3.0\\system.security.cryptography.algorithms.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.security.cryptography.cng\\5.0.0\\system.security.cryptography.cng.5.0.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.security.cryptography.csp\\4.3.0\\system.security.cryptography.csp.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.security.cryptography.encoding\\4.3.0\\system.security.cryptography.encoding.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.security.cryptography.openssl\\4.3.0\\system.security.cryptography.openssl.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.security.cryptography.pkcs\\5.0.0\\system.security.cryptography.pkcs.5.0.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.security.cryptography.primitives\\4.3.0\\system.security.cryptography.primitives.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.security.cryptography.protecteddata\\4.4.0\\system.security.cryptography.protecteddata.4.4.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.security.cryptography.x509certificates\\4.3.0\\system.security.cryptography.x509certificates.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.security.permissions\\4.5.0\\system.security.permissions.4.5.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.security.principal.windows\\4.5.0\\system.security.principal.windows.4.5.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.text.encoding\\4.3.0\\system.text.encoding.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.text.encoding.extensions\\4.3.0\\system.text.encoding.extensions.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.text.encodings.web\\8.0.0\\system.text.encodings.web.8.0.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.text.json\\8.0.4\\system.text.json.8.0.4.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.text.regularexpressions\\4.3.0\\system.text.regularexpressions.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.threading\\4.3.0\\system.threading.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.threading.tasks\\4.3.0\\system.threading.tasks.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.threading.tasks.dataflow\\4.6.0\\system.threading.tasks.dataflow.4.6.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.threading.tasks.extensions\\4.3.0\\system.threading.tasks.extensions.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.threading.timer\\4.3.0\\system.threading.timer.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.xml.readerwriter\\4.3.0\\system.xml.readerwriter.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\system.xml.xdocument\\4.3.0\\system.xml.xdocument.4.3.0.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\terminal.gui\\2.0.0-v2-develop.2329\\terminal.gui.2.0.0-v2-develop.2329.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\testableio.system.io.abstractions\\21.0.22\\testableio.system.io.abstractions.21.0.22.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\testableio.system.io.abstractions.wrappers\\21.0.22\\testableio.system.io.abstractions.wrappers.21.0.22.nupkg.sha512", - "C:\\Users\\Youmu\\.nuget\\packages\\wcwidth\\2.0.0\\wcwidth.2.0.0.nupkg.sha512" - ], - "logs": [ - { - "code": "NU1107", - "level": "Error", - "message": "Microsoft.CodeAnalysis.Common 中检测到版本冲突。直接安装/引用 Microsoft.CodeAnalysis.Common 4.13.0 到项目 StgSharpTest 可解决此问题。 \r\n StgSharpTest -> StgSharp.Script -> Microsoft.CodeAnalysis.CSharp 4.13.0 -> Microsoft.CodeAnalysis.Common (= 4.13.0) \r\n StgSharpTest -> Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.MSTest 1.1.2 -> Microsoft.CodeAnalysis.CSharp.Workspaces 3.8.0 -> Microsoft.CodeAnalysis.Common (= 3.8.0).", - "libraryId": "Microsoft.CodeAnalysis.Common", - "targetGraphs": [ - "net8.0" - ] - } - ] -} \ No newline at end of file diff --git a/STgSharpTest/obj/x64/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs b/STgSharpTest/obj/x64/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs deleted file mode 100644 index 2217181c..00000000 --- a/STgSharpTest/obj/x64/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs +++ /dev/null @@ -1,4 +0,0 @@ -// -using System; -using System.Reflection; -[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")] diff --git a/STgSharpTest/obj/x64/Debug/net8.0/StgSharpTest.AssemblyInfo.cs b/STgSharpTest/obj/x64/Debug/net8.0/StgSharpTest.AssemblyInfo.cs deleted file mode 100644 index 355cf89f..00000000 --- a/STgSharpTest/obj/x64/Debug/net8.0/StgSharpTest.AssemblyInfo.cs +++ /dev/null @@ -1,23 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 此代码由工具生成。 -// 运行时版本:4.0.30319.42000 -// -// 对此文件的更改可能会导致不正确的行为,并且如果 -// 重新生成代码,这些更改将会丢失。 -// -//------------------------------------------------------------------------------ - -using System; -using System.Reflection; - -[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharpTest")] -[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] -[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e3741687a706609a1d0055c3fd11f41945838a70")] -[assembly: System.Reflection.AssemblyProductAttribute("StgSharpTest")] -[assembly: System.Reflection.AssemblyTitleAttribute("StgSharpTest")] -[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] - -// 由 MSBuild WriteCodeFragment 类生成。 - diff --git a/STgSharpTest/obj/x64/Debug/net8.0/StgSharpTest.AssemblyInfoInputs.cache b/STgSharpTest/obj/x64/Debug/net8.0/StgSharpTest.AssemblyInfoInputs.cache deleted file mode 100644 index fc76d673..00000000 --- a/STgSharpTest/obj/x64/Debug/net8.0/StgSharpTest.AssemblyInfoInputs.cache +++ /dev/null @@ -1 +0,0 @@ -b8706b72b757bdb5c0e1698ab43d2be58ed2d2b06e83faa9ac18a3a38011643f diff --git a/STgSharpTest/obj/x64/Debug/net8.0/StgSharpTest.GeneratedMSBuildEditorConfig.editorconfig b/STgSharpTest/obj/x64/Debug/net8.0/StgSharpTest.GeneratedMSBuildEditorConfig.editorconfig deleted file mode 100644 index 15329311..00000000 --- a/STgSharpTest/obj/x64/Debug/net8.0/StgSharpTest.GeneratedMSBuildEditorConfig.editorconfig +++ /dev/null @@ -1,21 +0,0 @@ -is_global = true -build_property.TargetFramework = net8.0 -build_property.TargetFramework = net8.0 -build_property.TargetPlatformMinVersion = -build_property.TargetPlatformMinVersion = -build_property.UsingMicrosoftNETSdkWeb = -build_property.UsingMicrosoftNETSdkWeb = -build_property.ProjectTypeGuids = -build_property.ProjectTypeGuids = -build_property.InvariantGlobalization = -build_property.InvariantGlobalization = -build_property.PlatformNeutralAssembly = -build_property.PlatformNeutralAssembly = -build_property.EnforceExtendedAnalyzerRules = -build_property.EnforceExtendedAnalyzerRules = -build_property._SupportedPlatformList = Linux,macOS,Windows -build_property._SupportedPlatformList = Linux,macOS,Windows -build_property.RootNamespace = StgSharpTest -build_property.ProjectDir = D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\STgSharpTest\ -build_property.EnableComHosting = -build_property.EnableGeneratedComInterfaceComImportInterop = diff --git a/STgSharpTest/obj/x64/Debug/net8.0/StgSharpTest.GlobalUsings.g.cs b/STgSharpTest/obj/x64/Debug/net8.0/StgSharpTest.GlobalUsings.g.cs deleted file mode 100644 index a1f6d1a8..00000000 --- a/STgSharpTest/obj/x64/Debug/net8.0/StgSharpTest.GlobalUsings.g.cs +++ /dev/null @@ -1,9 +0,0 @@ -// -global using global::Microsoft.VisualStudio.TestTools.UnitTesting; -global using global::System; -global using global::System.Collections.Generic; -global using global::System.IO; -global using global::System.Linq; -global using global::System.Net.Http; -global using global::System.Threading; -global using global::System.Threading.Tasks; diff --git a/STgSharpTest/obj/x64/Debug/net8.0/StgSharpTest.assets.cache b/STgSharpTest/obj/x64/Debug/net8.0/StgSharpTest.assets.cache deleted file mode 100644 index 036cf7fa..00000000 Binary files a/STgSharpTest/obj/x64/Debug/net8.0/StgSharpTest.assets.cache and /dev/null differ diff --git a/STgSharpTest/obj/x64/Debug/net8.0/StgSharpTest.csproj.AssemblyReference.cache b/STgSharpTest/obj/x64/Debug/net8.0/StgSharpTest.csproj.AssemblyReference.cache deleted file mode 100644 index 9d2bfca1..00000000 Binary files a/STgSharpTest/obj/x64/Debug/net8.0/StgSharpTest.csproj.AssemblyReference.cache and /dev/null differ diff --git a/STgSharpTest/obj/x64/Debug/net8.0/StgSharpTest.csproj.BuildWithSkipAnalyzers b/STgSharpTest/obj/x64/Debug/net8.0/StgSharpTest.csproj.BuildWithSkipAnalyzers deleted file mode 100644 index e69de29b..00000000 diff --git a/STgSharpTest/obj/x64/Debug/net8.0/StgSharpTest.csproj.FileListAbsolute.txt b/STgSharpTest/obj/x64/Debug/net8.0/StgSharpTest.csproj.FileListAbsolute.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/STgSharpTest/obj/x64/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs b/STgSharpTest/obj/x64/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs deleted file mode 100644 index 2217181c..00000000 --- a/STgSharpTest/obj/x64/Release/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs +++ /dev/null @@ -1,4 +0,0 @@ -// -using System; -using System.Reflection; -[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")] diff --git a/STgSharpTest/obj/x64/Release/net8.0/StgSharpTest.AssemblyInfo.cs b/STgSharpTest/obj/x64/Release/net8.0/StgSharpTest.AssemblyInfo.cs deleted file mode 100644 index 6537f127..00000000 --- a/STgSharpTest/obj/x64/Release/net8.0/StgSharpTest.AssemblyInfo.cs +++ /dev/null @@ -1,23 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 此代码由工具生成。 -// 运行时版本:4.0.30319.42000 -// -// 对此文件的更改可能会导致不正确的行为,并且如果 -// 重新生成代码,这些更改将会丢失。 -// -//------------------------------------------------------------------------------ - -using System; -using System.Reflection; - -[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharpTest")] -[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")] -[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e687473132786f419a48170313782d6779890c3d")] -[assembly: System.Reflection.AssemblyProductAttribute("StgSharpTest")] -[assembly: System.Reflection.AssemblyTitleAttribute("StgSharpTest")] -[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] - -// 由 MSBuild WriteCodeFragment 类生成。 - diff --git a/STgSharpTest/obj/x64/Release/net8.0/StgSharpTest.AssemblyInfoInputs.cache b/STgSharpTest/obj/x64/Release/net8.0/StgSharpTest.AssemblyInfoInputs.cache deleted file mode 100644 index cb5cffcb..00000000 --- a/STgSharpTest/obj/x64/Release/net8.0/StgSharpTest.AssemblyInfoInputs.cache +++ /dev/null @@ -1 +0,0 @@ -1d3d676225642d4c08f4cbcba46a80275bd9d96fbf7d11d138efd8f869f71da6 diff --git a/STgSharpTest/obj/x64/Release/net8.0/StgSharpTest.GeneratedMSBuildEditorConfig.editorconfig b/STgSharpTest/obj/x64/Release/net8.0/StgSharpTest.GeneratedMSBuildEditorConfig.editorconfig deleted file mode 100644 index 21e2cab2..00000000 --- a/STgSharpTest/obj/x64/Release/net8.0/StgSharpTest.GeneratedMSBuildEditorConfig.editorconfig +++ /dev/null @@ -1,13 +0,0 @@ -is_global = true -build_property.TargetFramework = net8.0 -build_property.TargetPlatformMinVersion = -build_property.UsingMicrosoftNETSdkWeb = -build_property.ProjectTypeGuids = -build_property.InvariantGlobalization = -build_property.PlatformNeutralAssembly = -build_property.EnforceExtendedAnalyzerRules = -build_property._SupportedPlatformList = Linux,macOS,Windows -build_property.RootNamespace = StgSharpTest -build_property.ProjectDir = D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\STgSharpTest\ -build_property.EnableComHosting = -build_property.EnableGeneratedComInterfaceComImportInterop = diff --git a/STgSharpTest/obj/x64/Release/net8.0/StgSharpTest.GlobalUsings.g.cs b/STgSharpTest/obj/x64/Release/net8.0/StgSharpTest.GlobalUsings.g.cs deleted file mode 100644 index a1f6d1a8..00000000 --- a/STgSharpTest/obj/x64/Release/net8.0/StgSharpTest.GlobalUsings.g.cs +++ /dev/null @@ -1,9 +0,0 @@ -// -global using global::Microsoft.VisualStudio.TestTools.UnitTesting; -global using global::System; -global using global::System.Collections.Generic; -global using global::System.IO; -global using global::System.Linq; -global using global::System.Net.Http; -global using global::System.Threading; -global using global::System.Threading.Tasks; diff --git a/STgSharpTest/obj/x64/Release/net8.0/StgSharpTest.assets.cache b/STgSharpTest/obj/x64/Release/net8.0/StgSharpTest.assets.cache deleted file mode 100644 index d9a5c003..00000000 Binary files a/STgSharpTest/obj/x64/Release/net8.0/StgSharpTest.assets.cache and /dev/null differ diff --git a/STgSharpTest/obj/x64/Release/net8.0/StgSharpTest.csproj.AssemblyReference.cache b/STgSharpTest/obj/x64/Release/net8.0/StgSharpTest.csproj.AssemblyReference.cache deleted file mode 100644 index 545b625c..00000000 Binary files a/STgSharpTest/obj/x64/Release/net8.0/StgSharpTest.csproj.AssemblyReference.cache and /dev/null differ diff --git a/StgSharp.Common/bin/x64/Debug/net8.0/StgSharp.Common.deps.json b/StgSharp.Common/bin/x64/Debug/net8.0/StgSharp.Common.deps.json deleted file mode 100644 index 4c755f05..00000000 --- a/StgSharp.Common/bin/x64/Debug/net8.0/StgSharp.Common.deps.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "runtimeTarget": { - "name": ".NETCoreApp,Version=v8.0", - "signature": "" - }, - "compilationOptions": {}, - "targets": { - ".NETCoreApp,Version=v8.0": { - "StgSharp.Common/1.0.0": { - "dependencies": { - "Microsoft.CSharp": "4.7.0", - "System.Runtime.CompilerServices.Unsafe": "6.1.0" - }, - "runtime": { - "StgSharp.Common.dll": {} - } - }, - "Microsoft.CSharp/4.7.0": {}, - "System.Runtime.CompilerServices.Unsafe/6.1.0": {} - } - }, - "libraries": { - "StgSharp.Common/1.0.0": { - "type": "project", - "serviceable": false, - "sha512": "" - }, - "Microsoft.CSharp/4.7.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==", - "path": "microsoft.csharp/4.7.0", - "hashPath": "microsoft.csharp.4.7.0.nupkg.sha512" - }, - "System.Runtime.CompilerServices.Unsafe/6.1.0": { - "type": "package", - "serviceable": true, - "sha512": "sha512-5o/HZxx6RVqYlhKSq8/zronDkALJZUT2Vz0hx43f0gwe8mwlM0y2nYlqdBwLMzr262Bwvpikeb/yEwkAa5PADg==", - "path": "system.runtime.compilerservices.unsafe/6.1.0", - "hashPath": "system.runtime.compilerservices.unsafe.6.1.0.nupkg.sha512" - } - } -} \ No newline at end of file diff --git a/StgSharp.Common/bin/x64/Debug/net8.0/StgSharp.Common.dll b/StgSharp.Common/bin/x64/Debug/net8.0/StgSharp.Common.dll deleted file mode 100644 index 7ea2556c..00000000 Binary files a/StgSharp.Common/bin/x64/Debug/net8.0/StgSharp.Common.dll and /dev/null differ diff --git a/StgSharp.Common/bin/x64/Debug/net8.0/StgSharp.Common.pdb b/StgSharp.Common/bin/x64/Debug/net8.0/StgSharp.Common.pdb deleted file mode 100644 index ee6b51cf..00000000 Binary files a/StgSharp.Common/bin/x64/Debug/net8.0/StgSharp.Common.pdb and /dev/null differ diff --git a/StgSharp.Common/bin/x64/Debug/net8.0/StgSharp.Common.xml b/StgSharp.Common/bin/x64/Debug/net8.0/StgSharp.Common.xml deleted file mode 100644 index 987bd30e..00000000 --- a/StgSharp.Common/bin/x64/Debug/net8.0/StgSharp.Common.xml +++ /dev/null @@ -1,1066 +0,0 @@ - - - - StgSharp.Common - - - - - Determines whether the - contains the specified key. - - - The value to locate in the . - - - true if the contains an - element with the specified key; otherwise, false. - - - - - Determines whether the - contains the specified key. - - - The value to locate in the . - - - true if the contains an - element with the specified key; otherwise, false. - - - - - Part of a collection. This contains a direct reference to _origin collection, so all - change to _origin collection will be reflected in this object. - - - - - - - - Initializes a new instance of the RandomAccessStack class that is empty and has the - default initial capacity. - - - - - Initializes a new instance of the RandomAccessStack class that is empty and has the - specified initial capacity. - - - - - Gets or sets the element at the specified index in the stack (0 = bottom, Count-1 = - top). - - - - - Gets the number of elements contained in the stack. - - - - - Removes all objects from the stack. - - - - - Returns an enumerator that iterates through the stack from top to bottom. Throws if - the stack is modified during iteration. - - - - - Returns the object at the top of the stack without removing it. - - - - - Removes and returns the object at the top of the stack. - - - - - Adds an item to the top of the stack. - - - - - CustomizeInit an instance of OpenGL program, This method should be called before any - other World api. - - - - - Version of current World platform. Main version represent in hundred's digit, and sub - version represent in ten's digit. - - - - - Write a log message to log file, and mark the _level of this message. - - - A string contains information of how current evironment runs. - - - The severity of current message. - - - - - A class attempt to reduce cost of boxing, though still a bit slower than direct access to - _origin value type instance. - - - Type of instance to be boxed. - - - - - A class contains a sets of methods to serialize several types - - - - - An independent storage area, used as the only folder type in root folder. Contains several - files reference as virtual disc. Data is actually stored in s in certain RAID mode. - - - - - OpenGL numeric type. An IEEE-754 floating-point value, clamped to the range [0,1]. - - - - - OpenGL numeric type. An IEEE-754 double precision floating-point value, clamped to the - range [0,1]. - - - - - X position of an enenmy entity - - - - - Y position of an enemy entity - - - - - A sensor used for checking out if a bullet hit a player or something else - - - - - A 2D vector presenting the position of an enemy entity, position can also be visited - by X, Y - - - - - 当几何体调用了过多的CalcVec方法时,产生UnusedVertexException异常 - - - - - The _origin of this coordinate. - - - - - The horizontial axis of the coordinate. Point to the right direction. - - - - - The vertical axis of the coordinate. Point to the top direction. - - - - - Plain geometry only contains straight sides. - - - - - Calculate movement to center - - - CurrentPipeline time tick - - - - - - - - A square - - - - - A two dimension vector defined by two elements. Vec2 in World are default used as colum - vector. - - - - - Orthogonalize two s, let their length be 1 and perpendicular to - each other. - - - - - - - - - - - Reurns the value of ArcSin(x) - - - The sine value of the angle - - - - - - - - - - - Get the value of E ^ x; - - - - - - - - - - - - - - - - - Returns the value of ln(x). - - - - - calculate the value of x^y - - - - - - - - - Returns the value of x^y - - - - - returns a random float number between 0 and 1. - - - - - - - - - - - - - - - - Generates a random seed in int value. - - - - - - - - Interface of all kinds OpenGL BufferHandle objects - - - - - Get the only handle to one of the Object instance - - - - - - - - - - - Bind a BufferHandle instance to OpenGL - - - Index of handle of the object in this instance to be bind - - - - - - - - Function handler to load an opengl function by searching its _label. - - - the _label of the Opengl function - - - An Intptr value representing the pointer to the function - - - - - Hash code of time pixels updated last time. - - - - - A collection of a sets of OpenGL textures. The collection can automatically select one of - the texture with minimum costs to upgrade pixels to BufferHandle. Usually is used for loading, but not for - target of . - - - - - A collection of handle to Element BufferHandle Object in OpenglFunc. Each value indexed from instance of this class this is the only handle to - one Element BufferHandle Object. - - - - - Bind the frame BufferHandle object with _label frame BufferHandle to the frame - BufferHandle target specified by target. will - be set as default target. - - - Index of object to be binded in handle set - - - - - Bind the frame BufferHandle object with _label frame BufferHandle to the frame - BufferHandle target specified by target. Target of this frame BufferHandle should be - set manually. - - - The frame BufferHandle target of the binding operation. - - - Index of object to be binded in handle set - - - - - Load an to certain texture. - - - - - - - - - - - - - - - - Set _data to current vertex BufferHandle object - - - Type of bufferData - - - Index to find certain VBO in this instance - - - Data to write in - - - How OpenGL use these _data, defined by - - - - - Set _data to current vertex BufferHandle object - - - Type of bufferData - - - Index to find certain VBO in this instance - - - Data to write in - - - How OpenGL use these _data, defined by - - - - - Set _data to current vertex BufferHandle object - - - Type of bufferData - - - Index to find certain VBO in this instance - - - A of _data to write in - - - How OpenGL use these _data, defined by - - - - - Set data to current vertex BufferHandle object - - - Type of bufferData - - - Index to find certain VBO in this instance - - - A of data to write in - - - How OpenGL use these data, defined by - - - - - Set _data to current vertex BufferHandle object - - - Type of bufferData - - - Index to find certain VBO in this instance - - - A array of _data to write in - - - How OpenGL use these _data, defined by - - - - - Get the function pointer of given OpenGL api _label - - - ContextName of the OpenGL api - - - The funtion pointer of the api in stream of - - - - - Load all supported OpenGL APIs and bind them to given . - - - The handle to current OpenGL viewPortDisplay - - - - - Bind a frame BufferHandle to a frame BufferHandle target Same function as glBindFramebuffer . - - - The frame BufferHandle target of the binding operation. - - - The handle of the frame BufferHandle object to bind. - - - - - Delete a render BufferHandle object Very simlilar function as glDeleteRenderbuffers . The - only deifference is that this mehtod can only delete one renderbuffer at the same - time. - - - Handle to BufferHandle to delete. - - - - - Create a set of . - - - Amount of EBO to be created. - - - - - - - - Create a sets of - - - Amount of textures to be created. - - - - - - - - Create a set of . - - - Amount of VAO to be created. - - - - - - - - Create a set of . - - - Amount of Object to be created. - - - - - - - - Initialize an opengl context and load all opengl functions. - - - - - Initialize an OpenGl viewPortDisplay if current form has not been binded to any - viewPortDisplay. and set the viewPortDisplay binded to current form as current OpenGL - viewPortDisplay. - - - Something goes wrong and World fails in creating a new OpenGL viewPortDisplay. - - - - - - - - - - - Create an instance of program - - - New instance of instance. - - - - - Attach one shader code to a shader program. - - - Shader program to attach - - - Index of shader code in current shader code set. - - - - - CustomizeInit a program with no shader attached. - - - - - Get a uniform form current shader, the value type of the uniform should be provided. - - - ContextName of the Uniform in shader code - - - - - - - - Get a uniform form current shader, the value type of the uniform should be provided. - - - ContextName of the Uniform in shader code - - - - - - - - Get a uniform form current shader, the value type of the uniform should be provided. - - - ContextName of the Uniform in shader code - - - - - - - - Get a uniform form current shader, the value type of the uniform should be provided. - - - ContextName of the Uniform in shader code - - - - - - - - Link the shader to current viewPortDisplay. - - - - - Let the current viewPortDisplay use this shader. - - - - - - - - - - - - - - - - - - - - - - - - - - - - Set the Size limit of current form - - - Minimum width of current form - - - Minimum height of current form - - - Maximum width of current form - - - Maximum height of current form - - - - - Get (TView is ) uniform from a shader. - This uniform will be used as projection matrix of this camera. Additionally, for - multi- shader rendering, each shader requires a uniform, so do not ignore return - value of this method. - - - Shader using this camera - - - ContextName of projection camera named in shader - - - (TView is ) representing projection - matrix in shader program. - - - - - Marking the start of current render operations, and set this renser context as - current. - - - - - Marking the end of current render operations, and release the binding of this renser - context to current, making it available for another thread as current. - - - - - Get all uniform related to this . - - - Shader program requires this camera. - - - ContextName of all related uniforms. If you fallow form from - - - - - - - - Provide a lock for managing concurrent access to a buffer that can be expanded and use a - common two-pase-copy expanding mechanism. - - - - - An individual thread doing nothing, and its always returns false. - - - - - Try to allocate a new 16MB block when all buckets are empty - - - Output handle to the allocated Entry - - - True if allocation succeeded - - - - - Helper method for allocation - converts BucketNode to Entry - - - - - Initialize bucket system (called in constructor) - - - - - 根据锁类型释放BucketNode锁 - - - - - 按地址顺序释放BucketNode锁 - - - - - BucketNode structure - specialized node for bucket linked lists Stored in main - allocation area (user-overwritable region) - - - - - Free allocated memory block and perform adjacent block merging - - - Handle to the allocated memory block - - - - - Determine segment index based on size and originLevel - - - - - Check if two Entries are adjacent in memory - - - - - Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - Current Entry will serve as the final merged block. The Merge will be in lazy - strategy, any fail in acquiring spin lock will end a merging process. - - - - - Remove node from position linked list - - - - - Entry structure - streamlined version (only position and state information) Stored in - external SLAB - - - - - CustomizeInit this form and render it on screen, and respond with operation - - - - - Height of this form, represent in - - - - - Width of this form, represent in - - - - - Width of this form, represent in - - - - - Set the Size limit of current form - - - Minimum Size of current form. In form of a of (width,height) - - - Maximum Size of current form. In form of a of (width,height) - - - - - Set the Size limit of current form - - - Minimum width of current form - - - Minimum height of current form - - - Maximum width of current form - - - Maximum height of current form - - - - - ViewBase is the base type for all view types, providing context binding and control - element binding. A complete view should contain one complete , , and , which provide - layout descriptions of control elements, user responses, and rendering implementations in - the view. Data between instances of , , and is shared through . - - - - - Get the status of a certain key on the keyboard. - - - - - - representing if a key is pressed or released. - - - - - ViewDesigner provides descriptions of various controls in the view, binds the - controls to specific user actions and behaviors, and describes the layout and - interactions of each control. - - - - - - - - Reset pipeline has risk, this operation is a direct operation to port in current node, the - port on the other node cannot get the change. - - - - - Only the following occasions of calling are valid: 1. no bp is - running or the only bp is quitting.2. calling from the main thread or a - thread the current bp is running on. - - - - - A sets of complex logic designed for running in multi threads environment. Warning: do not - run a instance in multi threads more than once. - - - - - A microsecond-accuracy timer. It will refresh every a certain time span. - - - - - Create a new and define the length of time span. - Length of a single time span is defined in microseconds. - - - - - - - - - - - Create a new and define the length of time span. - Length of a single time span is defined in seconds. - - - - - - - - - - - Create a new and define the length of time span. - Length of a single time span is defined in microseconds. - - - - - - - - - - - - - - Time source provider provided in internal framework. - - - - - Optimized sampling-based adaptive backoff strategy that re-samples and evaluates the current - contention situation and adjusts the strategy after a certain number of fallbacks - - - - - Gets the current method - - - - - Creates a new optimized sampling adaptive backoff strategy instance - - - - - Gets the current sampling status (for debugging) - - - - - Gets the historical performance of the specified method (for monitoring) - - - - - Called when attempting CAS (must be called regardless of success or failure) - - - Whether this CAS attempt was successful - - - - - Called when CAS fails and fallback needs to be executed, performs backoff and may trigger - re-sampling - - - - - Determines initial method based on system characteristics - - - - - Determines the method to test in the next sampling window using optimized random selection - - - - - Evaluates the current sampling window and may adjust the strategy - - - - - Generates initial seed for RNG - - - - - Fast pseudo-random number generator using XorShift32 - - - - - Optimized backoff operation using jump table approach - - - - - Specialized SpinWait backoff with optimized logic - - - - - Switches to a new method with optimized state reset - - - - diff --git a/StgSharp.Common/obj/StgSharp.Common.csproj.nuget.dgspec.json b/StgSharp.Common/obj/StgSharp.Common.csproj.nuget.dgspec.json deleted file mode 100644 index a9460747..00000000 --- a/StgSharp.Common/obj/StgSharp.Common.csproj.nuget.dgspec.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "format": 1, - "restore": { - "D:\\platform-dev\\StgSharp.Common\\StgSharp.Common.csproj": {} - }, - "projects": { - "D:\\platform-dev\\StgSharp.Common\\StgSharp.Common.csproj": { - "version": "1.0.0", - "restore": { - "projectUniqueName": "D:\\platform-dev\\StgSharp.Common\\StgSharp.Common.csproj", - "projectName": "StgSharp.Common", - "projectPath": "D:\\platform-dev\\StgSharp.Common\\StgSharp.Common.csproj", - "packagesPath": "C:\\Users\\GF\\.nuget\\packages\\", - "outputPath": "D:\\platform-dev\\StgSharp.Common\\obj\\", - "projectStyle": "PackageReference", - "fallbackFolders": [ - "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" - ], - "configFilePaths": [ - "C:\\Users\\GF\\AppData\\Roaming\\NuGet\\NuGet.Config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" - ], - "originalTargetFrameworks": [ - "net8.0" - ], - "sources": { - "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, - "C:\\Program Files\\dotnet\\library-packs": {}, - "https://api.nuget.org/v3/index.json": {} - }, - "frameworks": { - "net8.0": { - "targetAlias": "net8.0", - "projectReferences": {} - } - }, - "warningProperties": { - "warnAsError": [ - "NU1605" - ] - }, - "restoreAuditProperties": { - "enableAudit": "true", - "auditLevel": "low", - "auditMode": "direct" - }, - "SdkAnalysisLevel": "9.0.300" - }, - "frameworks": { - "net8.0": { - "targetAlias": "net8.0", - "dependencies": { - "Microsoft.CSharp": { - "target": "Package", - "version": "[4.7.0, )" - }, - "System.Runtime.CompilerServices.Unsafe": { - "target": "Package", - "version": "[6.1.0, )" - } - }, - "imports": [ - "net461", - "net462", - "net47", - "net471", - "net472", - "net48", - "net481" - ], - "assetTargetFallback": true, - "warn": true, - "frameworkReferences": { - "Microsoft.NETCore.App": { - "privateAssets": "all" - } - }, - "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.304/PortableRuntimeIdentifierGraph.json" - } - } - } - } -} \ No newline at end of file diff --git a/StgSharp.Common/obj/StgSharp.Common.csproj.nuget.g.props b/StgSharp.Common/obj/StgSharp.Common.csproj.nuget.g.props deleted file mode 100644 index da8183d4..00000000 --- a/StgSharp.Common/obj/StgSharp.Common.csproj.nuget.g.props +++ /dev/null @@ -1,16 +0,0 @@ - - - - True - NuGet - $(MSBuildThisFileDirectory)project.assets.json - $(UserProfile)\.nuget\packages\ - C:\Users\GF\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages - PackageReference - 6.14.1 - - - - - - \ No newline at end of file diff --git a/StgSharp.Common/obj/StgSharp.Common.csproj.nuget.g.targets b/StgSharp.Common/obj/StgSharp.Common.csproj.nuget.g.targets deleted file mode 100644 index 3dc06ef3..00000000 --- a/StgSharp.Common/obj/StgSharp.Common.csproj.nuget.g.targets +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/StgSharp.Common/obj/project.assets.json b/StgSharp.Common/obj/project.assets.json deleted file mode 100644 index 1bc0a271..00000000 --- a/StgSharp.Common/obj/project.assets.json +++ /dev/null @@ -1,207 +0,0 @@ -{ - "version": 3, - "targets": { - "net8.0": { - "Microsoft.CSharp/4.7.0": { - "type": "package", - "compile": { - "ref/netcoreapp2.0/_._": {} - }, - "runtime": { - "lib/netcoreapp2.0/_._": {} - } - }, - "System.Runtime.CompilerServices.Unsafe/6.1.0": { - "type": "package", - "compile": { - "lib/net7.0/_._": {} - }, - "runtime": { - "lib/net7.0/_._": {} - }, - "build": { - "buildTransitive/net6.0/_._": {} - } - } - } - }, - "libraries": { - "Microsoft.CSharp/4.7.0": { - "sha512": "pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==", - "type": "package", - "path": "microsoft.csharp/4.7.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "LICENSE.TXT", - "THIRD-PARTY-NOTICES.TXT", - "lib/MonoAndroid10/_._", - "lib/MonoTouch10/_._", - "lib/net45/_._", - "lib/netcore50/Microsoft.CSharp.dll", - "lib/netcoreapp2.0/_._", - "lib/netstandard1.3/Microsoft.CSharp.dll", - "lib/netstandard2.0/Microsoft.CSharp.dll", - "lib/netstandard2.0/Microsoft.CSharp.xml", - "lib/portable-net45+win8+wp8+wpa81/_._", - "lib/uap10.0.16299/_._", - "lib/win8/_._", - "lib/wp80/_._", - "lib/wpa81/_._", - "lib/xamarinios10/_._", - "lib/xamarinmac20/_._", - "lib/xamarintvos10/_._", - "lib/xamarinwatchos10/_._", - "microsoft.csharp.4.7.0.nupkg.sha512", - "microsoft.csharp.nuspec", - "ref/MonoAndroid10/_._", - "ref/MonoTouch10/_._", - "ref/net45/_._", - "ref/netcore50/Microsoft.CSharp.dll", - "ref/netcore50/Microsoft.CSharp.xml", - "ref/netcore50/de/Microsoft.CSharp.xml", - "ref/netcore50/es/Microsoft.CSharp.xml", - "ref/netcore50/fr/Microsoft.CSharp.xml", - "ref/netcore50/it/Microsoft.CSharp.xml", - "ref/netcore50/ja/Microsoft.CSharp.xml", - "ref/netcore50/ko/Microsoft.CSharp.xml", - "ref/netcore50/ru/Microsoft.CSharp.xml", - "ref/netcore50/zh-hans/Microsoft.CSharp.xml", - "ref/netcore50/zh-hant/Microsoft.CSharp.xml", - "ref/netcoreapp2.0/_._", - "ref/netstandard1.0/Microsoft.CSharp.dll", - "ref/netstandard1.0/Microsoft.CSharp.xml", - "ref/netstandard1.0/de/Microsoft.CSharp.xml", - "ref/netstandard1.0/es/Microsoft.CSharp.xml", - "ref/netstandard1.0/fr/Microsoft.CSharp.xml", - "ref/netstandard1.0/it/Microsoft.CSharp.xml", - "ref/netstandard1.0/ja/Microsoft.CSharp.xml", - "ref/netstandard1.0/ko/Microsoft.CSharp.xml", - "ref/netstandard1.0/ru/Microsoft.CSharp.xml", - "ref/netstandard1.0/zh-hans/Microsoft.CSharp.xml", - "ref/netstandard1.0/zh-hant/Microsoft.CSharp.xml", - "ref/netstandard2.0/Microsoft.CSharp.dll", - "ref/netstandard2.0/Microsoft.CSharp.xml", - "ref/portable-net45+win8+wp8+wpa81/_._", - "ref/uap10.0.16299/_._", - "ref/win8/_._", - "ref/wp80/_._", - "ref/wpa81/_._", - "ref/xamarinios10/_._", - "ref/xamarinmac20/_._", - "ref/xamarintvos10/_._", - "ref/xamarinwatchos10/_._", - "useSharedDesignerContext.txt", - "version.txt" - ] - }, - "System.Runtime.CompilerServices.Unsafe/6.1.0": { - "sha512": "5o/HZxx6RVqYlhKSq8/zronDkALJZUT2Vz0hx43f0gwe8mwlM0y2nYlqdBwLMzr262Bwvpikeb/yEwkAa5PADg==", - "type": "package", - "path": "system.runtime.compilerservices.unsafe/6.1.0", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "Icon.png", - "PACKAGE.md", - "buildTransitive/net461/System.Runtime.CompilerServices.Unsafe.targets", - "buildTransitive/net462/_._", - "buildTransitive/net6.0/_._", - "buildTransitive/netcoreapp2.0/System.Runtime.CompilerServices.Unsafe.targets", - "lib/net462/System.Runtime.CompilerServices.Unsafe.dll", - "lib/net462/System.Runtime.CompilerServices.Unsafe.xml", - "lib/net7.0/_._", - "lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.dll", - "lib/netstandard2.0/System.Runtime.CompilerServices.Unsafe.xml", - "system.runtime.compilerservices.unsafe.6.1.0.nupkg.sha512", - "system.runtime.compilerservices.unsafe.nuspec" - ] - } - }, - "projectFileDependencyGroups": { - "net8.0": [ - "Microsoft.CSharp >= 4.7.0", - "System.Runtime.CompilerServices.Unsafe >= 6.1.0" - ] - }, - "packageFolders": { - "C:\\Users\\GF\\.nuget\\packages\\": {}, - "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages": {} - }, - "project": { - "version": "1.0.0", - "restore": { - "projectUniqueName": "D:\\platform-dev\\StgSharp.Common\\StgSharp.Common.csproj", - "projectName": "StgSharp.Common", - "projectPath": "D:\\platform-dev\\StgSharp.Common\\StgSharp.Common.csproj", - "packagesPath": "C:\\Users\\GF\\.nuget\\packages\\", - "outputPath": "D:\\platform-dev\\StgSharp.Common\\obj\\", - "projectStyle": "PackageReference", - "fallbackFolders": [ - "C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages" - ], - "configFilePaths": [ - "C:\\Users\\GF\\AppData\\Roaming\\NuGet\\NuGet.Config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config", - "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" - ], - "originalTargetFrameworks": [ - "net8.0" - ], - "sources": { - "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, - "C:\\Program Files\\dotnet\\library-packs": {}, - "https://api.nuget.org/v3/index.json": {} - }, - "frameworks": { - "net8.0": { - "targetAlias": "net8.0", - "projectReferences": {} - } - }, - "warningProperties": { - "warnAsError": [ - "NU1605" - ] - }, - "restoreAuditProperties": { - "enableAudit": "true", - "auditLevel": "low", - "auditMode": "direct" - }, - "SdkAnalysisLevel": "9.0.300" - }, - "frameworks": { - "net8.0": { - "targetAlias": "net8.0", - "dependencies": { - "Microsoft.CSharp": { - "target": "Package", - "version": "[4.7.0, )" - }, - "System.Runtime.CompilerServices.Unsafe": { - "target": "Package", - "version": "[6.1.0, )" - } - }, - "imports": [ - "net461", - "net462", - "net47", - "net471", - "net472", - "net48", - "net481" - ], - "assetTargetFallback": true, - "warn": true, - "frameworkReferences": { - "Microsoft.NETCore.App": { - "privateAssets": "all" - } - }, - "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.304/PortableRuntimeIdentifierGraph.json" - } - } - } -} \ No newline at end of file diff --git a/StgSharp.Common/obj/project.nuget.cache b/StgSharp.Common/obj/project.nuget.cache deleted file mode 100644 index 3da2b47f..00000000 --- a/StgSharp.Common/obj/project.nuget.cache +++ /dev/null @@ -1,11 +0,0 @@ -{ - "version": 2, - "dgSpecHash": "DkHI8xq62u8=", - "success": true, - "projectFilePath": "D:\\platform-dev\\StgSharp.Common\\StgSharp.Common.csproj", - "expectedPackageFiles": [ - "C:\\Users\\GF\\.nuget\\packages\\microsoft.csharp\\4.7.0\\microsoft.csharp.4.7.0.nupkg.sha512", - "C:\\Users\\GF\\.nuget\\packages\\system.runtime.compilerservices.unsafe\\6.1.0\\system.runtime.compilerservices.unsafe.6.1.0.nupkg.sha512" - ], - "logs": [] -} \ No newline at end of file diff --git a/StgSharp.Common/obj/x64/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs b/StgSharp.Common/obj/x64/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs deleted file mode 100644 index 2217181c..00000000 --- a/StgSharp.Common/obj/x64/Debug/net8.0/.NETCoreApp,Version=v8.0.AssemblyAttributes.cs +++ /dev/null @@ -1,4 +0,0 @@ -// -using System; -using System.Reflection; -[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")] diff --git a/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.AssemblyInfo.cs b/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.AssemblyInfo.cs deleted file mode 100644 index 9c8c86e9..00000000 --- a/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.AssemblyInfo.cs +++ /dev/null @@ -1,24 +0,0 @@ -//------------------------------------------------------------------------------ -// -// 此代码由工具生成。 -// 运行时版本:4.0.30319.42000 -// -// 对此文件的更改可能会导致不正确的行为,并且如果 -// 重新生成代码,这些更改将会丢失。 -// -//------------------------------------------------------------------------------ - -using System; -using System.Reflection; - -[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp.Common")] -[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] -[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+fb9398e8be3d431aa4ca7fb868cc14bdc702acd9")] -[assembly: System.Reflection.AssemblyProductAttribute("StgSharp.Common")] -[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp.Common")] -[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyMetadataAttribute("RepositoryUrl", "https://github.com/Nitload-NSI/StgSharp.git")] - -// 由 MSBuild WriteCodeFragment 类生成。 - diff --git a/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.AssemblyInfoInputs.cache b/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.AssemblyInfoInputs.cache deleted file mode 100644 index 2475b989..00000000 --- a/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.AssemblyInfoInputs.cache +++ /dev/null @@ -1 +0,0 @@ -214a229749746edd22a0354fcb9a5a374238563ad0aa2f1c164a60c41ac58dfb diff --git a/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.GeneratedMSBuildEditorConfig.editorconfig b/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.GeneratedMSBuildEditorConfig.editorconfig deleted file mode 100644 index aeb5d334..00000000 --- a/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.GeneratedMSBuildEditorConfig.editorconfig +++ /dev/null @@ -1,15 +0,0 @@ -is_global = true -build_property.TargetFramework = net8.0 -build_property.TargetPlatformMinVersion = -build_property.UsingMicrosoftNETSdkWeb = -build_property.ProjectTypeGuids = -build_property.InvariantGlobalization = -build_property.PlatformNeutralAssembly = -build_property.EnforceExtendedAnalyzerRules = -build_property._SupportedPlatformList = Linux,macOS,Windows -build_property.RootNamespace = StgSharp.Common -build_property.ProjectDir = D:\platform-dev\StgSharp.Common\ -build_property.EnableComHosting = -build_property.EnableGeneratedComInterfaceComImportInterop = -build_property.EffectiveAnalysisLevelStyle = 10.0 -build_property.EnableCodeStyleSeverity = diff --git a/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.assets.cache b/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.assets.cache deleted file mode 100644 index e93f7291..00000000 Binary files a/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.assets.cache and /dev/null differ diff --git a/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.csproj.BuildWithSkipAnalyzers b/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.csproj.BuildWithSkipAnalyzers deleted file mode 100644 index e69de29b..00000000 diff --git a/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.csproj.CoreCompileInputs.cache b/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.csproj.CoreCompileInputs.cache deleted file mode 100644 index 09abb015..00000000 --- a/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.csproj.CoreCompileInputs.cache +++ /dev/null @@ -1 +0,0 @@ -087b1cc39bfab9be9f3508d9e3a7130773d5d9c4f5e1be08e316668e4f20b187 diff --git a/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.csproj.FileListAbsolute.txt b/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.csproj.FileListAbsolute.txt deleted file mode 100644 index 135c22ea..00000000 --- a/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.csproj.FileListAbsolute.txt +++ /dev/null @@ -1,28 +0,0 @@ -D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Common\bin\x64\Debug\net8.0\StgSharp.Common.deps.json -D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Common\bin\x64\Debug\net8.0\StgSharp.Common.dll -D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Common\bin\x64\Debug\net8.0\StgSharp.Common.pdb -D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Common\bin\x64\Debug\net8.0\StgSharp.Common.xml -D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Common\obj\x64\Debug\net8.0\StgSharp.Common.GeneratedMSBuildEditorConfig.editorconfig -D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Common\obj\x64\Debug\net8.0\StgSharp.Common.AssemblyInfoInputs.cache -D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Common\obj\x64\Debug\net8.0\StgSharp.Common.AssemblyInfo.cs -D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Common\obj\x64\Debug\net8.0\StgSharp.Common.csproj.CoreCompileInputs.cache -D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Common\obj\x64\Debug\net8.0\StgSharp.Common.sourcelink.json -D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Common\obj\x64\Debug\net8.0\StgSharp.Common.dll -D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Common\obj\x64\Debug\net8.0\refint\StgSharp.Common.dll -D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Common\obj\x64\Debug\net8.0\StgSharp.Common.xml -D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Common\obj\x64\Debug\net8.0\StgSharp.Common.pdb -D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\内核源代码\StgSharp.Common\obj\x64\Debug\net8.0\ref\StgSharp.Common.dll -D:\platform-dev\StgSharp.Common\bin\x64\Debug\net8.0\StgSharp.Common.deps.json -D:\platform-dev\StgSharp.Common\bin\x64\Debug\net8.0\StgSharp.Common.dll -D:\platform-dev\StgSharp.Common\bin\x64\Debug\net8.0\StgSharp.Common.pdb -D:\platform-dev\StgSharp.Common\bin\x64\Debug\net8.0\StgSharp.Common.xml -D:\platform-dev\StgSharp.Common\obj\x64\Debug\net8.0\StgSharp.Common.GeneratedMSBuildEditorConfig.editorconfig -D:\platform-dev\StgSharp.Common\obj\x64\Debug\net8.0\StgSharp.Common.AssemblyInfoInputs.cache -D:\platform-dev\StgSharp.Common\obj\x64\Debug\net8.0\StgSharp.Common.AssemblyInfo.cs -D:\platform-dev\StgSharp.Common\obj\x64\Debug\net8.0\StgSharp.Common.csproj.CoreCompileInputs.cache -D:\platform-dev\StgSharp.Common\obj\x64\Debug\net8.0\StgSharp.Common.sourcelink.json -D:\platform-dev\StgSharp.Common\obj\x64\Debug\net8.0\StgSharp.Common.dll -D:\platform-dev\StgSharp.Common\obj\x64\Debug\net8.0\refint\StgSharp.Common.dll -D:\platform-dev\StgSharp.Common\obj\x64\Debug\net8.0\StgSharp.Common.xml -D:\platform-dev\StgSharp.Common\obj\x64\Debug\net8.0\StgSharp.Common.pdb -D:\platform-dev\StgSharp.Common\obj\x64\Debug\net8.0\ref\StgSharp.Common.dll diff --git a/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.dll b/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.dll deleted file mode 100644 index 7ea2556c..00000000 Binary files a/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.dll and /dev/null differ diff --git a/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.pdb b/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.pdb deleted file mode 100644 index ee6b51cf..00000000 Binary files a/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.pdb and /dev/null differ diff --git a/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.sourcelink.json b/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.sourcelink.json deleted file mode 100644 index 0fa893c0..00000000 --- a/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.sourcelink.json +++ /dev/null @@ -1 +0,0 @@ -{"documents":{"D:\\platform-dev\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/fb9398e8be3d431aa4ca7fb868cc14bdc702acd9/*"}} \ No newline at end of file diff --git a/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.xml b/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.xml deleted file mode 100644 index 987bd30e..00000000 --- a/StgSharp.Common/obj/x64/Debug/net8.0/StgSharp.Common.xml +++ /dev/null @@ -1,1066 +0,0 @@ - - - - StgSharp.Common - - - - - Determines whether the - contains the specified key. - - - The value to locate in the . - - - true if the contains an - element with the specified key; otherwise, false. - - - - - Determines whether the - contains the specified key. - - - The value to locate in the . - - - true if the contains an - element with the specified key; otherwise, false. - - - - - Part of a collection. This contains a direct reference to _origin collection, so all - change to _origin collection will be reflected in this object. - - - - - - - - Initializes a new instance of the RandomAccessStack class that is empty and has the - default initial capacity. - - - - - Initializes a new instance of the RandomAccessStack class that is empty and has the - specified initial capacity. - - - - - Gets or sets the element at the specified index in the stack (0 = bottom, Count-1 = - top). - - - - - Gets the number of elements contained in the stack. - - - - - Removes all objects from the stack. - - - - - Returns an enumerator that iterates through the stack from top to bottom. Throws if - the stack is modified during iteration. - - - - - Returns the object at the top of the stack without removing it. - - - - - Removes and returns the object at the top of the stack. - - - - - Adds an item to the top of the stack. - - - - - CustomizeInit an instance of OpenGL program, This method should be called before any - other World api. - - - - - Version of current World platform. Main version represent in hundred's digit, and sub - version represent in ten's digit. - - - - - Write a log message to log file, and mark the _level of this message. - - - A string contains information of how current evironment runs. - - - The severity of current message. - - - - - A class attempt to reduce cost of boxing, though still a bit slower than direct access to - _origin value type instance. - - - Type of instance to be boxed. - - - - - A class contains a sets of methods to serialize several types - - - - - An independent storage area, used as the only folder type in root folder. Contains several - files reference as virtual disc. Data is actually stored in s in certain RAID mode. - - - - - OpenGL numeric type. An IEEE-754 floating-point value, clamped to the range [0,1]. - - - - - OpenGL numeric type. An IEEE-754 double precision floating-point value, clamped to the - range [0,1]. - - - - - X position of an enenmy entity - - - - - Y position of an enemy entity - - - - - A sensor used for checking out if a bullet hit a player or something else - - - - - A 2D vector presenting the position of an enemy entity, position can also be visited - by X, Y - - - - - 当几何体调用了过多的CalcVec方法时,产生UnusedVertexException异常 - - - - - The _origin of this coordinate. - - - - - The horizontial axis of the coordinate. Point to the right direction. - - - - - The vertical axis of the coordinate. Point to the top direction. - - - - - Plain geometry only contains straight sides. - - - - - Calculate movement to center - - - CurrentPipeline time tick - - - - - - - - A square - - - - - A two dimension vector defined by two elements. Vec2 in World are default used as colum - vector. - - - - - Orthogonalize two s, let their length be 1 and perpendicular to - each other. - - - - - - - - - - - Reurns the value of ArcSin(x) - - - The sine value of the angle - - - - - - - - - - - Get the value of E ^ x; - - - - - - - - - - - - - - - - - Returns the value of ln(x). - - - - - calculate the value of x^y - - - - - - - - - Returns the value of x^y - - - - - returns a random float number between 0 and 1. - - - - - - - - - - - - - - - - Generates a random seed in int value. - - - - - - - - Interface of all kinds OpenGL BufferHandle objects - - - - - Get the only handle to one of the Object instance - - - - - - - - - - - Bind a BufferHandle instance to OpenGL - - - Index of handle of the object in this instance to be bind - - - - - - - - Function handler to load an opengl function by searching its _label. - - - the _label of the Opengl function - - - An Intptr value representing the pointer to the function - - - - - Hash code of time pixels updated last time. - - - - - A collection of a sets of OpenGL textures. The collection can automatically select one of - the texture with minimum costs to upgrade pixels to BufferHandle. Usually is used for loading, but not for - target of . - - - - - A collection of handle to Element BufferHandle Object in OpenglFunc. Each value indexed from instance of this class this is the only handle to - one Element BufferHandle Object. - - - - - Bind the frame BufferHandle object with _label frame BufferHandle to the frame - BufferHandle target specified by target. will - be set as default target. - - - Index of object to be binded in handle set - - - - - Bind the frame BufferHandle object with _label frame BufferHandle to the frame - BufferHandle target specified by target. Target of this frame BufferHandle should be - set manually. - - - The frame BufferHandle target of the binding operation. - - - Index of object to be binded in handle set - - - - - Load an to certain texture. - - - - - - - - - - - - - - - - Set _data to current vertex BufferHandle object - - - Type of bufferData - - - Index to find certain VBO in this instance - - - Data to write in - - - How OpenGL use these _data, defined by - - - - - Set _data to current vertex BufferHandle object - - - Type of bufferData - - - Index to find certain VBO in this instance - - - Data to write in - - - How OpenGL use these _data, defined by - - - - - Set _data to current vertex BufferHandle object - - - Type of bufferData - - - Index to find certain VBO in this instance - - - A of _data to write in - - - How OpenGL use these _data, defined by - - - - - Set data to current vertex BufferHandle object - - - Type of bufferData - - - Index to find certain VBO in this instance - - - A of data to write in - - - How OpenGL use these data, defined by - - - - - Set _data to current vertex BufferHandle object - - - Type of bufferData - - - Index to find certain VBO in this instance - - - A array of _data to write in - - - How OpenGL use these _data, defined by - - - - - Get the function pointer of given OpenGL api _label - - - ContextName of the OpenGL api - - - The funtion pointer of the api in stream of - - - - - Load all supported OpenGL APIs and bind them to given . - - - The handle to current OpenGL viewPortDisplay - - - - - Bind a frame BufferHandle to a frame BufferHandle target Same function as glBindFramebuffer . - - - The frame BufferHandle target of the binding operation. - - - The handle of the frame BufferHandle object to bind. - - - - - Delete a render BufferHandle object Very simlilar function as glDeleteRenderbuffers . The - only deifference is that this mehtod can only delete one renderbuffer at the same - time. - - - Handle to BufferHandle to delete. - - - - - Create a set of . - - - Amount of EBO to be created. - - - - - - - - Create a sets of - - - Amount of textures to be created. - - - - - - - - Create a set of . - - - Amount of VAO to be created. - - - - - - - - Create a set of . - - - Amount of Object to be created. - - - - - - - - Initialize an opengl context and load all opengl functions. - - - - - Initialize an OpenGl viewPortDisplay if current form has not been binded to any - viewPortDisplay. and set the viewPortDisplay binded to current form as current OpenGL - viewPortDisplay. - - - Something goes wrong and World fails in creating a new OpenGL viewPortDisplay. - - - - - - - - - - - Create an instance of program - - - New instance of instance. - - - - - Attach one shader code to a shader program. - - - Shader program to attach - - - Index of shader code in current shader code set. - - - - - CustomizeInit a program with no shader attached. - - - - - Get a uniform form current shader, the value type of the uniform should be provided. - - - ContextName of the Uniform in shader code - - - - - - - - Get a uniform form current shader, the value type of the uniform should be provided. - - - ContextName of the Uniform in shader code - - - - - - - - Get a uniform form current shader, the value type of the uniform should be provided. - - - ContextName of the Uniform in shader code - - - - - - - - Get a uniform form current shader, the value type of the uniform should be provided. - - - ContextName of the Uniform in shader code - - - - - - - - Link the shader to current viewPortDisplay. - - - - - Let the current viewPortDisplay use this shader. - - - - - - - - - - - - - - - - - - - - - - - - - - - - Set the Size limit of current form - - - Minimum width of current form - - - Minimum height of current form - - - Maximum width of current form - - - Maximum height of current form - - - - - Get (TView is ) uniform from a shader. - This uniform will be used as projection matrix of this camera. Additionally, for - multi- shader rendering, each shader requires a uniform, so do not ignore return - value of this method. - - - Shader using this camera - - - ContextName of projection camera named in shader - - - (TView is ) representing projection - matrix in shader program. - - - - - Marking the start of current render operations, and set this renser context as - current. - - - - - Marking the end of current render operations, and release the binding of this renser - context to current, making it available for another thread as current. - - - - - Get all uniform related to this . - - - Shader program requires this camera. - - - ContextName of all related uniforms. If you fallow form from - - - - - - - - Provide a lock for managing concurrent access to a buffer that can be expanded and use a - common two-pase-copy expanding mechanism. - - - - - An individual thread doing nothing, and its always returns false. - - - - - Try to allocate a new 16MB block when all buckets are empty - - - Output handle to the allocated Entry - - - True if allocation succeeded - - - - - Helper method for allocation - converts BucketNode to Entry - - - - - Initialize bucket system (called in constructor) - - - - - 根据锁类型释放BucketNode锁 - - - - - 按地址顺序释放BucketNode锁 - - - - - BucketNode structure - specialized node for bucket linked lists Stored in main - allocation area (user-overwritable region) - - - - - Free allocated memory block and perform adjacent block merging - - - Handle to the allocated memory block - - - - - Determine segment index based on size and originLevel - - - - - Check if two Entries are adjacent in memory - - - - - Used in Free operations, efficiently remove from buckets and merge adjacent blocks. - Current Entry will serve as the final merged block. The Merge will be in lazy - strategy, any fail in acquiring spin lock will end a merging process. - - - - - Remove node from position linked list - - - - - Entry structure - streamlined version (only position and state information) Stored in - external SLAB - - - - - CustomizeInit this form and render it on screen, and respond with operation - - - - - Height of this form, represent in - - - - - Width of this form, represent in - - - - - Width of this form, represent in - - - - - Set the Size limit of current form - - - Minimum Size of current form. In form of a of (width,height) - - - Maximum Size of current form. In form of a of (width,height) - - - - - Set the Size limit of current form - - - Minimum width of current form - - - Minimum height of current form - - - Maximum width of current form - - - Maximum height of current form - - - - - ViewBase is the base type for all view types, providing context binding and control - element binding. A complete view should contain one complete , , and , which provide - layout descriptions of control elements, user responses, and rendering implementations in - the view. Data between instances of , , and is shared through . - - - - - Get the status of a certain key on the keyboard. - - - - - - representing if a key is pressed or released. - - - - - ViewDesigner provides descriptions of various controls in the view, binds the - controls to specific user actions and behaviors, and describes the layout and - interactions of each control. - - - - - - - - Reset pipeline has risk, this operation is a direct operation to port in current node, the - port on the other node cannot get the change. - - - - - Only the following occasions of calling are valid: 1. no bp is - running or the only bp is quitting.2. calling from the main thread or a - thread the current bp is running on. - - - - - A sets of complex logic designed for running in multi threads environment. Warning: do not - run a instance in multi threads more than once. - - - - - A microsecond-accuracy timer. It will refresh every a certain time span. - - - - - Create a new and define the length of time span. - Length of a single time span is defined in microseconds. - - - - - - - - - - - Create a new and define the length of time span. - Length of a single time span is defined in seconds. - - - - - - - - - - - Create a new and define the length of time span. - Length of a single time span is defined in microseconds. - - - - - - - - - - - - - - Time source provider provided in internal framework. - - - - - Optimized sampling-based adaptive backoff strategy that re-samples and evaluates the current - contention situation and adjusts the strategy after a certain number of fallbacks - - - - - Gets the current method - - - - - Creates a new optimized sampling adaptive backoff strategy instance - - - - - Gets the current sampling status (for debugging) - - - - - Gets the historical performance of the specified method (for monitoring) - - - - - Called when attempting CAS (must be called regardless of success or failure) - - - Whether this CAS attempt was successful - - - - - Called when CAS fails and fallback needs to be executed, performs backoff and may trigger - re-sampling - - - - - Determines initial method based on system characteristics - - - - - Determines the method to test in the next sampling window using optimized random selection - - - - - Evaluates the current sampling window and may adjust the strategy - - - - - Generates initial seed for RNG - - - - - Fast pseudo-random number generator using XorShift32 - - - - - Optimized backoff operation using jump table approach - - - - - Specialized SpinWait backoff with optimized logic - - - - - Switches to a new method with optimized state reset - - - - diff --git a/StgSharp.Common/obj/x64/Debug/net8.0/ref/StgSharp.Common.dll b/StgSharp.Common/obj/x64/Debug/net8.0/ref/StgSharp.Common.dll deleted file mode 100644 index 49ff9dd8..00000000 Binary files a/StgSharp.Common/obj/x64/Debug/net8.0/ref/StgSharp.Common.dll and /dev/null differ diff --git a/StgSharp.Common/obj/x64/Debug/net8.0/refint/StgSharp.Common.dll b/StgSharp.Common/obj/x64/Debug/net8.0/refint/StgSharp.Common.dll deleted file mode 100644 index 49ff9dd8..00000000 Binary files a/StgSharp.Common/obj/x64/Debug/net8.0/refint/StgSharp.Common.dll and /dev/null differ