diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2016-01-26 12:46:38 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2016-01-26 12:46:38 +0100 |
commit | 1fbeedaba25af170bfb3ad00de1ccad1f8da1546 (patch) | |
tree | 6fc7c140f948c6aae4fe910a7155114699ae88cb /compiler/evalffi.nim | |
parent | d338744d7acce349380d4193dbd10043ee75c11b (diff) | |
parent | 4246f660ea4ba7bab05811662eb53a87cc0cc049 (diff) | |
download | Nim-1fbeedaba25af170bfb3ad00de1ccad1f8da1546.tar.gz |
Merge branch 'devel' of https://github.com/nim-lang/Nim into devel
Diffstat (limited to 'compiler/evalffi.nim')
-rw-r--r-- | compiler/evalffi.nim | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/compiler/evalffi.nim b/compiler/evalffi.nim index b1a23802d..75394c2f3 100644 --- a/compiler/evalffi.nim +++ b/compiler/evalffi.nim @@ -50,10 +50,10 @@ proc importcSymbol*(sym: PSym): PNode = # that contains the address instead: result = newNodeIT(nkPtrLit, sym.info, sym.typ) case name - of "stdin": result.intVal = cast[TAddress](system.stdin) - of "stdout": result.intVal = cast[TAddress](system.stdout) - of "stderr": result.intVal = cast[TAddress](system.stderr) - of "vmErrnoWrapper": result.intVal = cast[TAddress](myerrno) + of "stdin": result.intVal = cast[ByteAddress](system.stdin) + of "stdout": result.intVal = cast[ByteAddress](system.stdout) + of "stderr": result.intVal = cast[ByteAddress](system.stderr) + of "vmErrnoWrapper": result.intVal = cast[ByteAddress](myerrno) else: let lib = sym.annex if lib != nil and lib.path.kind notin {nkStrLit..nkTripleStrLit}: @@ -71,7 +71,7 @@ proc importcSymbol*(sym: PSym): PNode = else: lib.path.strVal, sym.info) theAddr = dllhandle.symAddr(name) if theAddr.isNil: globalError(sym.info, "cannot import: " & sym.name.s) - result.intVal = cast[TAddress](theAddr) + result.intVal = cast[ByteAddress](theAddr) proc mapType(t: ast.PType): ptr libffi.TType = if t == nil: return addr libffi.type_void @@ -107,7 +107,7 @@ proc mapCallConv(cc: TCallingConvention, info: TLineInfo): TABI = template rd(T, p: expr): expr {.immediate.} = (cast[ptr T](p))[] template wr(T, p, v: expr) {.immediate.} = (cast[ptr T](p))[] = v template `+!`(x, y: expr): expr {.immediate.} = - cast[pointer](cast[TAddress](x) + y) + cast[pointer](cast[ByteAddress](x) + y) proc packSize(v: PNode, typ: PType): int = ## computes the size of the blob @@ -363,13 +363,13 @@ proc unpack(x: pointer, typ: PType, n: PNode): PNode = # in their unboxed representation so nothing it to be unpacked: result = n else: - awi(nkPtrLit, cast[TAddress](p)) + awi(nkPtrLit, cast[ByteAddress](p)) of tyPtr, tyRef, tyVar: let p = rd(pointer, x) if p.isNil: setNil() elif n == nil or n.kind == nkPtrLit: - awi(nkPtrLit, cast[TAddress](p)) + awi(nkPtrLit, cast[ByteAddress](p)) elif n != nil and n.len == 1: internalAssert n.kind == nkRefTy n.sons[0] = unpack(p, typ.lastSon, n.sons[0]) |