From 4eaa2bf15d1f59311b2fb7efac39cd652f9b2a42 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Fri, 13 Oct 2017 14:25:56 +0200 Subject: [PATCH] improve code generation for custom strings/seqs --- compiler/ccgtypes.nim | 4 ++-- compiler/destroyer.nim | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index c9705e784b..4c85294b2c 100644 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -278,7 +278,7 @@ proc ccgIntroducedPtr(s: PSym): bool = elif tfByCopy in pt.flags: return false case pt.kind of tyObject: - if (optByRef in s.options) or (getSize(pt) > platform.floatSize * 2): + if (optByRef in s.options) or (getSize(pt) > platform.floatSize * 3): result = true # requested anyway elif (tfFinal in pt.flags) and (pt.sons[0] == nil): result = false # no need, because no subtyping possible @@ -286,7 +286,7 @@ proc ccgIntroducedPtr(s: PSym): bool = result = true # ordinary objects are always passed by reference, # otherwise casting doesn't work of tyTuple: - result = (getSize(pt) > platform.floatSize*2) or (optByRef in s.options) + result = (getSize(pt) > platform.floatSize*3) or (optByRef in s.options) else: result = false proc fillResult(param: PNode) = diff --git a/compiler/destroyer.nim b/compiler/destroyer.nim index 78df1bf065..afa2e5e50d 100644 --- a/compiler/destroyer.nim +++ b/compiler/destroyer.nim @@ -290,7 +290,7 @@ proc injectDestructorCalls*(owner: PSym; n: PNode): PNode = else: result.add body - when false: + when defined(nimDebugDestroys): echo "------------------------------------" - echo owner.name.s, " transformed from: ", n + echo owner.name.s, " transformed to: " echo result