Andreas Gampe | 513061a | 2017-06-01 09:17:34 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ART_RUNTIME_MANAGED_STACK_INL_H_ |
| 18 | #define ART_RUNTIME_MANAGED_STACK_INL_H_ |
| 19 | |
| 20 | #include "managed_stack.h" |
| 21 | |
Andreas Gampe | 36a296f | 2017-06-13 14:11:11 -0700 | [diff] [blame] | 22 | #include "interpreter/shadow_frame.h" |
Andreas Gampe | 513061a | 2017-06-01 09:17:34 -0700 | [diff] [blame] | 23 | |
Dmitrii Ishcheikin | 6f30991 | 2024-01-24 16:27:53 +0000 | [diff] [blame] | 24 | namespace art HIDDEN { |
Andreas Gampe | 513061a | 2017-06-01 09:17:34 -0700 | [diff] [blame] | 25 | |
| 26 | inline ShadowFrame* ManagedStack::PushShadowFrame(ShadowFrame* new_top_frame) { |
Vladimir Marko | 2196c65 | 2017-11-30 16:16:07 +0000 | [diff] [blame] | 27 | DCHECK(!HasTopQuickFrame()); |
Andreas Gampe | 513061a | 2017-06-01 09:17:34 -0700 | [diff] [blame] | 28 | ShadowFrame* old_frame = top_shadow_frame_; |
| 29 | top_shadow_frame_ = new_top_frame; |
| 30 | new_top_frame->SetLink(old_frame); |
| 31 | return old_frame; |
| 32 | } |
| 33 | |
| 34 | inline ShadowFrame* ManagedStack::PopShadowFrame() { |
Vladimir Marko | 2196c65 | 2017-11-30 16:16:07 +0000 | [diff] [blame] | 35 | DCHECK(!HasTopQuickFrame()); |
Andreas Gampe | 513061a | 2017-06-01 09:17:34 -0700 | [diff] [blame] | 36 | CHECK(top_shadow_frame_ != nullptr); |
| 37 | ShadowFrame* frame = top_shadow_frame_; |
| 38 | top_shadow_frame_ = frame->GetLink(); |
Nicolas Geoffray | 56ea350 | 2022-09-08 09:51:57 +0100 | [diff] [blame] | 39 | frame->ClearLink(); |
Andreas Gampe | 513061a | 2017-06-01 09:17:34 -0700 | [diff] [blame] | 40 | return frame; |
| 41 | } |
| 42 | |
| 43 | } // namespace art |
| 44 | |
| 45 | #endif // ART_RUNTIME_MANAGED_STACK_INL_H_ |