This commit is contained in:
Joey Yakimowich-Payne 2020-02-12 08:30:35 -07:00
commit ccf052fe6f
3 changed files with 15 additions and 10 deletions

View file

@ -130,7 +130,6 @@ template `+!`(x, y: untyped): untyped =
proc packSize(conf: ConfigRef, v: PNode, typ: PType): int =
## computes the size of the blob
echo typ.kind
case typ.kind
of tyPtr, tyRef, tyVar, tyLent:
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}:
result = sizeof(pointer)
elif typ.sons.len != 0:
echo v.kind
let trange = typ.sons[0].n
let ttypenode = typ.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)
# for ts in trange.sons:
# result += ts.intVal * packSize(conf, typ.sons[1], typ.sons[1].typ)

View file

@ -196,8 +196,8 @@ proc computeUnionObjectOffsetsFoldFunction(conf: ConfigRef; n: PNode; accum: var
proc computeSizeAlign(conf: ConfigRef; typ: PType) =
## computes and sets ``size`` and ``align`` members of ``typ``
assert typ != nil
echo "In size align!!"
echo typ.kind
# echo "In size align!!"
# echo typ.kind
let hasSize = typ.size != szUncomputedSize
let hasAlign = typ.align != szUncomputedSize

View file

@ -592,7 +592,17 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
of 1: # PtrLikeKinds
case regs[rb].kind
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:
regs[ra].intVal = cast[int](regs[rb].nodeAddr)
else:
@ -609,8 +619,8 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
of rkNode:
if regs[rb].node.typ.kind notin PtrLikeKinds:
stackTrace(c, tos, pc, "opcCastIntToPtr: regs[rb].node.typ: " & $regs[rb].node.typ.kind)
echo node2.kind
echo regs[rb].node.kind
# echo node2.kind
# echo regs[rb].node.kind
node2.intVal = regs[rb].node.intVal
else: stackTrace(c, tos, pc, "opcCastIntToPtr: regs[rb].kind: " & $regs[rb].kind)
regs[ra].node = node2