about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMarkus Westerlind <markus.westerlind@distilnetworks.com>2020-10-05 10:50:51 +0200
committerMarkus Westerlind <markus.westerlind@distilnetworks.com>2021-03-16 11:20:26 +0100
commit7cf8d3ac2bfb9aad4bdd229efce8f1f2e773303c (patch)
tree4a4de701bf3b3ea6f1c0ea53568a3c6cc0af0134 /src
parent195ad4830e11a544391abe296b146450dea8411b (diff)
downloadrust-7cf8d3ac2bfb9aad4bdd229efce8f1f2e773303c.tar.gz
rust-7cf8d3ac2bfb9aad4bdd229efce8f1f2e773303c.zip
feat: Update hashbrown to instantiate less llvm IR
Includes https://github.com/rust-lang/hashbrown/pull/204 and https://github.com/rust-lang/hashbrown/pull/205 (not yet merged) which both server to reduce the amount of IR generated for hashmaps.

Inspired by the llvm-lines data gathered in https://github.com/rust-lang/rust/pull/76680
Diffstat (limited to 'src')
-rw-r--r--src/etc/gdb_providers.py11
-rw-r--r--src/etc/lldb_providers.py2
-rw-r--r--src/etc/natvis/libstd.natvis14
3 files changed, 14 insertions, 13 deletions
diff --git a/src/etc/gdb_providers.py b/src/etc/gdb_providers.py
index 2d902a9b6e0..f0ce13b269c 100644
--- a/src/etc/gdb_providers.py
+++ b/src/etc/gdb_providers.py
@@ -349,17 +349,18 @@ class StdHashMapProvider:
         self.show_values = show_values
 
         table = self.table()
-        capacity = int(table["bucket_mask"]) + 1
-        ctrl = table["ctrl"]["pointer"]
+        table_inner = table["table"]
+        capacity = int(table_inner["bucket_mask"]) + 1
+        ctrl = table_inner["ctrl"]["pointer"]
 
-        self.size = int(table["items"])
+        self.size = int(table_inner["items"])
         self.pair_type = table.type.template_argument(0).strip_typedefs()
 
-        self.new_layout = not table.type.has_key("data")
+        self.new_layout = not table_inner.type.has_key("data")
         if self.new_layout:
             self.data_ptr = ctrl.cast(self.pair_type.pointer())
         else:
-            self.data_ptr = table["data"]["pointer"]
+            self.data_ptr = table_inner["data"]["pointer"]
 
         self.valid_indices = []
         for idx in range(capacity):
diff --git a/src/etc/lldb_providers.py b/src/etc/lldb_providers.py
index ca2685ca31f..702f2e82e4e 100644
--- a/src/etc/lldb_providers.py
+++ b/src/etc/lldb_providers.py
@@ -563,7 +563,7 @@ class StdHashMapSyntheticProvider:
             # HashSet wraps either std HashMap or hashbrown::HashSet, which both
             # wrap hashbrown::HashMap, so either way we "unwrap" twice.
             hashbrown_hashmap = self.valobj.GetChildAtIndex(0).GetChildAtIndex(0)
-        return hashbrown_hashmap.GetChildMemberWithName("table")
+        return hashbrown_hashmap.GetChildMemberWithName("table").GetChildMemberWithName("table")
 
     def has_children(self):
         # type: () -> bool
diff --git a/src/etc/natvis/libstd.natvis b/src/etc/natvis/libstd.natvis
index b0542b0c633..216935a0ba5 100644
--- a/src/etc/natvis/libstd.natvis
+++ b/src/etc/natvis/libstd.natvis
@@ -26,22 +26,22 @@
   -->
 
   <Type Name="std::collections::hash::map::HashMap&lt;*,*,*&gt;">
-    <DisplayString>{{ len={base.table.items} }}</DisplayString>
+    <DisplayString>{{ len={base.table.table.items} }}</DisplayString>
     <Expand>
-      <Item Name="[len]">base.table.items</Item>
-      <Item Name="[capacity]">base.table.items + base.table.growth_left</Item>
+      <Item Name="[len]">base.table.table.items</Item>
+      <Item Name="[capacity]">base.table.table.items + base.table.table.growth_left</Item>
       <Item Name="[state]">base.hash_builder</Item>
 
       <CustomListItems>
         <Variable Name="i" InitialValue="0" />
-        <Variable Name="n" InitialValue="base.table.items" />
-        <Size>base.table.items</Size>
+        <Variable Name="n" InitialValue="base.table.table.items" />
+        <Size>base.table.table.items</Size>
         <Loop>
           <Break Condition="n == 0" />
-          <If Condition="(base.table.ctrl.pointer[i] &amp; 0x80) == 0">
+          <If Condition="(base.table.table.ctrl.pointer[i] &amp; 0x80) == 0">
             <!-- Bucket is populated -->
             <Exec>n--</Exec>
-            <Item Name="{((tuple&lt;$T1, $T2&gt;*)base.table.ctrl.pointer)[-(i + 1)].__0}">((tuple&lt;$T1, $T2&gt;*)base.table.ctrl.pointer)[-(i + 1)].__1</Item>
+            <Item Name="{((tuple&lt;$T1, $T2&gt;*)base.table.table.ctrl.pointer)[-(i + 1)].__0}">((tuple&lt;$T1, $T2&gt;*)base.table.table.ctrl.pointer)[-(i + 1)].__1</Item>
           </If>
           <Exec>i++</Exec>
         </Loop>