From 02e44bade6370309c0292e84178095c2bae299be Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 20 Dec 2018 13:23:58 -0500 Subject: Feature/lex memory reduction (#762) * Only do scrubbing if needed. When allocating content try to limit size (with scrubbing each token takes up 1k), now it's 16 bytes min size. * Don't allocate for every call to write on the CallbackWriter - use the m_appendBuffer. * Don't allocate memory for CallbackWriter use m_appendBuffer. * Use UnownedStringSlice for suffix output for parsing float/int literals. Fix typo in invalidFloatingPointLiteralSuffix * Using memory arena to hold tokens that are not in SourceManager. * Improve comment on lexing. * Make UnownedStringSlice allocation simpler on SourceManager. * Fix error on gcc around UnownedStringSlice - because VC converted string + UnownedStringSlice automatically into a String. * Fix generateName needing concat string for gcc. * When constructing a Token in parseAttributeName - because it's a Identifier, we have to set the Name. * Remove translation through String on getIntrinsicOp * Make func-cbuffer-param disablable with -exclude compatibility-issue * Move memory leak in render-test. * From review - can just use "?:" instead of performing a concat. --- source/slang/lower-to-ir.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source/slang/lower-to-ir.cpp') diff --git a/source/slang/lower-to-ir.cpp b/source/slang/lower-to-ir.cpp index 0d39664c8..2242619d0 100644 --- a/source/slang/lower-to-ir.cpp +++ b/source/slang/lower-to-ir.cpp @@ -458,9 +458,9 @@ IROp getIntrinsicOp( // based on the name of the declaration... auto name = decl->getName(); - auto nameText = getText(name); + auto nameText = getUnownedStringSliceText(name); - IROp op = findIROp(nameText.Buffer()); + IROp op = findIROp(nameText); SLANG_ASSERT(op != kIROp_Invalid); return op; } @@ -4909,7 +4909,7 @@ struct DeclLoweringVisitor : DeclVisitor definition = definitionToken.Content; } - builder->addTargetIntrinsicDecoration(irInst, targetMod->targetToken.Content.getUnownedSlice(), definition.getUnownedSlice()); + builder->addTargetIntrinsicDecoration(irInst, targetMod->targetToken.Content, definition.getUnownedSlice()); } } @@ -5240,7 +5240,7 @@ struct DeclLoweringVisitor : DeclVisitor // a specialized definition of the particular function for the given // target, and we need to reflect that at the IR level. - getBuilder()->addTargetDecoration(irFunc, targetMod->targetToken.Content.getUnownedSlice()); + getBuilder()->addTargetDecoration(irFunc, targetMod->targetToken.Content); } // If this declaration was marked as having a target-specific lowering @@ -5255,7 +5255,7 @@ struct DeclLoweringVisitor : DeclVisitor // for(auto extensionMod : decl->GetModifiersOfType()) { - getBuilder()->addRequireGLSLExtensionDecoration(irFunc, extensionMod->extensionNameToken.Content.getUnownedSlice()); + getBuilder()->addRequireGLSLExtensionDecoration(irFunc, extensionMod->extensionNameToken.Content); } for(auto versionMod : decl->GetModifiersOfType()) { -- cgit v1.2.3