changeset 127:72b5b4a62cc5

Wip on fixing ref/scalar issues, partly fixed
author Louis Opter <louis@lse.epita.fr>
date Sun, 18 Aug 2013 15:33:24 -0700
parents 6e142648b2fe
children 0fdaa93ed62b
files rathaxes_compiler_passes_fix_ref_scalar_issues_with_chunk_parameters.patch series wip_debug.patch
diffstat 3 files changed, 127 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rathaxes_compiler_passes_fix_ref_scalar_issues_with_chunk_parameters.patch	Sun Aug 18 15:33:24 2013 -0700
@@ -0,0 +1,76 @@
+# HG changeset patch
+# Parent aa64f4dc928c5e844d1a7005652d059979544239
+rathaxes: fix ref/scalar issues with chunk parameters
+
+diff --git a/rathaxes/compiler/passes/common/rtxResolve.inc.cws b/rathaxes/compiler/passes/common/rtxResolve.inc.cws
+--- a/rathaxes/compiler/passes/common/rtxResolve.inc.cws
++++ b/rathaxes/compiler/passes/common/rtxResolve.inc.cws
+@@ -449,22 +449,35 @@
+         }
+         else if (search_chunk == false) // This may be the rtx implementation chunk -> different way to resolve...
+         {
+-            if (rtxNode2cnormNode<src_p.type>(src_p, param_value) == false)
+-                error(RED + "Could not translate rathaxes node " + toString(src_p, true)
+-                      + " to a resVal (containing one cnorm) node." + DEFAULT_COLOR);
+-            setall param_type = src_p.rtype;
+-            if (param_value.type == "__expr__" && param_value.operator != "__literal__")
++
++            if (rtxNodeArgs_GetArgByName(src_resVals, src_p.val, src_arg) == true)
+             {
+-                local src_arg;
+-                local src_name = param_value.id;
+-                if (rtxNodeArgs_GetArgByName(src_resVals, src_name, src_arg))
+-                    return false;
+                 if (rtxNodeArg_getRType(src_arg, param_type) == false)
+                     return false;
+                 if (rtxNodeArg_getValue(src_arg, param_value) == false)
+                     return false;
+                 param_name = dst_p;
+             }
++            else
++            {
++                if (rtxNode2cnormNode<src_p.type>(src_p, param_value) == false)
++                    error(RED + "Could not translate rathaxes node " + toString(src_p, true)
++                          + " to a resVal (containing one cnorm) node." + DEFAULT_COLOR);
++
++                setall param_type = src_p.rtype;
++                if (param_value.type == "__expr__" && param_value.operator != "__literal__")
++                {
++                    local src_arg;
++                    local src_name = param_value.id;
++                    if (rtxNodeArgs_GetArgByName(src_resVals, src_name, src_arg))
++                        return false;
++                    if (rtxNodeArg_getRType(src_arg, param_type) == false)
++                        return false;
++                    if (rtxNodeArg_getValue(src_arg, param_value) == false)
++                        return false;
++                    param_name = dst_p;
++                }
++            }
+         }
+         else
+         {
+@@ -529,7 +542,13 @@
+ 
+         // Now, resolve the loaded chunk...
+         local resVals;
+-        rtxResolve_BuildParameterResVals(resolverValues, call.args, resVals, chunkTree.tpl_params, source_tree, false);
++        if (rtxResolve_BuildParameterResVals(resolverValues, call.args, resVals, chunkTree.tpl_params, source_tree, false) == false)
++        {
++            // TODO: should be an error, but will be break to many things at
++            // this point:
++            traceLine(RED + "[Error] Could not build front-end parameter resvals." + DEFAULT_COLOR);
++        }
++
+         if (instanceChunk<chunkTree.instanceKey>(resVals, chunkTree.body, source_tree) == false)
+         {
+             increment(errcount);
+@@ -716,6 +735,8 @@
+                 }
+                 else
+                 {
++                    traceLine(YELLOW + "[Warning] Using variable's identifier as resolved value (high probability to be wrong): "
++                              + local_node#parent.location + DEFAULT_COLOR);
+                     clearVariable(self_value);
+                     cnormNode_TerminalId(self_value, varName);
+                 }
--- a/series	Sun Aug 18 12:51:47 2013 -0700
+++ b/series	Sun Aug 18 15:33:24 2013 -0700
@@ -10,3 +10,5 @@
 rathaxes_samples_e1000_use_the_dma_abstraction_in_socket.patch
 rathaxes_samples_e1000_add_ethernet_device_alloc_rx_skbuff.patch
 rathaxes_samples_e1000_split_set_up_device.patch
+rathaxes_compiler_passes_fix_ref_scalar_issues_with_chunk_parameters.patch
+wip_debug.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wip_debug.patch	Sun Aug 18 15:33:24 2013 -0700
@@ -0,0 +1,49 @@
+# HG changeset patch
+# Parent ea807d6831821c5fb094e7ae9258f5a282ec15e6
+diff --git a/rathaxes/compiler/passes/common/rtxResolve.inc.cws b/rathaxes/compiler/passes/common/rtxResolve.inc.cws
+--- a/rathaxes/compiler/passes/common/rtxResolve.inc.cws
++++ b/rathaxes/compiler/passes/common/rtxResolve.inc.cws
+@@ -782,6 +782,11 @@
+                 return false;
+             }
+ 
++            if (coreString(local_node#parent.location,0,2) == "/home/kal/projs/rathaxes/rathaxes/samples/e1000/e1000.blt:971:")
++            {
++                traceLine(BLUE + toString(mapping,true) + DEFAULT_COLOR);
++            }
++
+             if (isString(mapping))
+             {
+                 local_node#parent.ref_placeholder.id = mapping;
+@@ -812,9 +817,18 @@
+                 }
+                 local in_type = source_type.qualifier;
+                 local out_type = local_node#parent.ph_type;
++                traceLine("paf: " + local_node#parent.location);
++                if (local_node#parent.location == "/home/kal/projs/rathaxes/rathaxes/samples/e1000/ethernet.blt:124:40")
++                {
++                    traceLine(YELLOW + "in_type = " + in_type+ DEFAULT_COLOR);
++                    traceLine(YELLOW + "out_type = " + out_type+ DEFAULT_COLOR);
++                    traceLine(CYAN + toString(resolverValues,true) + DEFAULT_COLOR);
++                }
+                 if (rtxResolve_RefScalarTranscribe(mapping, in_type, out_type) == false)
+                 { error(RED + "[Error] Cannot transcribe an expression from " + in_type + " to " + out_type + DEFAULT_COLOR); }
+                 setall local_node#parent.ref_placeholder = mapping;
++                if (coreString(local_node#parent.location,0,2) == "/home/kal/projs/rathaxes/rathaxes/samples/e1000/e1000.blt:971:")
++                    exit(1);
+             }
+         }
+         else if (isBuiltinVariable(varName)) // Mapping for a  builtin type
+@@ -1445,6 +1459,12 @@
+         }
+         rtxNodeArg_getValue(self, val);
+         setall out_node = val;
++        if (placeHolder#parent.location == "/home/kal/projs/rathaxes/rathaxes/samples/e1000/ethernet.blt:124:40")
++        {
++            traceLine(PURPLE + toString(val,true)+ DEFAULT_COLOR);
++            //error("toto");
++            //exit(1);
++        }
+     }
+ 
+     return true;