This commit is contained in:
Araq 2013-06-06 23:15:05 +02:00
commit 9604df8431
5 changed files with 14 additions and 15 deletions

View file

@ -674,7 +674,7 @@ proc genProcHeader(m: BModule, prc: PSym): PRope =
# ------------------ type info generation ------------------------------------- # ------------------ type info generation -------------------------------------
proc genTypeInfo(m: BModule, typ: PType): PRope proc genTypeInfo(m: BModule, t: PType): PRope
proc getNimNode(m: BModule): PRope = proc getNimNode(m: BModule): PRope =
result = ropef("$1[$2]", [m.typeNodesName, toRope(m.typeNodes)]) result = ropef("$1[$2]", [m.typeNodesName, toRope(m.typeNodes)])
inc(m.typeNodes) inc(m.typeNodes)
@ -692,7 +692,7 @@ proc isObjLackingTypeField(typ: PType): bool {.inline.} =
result = (typ.kind == tyObject) and ((tfFinal in typ.flags) and result = (typ.kind == tyObject) and ((tfFinal in typ.flags) and
(typ.sons[0] == nil) or isPureObject(typ)) (typ.sons[0] == nil) or isPureObject(typ))
proc genTypeInfoAuxBase(m: BModule, typ: PType, name, base: PRope) = proc genTypeInfoAuxBase(m: BModule, typ: PType, name, base: PRope) =
var nimtypeKind: int var nimtypeKind: int
#allocMemTI(m, typ, name) #allocMemTI(m, typ, name)
if isObjLackingTypeField(typ): if isObjLackingTypeField(typ):
@ -901,21 +901,21 @@ type
include ccgtrav include ccgtrav
proc genTypeInfo(m: BModule, typ: PType): PRope = proc genTypeInfo(m: BModule, t: PType): PRope =
var t = getUniqueType(typ) var t = getUniqueType(t)
result = ropef("NTI$1", [toRope(t.id)]) result = ropef("NTI$1", [toRope(t.id)])
let owner = typ.skipTypes(typedescPtrs).owner.getModule if ContainsOrIncl(m.typeInfoMarker, t.id):
return con("(&".toRope, result, ")".toRope)
let owner = t.skipTypes(typedescPtrs).owner.getModule
if owner != m.module: if owner != m.module:
# make sure the type info is created in the owner module # make sure the type info is created in the owner module
discard genTypeInfo(owner.bmod, typ) discard genTypeInfo(owner.bmod, t)
# refenrece the type info as extern here # reference the type info as extern here
discard cgsym(m, "TNimType") discard cgsym(m, "TNimType")
discard cgsym(m, "TNimNode") discard cgsym(m, "TNimNode")
appf(m.s[cfsVars], "extern TNimType $1; /* $2 */$n", appf(m.s[cfsVars], "extern TNimType $1; /* $2 */$n",
[result, toRope(typeToString(t))]) [result, toRope(typeToString(t))])
return con("(&".toRope, result, ")".toRope) return con("(&".toRope, result, ")".toRope)
if ContainsOrIncl(m.typeInfoMarker, t.id):
return con("(&".toRope, result, ")".toRope)
case t.kind case t.kind
of tyEmpty: result = toRope"0" of tyEmpty: result = toRope"0"
of tyPointer, tyBool, tyChar, tyCString, tyString, tyInt..tyUInt64, tyVar: of tyPointer, tyBool, tyChar, tyCString, tyString, tyInt..tyUInt64, tyVar:

View file

@ -1031,7 +1031,7 @@ proc genInitCode(m: BModule) =
var procname = CStringLit(m.initProc, prc, m.module.name.s) var procname = CStringLit(m.initProc, prc, m.module.name.s)
app(prc, initFrame(m.initProc, procname, m.module.info.quotedFilename)) app(prc, initFrame(m.initProc, procname, m.module.info.quotedFilename))
else: else:
app(prc, ~"\tvolatile TFrame F; F.len = 0;$N") app(prc, ~"\tTFrame F; F.len = 0;$N")
app(prc, genSectionStart(cpsInit)) app(prc, genSectionStart(cpsInit))
app(prc, m.preInitProc.s(cpsInit)) app(prc, m.preInitProc.s(cpsInit))

View file

@ -93,10 +93,10 @@ hint[LineTooLong]=off
cc = clang cc = clang
tlsEmulation:on tlsEmulation:on
gcc.options.always = "-w -fasm-blocks" gcc.options.always = "-w -fasm-blocks"
gpp.options.always = "-w -fasm-blocks" gpp.options.always = "-w -fasm-blocks -fpermissive"
@else: @else:
gcc.options.always = "-w" gcc.options.always = "-w"
gpp.options.always = "-w" gpp.options.always = "-w -fpermissive"
@end @end
gcc.options.speed = "-O3 -fno-strict-aliasing" gcc.options.speed = "-O3 -fno-strict-aliasing"

View file

@ -437,11 +437,11 @@ struct TFrame {
}; };
#define nimfr(proc, file) \ #define nimfr(proc, file) \
volatile TFrame F; \ TFrame F; \
F.procname = proc; F.filename = file; F.line = 0; F.len = 0; nimFrame(&F); F.procname = proc; F.filename = file; F.line = 0; F.len = 0; nimFrame(&F);
#define nimfrs(proc, file, slots, length) \ #define nimfrs(proc, file, slots, length) \
volatile struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; TVarSlot s[slots];} F; \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; TVarSlot s[slots];} F; \
F.procname = proc; F.filename = file; F.line = 0; F.len = length; nimFrame((TFrame*)&F); F.procname = proc; F.filename = file; F.line = 0; F.len = length; nimFrame((TFrame*)&F);
#define nimln(n, file) \ #define nimln(n, file) \

View file

@ -24,7 +24,6 @@ Bugs
- blocks can "export" an identifier but the CCG generates {} for them ... - blocks can "export" an identifier but the CCG generates {} for them ...
- osproc execProcesses can deadlock if all processes fail (as experienced - osproc execProcesses can deadlock if all processes fail (as experienced
in c++ mode) in c++ mode)
- bootstrapping does not work in C++ mode
- result = result shr 8 for the "system()" wrapper - result = result shr 8 for the "system()" wrapper