@@ -7,7 +7,7 @@ import enum2nif
77type
88 DecodeContext = object
99 graph: ModuleGraph
10- nifSymToPSym: Table [string , PSym ] # foo.1.modsuffix -> PSym
10+ nifSymToPSym: Table [SymId , PSym ]
1111 types: Table [SymId , PType ]
1212 owner: PSym
1313 sysTypes: Table [TTypeKind , PSym ]
@@ -46,7 +46,7 @@ proc fromNifType(c: var DecodeContext; n: var Cursor): PType
4646include nifdecodertypes
4747
4848proc fromNifSymbol (c: var DecodeContext ; n: var Cursor ): PSym =
49- result = c.nifSymToPSym[pool.syms[ n.symId] ]
49+ result = c.nifSymToPSym[n.symId]
5050 inc n
5151
5252proc fromNifSymDef (c: var DecodeContext ; n: var Cursor ; kind: TNodeKind ): PNode =
@@ -59,8 +59,8 @@ proc fromNifSymDef(c: var DecodeContext; n: var Cursor; kind: TNodeKind): PNode
5959 else : skConst
6060 inc n
6161 assert n.kind == SymbolDef
62- let nifSym = pool.syms[ n.symId]
63- let symdef = nifSym .splitNifSym
62+ let nifSymId = n.symId
63+ let symdef = pool.syms[nifSymId] .splitNifSym
6464 assert symdef.name.len != 0
6565 let ident = c.graph.cache.getIdent (symdef.name)
6666 inc n
@@ -93,7 +93,7 @@ proc fromNifSymDef(c: var DecodeContext; n: var Cursor; kind: TNodeKind): PNode
9393 disamb: symdef.id.int32 )
9494 psym.setOwner (owner)
9595 result = newSymNode (psym)
96- let hasSym = c.nifSymToPSym.hasKeyOrPut (nifSym , psym)
96+ let hasSym = c.nifSymToPSym.hasKeyOrPut (nifSymId , psym)
9797 assert not hasSym
9898
9999 assert n.kind == ParRi
@@ -292,7 +292,8 @@ proc loadNif(stream: var Stream; modulePath: AbsoluteFile; graph: ModuleGraph):
292292 let modSym = newModule (graph, fileInfoIdx (graph.config, modulePath))
293293 let modSuffix = moduleSuffix (modulePath.string , cast [seq [string ]](graph.config.searchPaths))
294294 let nifModSym = modSym.name.s & '.' & $ modSym.disamb & '.' & modSuffix
295- c.nifSymToPSym[nifModSym] = modSym
295+ let nifModSymId = pool.syms.getOrIncl (nifModSym)
296+ c.nifSymToPSym[nifModSymId] = modSym
296297 c.owner = modSym
297298 c.idgen = idGeneratorFromModule (modSym)
298299
0 commit comments