Use ByteAddress instead of deprecated TAddress
This commit is contained in:
parent
44ad71b7e0
commit
4e0f8cf595
4 changed files with 16 additions and 16 deletions
|
|
@ -50,10 +50,10 @@ proc importcSymbol*(sym: PSym): PNode =
|
||||||
# that contains the address instead:
|
# that contains the address instead:
|
||||||
result = newNodeIT(nkPtrLit, sym.info, sym.typ)
|
result = newNodeIT(nkPtrLit, sym.info, sym.typ)
|
||||||
case name
|
case name
|
||||||
of "stdin": result.intVal = cast[TAddress](system.stdin)
|
of "stdin": result.intVal = cast[ByteAddress](system.stdin)
|
||||||
of "stdout": result.intVal = cast[TAddress](system.stdout)
|
of "stdout": result.intVal = cast[ByteAddress](system.stdout)
|
||||||
of "stderr": result.intVal = cast[TAddress](system.stderr)
|
of "stderr": result.intVal = cast[ByteAddress](system.stderr)
|
||||||
of "vmErrnoWrapper": result.intVal = cast[TAddress](myerrno)
|
of "vmErrnoWrapper": result.intVal = cast[ByteAddress](myerrno)
|
||||||
else:
|
else:
|
||||||
let lib = sym.annex
|
let lib = sym.annex
|
||||||
if lib != nil and lib.path.kind notin {nkStrLit..nkTripleStrLit}:
|
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)
|
else: lib.path.strVal, sym.info)
|
||||||
theAddr = dllhandle.symAddr(name)
|
theAddr = dllhandle.symAddr(name)
|
||||||
if theAddr.isNil: globalError(sym.info, "cannot import: " & sym.name.s)
|
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 =
|
proc mapType(t: ast.PType): ptr libffi.TType =
|
||||||
if t == nil: return addr libffi.type_void
|
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 rd(T, p: expr): expr {.immediate.} = (cast[ptr T](p))[]
|
||||||
template wr(T, p, v: expr) {.immediate.} = (cast[ptr T](p))[] = v
|
template wr(T, p, v: expr) {.immediate.} = (cast[ptr T](p))[] = v
|
||||||
template `+!`(x, y: expr): expr {.immediate.} =
|
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 =
|
proc packSize(v: PNode, typ: PType): int =
|
||||||
## computes the size of the blob
|
## 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:
|
# in their unboxed representation so nothing it to be unpacked:
|
||||||
result = n
|
result = n
|
||||||
else:
|
else:
|
||||||
awi(nkPtrLit, cast[TAddress](p))
|
awi(nkPtrLit, cast[ByteAddress](p))
|
||||||
of tyPtr, tyRef, tyVar:
|
of tyPtr, tyRef, tyVar:
|
||||||
let p = rd(pointer, x)
|
let p = rd(pointer, x)
|
||||||
if p.isNil:
|
if p.isNil:
|
||||||
setNil()
|
setNil()
|
||||||
elif n == nil or n.kind == nkPtrLit:
|
elif n == nil or n.kind == nkPtrLit:
|
||||||
awi(nkPtrLit, cast[TAddress](p))
|
awi(nkPtrLit, cast[ByteAddress](p))
|
||||||
elif n != nil and n.len == 1:
|
elif n != nil and n.len == 1:
|
||||||
internalAssert n.kind == nkRefTy
|
internalAssert n.kind == nkRefTy
|
||||||
n.sons[0] = unpack(p, typ.lastSon, n.sons[0])
|
n.sons[0] = unpack(p, typ.lastSon, n.sons[0])
|
||||||
|
|
|
||||||
|
|
@ -688,7 +688,7 @@ proc rawDealloc(a: var MemRegion, p: pointer) =
|
||||||
sysAssert(((cast[ByteAddress](p) and PageMask) - smallChunkOverhead()) %%
|
sysAssert(((cast[ByteAddress](p) and PageMask) - smallChunkOverhead()) %%
|
||||||
s == 0, "rawDealloc 3")
|
s == 0, "rawDealloc 3")
|
||||||
var f = cast[ptr FreeCell](p)
|
var f = cast[ptr FreeCell](p)
|
||||||
#echo("setting to nil: ", $cast[TAddress](addr(f.zeroField)))
|
#echo("setting to nil: ", $cast[ByteAddress](addr(f.zeroField)))
|
||||||
sysAssert(f.zeroField != 0, "rawDealloc 1")
|
sysAssert(f.zeroField != 0, "rawDealloc 1")
|
||||||
f.zeroField = 0
|
f.zeroField = 0
|
||||||
f.next = c.freeList
|
f.next = c.freeList
|
||||||
|
|
|
||||||
|
|
@ -659,7 +659,7 @@ when useMarkForDebug or useBackupGc:
|
||||||
proc stackMarkS(gch: var GcHeap, p: pointer) {.inline.} =
|
proc stackMarkS(gch: var GcHeap, p: pointer) {.inline.} =
|
||||||
# the addresses are not as cells on the stack, so turn them to cells:
|
# the addresses are not as cells on the stack, so turn them to cells:
|
||||||
var cell = usrToCell(p)
|
var cell = usrToCell(p)
|
||||||
var c = cast[TAddress](cell)
|
var c = cast[ByteAddress](cell)
|
||||||
if c >% PageSize:
|
if c >% PageSize:
|
||||||
# fast check: does it look like a cell?
|
# fast check: does it look like a cell?
|
||||||
var objStart = cast[PCell](interiorAllocatedPtr(gch.region, cell))
|
var objStart = cast[PCell](interiorAllocatedPtr(gch.region, cell))
|
||||||
|
|
@ -805,8 +805,8 @@ proc markThreadStacks(gch: var GcHeap) =
|
||||||
while it != nil:
|
while it != nil:
|
||||||
# mark registers:
|
# mark registers:
|
||||||
for i in 0 .. high(it.registers): gcMark(gch, it.registers[i])
|
for i in 0 .. high(it.registers): gcMark(gch, it.registers[i])
|
||||||
var sp = cast[TAddress](it.stackBottom)
|
var sp = cast[ByteAddress](it.stackBottom)
|
||||||
var max = cast[TAddress](it.stackTop)
|
var max = cast[ByteAddress](it.stackTop)
|
||||||
# XXX stack direction?
|
# XXX stack direction?
|
||||||
# XXX unroll this loop:
|
# XXX unroll this loop:
|
||||||
while sp <=% max:
|
while sp <=% max:
|
||||||
|
|
|
||||||
|
|
@ -131,9 +131,9 @@ when defined(sparc): # For SPARC architecture.
|
||||||
proc isOnStack(p: pointer): bool =
|
proc isOnStack(p: pointer): bool =
|
||||||
var stackTop {.volatile.}: pointer
|
var stackTop {.volatile.}: pointer
|
||||||
stackTop = addr(stackTop)
|
stackTop = addr(stackTop)
|
||||||
var b = cast[TAddress](gch.stackBottom)
|
var b = cast[ByteAddress](gch.stackBottom)
|
||||||
var a = cast[TAddress](stackTop)
|
var a = cast[ByteAddress](stackTop)
|
||||||
var x = cast[TAddress](p)
|
var x = cast[ByteAddress](p)
|
||||||
result = a <=% x and x <=% b
|
result = a <=% x and x <=% b
|
||||||
|
|
||||||
template forEachStackSlot(gch, gcMark: expr) {.immediate, dirty.} =
|
template forEachStackSlot(gch, gcMark: expr) {.immediate, dirty.} =
|
||||||
|
|
@ -150,7 +150,7 @@ when defined(sparc): # For SPARC architecture.
|
||||||
# Addresses decrease as the stack grows.
|
# Addresses decrease as the stack grows.
|
||||||
while sp <= max:
|
while sp <= max:
|
||||||
gcMark(gch, sp[])
|
gcMark(gch, sp[])
|
||||||
sp = cast[PPointer](cast[TAddress](sp) +% sizeof(pointer))
|
sp = cast[PPointer](cast[ByteAddress](sp) +% sizeof(pointer))
|
||||||
|
|
||||||
elif defined(ELATE):
|
elif defined(ELATE):
|
||||||
{.error: "stack marking code is to be written for this architecture".}
|
{.error: "stack marking code is to be written for this architecture".}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue