more fixes

This commit is contained in:
Araq 2016-12-02 08:37:51 +01:00
commit d2cbf7f242
3 changed files with 14 additions and 5 deletions

View file

@ -114,10 +114,11 @@ proc createObj*(owner: PSym, info: TLineInfo): PType =
rawAddSon(result, nil) rawAddSon(result, nil)
incl result.flags, tfFinal incl result.flags, tfFinal
result.n = newNodeI(nkRecList, info) result.n = newNodeI(nkRecList, info)
let s = newSym(skType, getIdent("Env_" & info.toFilename & "_" & $info.line), when false:
owner, info) let s = newSym(skType, getIdent("Env_" & info.toFilename & "_" & $info.line),
s.typ = result owner, info)
result.sym = s s.typ = result
result.sym = s
proc rawAddField*(obj: PType; field: PSym) = proc rawAddField*(obj: PType; field: PSym) =
assert field.kind == skField assert field.kind == skField

View file

@ -217,6 +217,14 @@ when defined(debugSigHashes):
let db = open(connection="sighashes.db", user="araq", password="", let db = open(connection="sighashes.db", user="araq", password="",
database="sighashes") database="sighashes")
db.exec(sql"DROP TABLE IF EXISTS sighashes")
db.exec sql"""CREATE TABLE sighashes(
id integer primary key,
hash varchar(5000) not null,
type varchar(5000) not null,
unique (hash, type))"""
# select hash, type from sighashes where hash in
# (select hash from sighashes group by hash having count(*) > 1) order by hash;
proc hashType*(t: PType; flags: set[ConsiderFlag] = {CoType}): SigHash = proc hashType*(t: PType; flags: set[ConsiderFlag] = {CoType}): SigHash =
var c: MD5Context var c: MD5Context

View file

@ -461,7 +461,7 @@ proc rawNewObj(typ: PNimType, size: int, gch: var GcHeap): pointer =
gcAssert(typ.kind in {tyRef, tyString, tySequence}, "newObj: 1") gcAssert(typ.kind in {tyRef, tyString, tySequence}, "newObj: 1")
collectCT(gch) collectCT(gch)
var res = cast[PCell](rawAlloc(gch.region, size + sizeof(Cell))) var res = cast[PCell](rawAlloc(gch.region, size + sizeof(Cell)))
gcAssert typ.kind == tyString or size >= typ.base.size, "size too small" gcAssert typ.kind in {tyString, tySequence} or size >= typ.base.size, "size too small"
gcAssert((cast[ByteAddress](res) and (MemAlign-1)) == 0, "newObj: 2") gcAssert((cast[ByteAddress](res) and (MemAlign-1)) == 0, "newObj: 2")
# now it is buffered in the ZCT # now it is buffered in the ZCT
res.typ = typ res.typ = typ