1/*
2 * Copyright (C) 2016 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// Offsets within ShadowFrame.
18
19#if defined(DEFINE_INCLUDE_DEPENDENCIES)
20#include "base/callee_save_type.h"  // art::CalleeSaveType
21#include "runtime.h"                // art::Runtime
22#endif
23
24#include "common.def"        // DEFINE_OFFSET_EXPR
25
26// Note: these callee save methods loads require read barriers.
27
28#define DEFINE_RUNTIME_CALLEE_SAVE_OFFSET(field_name, constant_name) \
29  DEFINE_OFFSET_EXPR(Runtime, \
30                     field_name ## _METHOD, \
31                     size_t, \
32                     art::Runtime::GetCalleeSaveMethodOffset(constant_name))
33
34                    //     Macro substring       Constant name
35// Offset of field Runtime::callee_save_methods_[kSaveAllCalleeSaves]
36DEFINE_RUNTIME_CALLEE_SAVE_OFFSET(SAVE_ALL_CALLEE_SAVES, art::CalleeSaveType::kSaveAllCalleeSaves)
37// Offset of field Runtime::callee_save_methods_[kSaveRefsOnly]
38DEFINE_RUNTIME_CALLEE_SAVE_OFFSET(SAVE_REFS_ONLY, art::CalleeSaveType::kSaveRefsOnly)
39// Offset of field Runtime::callee_save_methods_[kSaveRefsAndArgs]
40DEFINE_RUNTIME_CALLEE_SAVE_OFFSET(SAVE_REFS_AND_ARGS, art::CalleeSaveType::kSaveRefsAndArgs)
41// Offset of field Runtime::callee_save_methods_[kSaveEverything]
42DEFINE_RUNTIME_CALLEE_SAVE_OFFSET(SAVE_EVERYTHING, art::CalleeSaveType::kSaveEverything)
43// Offset of field Runtime::callee_save_methods_[kSaveEverythingForClinit]
44DEFINE_RUNTIME_CALLEE_SAVE_OFFSET(SAVE_EVERYTHING_FOR_CLINIT, art::CalleeSaveType::kSaveEverythingForClinit)
45// Offset of field Runtime::callee_save_methods_[kSaveEverythingForSuspendCheck]
46DEFINE_RUNTIME_CALLEE_SAVE_OFFSET(SAVE_EVERYTHING_FOR_SUSPEND_CHECK, art::CalleeSaveType::kSaveEverythingForSuspendCheck)
47
48#undef DEFINE_RUNTIME_CALLEE_SAVE_OFFSET
49#include "common_undef.def"  // undef DEFINE_OFFSET_EXPR
50