makes the -d:nimIncremental compiler mode compile again

This commit is contained in:
Andreas Rumpf
2019-07-21 16:41:46 +02:00
parent 1a77040278
commit 25e6c53bb5
5 changed files with 75 additions and 83 deletions

View File

@@ -225,18 +225,13 @@ proc encodeType(g: ModuleGraph, t: PType, result: var string) =
add(result, '\15')
encodeVInt(t.destructor.id, result)
pushSym(w, t.destructor)
if t.deepCopy != nil:
for a in t.attachedOps:
add(result, '\16')
encodeVInt(t.deepcopy.id, result)
pushSym(w, t.deepcopy)
if t.assignment != nil:
add(result, '\17')
encodeVInt(t.assignment.id, result)
pushSym(w, t.assignment)
if t.sink != nil:
add(result, '\18')
encodeVInt(t.sink.id, result)
pushSym(w, t.sink)
if a == nil:
encodeVInt(-1, result)
else:
encodeVInt(a.id, result)
pushSym(w, a)
for i, s in items(t.methods):
add(result, '\19')
encodeVInt(i, result)
@@ -427,8 +422,10 @@ proc storeRemaining*(g: ModuleGraph; module: PSym) =
stillForwarded.add s
swap w.forwardedSyms, stillForwarded
transitiveClosure(g)
var nimid = 0
for x in items(g.config.m.fileInfos):
storeFilename(g, x.fullPath, FileIndex(nimid))
inc nimid
# ---------------- decoder -----------------------------------
@@ -636,18 +633,13 @@ proc loadType(g; id: int; info: TLineInfo): PType =
else:
result.lockLevel = UnspecifiedLockLevel
if b.s[b.pos] == '\15':
inc(b.pos)
result.destructor = loadSym(g, decodeVInt(b.s, b.pos), info)
if b.s[b.pos] == '\16':
inc(b.pos)
result.deepCopy = loadSym(g, decodeVInt(b.s, b.pos), info)
if b.s[b.pos] == '\17':
inc(b.pos)
result.assignment = loadSym(g, decodeVInt(b.s, b.pos), info)
if b.s[b.pos] == '\18':
inc(b.pos)
result.sink = loadSym(g, decodeVInt(b.s, b.pos), info)
for a in low(result.attachedOps)..high(result.attachedOps):
if b.s[b.pos] == '\16':
inc(b.pos)
let id = decodeVInt(b.s, b.pos)
if id >= 0:
result.attachedOps[a] = loadSym(g, id, info)
while b.s[b.pos] == '\19':
inc(b.pos)
let x = decodeVInt(b.s, b.pos)
@@ -842,7 +834,7 @@ proc replay(g: ModuleGraph; module: PSym; n: PNode) =
of "error": localError(g.config, n.info, errUser, n[1].strVal)
of "compile":
internalAssert g.config, n.len == 3 and n[2].kind == nkStrLit
let cname = AbsoluteFile n[1].strVal,
let cname = AbsoluteFile n[1].strVal
var cf = Cfile(nimname: splitFile(cname).name, cname: cname,
obj: AbsoluteFile n[2].strVal,
flags: {CfileFlag.External})

View File

@@ -11,7 +11,7 @@
import
intsets, options, ast, astalgo, msgs, idents, renderer,
magicsys, passes, vmdef, modulegraphs, lineinfos
magicsys, vmdef, modulegraphs, lineinfos
type
TOptionEntry* = object # entries to put on a stack for pragma parsing

View File

@@ -10,7 +10,7 @@
## This module contains the type definitions for the new evaluation engine.
## An instruction is 1-3 int32s in memory, it is a register based VM.
import ast, passes, idents, intsets, options, modulegraphs, lineinfos
import ast, idents, intsets, options, modulegraphs, lineinfos
const
byteExcess* = 128 # we use excess-K for immediates

View File

