Skip to content

Commit

Permalink
Merge #269
Browse files Browse the repository at this point in the history
269: Remove `mNSetType` magic and associated VM opcode r=saem a=zerbina

They're dead code, originally used for implementing `macros.typ=`,
which was removed in commit `9465b5db443b98d7ac2c1683e986716fb9a9290f`


Co-authored-by: zerbina <100542850+zerbina@users.noreply.github.com>
  • Loading branch information
bors[bot] and zerbina authored Apr 9, 2022
2 parents acdb2ca + ab322ff commit 33db4eb
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 17 deletions.
2 changes: 1 addition & 1 deletion compiler/ast/ast_types.nim
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ type
mNctPut, mNctLen, mNctGet, mNctHasNext, mNctNext,

mNIntVal, mNFloatVal, mNSymbol, mNIdent, mNGetType, mNStrVal, mNSetIntVal,
mNSetFloatVal, mNSetSymbol, mNSetIdent, mNSetType, mNSetStrVal, mNLineInfo,
mNSetFloatVal, mNSetSymbol, mNSetIdent, mNSetStrVal, mNLineInfo,
mNNewNimNode, mNCopyNimNode, mNCopyNimTree, mStrToIdent, mNSigHash, mNSizeOf,
mNBindSym, mNCallSite,
mEqIdent, mEqNimrodNode, mSameNodeType, mGetImpl, mNGenSym,
Expand Down
12 changes: 0 additions & 12 deletions compiler/vm/vm.nim
Original file line number Diff line number Diff line change
Expand Up @@ -2168,18 +2168,6 @@ proc rawExecute(c: var TCtx, pc: var int, tos: var StackFrameIndex): TFullReg =
dest.ident = regs[rb].node.ident
else:
raiseVmError(reportStr(rsemVmFieldNotFound, "ident"))
of opcNSetType:
decodeB(rkNode)
let b = regs[rb].node
internalAssert(
c.config,
b.kind == nkSym and b.sym.kind == skType,
"Canot set type to a non-skType symbol")

internalAssert(
c.config, regs[ra].node != nil, "Target node must not be nil")

regs[ra].node.typ = b.sym.typ
of opcNSetStrVal:
decodeB(rkNode)
var dest = regs[ra].node
Expand Down
2 changes: 1 addition & 1 deletion compiler/vm/vm_enums.nim
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ type
opcNGetSize,

opcNSetIntVal,
opcNSetFloatVal, opcNSetSymbol, opcNSetIdent, opcNSetType, opcNSetStrVal,
opcNSetFloatVal, opcNSetSymbol, opcNSetIdent, opcNSetStrVal,
opcNNewNimNode, opcNCopyNimNode, opcNCopyNimTree, opcNDel, opcGenSym,

opcNccValue, opcNccInc, opcNcsAdd, opcNcsIncl, opcNcsLen, opcNcsAt,
Expand Down
3 changes: 0 additions & 3 deletions compiler/vm/vmgen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1359,9 +1359,6 @@ proc genMagic(c: var TCtx; n: PNode; dest: var TDest; m: TMagic) =
of mNSetIdent:
unused(c, n, dest)
genBinaryStmt(c, n, opcNSetIdent)
of mNSetType:
unused(c, n, dest)
genBinaryStmt(c, n, opcNSetType)
of mNSetStrVal:
unused(c, n, dest)
genBinaryStmt(c, n, opcNSetStrVal)
Expand Down

0 comments on commit 33db4eb

Please sign in to comment.