Explorar o código

HPCC-13543 Move parent extract from member to local variable

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
Gavin Halliday %!s(int64=10) %!d(string=hai) anos
pai
achega
880f91b41e
Modificáronse 3 ficheiros con 20 adicións e 10 borrados
  1. 1 0
      common/deftype/deftype.hpp
  2. 2 3
      ecl/hqlcpp/hqlinline.cpp
  3. 17 7
      ecl/hqlcpp/hqlwcpp.cpp

+ 1 - 0
common/deftype/deftype.hpp

@@ -128,6 +128,7 @@ enum typemod_t
     typemod_outofline   = 8,
     typemod_outofline   = 8,
     typemod_attr        = 9,
     typemod_attr        = 9,
     typemod_indirect    = 10,       // type definition needs to go via an ecl definition
     typemod_indirect    = 10,       // type definition needs to go via an ecl definition
+    typemod_mutable     = 11,
     typemod_max
     typemod_max
 };
 };
 
 

+ 2 - 3
ecl/hqlcpp/hqlinline.cpp

@@ -896,7 +896,6 @@ bool HqlCppTranslator::isNeverDistributed(IHqlExpression * expr)
     
     
 //============================================================================
 //============================================================================
 
 
-
 ParentExtract::ParentExtract(HqlCppTranslator & _translator, PEtype _type, IHqlExpression * _graphId, GraphLocalisation _localisation, EvalContext * _container)
 ParentExtract::ParentExtract(HqlCppTranslator & _translator, PEtype _type, IHqlExpression * _graphId, GraphLocalisation _localisation, EvalContext * _container)
 : HqlExprAssociation(parentExtractMarkerExpr), translator(_translator), type(_type), graphId(_graphId)
 : HqlExprAssociation(parentExtractMarkerExpr), translator(_translator), type(_type), graphId(_graphId)
 {
 {
@@ -977,19 +976,19 @@ void ParentExtract::associateCursors(BuildCtx & declarectx, BuildCtx & evalctx,
 void ParentExtract::beginCreateExtract(BuildCtx & ctx, bool doDeclare)
 void ParentExtract::beginCreateExtract(BuildCtx & ctx, bool doDeclare)
 {
 {
     buildctx.setown(new BuildCtx(ctx));
     buildctx.setown(new BuildCtx(ctx));
+
     // Don't leak the serialization row into other sub calls - may want to do this a different way so
     // Don't leak the serialization row into other sub calls - may want to do this a different way so
     // cses get commoned up by tagging the serialization somehow.
     // cses get commoned up by tagging the serialization somehow.
+    serialization = SerializationRow::create(translator, boundBuilder.expr, container ? container->queryActivity() : NULL);
 
 
     //Probably do this later and allow it to be null.  Will need a mechanism for calling some finalisation code
     //Probably do this later and allow it to be null.  Will need a mechanism for calling some finalisation code
     //after all code is generated in order to do it.
     //after all code is generated in order to do it.
     if (doDeclare)
     if (doDeclare)
     {
     {
         BuildCtx * declarectx = buildctx;
         BuildCtx * declarectx = buildctx;
-        translator.getInvariantMemberContext(ctx, &declarectx, NULL, false, false);
         declarectx->addDeclare(boundBuilder.expr);
         declarectx->addDeclare(boundBuilder.expr);
     }
     }
 
 
-    serialization = SerializationRow::create(translator, boundBuilder.expr, container ? container->queryActivity() : NULL);
     buildctx->associateOwn(*LINK(serialization));
     buildctx->associateOwn(*LINK(serialization));
 
 
     //Ensure the row is large enough to cope with any fixed fields - will only get relocated if variable fields are serialised
     //Ensure the row is large enough to cope with any fixed fields - will only get relocated if variable fields are serialised

+ 17 - 7
ecl/hqlcpp/hqlwcpp.cpp

@@ -1928,30 +1928,40 @@ void HqlCppWriter::generateStmtDeclare(IHqlStmt * declare)
     if (declare->getStmt() == external_stmt)
     if (declare->getStmt() == external_stmt)
         out.append("extern ");
         out.append("extern ");
 
 
+    indent();
+    if (hasModifier(type, typemod_mutable))
+        out.append("mutable ");
+
     size32_t typeSize = type->getSize();
     size32_t typeSize = type->getSize();
     if (hasWrapperModifier(type))
     if (hasWrapperModifier(type))
     {
     {
         if (hasModifier(type, typemod_builder))
         if (hasModifier(type, typemod_builder))
-            indent().append("mutable rtlRowBuilder ").append(targetName);
+            out.append("rtlRowBuilder ").append(targetName);
         else if (hasStreamedModifier(type))
         else if (hasStreamedModifier(type))
         {
         {
-            indent().append("Owned<IRowStream> ").append(targetName);
+            out.append("Owned<IRowStream> ").append(targetName);
         }
         }
         else if (hasLinkCountedModifier(type))
         else if (hasLinkCountedModifier(type))
         {
         {
             if (type->getTypeCode() == type_row)
             if (type->getTypeCode() == type_row)
-                indent().append("rtlRowAttr ").append(targetName);
+                out.append("rtlRowAttr ").append(targetName);
             else
             else
-                indent().append("rtlRowsAttr ").append(targetName);
+                out.append("rtlRowsAttr ").append(targetName);
         }
         }
         else if (typeSize != UNKNOWN_LENGTH)
         else if (typeSize != UNKNOWN_LENGTH)
-            indent().append("rtlFixedSizeDataAttr<").append(typeSize).append("> ").append(targetName);
+            out.append("rtlFixedSizeDataAttr<").append(typeSize).append("> ").append(targetName);
         else
         else
-            indent().append("rtlDataAttr ").append(targetName);
+            out.append("rtlDataAttr ").append(targetName);
+        if (value)
+        {
+            out.append("(");
+            generateExprCpp(value);
+            out.append(")");
+            value = NULL;
+        }
     }
     }
     else
     else
     {
     {
-        indent();
         generateType(type, targetName.str());
         generateType(type, targetName.str());
     }
     }