Try to let memTracker compile (#8502)

This commit is contained in:
Christopher Dunn
2018-08-05 02:53:10 -05:00
committed by Andreas Rumpf
parent 96c6c82d55
commit cc1fd50b27
2 changed files with 11 additions and 11 deletions

View File

@@ -454,10 +454,10 @@ proc requestOsChunks(a: var MemRegion, size: int): PBigChunk =
a.addHeapLink(result, size)
when defined(debugHeapLinks):
cprintf("owner: %p; result: %p; next pointer %p; size: %ld\n", addr(a),
result, result.heapLink, result.origSize)
result, result.heapLink, result.size)
when defined(memtracker):
trackLocation(addr result.origSize, sizeof(int))
trackLocation(addr result.size, sizeof(int))
sysAssert((cast[ByteAddress](result) and PageMask) == 0, "requestOsChunks 1")
#zeroMem(result, size)
@@ -527,7 +527,7 @@ proc updatePrevSize(a: var MemRegion, c: PBigChunk,
proc splitChunk2(a: var MemRegion, c: PBigChunk, size: int): PBigChunk =
result = cast[PBigChunk](cast[ByteAddress](c) +% size)
result.size = c.size - size
track("result.origSize", addr result.origSize, sizeof(int))
track("result.size", addr result.size, sizeof(int))
# XXX check if these two nil assignments are dead code given
# addChunkToMatrix's implementation:
result.next = nil
@@ -602,7 +602,7 @@ proc getBigChunk(a: var MemRegion, size: int): PBigChunk =
splitChunk(a, result, size)
# set 'used' to to true:
result.prevSize = 1
track("setUsedToFalse", addr result.origSize, sizeof(int))
track("setUsedToFalse", addr result.size, sizeof(int))
incl(a, a.chunkStarts, pageIndex(result))
dec(a.freeMem, size)
@@ -968,7 +968,7 @@ proc deallocOsPages(a: var MemRegion) =
let (p, size) = it.chunks[i]
when defined(debugHeapLinks):
cprintf("owner %p; dealloc A: %p size: %ld; next: %p\n", addr(a),
it, it.origSize, next)
it, it.size, next)
sysAssert size >= PageSize, "origSize too small"
osDeallocPages(p, size)
it = next

View File

@@ -73,12 +73,12 @@ proc addEntry(entry: LogEntry) =
let x = cast[proc() {.nimcall, tags: [], gcsafe, locks: 0.}](writeStackTrace)
x()
quit 1
if gLog.count > high(gLog.data):
gLogger(gLog)
gLog.count = 0
gLog.data[gLog.count] = entry
inc gLog.count
gLog.disabled = false
#if gLog.count > high(gLog.data):
# gLogger(gLog)
# gLog.count = 0
#gLog.data[gLog.count] = entry
#inc gLog.count
#gLog.disabled = false
proc memTrackerWrite(address: pointer; size: int; file: cstring; line: int) {.compilerProc.} =
addEntry LogEntry(op: "write", address: address,