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) |
| 28 | SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_); |
| 29 | |
| 30 | void ThrowNullPointerExceptionForMethodAccess(Method* caller, uint32_t method_idx, InvokeType type) |
| 31 | SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_); |
| 32 | |
| 33 | void ThrowNullPointerExceptionFromDexPC(Method* throw_method, uint32_t dex_pc) |
| 34 | SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_); |
| 35 | |
| 36 | // IllegalAccessError |
| 37 | |
| 38 | void ThrowIllegalAccessErrorClass(Class* referrer, Class* accessed) |
| 39 | SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_); |
| 40 | |
| 41 | void ThrowIllegalAccessErrorClassForMethodDispatch(Class* referrer, Class* accessed, |
| 42 | const Method* caller, const Method* called, |
| 43 | InvokeType type) |
| 44 | SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_); |
| 45 | |
| 46 | void ThrowIllegalAccessErrorMethod(Class* referrer, Method* accessed) |
| 47 | SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_); |
| 48 | |
| 49 | void ThrowIllegalAccessErrorField(Class* referrer, Field* accessed) |
| 50 | SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_); |
| 51 | |
| 52 | void ThrowIllegalAccessErrorFinalField(const Method* referrer, Field* accessed) |
| 53 | SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_); |
| 54 | |
| 55 | // IncompatibleClassChangeError |
| 56 | |
| 57 | void ThrowIncompatibleClassChangeError(InvokeType expected_type, InvokeType found_type, |
| 58 | Method* method, const Method* referrer) |
| 59 | SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_); |
| 60 | |
| 61 | void ThrowIncompatibleClassChangeErrorClassForInterfaceDispatch(const Method* interface_method, |
| 62 | Object* this_object, |
| 63 | const Method* referrer) |
| 64 | SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_); |
| 65 | |
| 66 | void ThrowIncompatibleClassChangeErrorField(const Field* resolved_field, bool is_static, |
| 67 | const Method* referrer) |
| 68 | SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_); |
| 69 | |
| 70 | // NoSuchMethodError |
| 71 | |
| 72 | void ThrowNoSuchMethodError(InvokeType type, Class* c, const StringPiece& name, |
| 73 | const StringPiece& signature, const Method* referrer) |
| 74 | SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_); |
| 75 | |
| 76 | void ThrowNoSuchMethodError(uint32_t method_idx, const Method* referrer) |
| 77 | SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_); |
| 78 | |
| 79 | } // namespace art |
| 80 | |
| 81 | #endif // ART_SRC_COMMON_THROWS_H_ |