summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2022-03-23 13:25:43 -0700
committerGravatar vslashg <gfalcon@google.com>2022-03-24 15:56:14 -0400
commiteb3db08cb3a4faf2aa09a2ba4a30b442457f36cf (patch)
tree49a04c9b03bb4a998aa68772ae3a33f30ffe1869
parentf3489c9ca64e0fad2a263e8560ee96718ac8b21b (diff)
Export of internal Abseil changes
-- 8c9dd24a6fbf9ed10ae81f9fa0bc2168558a9700 by Abseil Team <absl-team@google.com>: Improve WebAssembly detection when using Bazel. Unfortunately, the --cpu values are not standardized, and both --cpu=wasm and --cpu=wasm32 are used in the wild. Most notably, Emscripten's Bazel rules use --cpu=wasm, which was missing. While there, add support for @platforms//cpu:{wasm32,wasm64}. This change adds a dependency on @bazel_skylib, which requires adding the following http_archive() rule to the WORKSPACE file: http_archive( name = "bazel_skylib", urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/1.2.1/bazel-skylib-1.2.1.tar.gz"], sha256 = "f7be3474d42aae265405a592bb7da8e171919d74c16f082a5457840f06054728", ) PiperOrigin-RevId: 436815546 Change-Id: I4e1946070c6964abb12259f25a546f2d24e0992a -- 59514589043d9b0734a01f7aa7bc354f5b495eab by Abseil Team <absl-team@google.com>: Fix some typos that slipped through. PiperOrigin-RevId: 436777566 Change-Id: Ibf5c54e2671c749dc87d2bd5d36dcd220ce347d4 GitOrigin-RevId: 8c9dd24a6fbf9ed10ae81f9fa0bc2168558a9700
-rw-r--r--WORKSPACE7
-rw-r--r--absl/BUILD.bazel39
-rw-r--r--absl/container/internal/raw_hash_set.h20
3 files changed, 55 insertions, 11 deletions
diff --git a/WORKSPACE b/WORKSPACE
index 8120cd17..1a1753a8 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -35,6 +35,13 @@ http_archive(
urls = ["https://github.com/google/benchmark/archive/0baacde3618ca617da95375e0af13ce1baadea47.zip"],
)
+# Bazel Skylib.
+http_archive(
+ name = "bazel_skylib",
+ urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/1.2.1/bazel-skylib-1.2.1.tar.gz"],
+ sha256 = "f7be3474d42aae265405a592bb7da8e171919d74c16f082a5457840f06054728",
+)
+
# Bazel platform rules.
http_archive(
name = "platforms",
diff --git a/absl/BUILD.bazel b/absl/BUILD.bazel
index d799b7fe..7cccbbba 100644
--- a/absl/BUILD.bazel
+++ b/absl/BUILD.bazel
@@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
package(default_visibility = ["//visibility:public"])
licenses(["notice"])
@@ -64,7 +66,15 @@ config_setting(
)
config_setting(
- name = "wasm",
+ name = "cpu_wasm",
+ values = {
+ "cpu": "wasm",
+ },
+ visibility = [":__subpackages__"],
+)
+
+config_setting(
+ name = "cpu_wasm32",
values = {
"cpu": "wasm32",
},
@@ -72,6 +82,33 @@ config_setting(
)
config_setting(
+ name = "platforms_wasm32",
+ constraint_values = [
+ "@platforms//cpu:wasm32",
+ ],
+ visibility = [":__subpackages__"],
+)
+
+config_setting(
+ name = "platforms_wasm64",
+ constraint_values = [
+ "@platforms//cpu:wasm64",
+ ],
+ visibility = [":__subpackages__"],
+)
+
+selects.config_setting_group(
+ name = "wasm",
+ match_any = [
+ ":cpu_wasm",
+ ":cpu_wasm32",
+ ":platforms_wasm32",
+ ":platforms_wasm64",
+ ],
+ visibility = [":__subpackages__"],
+)
+
+config_setting(
name = "fuchsia",
values = {
"cpu": "fuchsia",
diff --git a/absl/container/internal/raw_hash_set.h b/absl/container/internal/raw_hash_set.h
index d24bbe83..a05bebf6 100644
--- a/absl/container/internal/raw_hash_set.h
+++ b/absl/container/internal/raw_hash_set.h
@@ -88,7 +88,7 @@
// +---------------+---------------+---------------+
//
// Each control byte is either a special value for empty slots, deleted slots
-// (sometimes called *tombstones*), and a speical end-of-table marker used by
+// (sometimes called *tombstones*), and a special end-of-table marker used by
// iterators, or, if occupied, seven bits (H2) from the hash of the value in the
// corresponding slot.
//
@@ -130,7 +130,7 @@
// 7 | 0.191 | 15 | 0.879
//
// The rule of thumb breaks down at around `n = 12`, but such groups would only
-// occur for tables close to their load factor. This is far better than an
+// occur for tables close to their max load factor. This is far better than an
// ordinary open-addressing table, which needs to perform an == at every step of
// the probe sequence. These probabilities don't tell the full story (for
// example, because elements are inserted into a group from the front, and
@@ -155,7 +155,7 @@
// this point, we may `unchecked_insert` the value `x`.
//
// Below, `unchecked_insert` is partly implemented by `prepare_insert`, which
-// presents a viable, intialized slot pointee to the caller.
+// presents a viable, initialized slot pointee to the caller.
//
// `erase` is implemented in terms of `erase_at`, which takes an index to a
// slot. Given an offset, we simply create a tombstone and destroy its contents.
@@ -229,7 +229,7 @@ void SwapAlloc(AllocType& /*lhs*/, AllocType& /*rhs*/,
//
// Wrapping around at `mask + 1` is important, but not for the obvious reason.
// As described above, the first few entries of the control byte array
-// is mirrored at the end of the array, which `Group` will find and use
+// are mirrored at the end of the array, which `Group` will find and use
// for selecting candidates. However, when those candidates' slots are
// actually inspected, there are no corresponding slots for the cloned bytes,
// so we need to make sure we've treated those offsets as "wrapping around".
@@ -300,7 +300,7 @@ uint32_t TrailingZeros(T x) {
return static_cast<uint32_t>(countr_zero(x));
}
-// A abstract bitmask, such as that emitted by a SIMD instruction.
+// An abstract bitmask, such as that emitted by a SIMD instruction.
//
// Specifically, this type implements a simple bitset whose representation is
// controlled by `SignificantBits` and `Shift`. `SignificantBits` is the number
@@ -452,7 +452,7 @@ inline size_t H1(size_t hash, const ctrl_t* ctrl) {
// Extracts the H2 portion of a hash: the 7 bits not used for H1.
//
-// Thse are used used as an occupied control byte.
+// These are used as an occupied control byte.
inline h2_t H2(size_t hash) { return hash & 0x7F; }
// Helpers for checking the state of a control byte.
@@ -462,7 +462,7 @@ inline bool IsDeleted(ctrl_t c) { return c == ctrl_t::kDeleted; }
inline bool IsEmptyOrDeleted(ctrl_t c) { return c < ctrl_t::kSentinel; }
#if ABSL_INTERNAL_RAW_HASH_SET_HAVE_SSE2
-// Quick eference guide for intrinsics used below:
+// Quick reference guide for intrinsics used below:
//
// * __m128i: An XMM (128-bit) word.
//
@@ -479,7 +479,7 @@ inline bool IsEmptyOrDeleted(ctrl_t c) { return c < ctrl_t::kSentinel; }
// * _mm_cmpgt_epi8: Same as above, but using > rather than ==.
//
// * _mm_loadu_si128: Performs an unaligned load of an i128.
-// * _mm_storeu_si128: Performs an unaligned store of a i128.
+// * _mm_storeu_si128: Performs an unaligned store of an i128.
//
// * _mm_sign_epi8: Retains, negates, or zeroes each i8 lane of the first
// argument if the corresponding lane of the second
@@ -731,7 +731,7 @@ struct FindInfo {
// In small mode only the first `capacity` control bytes after the sentinel
// are valid. The rest contain dummy ctrl_t::kEmpty values that do not
// represent a real slot. This is important to take into account on
-// `find_first_or_null()`, where we never try
+// `find_first_non_full()`, where we never try
// `ShouldInsertBackwards()` for small tables.
inline bool is_small(size_t capacity) { return capacity < Group::kWidth - 1; }
@@ -778,7 +778,7 @@ inline FindInfo find_first_non_full(const ctrl_t* ctrl, size_t hash,
extern template FindInfo find_first_non_full(const ctrl_t*, size_t, size_t);
// Sets `ctrl` to `{kEmpty, kSentinel, ..., kEmpty}`, marking the entire
-// array as deleted.
+// array as marked as empty.
inline void ResetCtrl(size_t capacity, ctrl_t* ctrl, const void* slot,
size_t slot_size) {
std::memset(ctrl, static_cast<int8_t>(ctrl_t::kEmpty),