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_ASM_SUPPORT_H_
18 #define ART_RUNTIME_ASM_SUPPORT_H_
19 
20 #include "read_barrier_c.h"
21 
22 // Value loaded into rSUSPEND for quick. When this value is counted down to zero we do a suspend
23 // check.
24 #define SUSPEND_CHECK_INTERVAL (96)
25 
26 // Offsets within java.lang.Object.
27 #define CLASS_OFFSET 0
28 #define LOCK_WORD_OFFSET 4
29 
30 #if !defined(USE_BAKER_OR_BROOKS_READ_BARRIER)
31 
32 // Offsets within java.lang.Class.
33 #define CLASS_COMPONENT_TYPE_OFFSET 12
34 
35 // Array offsets.
36 #define ARRAY_LENGTH_OFFSET 8
37 #define OBJECT_ARRAY_DATA_OFFSET 12
38 
39 // Offsets within java.lang.String.
40 #define STRING_VALUE_OFFSET 8
41 #define STRING_COUNT_OFFSET 12
42 #define STRING_OFFSET_OFFSET 20
43 #define STRING_DATA_OFFSET 12
44 
45 // Offsets within java.lang.Method.
46 #define METHOD_DEX_CACHE_METHODS_OFFSET 12
47 
48 // Verified by object_test.
49 #define METHOD_QUICK_CODE_OFFSET_32 44
50 #define METHOD_QUICK_CODE_OFFSET_64 56
51 #define METHOD_PORTABLE_CODE_OFFSET_32 56
52 #define METHOD_PORTABLE_CODE_OFFSET_64 72
53 
54 #else
55 
56 // Offsets within java.lang.Class.
57 #define CLASS_COMPONENT_TYPE_OFFSET 20
58 
59 // Array offsets.
60 #define ARRAY_LENGTH_OFFSET 16
61 #define OBJECT_ARRAY_DATA_OFFSET 20
62 
63 // Offsets within java.lang.String.
64 #define STRING_VALUE_OFFSET 16
65 #define STRING_COUNT_OFFSET 20
66 #define STRING_OFFSET_OFFSET 28
67 #define STRING_DATA_OFFSET 20
68 
69 // Offsets within java.lang.Method.
70 #define METHOD_DEX_CACHE_METHODS_OFFSET 20
71 #define METHOD_PORTABLE_CODE_OFFSET 48
72 #define METHOD_QUICK_CODE_OFFSET 56
73 
74 #endif  // USE_BAKER_OR_BROOKS_READ_BARRIER
75 
76 #endif  // ART_RUNTIME_ASM_SUPPORT_H_
77