1 /*
2  * Copyright (C) 2014 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_QUICK_QUICK_METHOD_FRAME_INFO_H_
18 #define ART_RUNTIME_QUICK_QUICK_METHOD_FRAME_INFO_H_
19 
20 #include <stdint.h>
21 
22 #include "base/macros.h"
23 
24 namespace art {
25 
26 class PACKED(4) QuickMethodFrameInfo {
27  public:
QuickMethodFrameInfo()28   constexpr QuickMethodFrameInfo()
29     : frame_size_in_bytes_(0u),
30       core_spill_mask_(0u),
31       fp_spill_mask_(0u) {
32   }
33 
QuickMethodFrameInfo(uint32_t frame_size_in_bytes,uint32_t core_spill_mask,uint32_t fp_spill_mask)34   constexpr QuickMethodFrameInfo(uint32_t frame_size_in_bytes, uint32_t core_spill_mask,
35                                  uint32_t fp_spill_mask)
36     : frame_size_in_bytes_(frame_size_in_bytes),
37       core_spill_mask_(core_spill_mask),
38       fp_spill_mask_(fp_spill_mask) {
39   }
40 
FrameSizeInBytes()41   uint32_t FrameSizeInBytes() const {
42     return frame_size_in_bytes_;
43   }
44 
CoreSpillMask()45   uint32_t CoreSpillMask() const {
46     return core_spill_mask_;
47   }
48 
FpSpillMask()49   uint32_t FpSpillMask() const {
50     return fp_spill_mask_;
51   }
52 
GetReturnPcOffset()53   size_t GetReturnPcOffset() const {
54     return FrameSizeInBytes() - sizeof(void*);
55   }
56 
57  private:
58   uint32_t frame_size_in_bytes_;
59   uint32_t core_spill_mask_;
60   uint32_t fp_spill_mask_;
61 };
62 
63 }  // namespace art
64 
65 #endif  // ART_RUNTIME_QUICK_QUICK_METHOD_FRAME_INFO_H_
66