File tree Expand file tree Collapse file tree 2 files changed +17
-10
lines changed Expand file tree Collapse file tree 2 files changed +17
-10
lines changed Original file line number Diff line number Diff line change @@ -214,16 +214,15 @@ int Instruction::stackOffset[Instruction::Tags::lastInstruction] = {
214
214
-1 , // valueBlockApplyLambda
215
215
};
216
216
217
- void ByteCode::allocStack (size_t size ) noexcept {
218
- invariant (size > 0 );
219
- auto newSizeDelta = size * sizeOfElement;
217
+ void ByteCode::allocStackImpl (size_t newSizeDelta ) noexcept {
218
+ invariant (newSizeDelta > 0 );
219
+
220
220
auto oldSize = _argStackEnd - _argStack;
221
- if (_argStackEnd <= _argStackTop + newSizeDelta) {
222
- auto oldTop = _argStackTop - _argStack;
223
- _argStack = reinterpret_cast <uint8_t *>(mongoRealloc (_argStack, oldSize + newSizeDelta));
224
- _argStackEnd = _argStack + oldSize + newSizeDelta;
225
- _argStackTop = _argStack + oldTop;
226
- }
221
+ auto oldTop = _argStackTop - _argStack;
222
+
223
+ _argStack = reinterpret_cast <uint8_t *>(mongoRealloc (_argStack, oldSize + newSizeDelta));
224
+ _argStackEnd = _argStack + oldSize + newSizeDelta;
225
+ _argStackTop = _argStack + oldTop;
227
226
}
228
227
229
228
std::string CodeFragment::toString () const {
Original file line number Diff line number Diff line change @@ -2276,7 +2276,15 @@ class ByteCode {
2276
2276
_argStackTop = _argStack - sizeOfElement;
2277
2277
}
2278
2278
2279
- void allocStack (size_t size) noexcept ;
2279
+ MONGO_COMPILER_ALWAYS_INLINE_OPT void allocStack (size_t size) noexcept {
2280
+ auto newSizeDelta = size * sizeOfElement;
2281
+ if (_argStackEnd <= _argStackTop + newSizeDelta) {
2282
+ allocStackImpl (newSizeDelta);
2283
+ }
2284
+ }
2285
+
2286
+ void allocStackImpl (size_t newSizeDelta) noexcept ;
2287
+
2280
2288
void swapStack ();
2281
2289
2282
2290
// The top entry in '_argStack', or one element before the stack when empty.
You can’t perform that action at this time.
0 commit comments