@@ -112,7 +112,7 @@ type
DbConn* = PSqlite3 ## Encapsulates a database connection.
Row* = seq[string] ## A row of a dataset. `NULL` database values will be
## converted to an empty string.
InstantRow* = Pstmt ## A handle that can be used to get a row's column
InstantRow* = PStmt ## A handle that can be used to get a row's column
## text on demand.
proc dbError*(db: DbConn) {.noreturn.} =
@@ -169,7 +169,7 @@ proc tryExec*(db: DbConn, query: SqlQuery,
## db.close()
assert(not db.isNil, "Database not connected.")
var q = dbFormat(query, args)
var stmt: sqlite3.Pstmt
var stmt: sqlite3.PStmt
if prepare_v2(db, q, q.len.cint, stmt, nil) == SQLITE_OK:
let x = step(stmt)
if x in {SQLITE_DONE, SQLITE_ROW}:
@@ -198,12 +198,12 @@ proc newRow(L: int): Row =
for i in 0..L-1: result[i] = ""
proc setupQuery(db: DbConn, query: SqlQuery,
args: varargs[string]): Pstmt =
args: varargs[string]): PStmt =
assert(not db.isNil, "Database not connected.")
var q = dbFormat(query, args)
if prepare_v2(db, q, q.len.cint, result, nil) != SQLITE_OK: dbError(db)
proc setRow(stmt: Pstmt, r: var Row, cols: cint) =
proc setRow(stmt: PStmt, r: var Row, cols: cint) =
for col in 0'i32..cols-1:
setLen(r[col], column_bytes(stmt, col)) # set capacity
setLen(r[col], 0)
@@ -514,7 +514,7 @@ proc tryInsertID*(db: DbConn, query: SqlQuery,
## db.close()
assert(not db.isNil, "Database not connected.")
var q = dbFormat(query, args)
var stmt: sqlite3.Pstmt
var stmt: sqlite3.PStmt
result = -1
if prepare_v2(db, q, q.len.cint, stmt, nil) == SQLITE_OK:
if step(stmt) == SQLITE_DONE:

View File

@@ -106,11 +106,11 @@ type
PPSqlite3* = ptr PSqlite3
Context{.pure, final.} = object
Pcontext* = ptr Context
Tstmt{.pure, final.} = object
Pstmt* = ptr Tstmt
TStmt{.pure, final.} = object
PStmt* = ptr TStmt
Value{.pure, final.} = object
Pvalue* = ptr Value
PValueArg* = array[0..127, Pvalue]
PValue* = ptr Value
PValueArg* = array[0..127, PValue]
Callback* = proc (para1: pointer, para2: int32, para3,
para4: cstringArray): int32{.cdecl.}
@@ -186,90 +186,90 @@ proc errcode*(db: PSqlite3): int32{.cdecl, dynlib: Lib, importc: "sqlite3_errcod
proc errmsg*(para1: PSqlite3): cstring{.cdecl, dynlib: Lib, importc: "sqlite3_errmsg".}
proc errmsg16*(para1: PSqlite3): pointer{.cdecl, dynlib: Lib,
importc: "sqlite3_errmsg16".}
proc prepare*(db: PSqlite3, zSql: cstring, nBytes: int32, ppStmt: var Pstmt,
proc prepare*(db: PSqlite3, zSql: cstring, nBytes: int32, ppStmt: var PStmt,
pzTail: ptr cstring): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_prepare".}
proc prepare_v2*(db: PSqlite3, zSql: cstring, nByte: cint, ppStmt: var Pstmt,
proc prepare_v2*(db: PSqlite3, zSql: cstring, nByte: cint, ppStmt: var PStmt,
pzTail: ptr cstring): cint {.
importc: "sqlite3_prepare_v2", cdecl, dynlib: Lib.}
proc prepare16*(db: PSqlite3, zSql: pointer, nBytes: int32, ppStmt: var Pstmt,
proc prepare16*(db: PSqlite3, zSql: pointer, nBytes: int32, ppStmt: var PStmt,
pzTail: var pointer): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_prepare16".}
proc bind_blob*(para1: Pstmt, para2: int32, para3: pointer, n: int32,
proc bind_blob*(para1: PStmt, para2: int32, para3: pointer, n: int32,
para5: Tbind_destructor_func): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_bind_blob".}
proc bind_double*(para1: Pstmt, para2: int32, para3: float64): int32{.cdecl,
proc bind_double*(para1: PStmt, para2: int32, para3: float64): int32{.cdecl,
dynlib: Lib, importc: "sqlite3_bind_double".}
proc bind_int*(para1: Pstmt, para2: int32, para3: int32): int32{.cdecl,
proc bind_int*(para1: PStmt, para2: int32, para3: int32): int32{.cdecl,
dynlib: Lib, importc: "sqlite3_bind_int".}
proc bind_int64*(para1: Pstmt, para2: int32, para3: int64): int32{.cdecl,
proc bind_int64*(para1: PStmt, para2: int32, para3: int64): int32{.cdecl,
dynlib: Lib, importc: "sqlite3_bind_int64".}
proc bind_null*(para1: Pstmt, para2: int32): int32{.cdecl, dynlib: Lib,
proc bind_null*(para1: PStmt, para2: int32): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_bind_null".}
proc bind_text*(para1: Pstmt, para2: int32, para3: cstring, n: int32,
proc bind_text*(para1: PStmt, para2: int32, para3: cstring, n: int32,
para5: Tbind_destructor_func): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_bind_text".}
proc bind_text16*(para1: Pstmt, para2: int32, para3: pointer, para4: int32,
proc bind_text16*(para1: PStmt, para2: int32, para3: pointer, para4: int32,
para5: Tbind_destructor_func): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_bind_text16".}
#function sqlite3_bind_value(_para1:Psqlite3_stmt; _para2:longint; _para3:Psqlite3_value):longint;cdecl; external Sqlite3Lib name 'sqlite3_bind_value';
#These overloaded functions were introduced to allow the use of SQLITE_STATIC and SQLITE_TRANSIENT
#It's the c world man ;-)
proc bind_blob*(para1: Pstmt, para2: int32, para3: pointer, n: int32,
proc bind_blob*(para1: PStmt, para2: int32, para3: pointer, n: int32,
para5: int32): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_bind_blob".}
proc bind_text*(para1: Pstmt, para2: int32, para3: cstring, n: int32,
proc bind_text*(para1: PStmt, para2: int32, para3: cstring, n: int32,
para5: int32): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_bind_text".}
proc bind_text16*(para1: Pstmt, para2: int32, para3: pointer, para4: int32,
proc bind_text16*(para1: PStmt, para2: int32, para3: pointer, para4: int32,
para5: int32): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_bind_text16".}
proc bind_parameter_count*(para1: Pstmt): int32{.cdecl, dynlib: Lib,
proc bind_parameter_count*(para1: PStmt): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_bind_parameter_count".}
proc bind_parameter_name*(para1: Pstmt, para2: int32): cstring{.cdecl,
proc bind_parameter_name*(para1: PStmt, para2: int32): cstring{.cdecl,
dynlib: Lib, importc: "sqlite3_bind_parameter_name".}
proc bind_parameter_index*(para1: Pstmt, zName: cstring): int32{.cdecl,
proc bind_parameter_index*(para1: PStmt, zName: cstring): int32{.cdecl,
dynlib: Lib, importc: "sqlite3_bind_parameter_index".}
proc clear_bindings*(para1: Pstmt): int32 {.cdecl,
proc clear_bindings*(para1: PStmt): int32 {.cdecl,
dynlib: Lib, importc: "sqlite3_clear_bindings".}
proc column_count*(pStmt: Pstmt): int32{.cdecl, dynlib: Lib,
proc column_count*(PStmt: PStmt): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_column_count".}
proc column_name*(para1: Pstmt, para2: int32): cstring{.cdecl, dynlib: Lib,
proc column_name*(para1: PStmt, para2: int32): cstring{.cdecl, dynlib: Lib,
importc: "sqlite3_column_name".}
proc column_table_name*(para1: Pstmt; para2: int32): cstring{.cdecl, dynlib: Lib,
proc column_table_name*(para1: PStmt; para2: int32): cstring{.cdecl, dynlib: Lib,
importc: "sqlite3_column_table_name".}
proc column_name16*(para1: Pstmt, para2: int32): pointer{.cdecl, dynlib: Lib,
proc column_name16*(para1: PStmt, para2: int32): pointer{.cdecl, dynlib: Lib,
importc: "sqlite3_column_name16".}
proc column_decltype*(para1: Pstmt, i: int32): cstring{.cdecl, dynlib: Lib,
proc column_decltype*(para1: PStmt, i: int32): cstring{.cdecl, dynlib: Lib,
importc: "sqlite3_column_decltype".}
proc column_decltype16*(para1: Pstmt, para2: int32): pointer{.cdecl,
proc column_decltype16*(para1: PStmt, para2: int32): pointer{.cdecl,
dynlib: Lib, importc: "sqlite3_column_decltype16".}
proc step*(para1: Pstmt): int32{.cdecl, dynlib: Lib, importc: "sqlite3_step".}
proc data_count*(pStmt: Pstmt): int32{.cdecl, dynlib: Lib,
proc step*(para1: PStmt): int32{.cdecl, dynlib: Lib, importc: "sqlite3_step".}
proc data_count*(PStmt: PStmt): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_data_count".}
proc column_blob*(para1: Pstmt, iCol: int32): pointer{.cdecl, dynlib: Lib,
proc column_blob*(para1: PStmt, iCol: int32): pointer{.cdecl, dynlib: Lib,
importc: "sqlite3_column_blob".}
proc column_bytes*(para1: Pstmt, iCol: int32): int32{.cdecl, dynlib: Lib,
proc column_bytes*(para1: PStmt, iCol: int32): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_column_bytes".}
proc column_bytes16*(para1: Pstmt, iCol: int32): int32{.cdecl, dynlib: Lib,
proc column_bytes16*(para1: PStmt, iCol: int32): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_column_bytes16".}
proc column_double*(para1: Pstmt, iCol: int32): float64{.cdecl, dynlib: Lib,
proc column_double*(para1: PStmt, iCol: int32): float64{.cdecl, dynlib: Lib,
importc: "sqlite3_column_double".}
proc column_int*(para1: Pstmt, iCol: int32): int32{.cdecl, dynlib: Lib,
proc column_int*(para1: PStmt, iCol: int32): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_column_int".}
proc column_int64*(para1: Pstmt, iCol: int32): int64{.cdecl, dynlib: Lib,
proc column_int64*(para1: PStmt, iCol: int32): int64{.cdecl, dynlib: Lib,
importc: "sqlite3_column_int64".}
proc column_text*(para1: Pstmt, iCol: int32): cstring{.cdecl, dynlib: Lib,
proc column_text*(para1: PStmt, iCol: int32): cstring{.cdecl, dynlib: Lib,
importc: "sqlite3_column_text".}
proc column_text16*(para1: Pstmt, iCol: int32): pointer{.cdecl, dynlib: Lib,
proc column_text16*(para1: PStmt, iCol: int32): pointer{.cdecl, dynlib: Lib,
importc: "sqlite3_column_text16".}
proc column_type*(para1: Pstmt, iCol: int32): int32{.cdecl, dynlib: Lib,
proc column_type*(para1: PStmt, iCol: int32): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_column_type".}
proc finalize*(pStmt: Pstmt): int32{.cdecl, dynlib: Lib,
proc finalize*(PStmt: PStmt): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_finalize".}
proc reset*(pStmt: Pstmt): int32{.cdecl, dynlib: Lib, importc: "sqlite3_reset".}
proc reset*(PStmt: PStmt): int32{.cdecl, dynlib: Lib, importc: "sqlite3_reset".}
proc create_function*(para1: PSqlite3, zFunctionName: cstring, nArg: int32,
eTextRep: int32, para5: pointer,
xFunc: Create_function_func_func,
@@ -284,27 +284,27 @@ proc create_function16*(para1: PSqlite3, zFunctionName: pointer, nArg: int32,
dynlib: Lib, importc: "sqlite3_create_function16".}
proc aggregate_count*(para1: Pcontext): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_aggregate_count".}
proc value_blob*(para1: Pvalue): pointer{.cdecl, dynlib: Lib,
proc value_blob*(para1: PValue): pointer{.cdecl, dynlib: Lib,
importc: "sqlite3_value_blob".}
proc value_bytes*(para1: Pvalue): int32{.cdecl, dynlib: Lib,
proc value_bytes*(para1: PValue): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_value_bytes".}
proc value_bytes16*(para1: Pvalue): int32{.cdecl, dynlib: Lib,
proc value_bytes16*(para1: PValue): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_value_bytes16".}
proc value_double*(para1: Pvalue): float64{.cdecl, dynlib: Lib,
proc value_double*(para1: PValue): float64{.cdecl, dynlib: Lib,
importc: "sqlite3_value_double".}
proc value_int*(para1: Pvalue): int32{.cdecl, dynlib: Lib,
proc value_int*(para1: PValue): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_value_int".}
proc value_int64*(para1: Pvalue): int64{.cdecl, dynlib: Lib,
proc value_int64*(para1: PValue): int64{.cdecl, dynlib: Lib,
importc: "sqlite3_value_int64".}
proc value_text*(para1: Pvalue): cstring{.cdecl, dynlib: Lib,
proc value_text*(para1: PValue): cstring{.cdecl, dynlib: Lib,
importc: "sqlite3_value_text".}
proc value_text16*(para1: Pvalue): pointer{.cdecl, dynlib: Lib,
proc value_text16*(para1: PValue): pointer{.cdecl, dynlib: Lib,
importc: "sqlite3_value_text16".}
proc value_text16le*(para1: Pvalue): pointer{.cdecl, dynlib: Lib,
proc value_text16le*(para1: PValue): pointer{.cdecl, dynlib: Lib,
importc: "sqlite3_value_text16le".}
proc value_text16be*(para1: Pvalue): pointer{.cdecl, dynlib: Lib,
proc value_text16be*(para1: PValue): pointer{.cdecl, dynlib: Lib,
importc: "sqlite3_value_text16be".}
proc value_type*(para1: Pvalue): int32{.cdecl, dynlib: Lib,
proc value_type*(para1: PValue): int32{.cdecl, dynlib: Lib,
importc: "sqlite3_value_type".}
proc aggregate_context*(para1: Pcontext, nBytes: int32): pointer{.cdecl,
dynlib: Lib, importc: "sqlite3_aggregate_context".}
@@ -342,7 +342,7 @@ proc result_text16le*(para1: Pcontext, para2: pointer, para3: int32,
proc result_text16be*(para1: Pcontext, para2: pointer, para3: int32,
para4: Result_func){.cdecl, dynlib: Lib,
importc: "sqlite3_result_text16be".}
proc result_value*(para1: Pcontext, para2: Pvalue){.cdecl, dynlib: Lib,
proc result_value*(para1: Pcontext, para2: PValue){.cdecl, dynlib: Lib,
importc: "sqlite3_result_value".}
proc create_collation*(para1: PSqlite3, zName: cstring, eTextRep: int32,
para4: pointer, xCompare: Create_collation_func): int32{.