From f6409bd2c4adba0d937c71b8270803c0945f33a0 Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Mon, 7 Aug 2023 10:48:15 -0700 Subject: [PATCH] [ObjC] Mark NSOutputStream helper as not inlinable. With some optimizer flags, GPBCodedOutputStream results in a lot of code bloat, for now just prevent the new helper related to NSOutputStream from being inlined to keep that in check. PiperOrigin-RevId: 554525631 --- objectivec/GPBCodedOutputStream.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/objectivec/GPBCodedOutputStream.m b/objectivec/GPBCodedOutputStream.m index dc7a37b129..4f4e6fd2c8 100644 --- a/objectivec/GPBCodedOutputStream.m +++ b/objectivec/GPBCodedOutputStream.m @@ -36,6 +36,10 @@ #import "GPBUnknownFieldSet_PackagePrivate.h" #import "GPBUtilities_PackagePrivate.h" +// TODO(b/294836507): Consider using on other functions to reduce bloat when +// some compiler optimizations are enabled. +#define GPB_NOINLINE __attribute__((noinline)) + // These values are the existing values so as not to break any code that might // have already been inspecting them when they weren't documented/exposed. NSString *const GPBCodedOutputStreamException_OutOfSpace = @"OutOfSpace"; @@ -62,6 +66,7 @@ static const int32_t LITTLE_ENDIAN_64_SIZE = sizeof(uint64_t); // Helper to write bytes to an NSOutputStream looping in case a subset is written in // any of the attempts. +GPB_NOINLINE static NSInteger WriteToOutputStream(NSOutputStream *output, uint8_t *bytes, size_t length) { size_t total = 0;