blob: 47186b04f2cc79fc698a6bbfd3baa1cea1f7e0cb [file] [log] [blame]
Ian Rogers87e552d2012-08-31 15:54:48 -07001/*
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
23namespace art {
24
25// NullPointerException
26
27void ThrowNullPointerExceptionForFieldAccess(Field* field, bool is_read)
28 SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_);
29
30void ThrowNullPointerExceptionForMethodAccess(Method* caller, uint32_t method_idx, InvokeType type)
31 SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_);
32
33void ThrowNullPointerExceptionFromDexPC(Method* throw_method, uint32_t dex_pc)
34 SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_);
35
36// IllegalAccessError
37
38void ThrowIllegalAccessErrorClass(Class* referrer, Class* accessed)
39 SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_);
40
41void ThrowIllegalAccessErrorClassForMethodDispatch(Class* referrer, Class* accessed,
42 const Method* caller, const Method* called,
43 InvokeType type)
44 SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_);
45
46void ThrowIllegalAccessErrorMethod(Class* referrer, Method* accessed)
47 SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_);
48
49void ThrowIllegalAccessErrorField(Class* referrer, Field* accessed)
50 SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_);
51
52void ThrowIllegalAccessErrorFinalField(const Method* referrer, Field* accessed)
53 SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_);
54
55// IncompatibleClassChangeError
56
57void ThrowIncompatibleClassChangeError(InvokeType expected_type, InvokeType found_type,
58 Method* method, const Method* referrer)
59 SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_);
60
61void ThrowIncompatibleClassChangeErrorClassForInterfaceDispatch(const Method* interface_method,
62 Object* this_object,
63 const Method* referrer)
64 SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_);
65
66void ThrowIncompatibleClassChangeErrorField(const Field* resolved_field, bool is_static,
67 const Method* referrer)
68 SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_);
69
70// NoSuchMethodError
71
72void ThrowNoSuchMethodError(InvokeType type, Class* c, const StringPiece& name,
73 const StringPiece& signature, const Method* referrer)
74 SHARED_LOCKS_REQUIRED(GlobalSynchronization::mutator_lock_);
75
76void 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_