File tree Expand file tree Collapse file tree 5 files changed +19
-13
lines changed Expand file tree Collapse file tree 5 files changed +19
-13
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ internal func osLog(
66
66
let preamble = message. interpolation. preamble
67
67
let argumentCount = message. interpolation. argumentCount
68
68
let bufferSize = message. bufferSize
69
+ let uint32bufferSize = UInt32 ( bufferSize)
69
70
let argumentClosures = message. interpolation. arguments. argumentClosures
70
71
71
72
let formatStringPointer = _getGlobalStringTablePointer ( formatString)
@@ -91,7 +92,7 @@ internal func osLog(
91
92
logLevel,
92
93
formatStringPointer,
93
94
bufferMemory,
94
- UInt32 ( bufferSize ) )
95
+ uint32bufferSize )
95
96
96
97
// The following operation extends the lifetime of stringStorageObjects
97
98
// and also of the objects stored in it till this point.
Original file line number Diff line number Diff line change @@ -155,9 +155,8 @@ extension OSLogArguments {
155
155
156
156
/// Return the number of bytes needed for serializing an integer argument as
157
157
/// specified by os_log. This function must be constant evaluable.
158
- @inlinable
159
158
@_semantics ( " constant_evaluable " )
160
- @_effects ( readonly )
159
+ @inlinable
161
160
@_optimize ( none)
162
161
internal func sizeForEncoding< T> (
163
162
_ type: T . Type
@@ -167,8 +166,9 @@ internal func sizeForEncoding<T>(
167
166
168
167
/// Serialize an integer at the buffer location that `position` points to and
169
168
/// increment `position` by the byte size of `T`.
170
- @usableFromInline
169
+ @inlinable
171
170
@_alwaysEmitIntoClient
171
+ @inline ( __always)
172
172
internal func serialize< T> (
173
173
_ value: T ,
174
174
at bufferPosition: inout ByteBufferPointer
Original file line number Diff line number Diff line change @@ -43,11 +43,14 @@ public enum Privacy {
43
43
/// Maximum number of arguments i.e., interpolated expressions that can
44
44
/// be used in the string interpolations passed to the log APIs.
45
45
/// This limit is imposed by the ABI of os_log.
46
- @_transparent
46
+ @_semantics ( " constant_evaluable " )
47
+ @inlinable
48
+ @_optimize ( none)
47
49
public var maxOSLogArgumentCount : UInt8 { return 48 }
48
50
49
- @usableFromInline
50
- @_transparent
51
+ @_semantics ( " constant_evaluable " )
52
+ @inlinable
53
+ @_optimize ( none)
51
54
internal var logBitsPerByte : Int { return 3 }
52
55
53
56
/// Represents a string interpolation passed to the log APIs.
@@ -303,7 +306,8 @@ public struct OSLogMessage :
303
306
/// The byte size of the buffer that will be passed to the C os_log ABI.
304
307
/// It will contain the elements of `interpolation.arguments` and the two
305
308
/// summary bytes: preamble and argument count.
306
- @_transparent
309
+ @_semantics ( " constant_evaluable " )
310
+ @inlinable
307
311
@_optimize ( none)
308
312
public var bufferSize : Int {
309
313
return interpolation. totalBytesForSerializingArguments + 2
@@ -353,8 +357,9 @@ internal struct OSLogArguments {
353
357
354
358
/// Serialize a UInt8 value at the buffer location pointed to by `bufferPosition`,
355
359
/// and increment the `bufferPosition` with the byte size of the serialized value.
356
- @usableFromInline
360
+ @inlinable
357
361
@_alwaysEmitIntoClient
362
+ @inline ( __always)
358
363
internal func serialize(
359
364
_ value: UInt8 ,
360
365
at bufferPosition: inout ByteBufferPointer )
Original file line number Diff line number Diff line change @@ -102,10 +102,9 @@ extension OSLogArguments {
102
102
/// evaluator, this function returns the byte size of Int, which must equal the
103
103
/// word length of the target architecture and hence the pointer size.
104
104
/// This function must be constant evaluable.
105
+ @_semantics ( " constant_evaluable " )
105
106
@inlinable
106
107
@_optimize ( none)
107
- @_effects ( readonly)
108
- @_semantics ( " constant_evaluable " )
109
108
internal func sizeForEncoding( ) -> Int {
110
109
return Int . bitWidth &>> logBitsPerByte
111
110
}
@@ -114,8 +113,9 @@ internal func sizeForEncoding() -> Int {
114
113
/// pointed by `bufferPosition`. When necessary, this function would copy the
115
114
/// string contents to a storage with a stable pointer. If that happens, a reference
116
115
/// to the storage will be added to `storageObjects`.
117
- @usableFromInline
116
+ @inlinable
118
117
@_alwaysEmitIntoClient
118
+ @inline ( __always)
119
119
internal func serialize(
120
120
_ stringValue: String ,
121
121
at bufferPosition: inout ByteBufferPointer ,
Original file line number Diff line number Diff line change 4
4
// Run the (mandatory) passes on which constant evaluator depends, and run the
5
5
// constant evaluator on the SIL produced after the dependent passes are run.
6
6
//
7
- // RUN: %target-sil-opt -silgen-cleanup -raw-sil-inst-lowering -allocbox-to-stack -mandatory-inlining -constexpr-limit 1024 -test-constant-evaluable-subset %t/OSLogConstantEvaluableTest_silgen.sil > %t/OSLogConstantEvaluableTest.sil 2> %t/error-output
7
+ // RUN: %target-sil-opt -silgen-cleanup -raw-sil-inst-lowering -allocbox-to-stack -mandatory-inlining -constexpr-limit 2048 -test-constant-evaluable-subset %t/OSLogConstantEvaluableTest_silgen.sil > %t/OSLogConstantEvaluableTest.sil 2> %t/error-output
8
8
//
9
9
// RUN: %FileCheck %s < %t/error-output
10
10
//
You can’t perform that action at this time.
0 commit comments