diff options
author | Ico Doornekamp <ico@pruts.nl> | 2020-01-25 17:14:31 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2020-01-25 17:14:31 +0100 |
commit | 4f3dd33509070f0f50bbe5bbb6cbfc8a12b47b49 (patch) | |
tree | adfb765ed9ea91be1c5ae8510b143c3bea7fe0ec /lib/system/mm/none.nim | |
parent | 5124b2e575a0293c665026dd766700c03bc6a04f (diff) | |
download | Nim-4f3dd33509070f0f50bbe5bbb6cbfc8a12b47b49.tar.gz |
Cleaned up mmdisp.nim, moved implementations into lib/system/mm/ (#13254)
Diffstat (limited to 'lib/system/mm/none.nim')
-rw-r--r-- | lib/system/mm/none.nim | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/system/mm/none.nim b/lib/system/mm/none.nim new file mode 100644 index 000000000..3572b062c --- /dev/null +++ b/lib/system/mm/none.nim @@ -0,0 +1,44 @@ + +when appType == "lib": + {.warning: "nogc in a library context may not work".} + +include "system/alloc" + +proc initGC() = discard +proc GC_disable() = discard +proc GC_enable() = discard +proc GC_fullCollect() = discard +proc GC_setStrategy(strategy: GC_Strategy) = discard +proc GC_enableMarkAndSweep() = discard +proc GC_disableMarkAndSweep() = discard +proc GC_getStatistics(): string = return "" + +proc newObj(typ: PNimType, size: int): pointer {.compilerproc.} = + result = alloc0Impl(size) + +proc newObjNoInit(typ: PNimType, size: int): pointer = + result = alloc(size) + +proc newSeq(typ: PNimType, len: int): pointer {.compilerproc.} = + result = newObj(typ, addInt(mulInt(len, typ.base.size), GenericSeqSize)) + cast[PGenericSeq](result).len = len + cast[PGenericSeq](result).reserved = len + +proc growObj(old: pointer, newsize: int): pointer = + result = realloc(old, newsize) + +proc nimGC_setStackBottom(theStackBottom: pointer) = discard +proc nimGCref(p: pointer) {.compilerproc, inline.} = discard +proc nimGCunref(p: pointer) {.compilerproc, inline.} = discard + +proc unsureAsgnRef(dest: PPointer, src: pointer) {.compilerproc, inline.} = + dest[] = src +proc asgnRef(dest: PPointer, src: pointer) {.compilerproc, inline.} = + dest[] = src +proc asgnRefNoCycle(dest: PPointer, src: pointer) {.compilerproc, inline, + deprecated: "old compiler compat".} = asgnRef(dest, src) + +var allocator {.rtlThreadVar.}: MemRegion +instantiateForRegion(allocator) + +include "system/cellsets" |