mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 11:07:42 +00:00
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
This commit is contained in:
parent
195ad4830e
commit
7cf8d3ac2b
18
Cargo.lock
18
Cargo.lock
@ -1507,9 +1507,15 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "hashbrown"
|
||||||
version = "0.9.0"
|
version = "0.9.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "00d63df3d41950fb462ed38308eea019113ad1508da725bbedcd0fa5a85ef5f7"
|
checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hashbrown"
|
||||||
|
version = "0.11.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "362385356d610bd1e5a408ddf8d022041774b683f345a1d2cfcb4f60f8ae2db5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"compiler_builtins",
|
"compiler_builtins",
|
||||||
"rustc-std-workspace-alloc",
|
"rustc-std-workspace-alloc",
|
||||||
@ -1653,7 +1659,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2"
|
checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
"hashbrown",
|
"hashbrown 0.9.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -2351,9 +2357,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "once_cell"
|
name = "once_cell"
|
||||||
version = "1.4.1"
|
version = "1.7.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad"
|
checksum = "af8b08b04175473088b46763e51ee54da5f9a164bc162f615b91bc179dbf15a3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "opaque-debug"
|
name = "opaque-debug"
|
||||||
@ -4987,7 +4993,7 @@ dependencies = [
|
|||||||
"core",
|
"core",
|
||||||
"dlmalloc",
|
"dlmalloc",
|
||||||
"fortanix-sgx-abi",
|
"fortanix-sgx-abi",
|
||||||
"hashbrown",
|
"hashbrown 0.11.0",
|
||||||
"hermit-abi",
|
"hermit-abi",
|
||||||
"libc",
|
"libc",
|
||||||
"miniz_oxide",
|
"miniz_oxide",
|
||||||
|
@ -20,7 +20,7 @@ libc = { version = "0.2.88", default-features = false, features = ['rustc-dep-of
|
|||||||
compiler_builtins = { version = "0.1.39" }
|
compiler_builtins = { version = "0.1.39" }
|
||||||
profiler_builtins = { path = "../profiler_builtins", optional = true }
|
profiler_builtins = { path = "../profiler_builtins", optional = true }
|
||||||
unwind = { path = "../unwind" }
|
unwind = { path = "../unwind" }
|
||||||
hashbrown = { version = "0.9.0", default-features = false, features = ['rustc-dep-of-std'] }
|
hashbrown = { version = "0.11", default-features = false, features = ['rustc-dep-of-std'] }
|
||||||
|
|
||||||
# Dependencies of the `backtrace` crate
|
# Dependencies of the `backtrace` crate
|
||||||
addr2line = { version = "0.14.0", optional = true, default-features = false }
|
addr2line = { version = "0.14.0", optional = true, default-features = false }
|
||||||
|
@ -349,17 +349,18 @@ class StdHashMapProvider:
|
|||||||
self.show_values = show_values
|
self.show_values = show_values
|
||||||
|
|
||||||
table = self.table()
|
table = self.table()
|
||||||
capacity = int(table["bucket_mask"]) + 1
|
table_inner = table["table"]
|
||||||
ctrl = table["ctrl"]["pointer"]
|
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.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:
|
if self.new_layout:
|
||||||
self.data_ptr = ctrl.cast(self.pair_type.pointer())
|
self.data_ptr = ctrl.cast(self.pair_type.pointer())
|
||||||
else:
|
else:
|
||||||
self.data_ptr = table["data"]["pointer"]
|
self.data_ptr = table_inner["data"]["pointer"]
|
||||||
|
|
||||||
self.valid_indices = []
|
self.valid_indices = []
|
||||||
for idx in range(capacity):
|
for idx in range(capacity):
|
||||||
|
@ -563,7 +563,7 @@ class StdHashMapSyntheticProvider:
|
|||||||
# HashSet wraps either std HashMap or hashbrown::HashSet, which both
|
# HashSet wraps either std HashMap or hashbrown::HashSet, which both
|
||||||
# wrap hashbrown::HashMap, so either way we "unwrap" twice.
|
# wrap hashbrown::HashMap, so either way we "unwrap" twice.
|
||||||
hashbrown_hashmap = self.valobj.GetChildAtIndex(0).GetChildAtIndex(0)
|
hashbrown_hashmap = self.valobj.GetChildAtIndex(0).GetChildAtIndex(0)
|
||||||
return hashbrown_hashmap.GetChildMemberWithName("table")
|
return hashbrown_hashmap.GetChildMemberWithName("table").GetChildMemberWithName("table")
|
||||||
|
|
||||||
def has_children(self):
|
def has_children(self):
|
||||||
# type: () -> bool
|
# type: () -> bool
|
||||||
|
@ -26,22 +26,22 @@
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
<Type Name="std::collections::hash::map::HashMap<*,*,*>">
|
<Type Name="std::collections::hash::map::HashMap<*,*,*>">
|
||||||
<DisplayString>{{ len={base.table.items} }}</DisplayString>
|
<DisplayString>{{ len={base.table.table.items} }}</DisplayString>
|
||||||
<Expand>
|
<Expand>
|
||||||
<Item Name="[len]">base.table.items</Item>
|
<Item Name="[len]">base.table.table.items</Item>
|
||||||
<Item Name="[capacity]">base.table.items + base.table.growth_left</Item>
|
<Item Name="[capacity]">base.table.table.items + base.table.table.growth_left</Item>
|
||||||
<Item Name="[state]">base.hash_builder</Item>
|
<Item Name="[state]">base.hash_builder</Item>
|
||||||
|
|
||||||
<CustomListItems>
|
<CustomListItems>
|
||||||
<Variable Name="i" InitialValue="0" />
|
<Variable Name="i" InitialValue="0" />
|
||||||
<Variable Name="n" InitialValue="base.table.items" />
|
<Variable Name="n" InitialValue="base.table.table.items" />
|
||||||
<Size>base.table.items</Size>
|
<Size>base.table.table.items</Size>
|
||||||
<Loop>
|
<Loop>
|
||||||
<Break Condition="n == 0" />
|
<Break Condition="n == 0" />
|
||||||
<If Condition="(base.table.ctrl.pointer[i] & 0x80) == 0">
|
<If Condition="(base.table.table.ctrl.pointer[i] & 0x80) == 0">
|
||||||
<!-- Bucket is populated -->
|
<!-- Bucket is populated -->
|
||||||
<Exec>n--</Exec>
|
<Exec>n--</Exec>
|
||||||
<Item Name="{((tuple<$T1, $T2>*)base.table.ctrl.pointer)[-(i + 1)].__0}">((tuple<$T1, $T2>*)base.table.ctrl.pointer)[-(i + 1)].__1</Item>
|
<Item Name="{((tuple<$T1, $T2>*)base.table.table.ctrl.pointer)[-(i + 1)].__0}">((tuple<$T1, $T2>*)base.table.table.ctrl.pointer)[-(i + 1)].__1</Item>
|
||||||
</If>
|
</If>
|
||||||
<Exec>i++</Exec>
|
<Exec>i++</Exec>
|
||||||
</Loop>
|
</Loop>
|
||||||
|
Loading…
Reference in New Issue
Block a user