Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 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_SRC_COMMON_THROWS__H_ |
| 18 | #define ART_SRC_COMMON_THROWS_H_ |
| 19 | |
| 20 | #include "mutex.h" |
| 21 | #include "object.h" |
| 22 | |
| 23 | namespace art { |
| 24 | |
| 25 | // NullPointerException |
| 26 | |
| 27 | void ThrowNullPointerExceptionForFieldAccess(Field* field, bool is_read) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 28 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 29 | |
Mathieu Chartier | 66f1925 | 2012-09-18 08:57:04 -0700 | [diff] [blame] | 30 | void ThrowNullPointerExceptionForMethodAccess(AbstractMethod* caller, uint32_t method_idx, InvokeType type) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 31 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 32 | |
Mathieu Chartier | 66f1925 | 2012-09-18 08:57:04 -0700 | [diff] [blame] | 33 | void ThrowNullPointerExceptionFromDexPC(AbstractMethod* throw_method, uint32_t dex_pc) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 34 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 35 | |
| 36 | // IllegalAccessError |
| 37 | |
| 38 | void ThrowIllegalAccessErrorClass(Class* referrer, Class* accessed) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 39 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 40 | |
| 41 | void ThrowIllegalAccessErrorClassForMethodDispatch(Class* referrer, Class* accessed, |
Mathieu Chartier | 66f1925 | 2012-09-18 08:57:04 -0700 | [diff] [blame] | 42 | const AbstractMethod* caller, const AbstractMethod* called, |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 43 | InvokeType type) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 44 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 45 | |
Mathieu Chartier | 66f1925 | 2012-09-18 08:57:04 -0700 | [diff] [blame] | 46 | void ThrowIllegalAccessErrorMethod(Class* referrer, AbstractMethod* accessed) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 47 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 48 | |
| 49 | void ThrowIllegalAccessErrorField(Class* referrer, Field* accessed) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 50 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 51 | |
Mathieu Chartier | 66f1925 | 2012-09-18 08:57:04 -0700 | [diff] [blame] | 52 | void ThrowIllegalAccessErrorFinalField(const AbstractMethod* referrer, Field* accessed) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 53 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 54 | |
| 55 | // IncompatibleClassChangeError |
| 56 | |
| 57 | void ThrowIncompatibleClassChangeError(InvokeType expected_type, InvokeType found_type, |
Mathieu Chartier | 66f1925 | 2012-09-18 08:57:04 -0700 | [diff] [blame] | 58 | AbstractMethod* method, const AbstractMethod* referrer) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 59 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 60 | |
Mathieu Chartier | 66f1925 | 2012-09-18 08:57:04 -0700 | [diff] [blame] | 61 | void ThrowIncompatibleClassChangeErrorClassForInterfaceDispatch(const AbstractMethod* interface_method, |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 62 | Object* this_object, |
Mathieu Chartier | 66f1925 | 2012-09-18 08:57:04 -0700 | [diff] [blame] | 63 | const AbstractMethod* referrer) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 64 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 65 | |
| 66 | void ThrowIncompatibleClassChangeErrorField(const Field* resolved_field, bool is_static, |
Mathieu Chartier | 66f1925 | 2012-09-18 08:57:04 -0700 | [diff] [blame] | 67 | const AbstractMethod* referrer) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 68 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 69 | |
| 70 | // NoSuchMethodError |
| 71 | |
| 72 | void ThrowNoSuchMethodError(InvokeType type, Class* c, const StringPiece& name, |
Mathieu Chartier | 66f1925 | 2012-09-18 08:57:04 -0700 | [diff] [blame] | 73 | const StringPiece& signature, const AbstractMethod* referrer) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 74 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 75 | |
Mathieu Chartier | 66f1925 | 2012-09-18 08:57:04 -0700 | [diff] [blame] | 76 | void ThrowNoSuchMethodError(uint32_t method_idx, const AbstractMethod* referrer) |
Ian Rogers | b726dcb | 2012-09-05 08:57:23 -0700 | [diff] [blame] | 77 | SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 78 | |
| 79 | } // namespace art |
| 80 | |
| 81 | #endif // ART_SRC_COMMON_THROWS_H_ |