This commit is contained in:
Andreas Rumpf 2019-07-06 21:20:16 +02:00
commit d2684cdfd2
3 changed files with 11 additions and 2 deletions

View file

@ -235,6 +235,8 @@ elif defined(gogc):
proc goSetFinalizer(obj: pointer, f: pointer) {.importc: "set_finalizer", codegenDecl:"$1 $2$3 __asm__ (\"main.Set_finalizer\");\n$1 $2$3", dynlib: goLib.} proc goSetFinalizer(obj: pointer, f: pointer) {.importc: "set_finalizer", codegenDecl:"$1 $2$3 __asm__ (\"main.Set_finalizer\");\n$1 $2$3", dynlib: goLib.}
proc writebarrierptr(dest: PPointer, src: pointer) {.importc: "writebarrierptr", codegenDecl:"$1 $2$3 __asm__ (\"main.Atomic_store_pointer\");\n$1 $2$3", dynlib: goLib.} proc writebarrierptr(dest: PPointer, src: pointer) {.importc: "writebarrierptr", codegenDecl:"$1 $2$3 __asm__ (\"main.Atomic_store_pointer\");\n$1 $2$3", dynlib: goLib.}
proc `$`*(x: uint64): string {.noSideEffect, raises: [].}
proc GC_getStatistics(): string = proc GC_getStatistics(): string =
var mstats = goMemStats() var mstats = goMemStats()
result = "[GC] total allocated memory: " & $(mstats.total_alloc) & "\n" & result = "[GC] total allocated memory: " & $(mstats.total_alloc) & "\n" &
@ -268,7 +270,7 @@ elif defined(gogc):
result = goMalloc(size.uint) result = goMalloc(size.uint)
proc realloc(p: pointer, newsize: Natural): pointer = proc realloc(p: pointer, newsize: Natural): pointer =
raise newException(Exception, "not implemented") doAssert false, "not implemented"
proc dealloc(p: pointer) = proc dealloc(p: pointer) =
discard discard

View file

@ -304,7 +304,7 @@ proc nimCharToStr(x: char): string {.compilerRtl.} =
result = newString(1) result = newString(1)
result[0] = x result[0] = x
proc `$`*(x: uint64): string {.noSideEffect.} = proc `$`*(x: uint64): string {.noSideEffect, raises: [].} =
## The stringify operator for an unsigned integer argument. Returns `x` ## The stringify operator for an unsigned integer argument. Returns `x`
## converted to a decimal string. ## converted to a decimal string.
if x == 0: if x == 0:

7
tests/system/tgogc.nim Normal file
View file

@ -0,0 +1,7 @@
discard """
disabled: "windows"
cmd: "nim c --gc:go $file"
action: "compile"
"""
# bug #11447
echo "Go GC test"