| OLD | NEW |
| 1 diff -ru --new-file protobuf/src/google/protobuf/arena.cc protobuf2/src/google/p
rotobuf/arena.cc | 1 diff -ru --new-file protobuf/src/google/protobuf/arena.cc protobuf2/src/google/p
rotobuf/arena.cc |
| 2 --- protobuf/src/google/protobuf/arena.cc» 2017-03-17 22:40:59.379153132 -0
700 | 2 --- protobuf/src/google/protobuf/arena.cc» 2017-03-21 21:50:28.399255503 -0
700 |
| 3 +++ protobuf2/src/google/protobuf/arena.cc» 2017-03-17 22:40:52.667151339 -0
700 | 3 +++ protobuf2/src/google/protobuf/arena.cc» 2017-03-21 21:50:11.671241466 -0
700 |
| 4 @@ -39,7 +39,6 @@ | 4 @@ -39,24 +39,18 @@ |
| 5 namespace protobuf { | 5 namespace protobuf { |
| 6 | 6 |
| 7 | 7 |
| 8 -google::protobuf::internal::SequenceNumber Arena::lifecycle_id_generator_; | 8 -google::protobuf::internal::SequenceNumber Arena::lifecycle_id_generator_; |
| 9 #if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL) | 9 #if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL) |
| 10 Arena::ThreadCache& Arena::thread_cache() { | 10 -Arena::ThreadCache& Arena::thread_cache() { |
| 11 +Arena::ThreadCache& Arena::cr_thread_cache() { |
| 11 static internal::ThreadLocalStorage<ThreadCache>* thread_cache_ = | 12 static internal::ThreadLocalStorage<ThreadCache>* thread_cache_ = |
| 12 @@ -56,7 +55,7 @@ | 13 new internal::ThreadLocalStorage<ThreadCache>(); |
| 14 return *thread_cache_->Get(); |
| 15 } |
| 16 -#elif defined(PROTOBUF_USE_DLLS) |
| 17 -Arena::ThreadCache& Arena::thread_cache() { |
| 18 - static GOOGLE_THREAD_LOCAL ThreadCache thread_cache_ = { -1, NULL }; |
| 19 - return thread_cache_; |
| 20 -} |
| 21 -#else |
| 22 +#elif !defined(PROTOBUF_USE_DLLS) |
| 23 GOOGLE_THREAD_LOCAL Arena::ThreadCache Arena::thread_cache_ = { -1, NULL }; |
| 13 #endif | 24 #endif |
| 14 | 25 |
| 15 void Arena::Init() { | 26 void Arena::Init() { |
| 16 - lifecycle_id_ = lifecycle_id_generator_.GetNext(); | 27 - lifecycle_id_ = lifecycle_id_generator_.GetNext(); |
| 17 + lifecycle_id_ = internal::cr_lifecycle_id_generator_.GetNext(); | 28 + lifecycle_id_ = internal::cr_lifecycle_id_generator_.GetNext(); |
| 18 blocks_ = 0; | 29 blocks_ = 0; |
| 19 hint_ = 0; | 30 hint_ = 0; |
| 20 owns_first_block_ = true; | 31 owns_first_block_ = true; |
| 21 @@ -99,7 +98,7 @@ | 32 @@ -74,7 +68,7 @@ |
| 33 // Thread which calls Init() owns the first block. This allows the |
| 34 // single-threaded case to allocate on the first block without taking any |
| 35 // locks. |
| 36 - first_block->owner = &thread_cache(); |
| 37 + first_block->owner = &cr_thread_cache(); |
| 38 SetThreadCacheBlock(first_block); |
| 39 AddBlockInternal(first_block); |
| 40 owns_first_block_ = false; |
| 41 @@ -99,7 +93,7 @@ |
| 22 | 42 |
| 23 uint64 Arena::Reset() { | 43 uint64 Arena::Reset() { |
| 24 // Invalidate any ThreadCaches pointing to any blocks we just destroyed. | 44 // Invalidate any ThreadCaches pointing to any blocks we just destroyed. |
| 25 - lifecycle_id_ = lifecycle_id_generator_.GetNext(); | 45 - lifecycle_id_ = lifecycle_id_generator_.GetNext(); |
| 26 + lifecycle_id_ = internal::cr_lifecycle_id_generator_.GetNext(); | 46 + lifecycle_id_ = internal::cr_lifecycle_id_generator_.GetNext(); |
| 27 return ResetInternal(); | 47 return ResetInternal(); |
| 28 } | 48 } |
| 29 | 49 |
| 50 @@ -184,18 +178,18 @@ |
| 51 // If this thread already owns a block in this arena then try to use that. |
| 52 // This fast path optimizes the case where multiple threads allocate from the |
| 53 // same arena. |
| 54 - if (thread_cache().last_lifecycle_id_seen == lifecycle_id_ && |
| 55 - thread_cache().last_block_used_ != NULL) { |
| 56 - if (thread_cache().last_block_used_->avail() < n) { |
| 57 + if (cr_thread_cache().last_lifecycle_id_seen == lifecycle_id_ && |
| 58 + cr_thread_cache().last_block_used_ != NULL) { |
| 59 + if (cr_thread_cache().last_block_used_->avail() < n) { |
| 60 return SlowAlloc(n); |
| 61 } |
| 62 - return AllocFromBlock(thread_cache().last_block_used_, n); |
| 63 + return AllocFromBlock(cr_thread_cache().last_block_used_, n); |
| 64 } |
| 65 |
| 66 // Check whether we own the last accessed block on this arena. |
| 67 // This fast path optimizes the case where a single thread uses multiple |
| 68 // arenas. |
| 69 - void* me = &thread_cache(); |
| 70 + void* me = &cr_thread_cache(); |
| 71 Block* b = reinterpret_cast<Block*>(google::protobuf::internal::Acquire_Load(
&hint_)); |
| 72 if (!b || b->owner != me || b->avail() < n) { |
| 73 return SlowAlloc(n); |
| 74 @@ -213,7 +207,7 @@ |
| 75 } |
| 76 |
| 77 void* Arena::SlowAlloc(size_t n) { |
| 78 - void* me = &thread_cache(); |
| 79 + void* me = &cr_thread_cache(); |
| 80 Block* b = FindBlock(me); // Find block owned by me. |
| 81 // See if allocation fits in my latest block. |
| 82 if (b != NULL && b->avail() >= n) { |
| 83 @@ -290,7 +284,7 @@ |
| 84 // Thread which calls Reset() owns the first block. This allows the |
| 85 // single-threaded case to allocate on the first block without taking any |
| 86 // locks. |
| 87 - first_block->owner = &thread_cache(); |
| 88 + first_block->owner = &cr_thread_cache(); |
| 89 SetThreadCacheBlock(first_block); |
| 90 AddBlockInternal(first_block); |
| 91 } |
| 30 diff -ru --new-file protobuf/src/google/protobuf/arena.h protobuf2/src/google/pr
otobuf/arena.h | 92 diff -ru --new-file protobuf/src/google/protobuf/arena.h protobuf2/src/google/pr
otobuf/arena.h |
| 31 --- protobuf/src/google/protobuf/arena.h» 2017-03-17 22:40:59.379153132 -0
700 | 93 --- protobuf/src/google/protobuf/arena.h» 2017-03-21 21:50:28.399255503 -0
700 |
| 32 +++ protobuf2/src/google/protobuf/arena.h» 2017-03-17 22:40:52.667151339 -0
700 | 94 +++ protobuf2/src/google/protobuf/arena.h» 2017-03-21 21:50:11.671241466 -0
700 |
| 33 @@ -70,6 +70,9 @@ | 95 @@ -70,6 +70,9 @@ |
| 34 template<typename Type> | 96 template<typename Type> |
| 35 class GenericTypeHandler; // repeated_field.h | 97 class GenericTypeHandler; // repeated_field.h |
| 36 | 98 |
| 37 +LIBPROTOBUF_EXPORT extern google::protobuf::internal::SequenceNumber | 99 +LIBPROTOBUF_EXPORT extern google::protobuf::internal::SequenceNumber |
| 38 + cr_lifecycle_id_generator_; | 100 + cr_lifecycle_id_generator_; |
| 39 + | 101 + |
| 40 // Templated cleanup methods. | 102 // Templated cleanup methods. |
| 41 template<typename T> void arena_destruct_object(void* object) { | 103 template<typename T> void arena_destruct_object(void* object) { |
| 42 reinterpret_cast<T*>(object)->~T(); | 104 reinterpret_cast<T*>(object)->~T(); |
| 43 @@ -552,7 +555,6 @@ | 105 @@ -552,19 +555,20 @@ |
| 44 }; | 106 }; |
| 45 | 107 |
| 46 static const size_t kHeaderSize = sizeof(Block); | 108 static const size_t kHeaderSize = sizeof(Block); |
| 47 - static google::protobuf::internal::SequenceNumber lifecycle_id_generator_; | 109 - static google::protobuf::internal::SequenceNumber lifecycle_id_generator_; |
| 48 #if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL) | 110 #if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL) |
| 49 // Android ndk does not support GOOGLE_THREAD_LOCAL keyword so we use a custo
m thread | 111 // Android ndk does not support GOOGLE_THREAD_LOCAL keyword so we use a custo
m thread |
| 50 // local storage class we implemented. | 112 // local storage class we implemented. |
| 113 // iOS also does not support the GOOGLE_THREAD_LOCAL keyword. |
| 114 - static ThreadCache& thread_cache(); |
| 115 + static ThreadCache& cr_thread_cache(); |
| 116 #elif defined(PROTOBUF_USE_DLLS) |
| 117 // Thread local variables cannot be exposed through DLL interface but we can |
| 118 // wrap them in static functions. |
| 119 - static ThreadCache& thread_cache(); |
| 120 + static ThreadCache& cr_thread_cache(); |
| 121 #else |
| 122 static GOOGLE_THREAD_LOCAL ThreadCache thread_cache_; |
| 123 - static ThreadCache& thread_cache() { return thread_cache_; } |
| 124 + static ThreadCache& cr_thread_cache() { |
| 125 + return thread_cache_; |
| 126 + } |
| 127 #endif |
| 128 |
| 129 // SFINAE for skipping addition to delete list for a message type when create
d |
| 130 @@ -872,8 +876,8 @@ |
| 131 uint64 ResetInternal(); |
| 132 |
| 133 inline void SetThreadCacheBlock(Block* block) { |
| 134 - thread_cache().last_block_used_ = block; |
| 135 - thread_cache().last_lifecycle_id_seen = lifecycle_id_; |
| 136 + cr_thread_cache().last_block_used_ = block; |
| 137 + cr_thread_cache().last_lifecycle_id_seen = lifecycle_id_; |
| 138 } |
| 139 |
| 140 int64 lifecycle_id_; // Unique for each arena. Changes on Reset(). |
| 51 diff -ru --new-file protobuf/src/google/protobuf/extension_set.cc protobuf2/src/
google/protobuf/extension_set.cc | 141 diff -ru --new-file protobuf/src/google/protobuf/extension_set.cc protobuf2/src/
google/protobuf/extension_set.cc |
| 52 --- protobuf/src/google/protobuf/extension_set.cc» 2017-03-17 22:40:59.3791
53132 -0700 | 142 --- protobuf/src/google/protobuf/extension_set.cc» 2017-03-21 21:50:28.3992
55503 -0700 |
| 53 +++ protobuf2/src/google/protobuf/extension_set.cc» 2017-03-17 22:40:52.6671
51339 -0700 | 143 +++ protobuf2/src/google/protobuf/extension_set.cc» 2017-03-21 21:50:11.6712
41466 -0700 |
| 54 @@ -46,6 +46,12 @@ | 144 @@ -46,6 +46,12 @@ |
| 55 namespace protobuf { | 145 namespace protobuf { |
| 56 namespace internal { | 146 namespace internal { |
| 57 | 147 |
| 58 +// Registry stuff. | 148 +// Registry stuff. |
| 59 +typedef hash_map<pair<const MessageLite*, int>, ExtensionInfo> | 149 +typedef hash_map<pair<const MessageLite*, int>, ExtensionInfo> |
| 60 + ExtensionRegistry; | 150 + ExtensionRegistry; |
| 61 +extern ExtensionRegistry* cr_registry_; | 151 +extern ExtensionRegistry* cr_registry_; |
| 62 +extern ProtobufOnceType cr_registry_init_; | 152 +extern ProtobufOnceType cr_registry_init_; |
| 63 + | 153 + |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 -RepeatedPrimitiveGenericTypeTraits::default_repeated_field_bool_ = NULL; | 283 -RepeatedPrimitiveGenericTypeTraits::default_repeated_field_bool_ = NULL; |
| 194 -const RepeatedStringTypeTraits::RepeatedFieldType* | 284 -const RepeatedStringTypeTraits::RepeatedFieldType* |
| 195 -RepeatedStringTypeTraits::default_repeated_field_ = NULL; | 285 -RepeatedStringTypeTraits::default_repeated_field_ = NULL; |
| 196 -const RepeatedMessageGenericTypeTraits::RepeatedFieldType* | 286 -const RepeatedMessageGenericTypeTraits::RepeatedFieldType* |
| 197 -RepeatedMessageGenericTypeTraits::default_repeated_field_ = NULL; | 287 -RepeatedMessageGenericTypeTraits::default_repeated_field_ = NULL; |
| 198 - | 288 - |
| 199 } // namespace internal | 289 } // namespace internal |
| 200 } // namespace protobuf | 290 } // namespace protobuf |
| 201 } // namespace google | 291 } // namespace google |
| 202 diff -ru --new-file protobuf/src/google/protobuf/extension_set.h protobuf2/src/g
oogle/protobuf/extension_set.h | 292 diff -ru --new-file protobuf/src/google/protobuf/extension_set.h protobuf2/src/g
oogle/protobuf/extension_set.h |
| 203 --- protobuf/src/google/protobuf/extension_set.h» 2017-03-17 22:40:59.3791
53132 -0700 | 293 --- protobuf/src/google/protobuf/extension_set.h» 2017-03-21 21:50:28.3992
55503 -0700 |
| 204 +++ protobuf2/src/google/protobuf/extension_set.h» 2017-03-17 22:40:52.6751
51341 -0700 | 294 +++ protobuf2/src/google/protobuf/extension_set.h» 2017-03-21 21:50:11.6792
41474 -0700 |
| 205 @@ -731,13 +731,13 @@ | 295 @@ -731,13 +731,13 @@ |
| 206 template<typename Type> friend class RepeatedPrimitiveTypeTraits; | 296 template<typename Type> friend class RepeatedPrimitiveTypeTraits; |
| 207 static void InitializeDefaultRepeatedFields(); | 297 static void InitializeDefaultRepeatedFields(); |
| 208 static void DestroyDefaultRepeatedFields(); | 298 static void DestroyDefaultRepeatedFields(); |
| 209 - static const RepeatedField<int32>* default_repeated_field_int32_; | 299 - static const RepeatedField<int32>* default_repeated_field_int32_; |
| 210 - static const RepeatedField<int64>* default_repeated_field_int64_; | 300 - static const RepeatedField<int64>* default_repeated_field_int64_; |
| 211 - static const RepeatedField<uint32>* default_repeated_field_uint32_; | 301 - static const RepeatedField<uint32>* default_repeated_field_uint32_; |
| 212 - static const RepeatedField<uint64>* default_repeated_field_uint64_; | 302 - static const RepeatedField<uint64>* default_repeated_field_uint64_; |
| 213 - static const RepeatedField<double>* default_repeated_field_double_; | 303 - static const RepeatedField<double>* default_repeated_field_double_; |
| 214 - static const RepeatedField<float>* default_repeated_field_float_; | 304 - static const RepeatedField<float>* default_repeated_field_float_; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 @@ -1053,7 +1055,7 @@ | 365 @@ -1053,7 +1055,7 @@ |
| 276 &repeated_message_generic_type_traits_once_init_, | 366 &repeated_message_generic_type_traits_once_init_, |
| 277 &RepeatedMessageGenericTypeTraits::InitializeDefaultRepeatedFields); | 367 &RepeatedMessageGenericTypeTraits::InitializeDefaultRepeatedFields); |
| 278 return reinterpret_cast<const RepeatedFieldType*>( | 368 return reinterpret_cast<const RepeatedFieldType*>( |
| 279 - RepeatedMessageGenericTypeTraits::default_repeated_field_); | 369 - RepeatedMessageGenericTypeTraits::default_repeated_field_); |
| 280 + RepeatedMessageGenericTypeTraits::cr_default_repeated_field_); | 370 + RepeatedMessageGenericTypeTraits::cr_default_repeated_field_); |
| 281 } | 371 } |
| 282 | 372 |
| 283 // ------------------------------------------------------------------- | 373 // ------------------------------------------------------------------- |
| 284 diff -ru --new-file protobuf/src/google/protobuf/generated_message_util.cc proto
buf2/src/google/protobuf/generated_message_util.cc | 374 diff -ru --new-file protobuf/src/google/protobuf/generated_message_util.cc proto
buf2/src/google/protobuf/generated_message_util.cc |
| 285 --- protobuf/src/google/protobuf/generated_message_util.cc» 2017-03-17 22:40
:59.379153132 -0700 | 375 --- protobuf/src/google/protobuf/generated_message_util.cc» 2017-03-21 21:50
:28.399255503 -0700 |
| 286 +++ protobuf2/src/google/protobuf/generated_message_util.cc» 2017-03-17 22:40
:52.691151345 -0700 | 376 +++ protobuf2/src/google/protobuf/generated_message_util.cc» 2017-03-21 21:50
:11.695241487 -0700 |
| 287 @@ -48,20 +48,18 @@ | 377 @@ -48,20 +48,18 @@ |
| 288 return std::numeric_limits<double>::quiet_NaN(); | 378 return std::numeric_limits<double>::quiet_NaN(); |
| 289 } | 379 } |
| 290 | 380 |
| 291 -const ::std::string* empty_string_; | 381 -const ::std::string* empty_string_; |
| 292 -GOOGLE_PROTOBUF_DECLARE_ONCE(empty_string_once_init_); | 382 -GOOGLE_PROTOBUF_DECLARE_ONCE(empty_string_once_init_); |
| 293 - | 383 - |
| 294 void DeleteEmptyString() { | 384 void DeleteEmptyString() { |
| 295 - delete empty_string_; | 385 - delete empty_string_; |
| 296 + delete cr_empty_string_; | 386 + delete cr_empty_string_; |
| 297 } | 387 } |
| 298 | 388 |
| 299 void InitEmptyString() { | 389 void InitEmptyString() { |
| 300 - empty_string_ = new string; | 390 - empty_string_ = new string; |
| 301 + cr_empty_string_ = new string; | 391 + cr_empty_string_ = new string; |
| 302 OnShutdown(&DeleteEmptyString); | 392 OnShutdown(&DeleteEmptyString); |
| 303 } | 393 } |
| 304 | 394 |
| 305 const ::std::string& GetEmptyString() { | 395 const ::std::string& GetEmptyString() { |
| 306 - ::google::protobuf::GoogleOnceInit(&empty_string_once_init_, &InitEmptyString
); | 396 - ::google::protobuf::GoogleOnceInit(&empty_string_once_init_, &InitEmptyString
); |
| 307 + ::google::protobuf::GoogleOnceInit(&cr_empty_string_once_init_, | 397 + ::google::protobuf::GoogleOnceInit(&cr_empty_string_once_init_, |
| 308 + &InitEmptyString); | 398 + &InitEmptyString); |
| 309 return GetEmptyStringAlreadyInited(); | 399 return GetEmptyStringAlreadyInited(); |
| 310 } | 400 } |
| 311 | 401 |
| 312 diff -ru --new-file protobuf/src/google/protobuf/generated_message_util.h protob
uf2/src/google/protobuf/generated_message_util.h | 402 diff -ru --new-file protobuf/src/google/protobuf/generated_message_util.h protob
uf2/src/google/protobuf/generated_message_util.h |
| 313 --- protobuf/src/google/protobuf/generated_message_util.h» 2017-03-17 22:40
:59.379153132 -0700 | 403 --- protobuf/src/google/protobuf/generated_message_util.h» 2017-03-21 21:50
:28.399255503 -0700 |
| 314 +++ protobuf2/src/google/protobuf/generated_message_util.h» 2017-03-17 22:40
:52.655151335 -0700 | 404 +++ protobuf2/src/google/protobuf/generated_message_util.h» 2017-03-21 21:50
:11.659241456 -0700 |
| 315 @@ -77,14 +77,14 @@ | 405 @@ -77,14 +77,14 @@ |
| 316 | 406 |
| 317 // Default empty string object. Don't use the pointer directly. Instead, call | 407 // Default empty string object. Don't use the pointer directly. Instead, call |
| 318 // GetEmptyString() to get the reference. | 408 // GetEmptyString() to get the reference. |
| 319 -LIBPROTOBUF_EXPORT extern const ::std::string* empty_string_; | 409 -LIBPROTOBUF_EXPORT extern const ::std::string* empty_string_; |
| 320 -LIBPROTOBUF_EXPORT extern ProtobufOnceType empty_string_once_init_; | 410 -LIBPROTOBUF_EXPORT extern ProtobufOnceType empty_string_once_init_; |
| 321 +LIBPROTOBUF_EXPORT extern const ::std::string* cr_empty_string_; | 411 +LIBPROTOBUF_EXPORT extern const ::std::string* cr_empty_string_; |
| 322 +LIBPROTOBUF_EXPORT extern ProtobufOnceType cr_empty_string_once_init_; | 412 +LIBPROTOBUF_EXPORT extern ProtobufOnceType cr_empty_string_once_init_; |
| 323 LIBPROTOBUF_EXPORT void InitEmptyString(); | 413 LIBPROTOBUF_EXPORT void InitEmptyString(); |
| 324 | 414 |
| 325 | 415 |
| 326 LIBPROTOBUF_EXPORT inline const ::std::string& GetEmptyStringAlreadyInited() { | 416 LIBPROTOBUF_EXPORT inline const ::std::string& GetEmptyStringAlreadyInited() { |
| 327 - assert(empty_string_ != NULL); | 417 - assert(empty_string_ != NULL); |
| 328 - return *empty_string_; | 418 - return *empty_string_; |
| 329 + assert(cr_empty_string_ != NULL); | 419 + assert(cr_empty_string_ != NULL); |
| 330 + return *cr_empty_string_; | 420 + return *cr_empty_string_; |
| 331 } | 421 } |
| 332 | 422 |
| 333 LIBPROTOBUF_EXPORT const ::std::string& GetEmptyString(); | 423 LIBPROTOBUF_EXPORT const ::std::string& GetEmptyString(); |
| 334 diff -ru --new-file protobuf/src/google/protobuf/globals.cc protobuf2/src/google
/protobuf/globals.cc | 424 diff -ru --new-file protobuf/src/google/protobuf/globals.cc protobuf2/src/google
/protobuf/globals.cc |
| 335 --- protobuf/src/google/protobuf/globals.cc 1969-12-31 16:00:00.000000000 -0
800 | 425 --- protobuf/src/google/protobuf/globals.cc 1969-12-31 16:00:00.000000000 -0
800 |
| 336 +++ protobuf2/src/google/protobuf/globals.cc» 2017-03-17 22:40:52.655151335 -0
700 | 426 +++ protobuf2/src/google/protobuf/globals.cc» 2017-03-21 21:50:11.659241456 -0
700 |
| 337 @@ -0,0 +1,113 @@ | 427 @@ -0,0 +1,122 @@ |
| 338 +// Protocol Buffers - Google's data interchange format | 428 +// Protocol Buffers - Google's data interchange format |
| 339 +// Copyright 2017 Google Inc. All rights reserved. | 429 +// Copyright 2017 Google Inc. All rights reserved. |
| 340 +// https://developers.google.com/protocol-buffers/ | 430 +// https://developers.google.com/protocol-buffers/ |
| 341 +// | 431 +// |
| 342 +// Redistribution and use in source and binary forms, with or without | 432 +// Redistribution and use in source and binary forms, with or without |
| 343 +// modification, are permitted provided that the following conditions are | 433 +// modification, are permitted provided that the following conditions are |
| 344 +// met: | 434 +// met: |
| 345 +// | 435 +// |
| 346 +// * Redistributions of source code must retain the above copyright | 436 +// * Redistributions of source code must retain the above copyright |
| 347 +// notice, this list of conditions and the following disclaimer. | 437 +// notice, this list of conditions and the following disclaimer. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 358 +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 448 +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 359 +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 449 +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 360 +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 450 +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 361 +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 451 +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 362 +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 452 +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 363 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 453 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 364 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 454 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 365 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 455 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 366 +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 456 +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 367 + | 457 + |
| 458 +#include <google/protobuf/arena.h> |
| 368 +#include <google/protobuf/extension_set.h> | 459 +#include <google/protobuf/extension_set.h> |
| 369 +#include <google/protobuf/generated_message_util.h> | 460 +#include <google/protobuf/generated_message_util.h> |
| 370 +#include <google/protobuf/stubs/atomicops.h> | 461 +#include <google/protobuf/stubs/atomicops.h> |
| 371 +#include <google/protobuf/stubs/hash.h> | 462 +#include <google/protobuf/stubs/hash.h> |
| 372 + | 463 + |
| 373 +namespace google { | 464 +namespace google { |
| 374 +namespace protobuf { | 465 +namespace protobuf { |
| 466 + |
| 467 +#if !defined(GOOGLE_PROTOBUF_NO_THREADLOCAL) && defined(PROTOBUF_USE_DLLS) |
| 468 +Arena::ThreadCache& Arena::cr_thread_cache() { |
| 469 + static GOOGLE_THREAD_LOCAL ThreadCache cr_thread_cache_ = {-1, NULL}; |
| 470 + return cr_thread_cache_; |
| 471 +} |
| 472 +#endif |
| 473 + |
| 375 +namespace internal { | 474 +namespace internal { |
| 376 + | 475 + |
| 377 +SequenceNumber cr_lifecycle_id_generator_; | 476 +SequenceNumber cr_lifecycle_id_generator_; |
| 378 + | 477 + |
| 379 +const ::std::string* cr_empty_string_; | 478 +const ::std::string* cr_empty_string_; |
| 380 +GOOGLE_PROTOBUF_DECLARE_ONCE(cr_empty_string_once_init_); | 479 +GOOGLE_PROTOBUF_DECLARE_ONCE(cr_empty_string_once_init_); |
| 381 + | 480 + |
| 382 +const RepeatedField<int32>* | 481 +const RepeatedField<int32>* |
| 383 + RepeatedPrimitiveGenericTypeTraits::cr_default_repeated_field_int32_ = NULL
; | 482 + RepeatedPrimitiveGenericTypeTraits::cr_default_repeated_field_int32_ = NULL
; |
| 384 +const RepeatedField<int64>* | 483 +const RepeatedField<int64>* |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 + AtomicOpsx86Initializer() { AtomicOps_Internalx86CPUFeaturesInit(); } | 541 + AtomicOpsx86Initializer() { AtomicOps_Internalx86CPUFeaturesInit(); } |
| 443 +}; | 542 +}; |
| 444 + | 543 + |
| 445 +AtomicOpsx86Initializer cr_g_initer; | 544 +AtomicOpsx86Initializer cr_g_initer; |
| 446 +#endif | 545 +#endif |
| 447 + | 546 + |
| 448 +} // namespace internal | 547 +} // namespace internal |
| 449 +} // namespace protobuf | 548 +} // namespace protobuf |
| 450 +} // namespace google | 549 +} // namespace google |
| 451 diff -ru --new-file protobuf/src/google/protobuf/io/coded_stream.cc protobuf2/sr
c/google/protobuf/io/coded_stream.cc | 550 diff -ru --new-file protobuf/src/google/protobuf/io/coded_stream.cc protobuf2/sr
c/google/protobuf/io/coded_stream.cc |
| 452 --- protobuf/src/google/protobuf/io/coded_stream.cc» 2017-03-17 22:40:59.3831
53133 -0700 | 551 --- protobuf/src/google/protobuf/io/coded_stream.cc» 2017-03-21 21:50:28.3992
55503 -0700 |
| 453 +++ protobuf2/src/google/protobuf/io/coded_stream.cc» 2017-03-17 22:40:52.6591
51336 -0700 | 552 +++ protobuf2/src/google/protobuf/io/coded_stream.cc» 2017-03-21 21:50:11.6632
41460 -0700 |
| 454 @@ -83,7 +83,7 @@ | 553 @@ -83,7 +83,7 @@ |
| 455 } | 554 } |
| 456 | 555 |
| 457 // Static. | 556 // Static. |
| 458 -int CodedInputStream::default_recursion_limit_ = 100; | 557 -int CodedInputStream::default_recursion_limit_ = 100; |
| 459 +int const CodedInputStream::default_recursion_limit_ = 100; | 558 +int const CodedInputStream::default_recursion_limit_ = 100; |
| 460 | 559 |
| 461 | 560 |
| 462 void CodedOutputStream::EnableAliasing(bool enabled) { | 561 void CodedOutputStream::EnableAliasing(bool enabled) { |
| 463 diff -ru --new-file protobuf/src/google/protobuf/io/coded_stream.h protobuf2/src
/google/protobuf/io/coded_stream.h | 562 diff -ru --new-file protobuf/src/google/protobuf/io/coded_stream.h protobuf2/src
/google/protobuf/io/coded_stream.h |
| 464 --- protobuf/src/google/protobuf/io/coded_stream.h» 2017-03-17 22:40:59.3831
53133 -0700 | 563 --- protobuf/src/google/protobuf/io/coded_stream.h» 2017-03-21 21:50:28.3992
55503 -0700 |
| 465 +++ protobuf2/src/google/protobuf/io/coded_stream.h» 2017-03-17 22:40:52.6591
51336 -0700 | 564 +++ protobuf2/src/google/protobuf/io/coded_stream.h» 2017-03-21 21:50:11.6632
41460 -0700 |
| 466 @@ -613,7 +613,7 @@ | 565 @@ -613,7 +613,7 @@ |
| 467 | 566 |
| 468 static const int kDefaultTotalBytesWarningThreshold = 32 << 20; // 32MB | 567 static const int kDefaultTotalBytesWarningThreshold = 32 << 20; // 32MB |
| 469 | 568 |
| 470 - static int default_recursion_limit_; // 100 by default. | 569 - static int default_recursion_limit_; // 100 by default. |
| 471 + static const int default_recursion_limit_; // 100 by default. | 570 + static const int default_recursion_limit_; // 100 by default. |
| 472 }; | 571 }; |
| 473 | 572 |
| 474 // Class which encodes and writes binary data which is composed of varint- | 573 // Class which encodes and writes binary data which is composed of varint- |
| 475 diff -ru --new-file protobuf/src/google/protobuf/stubs/atomicops_internals_x86_g
cc.cc protobuf2/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc | 574 diff -ru --new-file protobuf/src/google/protobuf/stubs/atomicops_internals_x86_g
cc.cc protobuf2/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc |
| 476 --- protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc» 2017-03-
17 22:40:59.383153133 -0700 | 575 --- protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc» 2017-03-
21 21:50:28.399255503 -0700 |
| 477 +++ protobuf2/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc» 2017-03-
17 22:40:52.671151340 -0700 | 576 +++ protobuf2/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc» 2017-03-
21 21:50:11.675241470 -0700 |
| 478 @@ -58,23 +58,13 @@ | 577 @@ -58,23 +58,13 @@ |
| 479 : "=a" (a), "=D" (b), "=c" (c), "=d" (d) : "a" (inp)) | 578 : "=a" (a), "=D" (b), "=c" (c), "=d" (d) : "a" (inp)) |
| 480 #endif | 579 #endif |
| 481 | 580 |
| 482 -#if defined(cpuid) // initialize the struct only on x86 | 581 -#if defined(cpuid) // initialize the struct only on x86 |
| 483 - | 582 - |
| 484 namespace google { | 583 namespace google { |
| 485 namespace protobuf { | 584 namespace protobuf { |
| 486 namespace internal { | 585 namespace internal { |
| 487 | 586 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 +#endif // __i386__ | 632 +#endif // __i386__ |
| 534 | 633 |
| 535 } // namespace internal | 634 } // namespace internal |
| 536 } // namespace protobuf | 635 } // namespace protobuf |
| 537 } // namespace google | 636 } // namespace google |
| 538 | 637 |
| 539 -#endif // __i386__ | 638 -#endif // __i386__ |
| 540 - | 639 - |
| 541 #endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_X86_GCC_H_ | 640 #endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_X86_GCC_H_ |
| 542 diff -ru --new-file protobuf/src/google/protobuf/stubs/atomicops_internals_x86_g
cc.h protobuf2/src/google/protobuf/stubs/atomicops_internals_x86_gcc.h | 641 diff -ru --new-file protobuf/src/google/protobuf/stubs/atomicops_internals_x86_g
cc.h protobuf2/src/google/protobuf/stubs/atomicops_internals_x86_gcc.h |
| 543 --- protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.h» 2017-03-
17 22:40:59.383153133 -0700 | 642 --- protobuf/src/google/protobuf/stubs/atomicops_internals_x86_gcc.h» 2017-03-
21 21:50:28.399255503 -0700 |
| 544 +++ protobuf2/src/google/protobuf/stubs/atomicops_internals_x86_gcc.h» 2017-03-
17 22:40:52.671151340 -0700 | 643 +++ protobuf2/src/google/protobuf/stubs/atomicops_internals_x86_gcc.h» 2017-03-
21 21:50:11.675241470 -0700 |
| 545 @@ -46,7 +46,9 @@ | 644 @@ -46,7 +46,9 @@ |
| 546 // after acquire compare-and-swap. | 645 // after acquire compare-and-swap. |
| 547 bool has_sse2; // Processor has SSE2. | 646 bool has_sse2; // Processor has SSE2. |
| 548 }; | 647 }; |
| 549 -extern struct AtomicOps_x86CPUFeatureStruct AtomicOps_Internalx86CPUFeatures; | 648 -extern struct AtomicOps_x86CPUFeatureStruct AtomicOps_Internalx86CPUFeatures; |
| 550 +extern struct AtomicOps_x86CPUFeatureStruct cr_AtomicOps_Internalx86CPUFeatures
; | 649 +extern struct AtomicOps_x86CPUFeatureStruct cr_AtomicOps_Internalx86CPUFeatures
; |
| 551 + | 650 + |
| 552 +void AtomicOps_Internalx86CPUFeaturesInit(); | 651 +void AtomicOps_Internalx86CPUFeaturesInit(); |
| 553 | 652 |
| 554 #define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory") | 653 #define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory") |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 601 @@ -270,7 +272,7 @@ | 700 @@ -270,7 +272,7 @@ |
| 602 Atomic64 old_value, | 701 Atomic64 old_value, |
| 603 Atomic64 new_value) { | 702 Atomic64 new_value) { |
| 604 Atomic64 x = NoBarrier_CompareAndSwap(ptr, old_value, new_value); | 703 Atomic64 x = NoBarrier_CompareAndSwap(ptr, old_value, new_value); |
| 605 - if (AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug) { | 704 - if (AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug) { |
| 606 + if (cr_AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug) { | 705 + if (cr_AtomicOps_Internalx86CPUFeatures.has_amd_lock_mb_bug) { |
| 607 __asm__ __volatile__("lfence" : : : "memory"); | 706 __asm__ __volatile__("lfence" : : : "memory"); |
| 608 } | 707 } |
| 609 return x; | 708 return x; |
| 610 diff -ru --new-file protobuf/src/google/protobuf/stubs/common.cc protobuf2/src/g
oogle/protobuf/stubs/common.cc | 709 diff -ru --new-file protobuf/src/google/protobuf/stubs/common.cc protobuf2/src/g
oogle/protobuf/stubs/common.cc |
| 611 --- protobuf/src/google/protobuf/stubs/common.cc» 2017-03-17 22:40:59.3831
53133 -0700 | 710 --- protobuf/src/google/protobuf/stubs/common.cc» 2017-03-21 21:50:28.3992
55503 -0700 |
| 612 +++ protobuf2/src/google/protobuf/stubs/common.cc» 2017-03-17 22:40:52.6711
51340 -0700 | 711 +++ protobuf2/src/google/protobuf/stubs/common.cc» 2017-03-21 21:50:11.6752
41470 -0700 |
| 613 @@ -116,7 +116,8 @@ | 712 @@ -116,7 +116,8 @@ |
| 614 if (level < GOOGLE_PROTOBUF_MIN_LOG_LEVEL) { | 713 if (level < GOOGLE_PROTOBUF_MIN_LOG_LEVEL) { |
| 615 return; | 714 return; |
| 616 } | 715 } |
| 617 - static const char* level_names[] = {"INFO", "WARNING", "ERROR", "FATAL"}; | 716 - static const char* level_names[] = {"INFO", "WARNING", "ERROR", "FATAL"}; |
| 618 + static const char* const level_names[] = {"INFO", "WARNING", "ERROR", | 717 + static const char* const level_names[] = {"INFO", "WARNING", "ERROR", |
| 619 + "FATAL"}; | 718 + "FATAL"}; |
| 620 | 719 |
| 621 static const int android_log_levels[] = { | 720 static const int android_log_levels[] = { |
| 622 ANDROID_LOG_INFO, // LOG(INFO), | 721 ANDROID_LOG_INFO, // LOG(INFO), |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 - delete internal::shutdown_functions_mutex; | 869 - delete internal::shutdown_functions_mutex; |
| 771 - internal::shutdown_functions_mutex = NULL; | 870 - internal::shutdown_functions_mutex = NULL; |
| 772 + delete internal::cr_shutdown_functions; | 871 + delete internal::cr_shutdown_functions; |
| 773 + internal::cr_shutdown_functions = NULL; | 872 + internal::cr_shutdown_functions = NULL; |
| 774 + delete internal::cr_shutdown_functions_mutex; | 873 + delete internal::cr_shutdown_functions_mutex; |
| 775 + internal::cr_shutdown_functions_mutex = NULL; | 874 + internal::cr_shutdown_functions_mutex = NULL; |
| 776 } | 875 } |
| 777 | 876 |
| 778 #if PROTOBUF_USE_EXCEPTIONS | 877 #if PROTOBUF_USE_EXCEPTIONS |
| 779 diff -ru --new-file protobuf/src/google/protobuf/stubs/structurally_valid.cc pro
tobuf2/src/google/protobuf/stubs/structurally_valid.cc | 878 diff -ru --new-file protobuf/src/google/protobuf/stubs/structurally_valid.cc pro
tobuf2/src/google/protobuf/stubs/structurally_valid.cc |
| 780 --- protobuf/src/google/protobuf/stubs/structurally_valid.cc» 2017-03-17 22:40
:59.383153133 -0700 | 879 --- protobuf/src/google/protobuf/stubs/structurally_valid.cc» 2017-03-21 21:50
:28.399255503 -0700 |
| 781 +++ protobuf2/src/google/protobuf/stubs/structurally_valid.cc» 2017-03-17 22:40
:52.675151341 -0700 | 880 +++ protobuf2/src/google/protobuf/stubs/structurally_valid.cc» 2017-03-21 21:50
:11.679241474 -0700 |
| 782 @@ -511,21 +511,10 @@ | 881 @@ -511,21 +511,10 @@ |
| 783 // UTF-8 strings. Since UTF-8 validation is only used for debugging | 882 // UTF-8 strings. Since UTF-8 validation is only used for debugging |
| 784 // anyway, we simply always return success if initialization hasn't | 883 // anyway, we simply always return success if initialization hasn't |
| 785 // occurred yet. | 884 // occurred yet. |
| 786 -namespace { | 885 -namespace { |
| 787 - | 886 - |
| 788 -bool module_initialized_ = false; | 887 -bool module_initialized_ = false; |
| 789 - | 888 - |
| 790 -struct InitDetector { | 889 -struct InitDetector { |
| 791 - InitDetector() { | 890 - InitDetector() { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 806 @@ -534,7 +523,7 @@ | 905 @@ -534,7 +523,7 @@ |
| 807 } | 906 } |
| 808 | 907 |
| 809 int UTF8SpnStructurallyValid(const StringPiece& str) { | 908 int UTF8SpnStructurallyValid(const StringPiece& str) { |
| 810 - if (!module_initialized_) return str.size(); | 909 - if (!module_initialized_) return str.size(); |
| 811 + if (!cr_module_initialized_) return str.size(); | 910 + if (!cr_module_initialized_) return str.size(); |
| 812 | 911 |
| 813 int bytes_consumed = 0; | 912 int bytes_consumed = 0; |
| 814 UTF8GenericScanFastAscii(&utf8acceptnonsurrogates_obj, | 913 UTF8GenericScanFastAscii(&utf8acceptnonsurrogates_obj, |
| 815 diff -ru --new-file protobuf/src/google/protobuf/stubs/strutil.cc protobuf2/src/
google/protobuf/stubs/strutil.cc | 914 diff -ru --new-file protobuf/src/google/protobuf/stubs/strutil.cc protobuf2/src/
google/protobuf/stubs/strutil.cc |
| 816 --- protobuf/src/google/protobuf/stubs/strutil.cc» 2017-03-17 22:40:59.3831
53133 -0700 | 915 --- protobuf/src/google/protobuf/stubs/strutil.cc» 2017-03-21 21:50:28.3992
55503 -0700 |
| 817 +++ protobuf2/src/google/protobuf/stubs/strutil.cc» 2017-03-17 22:40:52.6711
51340 -0700 | 916 +++ protobuf2/src/google/protobuf/stubs/strutil.cc» 2017-03-21 21:50:11.6752
41470 -0700 |
| 818 @@ -528,7 +528,7 @@ | 917 @@ -528,7 +528,7 @@ |
| 819 // Assumes that non-printable characters are escaped using octal sequences, and | 918 // Assumes that non-printable characters are escaped using octal sequences, and |
| 820 // that UTF-8 bytes are not handled specially. | 919 // that UTF-8 bytes are not handled specially. |
| 821 static inline size_t CEscapedLength(StringPiece src) { | 920 static inline size_t CEscapedLength(StringPiece src) { |
| 822 - static char c_escaped_len[256] = { | 921 - static char c_escaped_len[256] = { |
| 823 + static const char c_escaped_len[256] = { | 922 + static const char c_escaped_len[256] = { |
| 824 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 4, 4, 2, 4, 4, // \t, \n, \r | 923 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 4, 4, 2, 4, 4, // \t, \n, \r |
| 825 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | 924 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, |
| 826 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, // ", ' | 925 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, // ", ' |
| 827 @@ -891,7 +891,7 @@ | 926 @@ -891,7 +891,7 @@ |
| 828 char *FastHexToBuffer(int i, char* buffer) { | 927 char *FastHexToBuffer(int i, char* buffer) { |
| 829 GOOGLE_CHECK(i >= 0) << "FastHexToBuffer() wants non-negative integers, not "
<< i; | 928 GOOGLE_CHECK(i >= 0) << "FastHexToBuffer() wants non-negative integers, not "
<< i; |
| 830 | 929 |
| 831 - static const char *hexdigits = "0123456789abcdef"; | 930 - static const char *hexdigits = "0123456789abcdef"; |
| 832 + static const char hexdigits[] = "0123456789abcdef"; | 931 + static const char hexdigits[] = "0123456789abcdef"; |
| 833 char *p = buffer + 21; | 932 char *p = buffer + 21; |
| 834 *p-- = '\0'; | 933 *p-- = '\0'; |
| 835 do { | 934 do { |
| 836 @@ -902,7 +902,7 @@ | 935 @@ -902,7 +902,7 @@ |
| 837 } | 936 } |
| 838 | 937 |
| 839 char *InternalFastHexToBuffer(uint64 value, char* buffer, int num_byte) { | 938 char *InternalFastHexToBuffer(uint64 value, char* buffer, int num_byte) { |
| 840 - static const char *hexdigits = "0123456789abcdef"; | 939 - static const char *hexdigits = "0123456789abcdef"; |
| 841 + static const char hexdigits[] = "0123456789abcdef"; | 940 + static const char hexdigits[] = "0123456789abcdef"; |
| 842 buffer[num_byte] = '\0'; | 941 buffer[num_byte] = '\0'; |
| 843 for (int i = num_byte - 1; i >= 0; i--) { | 942 for (int i = num_byte - 1; i >= 0; i--) { |
| 844 #ifdef _M_X64 | 943 #ifdef _M_X64 |
| OLD | NEW |