OSDN Git Service

Merge "Allow libcore and JDWP tests to be executed without JIT."
[android-x86/art.git] / runtime / common_throws.h
1 /*
2  * Copyright (C) 2012 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_COMMON_THROWS_H_
18 #define ART_RUNTIME_COMMON_THROWS_H_
19
20 #include "base/mutex.h"
21 #include "invoke_type.h"
22
23 namespace art {
24 namespace mirror {
25   class Class;
26   class Object;
27 }  // namespace mirror
28 class ArtField;
29 class ArtMethod;
30 class DexFile;
31 class Signature;
32 class StringPiece;
33
34 // AbstractMethodError
35
36 void ThrowAbstractMethodError(ArtMethod* method)
37     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
38
39 void ThrowAbstractMethodError(uint32_t method_idx, const DexFile& dex_file)
40     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
41
42 // ArithmeticException
43
44 void ThrowArithmeticExceptionDivideByZero() SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
45
46 // ArrayIndexOutOfBoundsException
47
48 void ThrowArrayIndexOutOfBoundsException(int index, int length)
49     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
50
51 // ArrayStoreException
52
53 void ThrowArrayStoreException(mirror::Class* element_class, mirror::Class* array_class)
54     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
55
56 // ClassCircularityError
57
58 void ThrowClassCircularityError(mirror::Class* c)
59     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
60
61 void ThrowClassCircularityError(mirror::Class* c, const char* fmt, ...)
62     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
63
64 // ClassCastException
65
66 void ThrowClassCastException(mirror::Class* dest_type, mirror::Class* src_type)
67     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
68
69 void ThrowClassCastException(const char* msg)
70     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
71
72 // ClassFormatError
73
74 void ThrowClassFormatError(mirror::Class* referrer, const char* fmt, ...)
75     __attribute__((__format__(__printf__, 2, 3)))
76     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
77
78 // IllegalAccessError
79
80 void ThrowIllegalAccessErrorClass(mirror::Class* referrer, mirror::Class* accessed)
81     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
82
83 void ThrowIllegalAccessErrorClassForMethodDispatch(mirror::Class* referrer, mirror::Class* accessed,
84                                                    ArtMethod* called,
85                                                    InvokeType type)
86     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
87
88 void ThrowIllegalAccessErrorMethod(mirror::Class* referrer, ArtMethod* accessed)
89     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
90
91 void ThrowIllegalAccessErrorField(mirror::Class* referrer, ArtField* accessed)
92     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
93
94 void ThrowIllegalAccessErrorFinalField(ArtMethod* referrer, ArtField* accessed)
95     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
96
97 void ThrowIllegalAccessError(mirror::Class* referrer, const char* fmt, ...)
98     __attribute__((__format__(__printf__, 2, 3)))
99     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
100
101 // IllegalAccessException
102
103 void ThrowIllegalAccessException(const char* msg)
104     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
105
106 // IllegalArgumentException
107
108 void ThrowIllegalArgumentException(const char* msg)
109     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
110
111 // IncompatibleClassChangeError
112
113 void ThrowIncompatibleClassChangeError(InvokeType expected_type, InvokeType found_type,
114                                        ArtMethod* method, ArtMethod* referrer)
115     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
116
117 void ThrowIncompatibleClassChangeErrorClassForInterfaceSuper(ArtMethod* method,
118                                                              mirror::Class* target_class,
119                                                              mirror::Object* this_object,
120                                                              ArtMethod* referrer)
121     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
122
123 void ThrowIncompatibleClassChangeErrorClassForInterfaceDispatch(ArtMethod* interface_method,
124                                                                 mirror::Object* this_object,
125                                                                 ArtMethod* referrer)
126     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
127
128 void ThrowIncompatibleClassChangeErrorField(ArtField* resolved_field, bool is_static,
129                                             ArtMethod* referrer)
130     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
131
132 void ThrowIncompatibleClassChangeError(mirror::Class* referrer, const char* fmt, ...)
133     __attribute__((__format__(__printf__, 2, 3)))
134     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
135
136 void ThrowIncompatibleClassChangeErrorForMethodConflict(ArtMethod* method)
137     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
138
139 // IOException
140
141 void ThrowIOException(const char* fmt, ...) __attribute__((__format__(__printf__, 1, 2)))
142     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
143
144 void ThrowWrappedIOException(const char* fmt, ...) __attribute__((__format__(__printf__, 1, 2)))
145     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
146
147 // LinkageError
148
149 void ThrowLinkageError(mirror::Class* referrer, const char* fmt, ...)
150     __attribute__((__format__(__printf__, 2, 3)))
151     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
152
153 void ThrowWrappedLinkageError(mirror::Class* referrer, const char* fmt, ...)
154     __attribute__((__format__(__printf__, 2, 3)))
155     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
156
157 // NegativeArraySizeException
158
159 void ThrowNegativeArraySizeException(int size)
160     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
161
162 void ThrowNegativeArraySizeException(const char* msg)
163     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
164
165
166 // NoSuchFieldError
167
168 void ThrowNoSuchFieldError(const StringPiece& scope, mirror::Class* c,
169                            const StringPiece& type, const StringPiece& name)
170     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
171
172 void ThrowNoSuchFieldException(mirror::Class* c, const StringPiece& name)
173     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
174
175 // NoSuchMethodError
176
177 void ThrowNoSuchMethodError(InvokeType type, mirror::Class* c, const StringPiece& name,
178                             const Signature& signature)
179     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
180
181 void ThrowNoSuchMethodError(uint32_t method_idx)
182     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
183
184 // NullPointerException
185
186 void ThrowNullPointerExceptionForFieldAccess(ArtField* field,
187                                              bool is_read)
188     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
189
190 void ThrowNullPointerExceptionForMethodAccess(uint32_t method_idx,
191                                               InvokeType type)
192     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
193
194 void ThrowNullPointerExceptionForMethodAccess(ArtMethod* method,
195                                               InvokeType type)
196     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
197
198 void ThrowNullPointerExceptionFromDexPC()
199     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
200
201 void ThrowNullPointerException(const char* msg)
202     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
203
204 // RuntimeException
205
206 void ThrowRuntimeException(const char* fmt, ...)
207     __attribute__((__format__(__printf__, 1, 2)))
208     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
209
210 // Stack overflow.
211
212 void ThrowStackOverflowError(Thread* self) SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
213
214 // VerifyError
215
216 void ThrowVerifyError(mirror::Class* referrer, const char* fmt, ...)
217     __attribute__((__format__(__printf__, 2, 3)))
218     SHARED_REQUIRES(Locks::mutator_lock_) COLD_ATTR;
219
220 }  // namespace art
221
222 #endif  // ART_RUNTIME_COMMON_THROWS_H_