changeset 128:0fdaa93ed62b

Start to clean up new compiler patch
author Louis Opter <louis@lse.epita.fr>
date Mon, 26 Aug 2013 22:53:34 -0700
parents 72b5b4a62cc5
children 518d9c8ac70c
files e1000_wip.patch series wip_debug.patch
diffstat 3 files changed, 90 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/e1000_wip.patch	Mon Aug 26 22:53:34 2013 -0700
@@ -0,0 +1,60 @@
+# HG changeset patch
+# Parent e2e8117a5aede962810a9a561890d2cf80997815
+diff --git a/rathaxes/samples/e1000/e1000.blt b/rathaxes/samples/e1000/e1000.blt
+--- a/rathaxes/samples/e1000/e1000.blt
++++ b/rathaxes/samples/e1000/e1000.blt
+@@ -186,9 +186,9 @@
+                         goto err_skbuffs_alloc;
+                     }
+                     ${Socket::SKBuff.ref} skbuff = &hw_ctx->rx_ring.skbuffs[i];
+-                    // XXX breaks rtxGen: ${local.skbuff.init(local.k_sk_buff)};
+-                    skbuff->skbuff = k_sk_buff;
+-                    skbuff->dma_handle = 0;
++                    ${local.skbuff.init(local.k_sk_buff)};
++                    // skbuff->skbuff = k_sk_buff;
++                    // *(dma_addr_t *)&(skbuff->dma_handle) = 0;
+                     // XXX #46: ${local.skbuff.map_from(rtx_ether_ctx.device)};
+                     if (rtx_socket_skbuff_map(${local.skbuff}, ${rtx_ether_ctx.device}, RTX_DMA_FROM_DEVICE))
+                     {
+@@ -228,7 +228,7 @@
+                 {
+                     dma_unmap_single(
+                             ${rtx_ether_ctx.device},
+-                            hw_ctx->rx_ring.skbuffs[i].dma_handle,
++                            *((dma_addr_t *)&(hw_ctx->rx_ring.skbuffs[i].dma_handle)),
+                             ${config.rx_buffer_len},
+                             DMA_FROM_DEVICE);
+             err_skbuffs_map:
+@@ -350,7 +350,7 @@
+                         E1000_TXD_CMD_RS   |
+                         skb_headlen(${local.k_skb.k_sk_buff}));
+                 tx_desc->upper.data = 0;
+-                tx_desc->buff_addr = cpu_to_le64(skb->dma_handle);
++                tx_desc->buff_addr = cpu_to_le64(${local.skb.dma_handle.k_dma_handle});
+                 memcpy(&self->skbuffs[self->tail], ${local.k_skb.k_sk_buff}, sizeof(*${local.k_skb.k_sk_buff}));
+                 self->tail = (self->tail + 1) % ${config.tx_ring_size};
+             }
+@@ -890,15 +890,18 @@
+              */
+             for (int i = 0; i != ${config.rx_ring_size}; ++i)
+             {
++                /*
++                 * XXX Leaking casts:
++                 *
++                 * We should go through the rtx types (Socket::SKBuff,
++                 * AbstractSKBuff), but we can't because of the array here,
++                 * which is not supported by the compiler.
++                 */
+                 dma_unmap_single(
+                         ${rtx_ether_ctx.device},
+-                        (dma_addr_t)hw_ctx_->rx_ring.skbuffs[i].dma_handle,
++                        *((dma_addr_t *)&(hw_ctx_->rx_ring.skbuffs[i].dma_handle)),
+                         ${config.rx_buffer_len},
+                         DMA_FROM_DEVICE);
+-                /* XXX Leaking cast
+-                 * (We should go through the rtx types (Socket::SKBuff,
+-                 * AbstractSKBuff)
+-                 */
+                 dev_kfree_skb((struct sk_buff *)hw_ctx_->rx_ring.skbuffs[i].skbuff);
+             }
+             dma_free_coherent(${rtx_ether_ctx.device}, hw_ctx_->rx_ring.size,
--- a/series	Sun Aug 18 15:33:24 2013 -0700
+++ b/series	Mon Aug 26 22:53:34 2013 -0700
@@ -12,3 +12,4 @@
 rathaxes_samples_e1000_split_set_up_device.patch
 rathaxes_compiler_passes_fix_ref_scalar_issues_with_chunk_parameters.patch
 wip_debug.patch
+e1000_wip.patch
--- a/wip_debug.patch	Sun Aug 18 15:33:24 2013 -0700
+++ b/wip_debug.patch	Mon Aug 26 22:53:34 2013 -0700
@@ -1,49 +1,37 @@
 # 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))
+@@ -729,9 +729,17 @@
+             // First, try to retrieve value from previous resVals, otherwise build it from chunk
+             if (varName != "self")
              {
-                 local_node#parent.ref_placeholder.id = mapping;
-@@ -812,9 +817,18 @@
++                //
++                // XXX Note: Here, we may encounter some issues if the chunk's type_map isnt properly filled
++                // (encountered once, the type was scalar instead of ref)
++                //
++                local self_reftype = "scalar";
++                local self_rtype;
+                 if (rtxNodeArgs_GetArgByName(resolverValues, varName, self) == true)
+                 {
+                     rtxNodeArg_getValue(self, self_value);
++                    rtxNodeArg_getRType(self, self_rtype);
++                    self_reftype = self_rtype.qualifier;
                  }
-                 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
+                 {
+@@ -740,8 +748,10 @@
+                     clearVariable(self_value);
+                     cnormNode_TerminalId(self_value, varName);
+                 }
+-                rtxNodeArgs_AppendArg(resVal, "self", theChunk.type_map[varName], self_value);
+-                setall self_type = theChunk.type_map[varName];
++                setall self_rtype = theChunk.type_map[varName];
++                self_rtype.qualifier = self_reftype;
++                rtxNodeArgs_AppendArg(resVal, "self", self_rtype, self_value);
++                setall self_type = self_rtype;
              }
-         }
-         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;
+             else
+             {