[protobuf] Add Compiler Condition to use inline assembly optimizations with ARM64 (#40173)

This commit is contained in:
David Smith 2024-08-01 14:35:33 -07:00 committed by GitHub
parent 4f597750e8
commit b43e7adc6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 30 additions and 1 deletions

View File

@ -0,0 +1,22 @@
diff --git a/src/google/protobuf/parse_context.h b/src/google/protobuf/parse_context.h
index df12ee1ab..3eb2e56c7 100644
--- a/src/google/protobuf/parse_context.h
+++ b/src/google/protobuf/parse_context.h
@@ -653,7 +653,7 @@ inline const char* VarintParseSlow(const char* p, uint32_t res, uint64_t* out) {
return tmp.first;
}
-#ifdef __aarch64__
+#if defined(__aarch64__) && !defined(_MSC_VER)
// Generally, speaking, the ARM-optimized Varint decode algorithm is to extract
// and concatenate all potentially valid data bits, compute the actual length
// of the Varint, and mask off the data bits which are not actually part of the
@@ -883,7 +883,7 @@ static const char* VarintParseSlowArm(const char* p, uint64_t* out,
template <typename T>
PROTOBUF_NODISCARD const char* VarintParse(const char* p, T* out) {
-#if defined(__aarch64__) && defined(PROTOBUF_LITTLE_ENDIAN)
+#if defined(__aarch64__) && defined(PROTOBUF_LITTLE_ENDIAN) && !defined(_MSC_VER)
// This optimization is not supported in big endian mode
uint64_t first8;
std::memcpy(&first8, p, sizeof(first8));

View File

@ -8,6 +8,7 @@ vcpkg_from_github(
fix-static-build.patch
fix-default-proto-file-path.patch
fix-utf8-range.patch
fix-arm64-msvc.patch
)
string(COMPARE EQUAL "${TARGET_TRIPLET}" "${HOST_TRIPLET}" protobuf_BUILD_PROTOC_BINARIES)

View File

@ -1,6 +1,7 @@
{
"name": "protobuf",
"version": "4.25.1",
"port-version": 1,
"description": "Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data.",
"homepage": "https://github.com/protocolbuffers/protobuf",
"license": "BSD-3-Clause",

View File

@ -7086,7 +7086,7 @@
},
"protobuf": {
"baseline": "4.25.1",
"port-version": 0
"port-version": 1
},
"protobuf-c": {
"baseline": "1.5.0",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "5479e9c75e5ed6401d10163a0fa8f281dcf33f0f",
"version": "4.25.1",
"port-version": 1
},
{
"git-tree": "278ba5370a8c59bbb60650d6ad91ae1eab0fadad",
"version": "4.25.1",