Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace stdx-allocator with std.experimental #672

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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%^
Expand Down
5 changes: 2 additions & 3 deletions dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
3 changes: 0 additions & 3 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ LDC := ldc2

DPARSE_DIR := libdparse
DSYMBOL_DIR := dsymbol
STDXALLOC_DIR := stdx-allocator

SHELL:=/bin/bash

Expand Down Expand Up @@ -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")
Expand All @@ -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\
Expand Down
13 changes: 7 additions & 6 deletions src/dcd/server/autocomplete/complete.d
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion src/dcd/server/autocomplete/doc.d
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions src/dcd/server/autocomplete/localuse.d
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

module dcd.server.autocomplete.localuse;

import std.experimental.allocator;
import std.experimental.logger;
import std.range;
import std.typecons;
Expand Down Expand Up @@ -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_);
Expand Down
9 changes: 5 additions & 4 deletions src/dcd/server/autocomplete/symbols.d
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

module dcd.server.autocomplete.symbols;

import std.experimental.allocator;
import std.experimental.logger;
import std.typecons;

Expand Down Expand Up @@ -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)
{
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/dcd/server/autocomplete/util.d
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/dcd/server/main.d
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());

Expand Down