WIP2
This commit is contained in:
parent
a401a8e553
commit
ccf052fe6f
3 changed files with 15 additions and 10 deletions
|
|
@ -130,7 +130,6 @@ template `+!`(x, y: untyped): untyped =
|
||||||
|
|
||||||
proc packSize(conf: ConfigRef, v: PNode, typ: PType): int =
|
proc packSize(conf: ConfigRef, v: PNode, typ: PType): int =
|
||||||
## computes the size of the blob
|
## computes the size of the blob
|
||||||
echo typ.kind
|
|
||||||
case typ.kind
|
case typ.kind
|
||||||
of tyPtr, tyRef, tyVar, tyLent:
|
of tyPtr, tyRef, tyVar, tyLent:
|
||||||
if v.kind in {nkNilLit, nkPtrLit}:
|
if v.kind in {nkNilLit, nkPtrLit}:
|
||||||
|
|
@ -145,13 +144,9 @@ proc packSize(conf: ConfigRef, v: PNode, typ: PType): int =
|
||||||
if v.kind in {nkNilLit, nkPtrLit}:
|
if v.kind in {nkNilLit, nkPtrLit}:
|
||||||
result = sizeof(pointer)
|
result = sizeof(pointer)
|
||||||
elif typ.sons.len != 0:
|
elif typ.sons.len != 0:
|
||||||
echo v.kind
|
|
||||||
let trange = typ.sons[0].n
|
let trange = typ.sons[0].n
|
||||||
let ttypenode = typ.sons[1]
|
let ttypenode = typ.sons[1]
|
||||||
let anode = trange.sons[1]
|
let anode = trange.sons[1]
|
||||||
echo anode.intVal
|
|
||||||
echo "adfadf"
|
|
||||||
echo typ.kind
|
|
||||||
result += (anode.intVal.int + 1) * packSize(conf, ttypenode.n, ttypenode)
|
result += (anode.intVal.int + 1) * packSize(conf, ttypenode.n, ttypenode)
|
||||||
# for ts in trange.sons:
|
# for ts in trange.sons:
|
||||||
# result += ts.intVal * packSize(conf, typ.sons[1], typ.sons[1].typ)
|
# result += ts.intVal * packSize(conf, typ.sons[1], typ.sons[1].typ)
|
||||||
|
|
|
||||||
|
|
@ -196,8 +196,8 @@ proc computeUnionObjectOffsetsFoldFunction(conf: ConfigRef; n: PNode; accum: var
|
||||||
proc computeSizeAlign(conf: ConfigRef; typ: PType) =
|
proc computeSizeAlign(conf: ConfigRef; typ: PType) =
|
||||||
## computes and sets ``size`` and ``align`` members of ``typ``
|
## computes and sets ``size`` and ``align`` members of ``typ``
|
||||||
assert typ != nil
|
assert typ != nil
|
||||||
echo "In size align!!"
|
# echo "In size align!!"
|
||||||
echo typ.kind
|
# echo typ.kind
|
||||||
let hasSize = typ.size != szUncomputedSize
|
let hasSize = typ.size != szUncomputedSize
|
||||||
let hasAlign = typ.align != szUncomputedSize
|
let hasAlign = typ.align != szUncomputedSize
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -592,7 +592,17 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||||
of 1: # PtrLikeKinds
|
of 1: # PtrLikeKinds
|
||||||
case regs[rb].kind
|
case regs[rb].kind
|
||||||
of rkNode:
|
of rkNode:
|
||||||
regs[ra].intVal = cast[int](regs[rb].node.intVal)
|
case regs[rb].node.kind
|
||||||
|
of nkCharLit..nkUInt64Lit:
|
||||||
|
regs[ra].intVal = regs[rb].node.intVal
|
||||||
|
of nkFloatLit..nkFloat128Lit:
|
||||||
|
regs[ra].intVal = int64(regs[rb].floatVal)
|
||||||
|
else:
|
||||||
|
# echo regs[rb].node.kind
|
||||||
|
# echo regs[rb].node.typ.kind
|
||||||
|
# for son in regs[rb].node.sons:
|
||||||
|
# echo son.kind
|
||||||
|
regs[ra].intVal = cast[int](regs[rb].node.addr)
|
||||||
of rkNodeAddr:
|
of rkNodeAddr:
|
||||||
regs[ra].intVal = cast[int](regs[rb].nodeAddr)
|
regs[ra].intVal = cast[int](regs[rb].nodeAddr)
|
||||||
else:
|
else:
|
||||||
|
|
@ -609,8 +619,8 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||||
of rkNode:
|
of rkNode:
|
||||||
if regs[rb].node.typ.kind notin PtrLikeKinds:
|
if regs[rb].node.typ.kind notin PtrLikeKinds:
|
||||||
stackTrace(c, tos, pc, "opcCastIntToPtr: regs[rb].node.typ: " & $regs[rb].node.typ.kind)
|
stackTrace(c, tos, pc, "opcCastIntToPtr: regs[rb].node.typ: " & $regs[rb].node.typ.kind)
|
||||||
echo node2.kind
|
# echo node2.kind
|
||||||
echo regs[rb].node.kind
|
# echo regs[rb].node.kind
|
||||||
node2.intVal = regs[rb].node.intVal
|
node2.intVal = regs[rb].node.intVal
|
||||||
else: stackTrace(c, tos, pc, "opcCastIntToPtr: regs[rb].kind: " & $regs[rb].kind)
|
else: stackTrace(c, tos, pc, "opcCastIntToPtr: regs[rb].kind: " & $regs[rb].kind)
|
||||||
regs[ra].node = node2
|
regs[ra].node = node2
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue