diff options
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/ccgexprs.nim | 12 | ||||
-rw-r--r-- | compiler/ccgliterals.nim | 4 | ||||
-rw-r--r-- | compiler/ccgtypes.nim | 2 |
3 files changed, 9 insertions, 9 deletions
diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index d718eab42..c23b64257 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -2037,15 +2037,15 @@ proc genDestroy(p: BProc; n: PNode) = of tyString: var a: TLoc initLocExpr(p, arg, a) - linefmt(p, cpsStmts, "if ($1.p && $1.p->allocator) {$n" & - " $1.p->allocator->dealloc($1.p->allocator, $1.p, $1.p->cap + 1 + sizeof(NI) + sizeof(void*));$n" & + linefmt(p, cpsStmts, "if ($1.p && !($1.p->cap & NIM_STRLIT_FLAG)) {$n" & + " #deallocShared($1.p);$n" & " $1.p = NIM_NIL; }$n", [rdLoc(a)]) of tySequence: var a: TLoc initLocExpr(p, arg, a) - linefmt(p, cpsStmts, "if ($1.p && $1.p->allocator) {$n" & - " $1.p->allocator->dealloc($1.p->allocator, $1.p, ($1.p->cap * sizeof($2)) + sizeof(NI) + sizeof(void*));$n" & + linefmt(p, cpsStmts, "if ($1.p && !($1.p->cap & NIM_STRLIT_FLAG)) {$n" & + " #deallocShared($1.p);$n" & " $1.p = NIM_NIL; }$n", [rdLoc(a), getTypeDesc(p.module, t.lastSon)]) else: discard "nothing to do" @@ -2917,8 +2917,8 @@ proc genConstSeqV2(p: BProc, n: PNode, t: PType; isConst: bool): Rope = appcg(p.module, cfsData, "static $5 struct {$n" & - " NI cap; void* allocator; $1 data[$2];$n" & - "} $3 = {$2, NIM_NIL, $4};$n", [ + " NI cap; $1 data[$2];$n" & + "} $3 = {$2 | NIM_STRLIT_FLAG, $4};$n", [ getTypeDesc(p.module, base), n.len, payload, data, if isConst: "const" else: ""]) result = "{$1, ($2*)&$3}" % [rope(n.len), getSeqPayloadType(p.module, t), payload] diff --git a/compiler/ccgliterals.nim b/compiler/ccgliterals.nim index b51348508..ee56da586 100644 --- a/compiler/ccgliterals.nim +++ b/compiler/ccgliterals.nim @@ -55,8 +55,8 @@ proc genStringLiteralV1(m: BModule; n: PNode): Rope = proc genStringLiteralDataOnlyV2(m: BModule, s: string; result: Rope; isConst: bool) = m.s[cfsData].addf("static $4 struct {$n" & - " NI cap; void* allocator; NIM_CHAR data[$2+1];$n" & - "} $1 = { $2, NIM_NIL, $3 };$n", + " NI cap; NIM_CHAR data[$2+1];$n" & + "} $1 = { $2 | NIM_STRLIT_FLAG, $3 };$n", [result, rope(s.len), makeCString(s), rope(if isConst: "const" else: "")]) diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index 054aa2b7c..24551e7e5 100644 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -432,7 +432,7 @@ proc seqV2ContentType(m: BModule; t: PType; check: var IntSet) = appcg(m, m.s[cfsTypes], """$N $3ifndef $2_Content_PP $3define $2_Content_PP -struct $2_Content { NI cap;#AllocatorObj* allocator;$1 data[SEQ_DECL_SIZE];}; +struct $2_Content { NI cap; $1 data[SEQ_DECL_SIZE];}; $3endif$N """, [getTypeDescAux(m, t.skipTypes(abstractInst)[0], check), result, rope"#"]) |