new gensym handling (#11985)

* new .gensym implementation
* make astspec test green again
* introduce a --useVersion switch to group compatibility switches
* fixes #10180
* fixes #11494 
* fixes #11483
* object constructor fields and named parameters are also not gensym'ed
* disabled broken package
This commit is contained in:
Andreas Rumpf
2019-08-23 16:15:02 +02:00
committed by GitHub
parent f28a47ea7b
commit b07694cd90
18 changed files with 346 additions and 114 deletions

View File

@@ -60,11 +60,11 @@ template withLock*(a: Lock, body: untyped) =
## Acquires the given lock, executes the statements in body and
## releases the lock after the statements finish executing.
mixin acquire, release
a.acquire()
acquire(a)
{.locks: [a].}:
try:
body
finally:
a.release()
release(a)
{.pop.}

View File

@@ -984,7 +984,7 @@ when defined(nimTypeNames):
# ---------------------- thread memory region -------------------------------
template instantiateForRegion(allocator: untyped) =
template instantiateForRegion(allocator: untyped) {.dirty.} =
{.push stackTrace: off.}
when defined(fulldebug):
@@ -1006,8 +1006,8 @@ template instantiateForRegion(allocator: untyped) =
proc dealloc(p: pointer) =
dealloc(allocator, p)
proc realloc(p: pointer, newsize: Natural): pointer =
result = realloc(allocator, p, newsize)
proc realloc(p: pointer, newSize: Natural): pointer =
result = realloc(allocator, p, newSize)
when false:
proc countFreeMem(): int =
@@ -1054,13 +1054,13 @@ template instantiateForRegion(allocator: untyped) =
else:
dealloc(p)
proc reallocShared(p: pointer, newsize: Natural): pointer =
proc reallocShared(p: pointer, newSize: Natural): pointer =
when hasThreadSupport:
acquireSys(heapLock)
result = realloc(sharedHeap, p, newsize)
result = realloc(sharedHeap, p, newSize)
releaseSys(heapLock)
else:
result = realloc(p, newsize)
result = realloc(p, newSize)
when hasThreadSupport:
template sharedMemStatsShared(v: int) =