summary refs log tree commit diff stats
path: root/compiler/vm.nim
Commit message (Expand)AuthorAgeFilesLines
...
* Change the order of compilation passes, transformation is made lazy at code g...cooldome2018-10-181-0/+11
* Make the registered passes local to the ModuleGraph (#9259)LemonBoy2018-10-091-1/+1
* Fix error during field access in VMLemonBoy2018-09-171-3/+7
* Add sym owner to macros (#8253)cooldome2018-09-031-0/+9
* fixes the remaining fixable Nimrod->Nim renamings; closes #2032Araq2018-09-031-1/+1
* fixes #8740Araq2018-09-031-1/+1
* Allow `hint` and `warning` to specify its loc info (#8771)LemonBoy2018-08-281-8/+12
* fixes 8754 (#8755)cooldome2018-08-241-0/+8
* even more strict isNil handling for strings/seqs in order to detect bugsAraq2018-08-221-12/+10
* fixes #6255, add `system.ashr` arithmetic right shift (#8547)andri lim2018-08-071-0/+3
* fixes #5617, 'copyLineInfo' addition (#8523)andri lim2018-08-051-14/+13
* fixes #7827, bindSym enhancement (#8499)andri lim2018-08-021-1/+17
* `lineInfoObj` (and `check`, `expect`) now return absolute paths (#8466)Timothee Cour2018-07-311-1/+1
* Fix ref bug in vmgen (#8424)Oscar Nihlgård2018-07-301-8/+1
* VM: accessing the string terminator is not allowed anymore; cleanup tests/sys...Andreas Rumpf2018-07-171-1/+3
* Fix vm regression (#8163)Oscar Nihlgård2018-06-301-0/+7
* Fixes #6689 (#8135)Oscar Nihlgård2018-06-301-2/+8
* VM regression fixes (#8146)Oscar Nihlgård2018-06-291-1/+3
* Improve vm support for ref typesOscar Nihlgård2018-06-261-21/+26
* completed VM support for incremental compilationsAndreas Rumpf2018-06-041-26/+38
* WIP: an API for VM replay global state supportAndreas Rumpf2018-06-031-1/+90
* incremental compilation: implemented basic replay logicAndreas Rumpf2018-06-021-17/+17
* compiler API: final cleanups; improve security by diabling 'gorge' and friendsAndreas Rumpf2018-05-291-9/+12
* vm now free of global variablesAndreas Rumpf2018-05-281-14/+8
* vm.nim: evalMacroCounter is not a global variable anymoreAndreas Rumpf2018-05-281-6/+5
* refactoring: remove idents.legacy global variable and pass the IdentCache aro...Andreas Rumpf2018-05-271-6/+6
* remove more global variables in the Nim compilerAndreas Rumpf2018-05-271-1/+1
* Merge branch 'devel' into araq-big-refactoringAndreas Rumpf2018-05-211-1/+1
|\
| * Fix typo in "out of bounds" error messagecoffeepots2018-05-181-1/+1
* | platform.nim doesn't use globals anymore; prepare msgs.nim for not using globalsAndreas Rumpf2018-05-181-10/+10
* | preparations of making compiler/msgs.nim free of global variablesAndreas Rumpf2018-05-171-4/+4
* | remove ast.emptyNode global; cleanup configuration.nimAraq2018-05-161-3/+3
|/
* fixes testament compilationAraq2018-05-141-2/+8
|\
| * VM fix for refsOscar Nihlgård2018-05-081-2/+8
* | move more globals into the config objectAndreas Rumpf2018-05-131-9/+9
* | more modules compile againAndreas Rumpf2018-05-121-1/+1
* | more modules compile againAndreas Rumpf2018-05-121-100/+110
|/
* compiler refactoring, pass config around explicitlyAndreas Rumpf2018-05-051-20/+21
* make tests green againAndreas Rumpf2018-04-211-1/+1
* refactoring: make FileIndex a distinct type; make line information an uint16;...Andreas Rumpf2018-04-211-3/+3
* allow setting template/macro recursive evaluation limits (#7652)jcosborn2018-04-191-2/+4
* eqIdent new returns false on non identifier types (#7629)Arne Döring2018-04-171-5/+13
* move eqIdent to vm.nim (#7585)Arne Döring2018-04-151-3/+29
* introduce nkTupleConstr AST node for unary tuple construction; breaking changeAndreas Rumpf2018-04-131-9/+9
* Get symbol kind (#7491)Arne Döring2018-04-111-15/+20
* reuse default ident in opcNNewNimNode (performance regression) (#7330)jcosborn2018-03-141-1/+1
* some progress on #7261; VM does not support the new backwards indexingAraq2018-02-281-3/+15
* fixes #7215Andreas Rumpf2018-02-141-2/+5
* deprecated unary '<'Andreas Rumpf2017-10-291-12/+11
* implemented new experimental scriptable import mechanismAndreas Rumpf2017-10-011-1/+1
ass="w"> s.typ if etyp.kind in {tyBool, tyEnum}: for j in countup(0, sonsLen(etyp.n) - 1): var e = etyp.n.sons[j].sym if e.kind != skEnumField: internalError(s.info, "rawImportSymbol") # BUGFIX: because of aliases for enums the symbol may already # have been put into the symbol table # BUGFIX: but only iff they are the same symbols! var it: TIdentIter check = initIdentIter(it, c.importTable.symbols, e.name) while check != nil: if check.id == e.id: e = nil break check = nextIdentIter(it, c.importTable.symbols) if e != nil: if sfPure notin s.flags: rawImportSymbol(c, e) else: importPureEnumField(c, e) else: # rodgen assures that converters and patterns are no stubs if s.kind == skConverter: addConverter(c, s) if hasPattern(s): addPattern(c, s) proc importSymbol(c: PContext, n: PNode, fromMod: PSym) = let ident = lookups.considerQuotedIdent(n) let s = strTableGet(fromMod.tab, ident) if s == nil: errorUndeclaredIdentifier(c, n.info, ident.s) else: if s.kind == skStub: loadStub(s) if s.kind notin ExportableSymKinds: internalError(n.info, "importSymbol: 2") # for an enumeration we have to add all identifiers case s.kind of skProcKinds: # for a overloadable syms add all overloaded routines var it: TIdentIter var e = initIdentIter(it, fromMod.tab, s.name) while e != nil: if e.name.id != s.name.id: internalError(n.info, "importSymbol: 3") rawImportSymbol(c, e) e = nextIdentIter(it, fromMod.tab) else: rawImportSymbol(c, s) proc importAllSymbolsExcept(c: PContext, fromMod: PSym, exceptSet: IntSet) = var i: TTabIter var s = initTabIter(i, fromMod.tab) while s != nil: if s.kind != skModule: if s.kind != skEnumField: if s.kind notin ExportableSymKinds: internalError(s.info, "importAllSymbols: " & $s.kind) if exceptSet.isNil or s.name.id notin exceptSet: rawImportSymbol(c, s) s = nextIter(i, fromMod.tab) proc importAllSymbols*(c: PContext, fromMod: PSym) = var exceptSet: IntSet importAllSymbolsExcept(c, fromMod, exceptSet) proc importForwarded(c: PContext, n: PNode, exceptSet: IntSet) = if n.isNil: return case n.kind of nkExportStmt: for a in n: assert a.kind == nkSym let s = a.sym if s.kind == skModule: importAllSymbolsExcept(c, s, exceptSet) elif exceptSet.isNil or s.name.id notin exceptSet: rawImportSymbol(c, s) of nkExportExceptStmt: localError(n.info, errGenerated, "'export except' not implemented") else: for i in 0..safeLen(n)-1: importForwarded(c, n.sons[i], exceptSet) proc importModuleAs(n: PNode, realModule: PSym): PSym = result = realModule if n.kind != nkImportAs: discard elif n.len != 2 or n.sons[1].kind != nkIdent: localError(n.info, errGenerated, "module alias must be an identifier") elif n.sons[1].ident.id != realModule.name.id: # some misguided guy will write 'import abc.foo as foo' ... result = createModuleAlias(realModule, n.sons[1].ident, realModule.info) proc myImportModule(c: PContext, n: PNode): PSym = var f = checkModuleName(n) if f != InvalidFileIDX: let L = c.graph.importStack.len let recursion = c.graph.importStack.find(f) c.graph.importStack.add f #echo "adding ", toFullPath(f), " at ", L+1 if recursion >= 0: var err = "" for i in countup(recursion, L-1): if i > recursion: err.add "\n" err.add toFullPath(c.graph.importStack[i]) & " imports " & toFullPath(c.graph.importStack[i+1]) c.recursiveDep = err result = importModuleAs(n, gImportModule(c.graph, c.module, f, c.cache)) #echo "set back to ", L c.graph.importStack.setLen(L) # we cannot perform this check reliably because of # test: modules/import_in_config) when true: if result.info.fileIndex == c.module.info.fileIndex and result.info.fileIndex == n.info.fileIndex: localError(n.info, errGenerated, "A module cannot import itself") if sfDeprecated in result.flags: if result.constraint != nil: message(n.info, warnDeprecated, result.constraint.strVal & "; " & result.name.s) else: message(n.info, warnDeprecated, result.name.s) suggestSym(n.info, result, c.graph.usageSym, false) proc impMod(c: PContext; it: PNode) = let m = myImportModule(c, it) if m != nil: var emptySet: IntSet # ``addDecl`` needs to be done before ``importAllSymbols``! addDecl(c, m, it.info) # add symbol to symbol table of module importAllSymbolsExcept(c, m, emptySet) #importForwarded(c, m.ast, emptySet) proc evalImport(c: PContext, n: PNode): PNode = result = n for i in countup(0, sonsLen(n) - 1): let it = n.sons[i] if it.kind == nkInfix and it.len == 3 and it[2].kind == nkBracket: let sep = it[0] let dir = it[1] let a = newNodeI(nkInfix, it.info) a.add sep a.add dir a.add sep # dummy entry, replaced in the loop for x in it[2]: a.sons[2] = x impMod(c, a) else: impMod(c, it) proc evalFrom(c: PContext, n: PNode): PNode = result = n checkMinSonsLen(n, 2) var m = myImportModule(c, n.sons[0]) if m != nil: n.sons[0] = newSymNode(m) addDecl(c, m, n.info) # add symbol to symbol table of module for i in countup(1, sonsLen(n) - 1): if n.sons[i].kind != nkNilLit: importSymbol(c, n.sons[i], m) proc evalImportExcept*(c: PContext, n: PNode): PNode = result = n checkMinSonsLen(n, 2) var m = myImportModule(c, n.sons[0]) if m != nil: n.sons[0] = newSymNode(m) addDecl(c, m, n.info) # add symbol to symbol table of module var exceptSet = initIntSet() for i in countup(1, sonsLen(n) - 1): let ident = lookups.considerQuotedIdent(n.sons[i]) exceptSet.incl(ident.id) importAllSymbolsExcept(c, m, exceptSet) #importForwarded(c, m.ast, exceptSet)