Add instructions on how to generate the configure script.#4
Merged
Conversation
Contributor
Author
|
@pherl can you review this change? |
Contributor
|
LGTM |
liujisi
added a commit
that referenced
this pull request
Aug 28, 2014
Add instructions on how to generate the configure script.
mkosieradzki
pushed a commit
to mkosieradzki/protobuf
that referenced
this pull request
Aug 6, 2018
…n_methods Useful Span-based methods for ByteString
PierrickVoulet
pushed a commit
to PierrickVoulet/protobuf
that referenced
this pull request
May 27, 2020
dnkoutso
added a commit
to dnkoutso/protobuf
that referenced
this pull request
Feb 22, 2022
…t_objc_class_prefix objective-c: Add `objc_class_prefix` generation option.
copybara-service bot
pushed a commit
that referenced
this pull request
Dec 29, 2022
We would like for upb_Map_Delete() to optionally return the deleted value. Unfortunately this will require several steps since we are crossing repos. Step #4: update PHP/Ruby and advance the upb version used by protobuf PiperOrigin-RevId: 498406089
copybara-service bot
pushed a commit
that referenced
this pull request
Dec 29, 2022
We would like for upb_Map_Delete() to optionally return the deleted value. Unfortunately this will require several steps since we are crossing repos. Step #4: update PHP/Ruby and advance the upb version used by protobuf PiperOrigin-RevId: 498406089
copybara-service bot
pushed a commit
that referenced
this pull request
Dec 29, 2022
We would like for upb_Map_Delete() to optionally return the deleted value. Unfortunately this will require several steps since we are crossing repos. Step #4: update PHP/Ruby and advance the upb version used by protobuf PiperOrigin-RevId: 498406089
copybara-service bot
pushed a commit
that referenced
this pull request
Dec 29, 2022
We would like for upb_Map_Delete() to optionally return the deleted value. Unfortunately this will require several steps since we are crossing repos. Step #4: advance the upb version used by protobuf and update PHP/Ruby accordingly. PiperOrigin-RevId: 498406089
copybara-service bot
pushed a commit
that referenced
this pull request
Dec 29, 2022
We would like for upb_Map_Delete() to optionally return the deleted value. Unfortunately this will require several steps since we are crossing repos. Step #4: advance the upb version used by protobuf and update PHP/Ruby accordingly. PiperOrigin-RevId: 498406089
copybara-service bot
pushed a commit
that referenced
this pull request
Dec 29, 2022
We would like for upb_Map_Delete() to optionally return the deleted value. Unfortunately this will require several steps since we are crossing repos. Step #4: advance the upb version used by protobuf and update PHP/Ruby accordingly. PiperOrigin-RevId: 498426185
rschu1ze
referenced
this pull request
in ClickHouse/google-protobuf
Jun 1, 2023
==500166==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0xdd383e in google::protobuf::compiler::DiskSourceTree::OpenDiskFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) build_msan/./contrib/protobuf/src/google/protobuf/compiler/importer.cc:504:7
#1 0xdd1eb2 in google::protobuf::compiler::DiskSourceTree::DiskFileToVirtualFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) build_msan/./contrib/protobuf/src/google/protobuf/compiler/importer.cc:431:51
#2 0x540619 in google::protobuf::compiler::CommandLineInterface::MakeProtoProtoPathRelative(google::protobuf::compiler::DiskSourceTree*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, google::protobuf::DescriptorDatabase*) build_msan/./contrib/protobuf/src/google/protobuf/compiler/command_line_interface.cc:1362:24
#3 0x5314fb in google::protobuf::compiler::CommandLineInterface::MakeInputsBeProtoPathRelative(google::protobuf::compiler::DiskSourceTree*, google::protobuf::DescriptorDatabase*) build_msan/./contrib/protobuf/src/google/protobuf/compiler/command_line_interface.cc:1415:10
#4 0x5314fb in google::protobuf::compiler::CommandLineInterface::InitializeDiskSourceTree(google::protobuf::compiler::DiskSourceTree*, google::protobuf::DescriptorDatabase*) build_msan/./contrib/protobuf/src/google/protobuf/compiler/command_line_interface.cc:1168:8
#5 0x52541f in google::protobuf::compiler::CommandLineInterface::Run(int, char const* const*) build_msan/./contrib/protobuf/src/google/protobuf/compiler/command_line_interface.cc:1026:10
#6 0x50f5d6 in google::protobuf::compiler::ProtobufMain(int, char**) build_msan/./contrib/protobuf/src/google/protobuf/compiler/main.cc:104:14
protocolbuffers#7 0x50fe58 in main build_msan/./contrib/protobuf/src/google/protobuf/compiler/main.cc:112:10
protocolbuffers#8 0x7f817143db24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
protocolbuffers#9 0x48904d in _start (/mnt/ch/ClickHouse/build_msan/contrib/protobuf-cmake/protoc+0x48904d)
Uninitialized value was created by an allocation of 'sb' in the stack frame of function '_ZN6google8protobuf8compiler14DiskSourceTree12OpenDiskFileERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE'
#0 0xdd3320 in google::protobuf::compiler::DiskSourceTree::OpenDiskFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) build_msan/./contrib/protobuf/src/google/protobuf/compiler/importer.cc:492
SUMMARY: MemorySanitizer: use-of-uninitialized-value build_msan/./contrib/protobuf/src/google/protobuf/compiler/importer.cc:504:7 in google::protobuf::compiler::DiskSourceTree::OpenDiskFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Exiting
copybara-service bot
pushed a commit
that referenced
this pull request
Oct 15, 2023
PiperOrigin-RevId: 573375093
copybara-service bot
pushed a commit
that referenced
this pull request
Oct 18, 2023
PiperOrigin-RevId: 573375093
copybara-service bot
pushed a commit
that referenced
this pull request
Oct 18, 2023
PiperOrigin-RevId: 574544964
rschu1ze
referenced
this pull request
in ClickHouse/google-protobuf
Oct 24, 2023
==500166==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0xdd383e in google::protobuf::compiler::DiskSourceTree::OpenDiskFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) build_msan/./contrib/protobuf/src/google/protobuf/compiler/importer.cc:504:7
#1 0xdd1eb2 in google::protobuf::compiler::DiskSourceTree::DiskFileToVirtualFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) build_msan/./contrib/protobuf/src/google/protobuf/compiler/importer.cc:431:51
#2 0x540619 in google::protobuf::compiler::CommandLineInterface::MakeProtoProtoPathRelative(google::protobuf::compiler::DiskSourceTree*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, google::protobuf::DescriptorDatabase*) build_msan/./contrib/protobuf/src/google/protobuf/compiler/command_line_interface.cc:1362:24
#3 0x5314fb in google::protobuf::compiler::CommandLineInterface::MakeInputsBeProtoPathRelative(google::protobuf::compiler::DiskSourceTree*, google::protobuf::DescriptorDatabase*) build_msan/./contrib/protobuf/src/google/protobuf/compiler/command_line_interface.cc:1415:10
#4 0x5314fb in google::protobuf::compiler::CommandLineInterface::InitializeDiskSourceTree(google::protobuf::compiler::DiskSourceTree*, google::protobuf::DescriptorDatabase*) build_msan/./contrib/protobuf/src/google/protobuf/compiler/command_line_interface.cc:1168:8
#5 0x52541f in google::protobuf::compiler::CommandLineInterface::Run(int, char const* const*) build_msan/./contrib/protobuf/src/google/protobuf/compiler/command_line_interface.cc:1026:10
#6 0x50f5d6 in google::protobuf::compiler::ProtobufMain(int, char**) build_msan/./contrib/protobuf/src/google/protobuf/compiler/main.cc:104:14
protocolbuffers#7 0x50fe58 in main build_msan/./contrib/protobuf/src/google/protobuf/compiler/main.cc:112:10
protocolbuffers#8 0x7f817143db24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
protocolbuffers#9 0x48904d in _start (/mnt/ch/ClickHouse/build_msan/contrib/protobuf-cmake/protoc+0x48904d)
Uninitialized value was created by an allocation of 'sb' in the stack frame of function '_ZN6google8protobuf8compiler14DiskSourceTree12OpenDiskFileERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE'
#0 0xdd3320 in google::protobuf::compiler::DiskSourceTree::OpenDiskFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) build_msan/./contrib/protobuf/src/google/protobuf/compiler/importer.cc:492
SUMMARY: MemorySanitizer: use-of-uninitialized-value build_msan/./contrib/protobuf/src/google/protobuf/compiler/importer.cc:504:7 in google::protobuf::compiler::DiskSourceTree::OpenDiskFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Exiting
rschu1ze
referenced
this pull request
in ClickHouse/google-protobuf
Oct 24, 2023
==500166==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0xdd383e in google::protobuf::compiler::DiskSourceTree::OpenDiskFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) build_msan/./contrib/protobuf/src/google/protobuf/compiler/importer.cc:504:7
#1 0xdd1eb2 in google::protobuf::compiler::DiskSourceTree::DiskFileToVirtualFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) build_msan/./contrib/protobuf/src/google/protobuf/compiler/importer.cc:431:51
#2 0x540619 in google::protobuf::compiler::CommandLineInterface::MakeProtoProtoPathRelative(google::protobuf::compiler::DiskSourceTree*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, google::protobuf::DescriptorDatabase*) build_msan/./contrib/protobuf/src/google/protobuf/compiler/command_line_interface.cc:1362:24
#3 0x5314fb in google::protobuf::compiler::CommandLineInterface::MakeInputsBeProtoPathRelative(google::protobuf::compiler::DiskSourceTree*, google::protobuf::DescriptorDatabase*) build_msan/./contrib/protobuf/src/google/protobuf/compiler/command_line_interface.cc:1415:10
#4 0x5314fb in google::protobuf::compiler::CommandLineInterface::InitializeDiskSourceTree(google::protobuf::compiler::DiskSourceTree*, google::protobuf::DescriptorDatabase*) build_msan/./contrib/protobuf/src/google/protobuf/compiler/command_line_interface.cc:1168:8
#5 0x52541f in google::protobuf::compiler::CommandLineInterface::Run(int, char const* const*) build_msan/./contrib/protobuf/src/google/protobuf/compiler/command_line_interface.cc:1026:10
#6 0x50f5d6 in google::protobuf::compiler::ProtobufMain(int, char**) build_msan/./contrib/protobuf/src/google/protobuf/compiler/main.cc:104:14
protocolbuffers#7 0x50fe58 in main build_msan/./contrib/protobuf/src/google/protobuf/compiler/main.cc:112:10
protocolbuffers#8 0x7f817143db24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
protocolbuffers#9 0x48904d in _start (/mnt/ch/ClickHouse/build_msan/contrib/protobuf-cmake/protoc+0x48904d)
Uninitialized value was created by an allocation of 'sb' in the stack frame of function '_ZN6google8protobuf8compiler14DiskSourceTree12OpenDiskFileERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE'
#0 0xdd3320 in google::protobuf::compiler::DiskSourceTree::OpenDiskFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) build_msan/./contrib/protobuf/src/google/protobuf/compiler/importer.cc:492
SUMMARY: MemorySanitizer: use-of-uninitialized-value build_msan/./contrib/protobuf/src/google/protobuf/compiler/importer.cc:504:7 in google::protobuf::compiler::DiskSourceTree::OpenDiskFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Exiting
rschu1ze
referenced
this pull request
in ClickHouse/google-protobuf
Oct 25, 2023
==500166==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0xdd383e in google::protobuf::compiler::DiskSourceTree::OpenDiskFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) build_msan/./contrib/protobuf/src/google/protobuf/compiler/importer.cc:504:7
#1 0xdd1eb2 in google::protobuf::compiler::DiskSourceTree::DiskFileToVirtualFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*) build_msan/./contrib/protobuf/src/google/protobuf/compiler/importer.cc:431:51
#2 0x540619 in google::protobuf::compiler::CommandLineInterface::MakeProtoProtoPathRelative(google::protobuf::compiler::DiskSourceTree*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, google::protobuf::DescriptorDatabase*) build_msan/./contrib/protobuf/src/google/protobuf/compiler/command_line_interface.cc:1362:24
#3 0x5314fb in google::protobuf::compiler::CommandLineInterface::MakeInputsBeProtoPathRelative(google::protobuf::compiler::DiskSourceTree*, google::protobuf::DescriptorDatabase*) build_msan/./contrib/protobuf/src/google/protobuf/compiler/command_line_interface.cc:1415:10
#4 0x5314fb in google::protobuf::compiler::CommandLineInterface::InitializeDiskSourceTree(google::protobuf::compiler::DiskSourceTree*, google::protobuf::DescriptorDatabase*) build_msan/./contrib/protobuf/src/google/protobuf/compiler/command_line_interface.cc:1168:8
#5 0x52541f in google::protobuf::compiler::CommandLineInterface::Run(int, char const* const*) build_msan/./contrib/protobuf/src/google/protobuf/compiler/command_line_interface.cc:1026:10
#6 0x50f5d6 in google::protobuf::compiler::ProtobufMain(int, char**) build_msan/./contrib/protobuf/src/google/protobuf/compiler/main.cc:104:14
protocolbuffers#7 0x50fe58 in main build_msan/./contrib/protobuf/src/google/protobuf/compiler/main.cc:112:10
protocolbuffers#8 0x7f817143db24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
protocolbuffers#9 0x48904d in _start (/mnt/ch/ClickHouse/build_msan/contrib/protobuf-cmake/protoc+0x48904d)
Uninitialized value was created by an allocation of 'sb' in the stack frame of function '_ZN6google8protobuf8compiler14DiskSourceTree12OpenDiskFileERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE'
#0 0xdd3320 in google::protobuf::compiler::DiskSourceTree::OpenDiskFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) build_msan/./contrib/protobuf/src/google/protobuf/compiler/importer.cc:492
SUMMARY: MemorySanitizer: use-of-uninitialized-value build_msan/./contrib/protobuf/src/google/protobuf/compiler/importer.cc:504:7 in google::protobuf::compiler::DiskSourceTree::OpenDiskFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Exiting
GerHobbelt
pushed a commit
to GerHobbelt/protobuf
that referenced
this pull request
Aug 4, 2024
Signed-off-by: Christian Venegas <[email protected]> Reviewed-by: Dan Kalowsky <[email protected]>
qinghui-xu
pushed a commit
to qinghui-xu/protobuf
that referenced
this pull request
Aug 23, 2024
…nullable-plugin 3.22.x backport nullable plugin
copybara-service bot
pushed a commit
that referenced
this pull request
Oct 10, 2024
…um value is detected. This should never happen, so I don't think it matters much exactly what kind of exception we throw. We could even arguably return null, but this option saves a lot of space while still preserving some error checking. See https://godbolt.org/z/jKhcKs3x1 for code gen. This generates much tighter bytecode and ARM assembly than alternatives. As this code is generated many times over, small wins in code size here can reduce icache pressure, APK size, and OAT size. This java code: ```java Object uoe() { throw new UnsupportedOperationException(); } Object npe2() { throw null; } ``` Generates this dex code: ``` .method uoe()Ljava/lang/Object; new-instance v0, Ljava/lang/UnsupportedOperationException; invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;-><init>()V throw v0 .end method .method npe2()Ljava/lang/Object; const/4 v0, 0x0 throw v0 .end method ``` Which generates this OAT code: ``` java.lang.Object SomeProto.uoe() [84 bytes] 0x000081c0 sub x16, sp, #0x2000 (8192) 0x000081c4 ldr wzr, [x16] StackMap[0] native_pc=0x41c8, dex_pc=0x0, register_mask=0x0, stack_mask=0b 0x000081c8 str x0, [sp, #-48]! 0x000081cc str x22, [sp, #24] 0x000081d0 stp x23, lr, [sp, #32] 0x000081d4 ldr x21, [x21] StackMap[1] native_pc=0x41d8, dex_pc=0x0, register_mask=0x2, stack_mask=0b 0x000081d8 mov x22, x1 0x000081dc adrp x0, #+0x4000 (addr 0x0000c000) 0x000081e0 ldr w0, [x0, #4] 0x000081e4 ldr lr, [tr, #464] ; pAllocObjectInitialized 0x000081e8 blr lr StackMap[2] native_pc=0x41ec, dex_pc=0x0, register_mask=0x400000, stack_mask=0b 0x000081ec dmb ishst 0x000081f0 mov x1, x0 0x000081f4 mov x23, x1 0x000081f8 adrp x0, #+0x4000 (addr 0x0000c000) 0x000081fc ldr w0, [x0, #12] 0x00008200 ldr lr, [x0, #24] 0x00008204 blr lr StackMap[3] native_pc=0x4208, dex_pc=0x2, register_mask=0xc00000, stack_mask=0b 0x00008208 mov x0, x23 0x0000820c ldr lr, [tr, #1264] ; pDeliverException 0x00008210 blr lr StackMap[4] native_pc=0x4214, dex_pc=0x5, register_mask=0xc00000, stack_mask=0b java.lang.Object SomeProto.npe2() [36 bytes] 0x000080d0 sub x16, sp, #0x2000 (8192) 0x000080d4 ldr wzr, [x16] StackMap[0] native_pc=0x40d8, dex_pc=0x0, register_mask=0x0, stack_mask=0b 0x000080d8 str x0, [sp, #-32]! 0x000080dc stp x22, lr, [sp, #16] 0x000080e0 ldr x21, [x21] StackMap[1] native_pc=0x40e4, dex_pc=0x0, register_mask=0x2, stack_mask=0b 0x000080e4 mov x22, x1 0x000080e8 mov w0, #0x0 0x000080ec ldr lr, [tr, #1264] ; pDeliverException 0x000080f0 blr lr StackMap[2] native_pc=0x40f4, dex_pc=0x1, register_mask=0x400000, stack_mask=0b ``` This saves 84-36 = 48 bytes of OAT per method. PiperOrigin-RevId: 684258075
copybara-service bot
pushed a commit
that referenced
this pull request
Oct 10, 2024
…um value is detected. This should never happen, so I don't think it matters much exactly what kind of exception we throw. We could even arguably return null, but this option saves a lot of space while still preserving some error checking. See https://godbolt.org/z/jKhcKs3x1 for code gen. This generates much tighter bytecode and ARM assembly than alternatives. As this code is generated many times over, small wins in code size here can reduce icache pressure, APK size, and OAT size. This java code: ```java Object uoe() { throw new UnsupportedOperationException(); } Object npe2() { throw null; } ``` Generates this dex code: ``` .method uoe()Ljava/lang/Object; new-instance v0, Ljava/lang/UnsupportedOperationException; invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;-><init>()V throw v0 .end method .method npe2()Ljava/lang/Object; const/4 v0, 0x0 throw v0 .end method ``` Which generates this OAT code: ``` java.lang.Object SomeProto.uoe() [84 bytes] 0x000081c0 sub x16, sp, #0x2000 (8192) 0x000081c4 ldr wzr, [x16] StackMap[0] native_pc=0x41c8, dex_pc=0x0, register_mask=0x0, stack_mask=0b 0x000081c8 str x0, [sp, #-48]! 0x000081cc str x22, [sp, #24] 0x000081d0 stp x23, lr, [sp, #32] 0x000081d4 ldr x21, [x21] StackMap[1] native_pc=0x41d8, dex_pc=0x0, register_mask=0x2, stack_mask=0b 0x000081d8 mov x22, x1 0x000081dc adrp x0, #+0x4000 (addr 0x0000c000) 0x000081e0 ldr w0, [x0, #4] 0x000081e4 ldr lr, [tr, #464] ; pAllocObjectInitialized 0x000081e8 blr lr StackMap[2] native_pc=0x41ec, dex_pc=0x0, register_mask=0x400000, stack_mask=0b 0x000081ec dmb ishst 0x000081f0 mov x1, x0 0x000081f4 mov x23, x1 0x000081f8 adrp x0, #+0x4000 (addr 0x0000c000) 0x000081fc ldr w0, [x0, #12] 0x00008200 ldr lr, [x0, #24] 0x00008204 blr lr StackMap[3] native_pc=0x4208, dex_pc=0x2, register_mask=0xc00000, stack_mask=0b 0x00008208 mov x0, x23 0x0000820c ldr lr, [tr, #1264] ; pDeliverException 0x00008210 blr lr StackMap[4] native_pc=0x4214, dex_pc=0x5, register_mask=0xc00000, stack_mask=0b java.lang.Object SomeProto.npe2() [36 bytes] 0x000080d0 sub x16, sp, #0x2000 (8192) 0x000080d4 ldr wzr, [x16] StackMap[0] native_pc=0x40d8, dex_pc=0x0, register_mask=0x0, stack_mask=0b 0x000080d8 str x0, [sp, #-32]! 0x000080dc stp x22, lr, [sp, #16] 0x000080e0 ldr x21, [x21] StackMap[1] native_pc=0x40e4, dex_pc=0x0, register_mask=0x2, stack_mask=0b 0x000080e4 mov x22, x1 0x000080e8 mov w0, #0x0 0x000080ec ldr lr, [tr, #1264] ; pDeliverException 0x000080f0 blr lr StackMap[2] native_pc=0x40f4, dex_pc=0x1, register_mask=0x400000, stack_mask=0b ``` This saves 84-36 = 48 bytes of OAT per method. PiperOrigin-RevId: 684258075
copybara-service bot
pushed a commit
that referenced
this pull request
Oct 10, 2024
…um value is detected. This should never happen, so I don't think it matters much exactly what kind of exception we throw. We could even arguably return null, but this option saves a lot of space while still preserving some error checking. See https://godbolt.org/z/jKhcKs3x1 for code gen. This generates much tighter bytecode and ARM assembly than alternatives. As this code is generated many times over, small wins in code size here can reduce icache pressure, APK size, and OAT size. This java code: ```java Object uoe() { throw new UnsupportedOperationException(); } Object npe2() { throw null; } ``` Generates this dex code: ``` .method uoe()Ljava/lang/Object; new-instance v0, Ljava/lang/UnsupportedOperationException; invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;-><init>()V throw v0 .end method .method npe2()Ljava/lang/Object; const/4 v0, 0x0 throw v0 .end method ``` Which generates this OAT code: ``` java.lang.Object SomeProto.uoe() [84 bytes] 0x000081c0 sub x16, sp, #0x2000 (8192) 0x000081c4 ldr wzr, [x16] StackMap[0] native_pc=0x41c8, dex_pc=0x0, register_mask=0x0, stack_mask=0b 0x000081c8 str x0, [sp, #-48]! 0x000081cc str x22, [sp, #24] 0x000081d0 stp x23, lr, [sp, #32] 0x000081d4 ldr x21, [x21] StackMap[1] native_pc=0x41d8, dex_pc=0x0, register_mask=0x2, stack_mask=0b 0x000081d8 mov x22, x1 0x000081dc adrp x0, #+0x4000 (addr 0x0000c000) 0x000081e0 ldr w0, [x0, #4] 0x000081e4 ldr lr, [tr, #464] ; pAllocObjectInitialized 0x000081e8 blr lr StackMap[2] native_pc=0x41ec, dex_pc=0x0, register_mask=0x400000, stack_mask=0b 0x000081ec dmb ishst 0x000081f0 mov x1, x0 0x000081f4 mov x23, x1 0x000081f8 adrp x0, #+0x4000 (addr 0x0000c000) 0x000081fc ldr w0, [x0, #12] 0x00008200 ldr lr, [x0, #24] 0x00008204 blr lr StackMap[3] native_pc=0x4208, dex_pc=0x2, register_mask=0xc00000, stack_mask=0b 0x00008208 mov x0, x23 0x0000820c ldr lr, [tr, #1264] ; pDeliverException 0x00008210 blr lr StackMap[4] native_pc=0x4214, dex_pc=0x5, register_mask=0xc00000, stack_mask=0b java.lang.Object SomeProto.npe2() [36 bytes] 0x000080d0 sub x16, sp, #0x2000 (8192) 0x000080d4 ldr wzr, [x16] StackMap[0] native_pc=0x40d8, dex_pc=0x0, register_mask=0x0, stack_mask=0b 0x000080d8 str x0, [sp, #-32]! 0x000080dc stp x22, lr, [sp, #16] 0x000080e0 ldr x21, [x21] StackMap[1] native_pc=0x40e4, dex_pc=0x0, register_mask=0x2, stack_mask=0b 0x000080e4 mov x22, x1 0x000080e8 mov w0, #0x0 0x000080ec ldr lr, [tr, #1264] ; pDeliverException 0x000080f0 blr lr StackMap[2] native_pc=0x40f4, dex_pc=0x1, register_mask=0x400000, stack_mask=0b ``` This saves 84-36 = 48 bytes of OAT per method. PiperOrigin-RevId: 684258075
copybara-service bot
pushed a commit
that referenced
this pull request
Oct 10, 2024
…um value is detected. This should never happen, so I don't think it matters much exactly what kind of exception we throw. We could even arguably return null, but this option saves a lot of space while still preserving some error checking. See https://godbolt.org/z/jKhcKs3x1 for code gen. This generates much tighter bytecode and ARM assembly than alternatives. As this code is generated many times over, small wins in code size here can reduce icache pressure, APK size, and OAT size. This java code: ```java Object uoe() { throw new UnsupportedOperationException(); } Object npe2() { throw null; } ``` Generates this dex code: ``` .method uoe()Ljava/lang/Object; new-instance v0, Ljava/lang/UnsupportedOperationException; invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;-><init>()V throw v0 .end method .method npe2()Ljava/lang/Object; const/4 v0, 0x0 throw v0 .end method ``` Which generates this OAT code: ``` java.lang.Object SomeProto.uoe() [84 bytes] 0x000081c0 sub x16, sp, #0x2000 (8192) 0x000081c4 ldr wzr, [x16] StackMap[0] native_pc=0x41c8, dex_pc=0x0, register_mask=0x0, stack_mask=0b 0x000081c8 str x0, [sp, #-48]! 0x000081cc str x22, [sp, #24] 0x000081d0 stp x23, lr, [sp, #32] 0x000081d4 ldr x21, [x21] StackMap[1] native_pc=0x41d8, dex_pc=0x0, register_mask=0x2, stack_mask=0b 0x000081d8 mov x22, x1 0x000081dc adrp x0, #+0x4000 (addr 0x0000c000) 0x000081e0 ldr w0, [x0, #4] 0x000081e4 ldr lr, [tr, #464] ; pAllocObjectInitialized 0x000081e8 blr lr StackMap[2] native_pc=0x41ec, dex_pc=0x0, register_mask=0x400000, stack_mask=0b 0x000081ec dmb ishst 0x000081f0 mov x1, x0 0x000081f4 mov x23, x1 0x000081f8 adrp x0, #+0x4000 (addr 0x0000c000) 0x000081fc ldr w0, [x0, #12] 0x00008200 ldr lr, [x0, #24] 0x00008204 blr lr StackMap[3] native_pc=0x4208, dex_pc=0x2, register_mask=0xc00000, stack_mask=0b 0x00008208 mov x0, x23 0x0000820c ldr lr, [tr, #1264] ; pDeliverException 0x00008210 blr lr StackMap[4] native_pc=0x4214, dex_pc=0x5, register_mask=0xc00000, stack_mask=0b java.lang.Object SomeProto.npe2() [36 bytes] 0x000080d0 sub x16, sp, #0x2000 (8192) 0x000080d4 ldr wzr, [x16] StackMap[0] native_pc=0x40d8, dex_pc=0x0, register_mask=0x0, stack_mask=0b 0x000080d8 str x0, [sp, #-32]! 0x000080dc stp x22, lr, [sp, #16] 0x000080e0 ldr x21, [x21] StackMap[1] native_pc=0x40e4, dex_pc=0x0, register_mask=0x2, stack_mask=0b 0x000080e4 mov x22, x1 0x000080e8 mov w0, #0x0 0x000080ec ldr lr, [tr, #1264] ; pDeliverException 0x000080f0 blr lr StackMap[2] native_pc=0x40f4, dex_pc=0x1, register_mask=0x400000, stack_mask=0b ``` This saves 84-36 = 48 bytes of OAT per method. PiperOrigin-RevId: 684620833
yordis
pushed a commit
to yordis/protobuf
that referenced
this pull request
Dec 8, 2024
Add some basic Property-Based Testing
copybara-service bot
pushed a commit
that referenced
this pull request
Mar 16, 2026
To make the method smaller and faster. The hot-path assembly code is substantially smaller if it doesn't have to allocate (and handle allocation failure) and throw the exception directly. Take this example: https://godbolt.org/z/EGYefWMEG ```java class Square { public int throwDirectly(int a) { switch (a) { case 1: return 1; } throw new IllegalArgumentException(); } public int throwViaMethod(int a) { switch (a) { case 1: return 1; } return throwIllegalArgumentException(); } public static int throwIllegalArgumentException() { throw new IllegalArgumentException(); } } ``` Outputs dex: ``` # virtual methods .method public throwDirectly(I)I .registers 2 #@0 .line 3 packed-switch p1, :pswitch_data_c #@3 .line 6 new-instance p1, Ljava/lang/IllegalArgumentException; #@5 invoke-direct {p1}, Ljava/lang/IllegalArgumentException;-><init>()V #@8 throw p1 #@9 .line 4 :pswitch_9 const/4 p1, 0x1 #@A return p1 #@b nop #@c :pswitch_data_c .packed-switch 0x1 :pswitch_9 .end packed-switch .end method .method public throwViaMethod(I)I .registers 2 #@0 .line 10 packed-switch p1, :pswitch_data_a #@3 .line 13 invoke-static {}, LSquare;->throwIllegalArgumentException()I #@6 move-result p1 #@7 return p1 #@8 .line 11 :pswitch_8 const/4 p1, 0x1 #@9 return p1 #@A :pswitch_data_a .packed-switch 0x1 :pswitch_8 .end packed-switch .end method ``` Which compiles to substantially smaller oat code (100 bytes before, 52 bytes after): ``` int Square.throwDirectly(int) [100 bytes] 0x00004070 sub x16, sp, #0x2000 (8192) 0x00004074 ldr wzr, [x16] StackMap[0] native_pc=0x4078, dex_pc=0x0, register_mask=0x0, stack_mask=0b 0x00004078 str x0, [sp, #-32]! 0x0000407c stp x22, lr, [sp, #16] 0x00004080 ldr x21, [x21] StackMap[1] native_pc=0x4084, dex_pc=0x0, register_mask=0x2, stack_mask=0b 0x00004084 cmp w2, #0x1 (1) 0x00004088 b.ne #+0x14 (addr 0x0000409c) 0x0000408c mov w0, #0x1 0x00004090 ldp x22, lr, [sp, #16] 0x00004094 add sp, sp, #0x20 (32) 0x00004098 ret 0x0000409c adrp x0, #+0x4000 (addr 0x00008000) 0x000040a0 ldr w0, [x0] 0x000040a4 ldr lr, [tr, #464] ; pAllocObjectInitialized 0x000040a8 blr lr StackMap[2] native_pc=0x40ac, dex_pc=0x4, register_mask=0x0, stack_mask=0b 0x000040ac dmb ishst 0x000040b0 mov x1, x0 0x000040b4 mov x22, x1 0x000040b8 adrp x0, #+0x4000 (addr 0x00008000) 0x000040bc ldr w0, [x0, #4] 0x000040c0 ldr lr, [x0, #24] 0x000040c4 blr lr StackMap[3] native_pc=0x40c8, dex_pc=0x6, register_mask=0x400000, stack_mask=0b 0x000040c8 mov x0, x22 0x000040cc ldr lr, [tr, #1264] ; pDeliverException 0x000040d0 blr lr StackMap[4] native_pc=0x40d4, dex_pc=0x9, register_mask=0x400000, stack_mask=0b int Square.throwViaMethod(int) [52 bytes] 0x000040e0 sub x16, sp, #0x2000 (8192) 0x000040e4 ldr wzr, [x16] StackMap[0] native_pc=0x40e8, dex_pc=0x0, register_mask=0x0, stack_mask=0b 0x000040e8 stp x0, lr, [sp, #-16]! 0x000040ec ldr x21, [x21] StackMap[1] native_pc=0x40f0, dex_pc=0x0, register_mask=0x2, stack_mask=0b 0x000040f0 cmp w2, #0x1 (1) 0x000040f4 b.eq #+0x14 (addr 0x00004108) 0x000040f8 adrp x0, #+0x8000 (addr 0x0000c000) 0x000040fc ldr x0, [x0] 0x00004100 ldr lr, [x0, #24] 0x00004104 blr lr StackMap[2] native_pc=0x4108, dex_pc=0x3, register_mask=0x0, stack_mask=0b 0x00004108 mov w0, #0x1 0x0000410c ldp xzr, lr, [sp], #16 0x00004110 ret ``` PiperOrigin-RevId: 884221230
copybara-service bot
pushed a commit
that referenced
this pull request
Mar 16, 2026
To make the method smaller and faster. The hot-path assembly code is substantially smaller if it doesn't have to allocate (and handle allocation failure) and throw the exception directly. Take this example: https://godbolt.org/z/EGYefWMEG ```java class Square { public int throwDirectly(int a) { switch (a) { case 1: return 1; } throw new IllegalArgumentException(); } public int throwViaMethod(int a) { switch (a) { case 1: return 1; } return throwIllegalArgumentException(); } public static int throwIllegalArgumentException() { throw new IllegalArgumentException(); } } ``` Outputs dex: ``` # virtual methods .method public throwDirectly(I)I .registers 2 #@0 .line 3 packed-switch p1, :pswitch_data_c #@3 .line 6 new-instance p1, Ljava/lang/IllegalArgumentException; #@5 invoke-direct {p1}, Ljava/lang/IllegalArgumentException;-><init>()V #@8 throw p1 #@9 .line 4 :pswitch_9 const/4 p1, 0x1 #@A return p1 #@b nop #@c :pswitch_data_c .packed-switch 0x1 :pswitch_9 .end packed-switch .end method .method public throwViaMethod(I)I .registers 2 #@0 .line 10 packed-switch p1, :pswitch_data_a #@3 .line 13 invoke-static {}, LSquare;->throwIllegalArgumentException()I #@6 move-result p1 #@7 return p1 #@8 .line 11 :pswitch_8 const/4 p1, 0x1 #@9 return p1 #@A :pswitch_data_a .packed-switch 0x1 :pswitch_8 .end packed-switch .end method ``` Which compiles to substantially smaller oat code (100 bytes before, 52 bytes after): ``` int Square.throwDirectly(int) [100 bytes] 0x00004070 sub x16, sp, #0x2000 (8192) 0x00004074 ldr wzr, [x16] StackMap[0] native_pc=0x4078, dex_pc=0x0, register_mask=0x0, stack_mask=0b 0x00004078 str x0, [sp, #-32]! 0x0000407c stp x22, lr, [sp, #16] 0x00004080 ldr x21, [x21] StackMap[1] native_pc=0x4084, dex_pc=0x0, register_mask=0x2, stack_mask=0b 0x00004084 cmp w2, #0x1 (1) 0x00004088 b.ne #+0x14 (addr 0x0000409c) 0x0000408c mov w0, #0x1 0x00004090 ldp x22, lr, [sp, #16] 0x00004094 add sp, sp, #0x20 (32) 0x00004098 ret 0x0000409c adrp x0, #+0x4000 (addr 0x00008000) 0x000040a0 ldr w0, [x0] 0x000040a4 ldr lr, [tr, #464] ; pAllocObjectInitialized 0x000040a8 blr lr StackMap[2] native_pc=0x40ac, dex_pc=0x4, register_mask=0x0, stack_mask=0b 0x000040ac dmb ishst 0x000040b0 mov x1, x0 0x000040b4 mov x22, x1 0x000040b8 adrp x0, #+0x4000 (addr 0x00008000) 0x000040bc ldr w0, [x0, #4] 0x000040c0 ldr lr, [x0, #24] 0x000040c4 blr lr StackMap[3] native_pc=0x40c8, dex_pc=0x6, register_mask=0x400000, stack_mask=0b 0x000040c8 mov x0, x22 0x000040cc ldr lr, [tr, #1264] ; pDeliverException 0x000040d0 blr lr StackMap[4] native_pc=0x40d4, dex_pc=0x9, register_mask=0x400000, stack_mask=0b int Square.throwViaMethod(int) [52 bytes] 0x000040e0 sub x16, sp, #0x2000 (8192) 0x000040e4 ldr wzr, [x16] StackMap[0] native_pc=0x40e8, dex_pc=0x0, register_mask=0x0, stack_mask=0b 0x000040e8 stp x0, lr, [sp, #-16]! 0x000040ec ldr x21, [x21] StackMap[1] native_pc=0x40f0, dex_pc=0x0, register_mask=0x2, stack_mask=0b 0x000040f0 cmp w2, #0x1 (1) 0x000040f4 b.eq #+0x14 (addr 0x00004108) 0x000040f8 adrp x0, #+0x8000 (addr 0x0000c000) 0x000040fc ldr x0, [x0] 0x00004100 ldr lr, [x0, #24] 0x00004104 blr lr StackMap[2] native_pc=0x4108, dex_pc=0x3, register_mask=0x0, stack_mask=0b 0x00004108 mov w0, #0x1 0x0000410c ldp xzr, lr, [sp], #16 0x00004110 ret ``` PiperOrigin-RevId: 884663197
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.