cgen: no type canon for integral types; osproc use posix_spawn instead of fork&exec

This commit is contained in:
Araq 2011-11-18 00:29:56 +01:00
commit 61792dc7d6
9 changed files with 149 additions and 54 deletions

View file

@ -574,7 +574,8 @@ const
tyPointer,
tyOpenArray, tyString, tyCString, tyInt..tyInt64, tyFloat..tyFloat128,
tyUInt..tyUInt64}
IntegralTypes* = {tyBool, tyChar, tyEnum, tyInt..tyInt64,
tyFloat..tyFloat128, tyUInt..tyUInt64}
ConstantDataTypes*: TTypeKinds = {tyArrayConstr, tyArray, tySet,
tyTuple, tySequence}
ExportableSymKinds* = {skVar, skConst, skProc, skMethod, skType, skIterator,

View file

@ -265,7 +265,7 @@ proc getSimpleTypeDesc(m: BModule, typ: PType): PRope =
of tyBool: result = typeNameOrLiteral(typ, "NIM_BOOL")
of tyChar: result = typeNameOrLiteral(typ, "NIM_CHAR")
of tyNil: result = typeNameOrLiteral(typ, "0")
of tyInt..tyFloat128:
of tyInt..tyFloat128, tyUInt..tyUInt64:
result = typeNameOrLiteral(typ, NumericalTypeToStr[typ.Kind])
of tyRange: result = getSimpleTypeDesc(m, typ.sons[0])
else: result = nil

View file

@ -73,11 +73,15 @@ proc GetUniqueType*(key: PType): PType =
if key == nil: return
var k = key.kind
case k
of tyNone, tyBool, tyChar, tyEmpty,
tyNil, tyExpr, tyStmt, tyTypeDesc, tyPointer, tyString, tyCString,
of tyBool, tyChar,
tyInt, tyInt8, tyInt16, tyInt32, tyInt64,
tyFloat, tyFloat32, tyFloat64, tyFloat128,
tyUInt, tyUInt8, tyUInt16, tyUInt32, tyUInt64, tyBigNum:
tyUInt, tyUInt8, tyUInt16, tyUInt32, tyUInt64:
# no canonicalization for integral types, so that e.g. ``pid_t`` is
# produced instead of ``NI``.
result = key
of tyEmpty, tyNil, tyExpr, tyStmt, tyTypeDesc, tyPointer, tyString,
tyCString, tyNone, tyBigNum:
result = gCanonicalTypes[k]
if result == nil:
gCanonicalTypes[k] = key