From 4594a6363424928ab812643a4972f6111ed8689a Mon Sep 17 00:00:00 2001 From: WebFreak001 Date: Thu, 7 Jul 2022 00:41:57 +0200 Subject: [PATCH] replace stdx-allocator with std.experimental --- build.bat | 5 ----- dsymbol | 2 +- dub.json | 5 ++--- libdparse | 2 +- makefile | 3 --- src/dcd/server/autocomplete/complete.d | 13 +++++++------ src/dcd/server/autocomplete/doc.d | 3 ++- src/dcd/server/autocomplete/localuse.d | 5 +++-- src/dcd/server/autocomplete/symbols.d | 9 +++++---- src/dcd/server/autocomplete/util.d | 4 ++-- src/dcd/server/main.d | 6 +++--- 11 files changed, 26 insertions(+), 31 deletions(-) diff --git a/build.bat b/build.bat index 285502b..ee208cc 100644 --- a/build.bat +++ b/build.bat @@ -34,9 +34,6 @@ for /r "libdparse/src" %%F in (*.d) do call set libdparse_modules=%%libdparse_mo set msgspack_modules= for /r "msgpack-d/src" %%F in (*.d) do call set msgspack_modules=%%msgspack_modules%% "%%F" -set stdx_allocator= -for /r "stdx-allocator/source/stdx/allocator" %%F in (*.d) do call set stdx_allocator=%%stdx_allocator%% "%%F" - set client_name=bin\dcd-client set server_name=bin\dcd-server @@ -59,11 +56,9 @@ set server_name=bin\dcd-server %common_modules%^ %containers_modules%^ %msgspack_modules%^ - %stdx_allocator%^ -Icontainers/src^ -Imsgpack-d/src^ -Ilibdparse/src^ - -Istdx-allocator/source^ -wi -O -release^ -Jbin^ %MFLAGS%^ diff --git a/dsymbol b/dsymbol index f9a3d30..46873f0 160000 --- a/dsymbol +++ b/dsymbol @@ -1 +1 @@ -Subproject commit f9a3d302527a9e50140991562648a147b6f5a78e +Subproject commit 46873f01f74844ab0bea0af14643cdd791573505 diff --git a/dub.json b/dub.json index 561e8e8..65ba4eb 100644 --- a/dub.json +++ b/dub.json @@ -7,10 +7,9 @@ ], "license": "GPL-3.0", "dependencies": { - "dsymbol": ">=0.11.2 <0.12.0", - "libdparse": ">=0.15.4 <0.16.0", + "dsymbol": ">=0.14.0 <0.15.0", + "libdparse": ">=0.20.0 <0.21.0", ":common": "*", - "stdx-allocator": "~>2.77.5", "emsi_containers": "~>0.8.0" }, "subPackages": ["common"], diff --git a/libdparse b/libdparse index 1393ee4..c3fa4e6 160000 --- a/libdparse +++ b/libdparse @@ -1 +1 @@ -Subproject commit 1393ee4d0c8e50011e641e06d64c429841fb3c2b +Subproject commit c3fa4e6eb3720c6aad9e9a772a919ccee2cf1215 diff --git a/makefile b/makefile index 0adeb83..6c5be13 100644 --- a/makefile +++ b/makefile @@ -12,7 +12,6 @@ LDC := ldc2 DPARSE_DIR := libdparse DSYMBOL_DIR := dsymbol -STDXALLOC_DIR := stdx-allocator SHELL:=/bin/bash @@ -65,7 +64,6 @@ SERVER_SRC := \ $(shell find common/src/dcd/common -name "*.d")\ $(shell find src/dcd/server -name "*.d")\ $(shell find ${DSYMBOL_DIR}/src -name "*.d")\ - $(shell find ${STDXALLOC_DIR}/source -name "*.d")\ $(shell find ${DPARSE_DIR}/src -name "*.d")\ $(shell find containers/src -name "*.d")\ $(shell find msgpack-d/src/ -name "*.d") @@ -74,7 +72,6 @@ DMD_SERVER_FLAGS := -Icontainers/src\ -Imsgpack-d/src\ -I${DPARSE_DIR}/src\ -I${DSYMBOL_DIR}/src\ - -I${STDXALLOC_DIR}/source\ -Jbin\ -wi\ -O\ diff --git a/src/dcd/server/autocomplete/complete.d b/src/dcd/server/autocomplete/complete.d index c346e27..3e84b30 100644 --- a/src/dcd/server/autocomplete/complete.d +++ b/src/dcd/server/autocomplete/complete.d @@ -21,6 +21,7 @@ module dcd.server.autocomplete.complete; import std.algorithm; import std.array; import std.conv; +import std.experimental.allocator; import std.experimental.logger; import std.file; import std.path; @@ -215,8 +216,8 @@ AutocompleteResponse dotCompletion(T)(T beforeTokens, const(Token)[] tokenArray, case tok!"]": scope allocator = new ASTAllocator(); RollbackAllocator rba; - ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, allocator, - &rba, cursorPosition, moduleCache); + ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, + allocator.allocatorObject, &rba, cursorPosition, moduleCache); scope(exit) pair.destroy(); response.setCompletions(pair.scope_, getExpression(beforeTokens), cursorPosition, CompletionType.identifiers, false, partial); @@ -231,8 +232,8 @@ AutocompleteResponse dotCompletion(T)(T beforeTokens, const(Token)[] tokenArray, case tok!",": scope allocator = new ASTAllocator(); RollbackAllocator rba; - ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, allocator, - &rba, 1, moduleCache); + ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, + allocator.allocatorObject, &rba, 1, moduleCache); scope(exit) pair.destroy(); response.setCompletions(pair.scope_, getExpression(beforeTokens), 1, CompletionType.identifiers, false, partial); @@ -304,8 +305,8 @@ AutocompleteResponse parenCompletion(T)(T beforeTokens, mixin(STRING_LITERAL_CASES); scope allocator = new ASTAllocator(); RollbackAllocator rba; - ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, allocator, - &rba, cursorPosition, moduleCache); + ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, + allocator.allocatorObject, &rba, cursorPosition, moduleCache); scope(exit) pair.destroy(); auto expression = getExpression(beforeTokens[0 .. $ - 1]); response.setCompletions(pair.scope_, expression, diff --git a/src/dcd/server/autocomplete/doc.d b/src/dcd/server/autocomplete/doc.d index 5d6ee3b..f3103ea 100644 --- a/src/dcd/server/autocomplete/doc.d +++ b/src/dcd/server/autocomplete/doc.d @@ -20,6 +20,7 @@ module dcd.server.autocomplete.doc; import std.algorithm; import std.array; +import std.experimental.allocator; import std.experimental.logger; import std.typecons; @@ -48,7 +49,7 @@ public AutocompleteResponse getDoc(const AutocompleteRequest request, scope allocator = new ASTAllocator(); auto cache = StringCache(request.sourceCode.length.optimalBucketCount); SymbolStuff stuff = getSymbolsForCompletion(request, CompletionType.ddoc, - allocator, &rba, cache, moduleCache); + allocator.allocatorObject, &rba, cache, moduleCache); if (stuff.symbols.length == 0) warning("Could not find symbol"); else diff --git a/src/dcd/server/autocomplete/localuse.d b/src/dcd/server/autocomplete/localuse.d index b3ab16c..9195624 100644 --- a/src/dcd/server/autocomplete/localuse.d +++ b/src/dcd/server/autocomplete/localuse.d @@ -18,6 +18,7 @@ module dcd.server.autocomplete.localuse; +import std.experimental.allocator; import std.experimental.logger; import std.range; import std.typecons; @@ -60,8 +61,8 @@ public AutocompleteResponse findLocalUse(AutocompleteRequest request, { auto sortedTokens = assumeSorted(tokenArray); auto beforeTokens = sortedTokens.lowerBound(cursorPosition); - ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, allocator, - &rba, request.cursorPosition, moduleCache); + ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, + allocator.allocatorObject, &rba, request.cursorPosition, moduleCache); auto expression = getExpression(beforeTokens); return SymbolStuff(getSymbolsByTokenChain(pair.scope_, expression, cursorPosition, CompletionType.location), pair.symbol, pair.scope_); diff --git a/src/dcd/server/autocomplete/symbols.d b/src/dcd/server/autocomplete/symbols.d index d06df7e..5c8bd3a 100644 --- a/src/dcd/server/autocomplete/symbols.d +++ b/src/dcd/server/autocomplete/symbols.d @@ -18,6 +18,7 @@ module dcd.server.autocomplete.symbols; +import std.experimental.allocator; import std.experimental.logger; import std.typecons; @@ -49,8 +50,8 @@ public AutocompleteResponse findDeclaration(const AutocompleteRequest request, RollbackAllocator rba; scope allocator = new ASTAllocator(); auto cache = StringCache(request.sourceCode.length.optimalBucketCount); - SymbolStuff stuff = getSymbolsForCompletion(request, - CompletionType.location, allocator, &rba, cache, moduleCache); + SymbolStuff stuff = getSymbolsForCompletion(request, CompletionType.location, + allocator.allocatorObject, &rba, cache, moduleCache); scope(exit) stuff.destroy(); if (stuff.symbols.length > 0) { @@ -77,8 +78,8 @@ public AutocompleteResponse symbolSearch(const AutocompleteRequest request, config, &cache); scope allocator = new ASTAllocator(); RollbackAllocator rba; - ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, allocator, - &rba, request.cursorPosition, moduleCache); + ScopeSymbolPair pair = generateAutocompleteTrees(tokenArray, + allocator.allocatorObject, &rba, request.cursorPosition, moduleCache); scope(exit) pair.destroy(); static struct SearchResults diff --git a/src/dcd/server/autocomplete/util.d b/src/dcd/server/autocomplete/util.d index 9bc6439..9c06c50 100644 --- a/src/dcd/server/autocomplete/util.d +++ b/src/dcd/server/autocomplete/util.d @@ -19,7 +19,7 @@ module dcd.server.autocomplete.util; import std.algorithm; -import stdx.allocator; +import std.experimental.allocator; import std.experimental.logger; import std.range; import std.string; @@ -134,7 +134,7 @@ auto getTokensBeforeCursor(const(ubyte[]) sourceCode, size_t cursorPosition, * the request's source code, cursor position, and completion type. */ SymbolStuff getSymbolsForCompletion(const AutocompleteRequest request, - const CompletionType type, IAllocator allocator, RollbackAllocator* rba, + const CompletionType type, RCIAllocator allocator, RollbackAllocator* rba, ref StringCache cache, ref ModuleCache moduleCache) { const(Token)[] tokenArray; diff --git a/src/dcd/server/main.d b/src/dcd/server/main.d index ed31645..4fa4d3b 100644 --- a/src/dcd/server/main.d +++ b/src/dcd/server/main.d @@ -24,8 +24,8 @@ import std.array; import std.conv; import std.datetime.stopwatch : AutoStart, StopWatch; import std.exception : enforce; -import stdx.allocator; -import stdx.allocator.mallocator; +import std.experimental.allocator; +import std.experimental.allocator.mallocator; import std.experimental.logger; import std.file; import std.getopt; @@ -176,7 +176,7 @@ int runServer(string[] args) info("Sockets shut down."); } - ModuleCache cache = ModuleCache(new ASTAllocator); + ModuleCache cache = ModuleCache(new ASTAllocator().allocatorObject); cache.addImportPaths(importPaths); infof("Import directories:\n %-(%s\n %)", cache.getImportPaths());