blob: e0766b6b9c1b7336f291b9d9f9359c480a6f8e88 [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)
Ian Rogersb726dcb2012-09-05 08:57:23 -070028 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers87e552d2012-08-31 15:54:48 -070029
Mathieu Chartier66f19252012-09-18 08:57:04 -070030void ThrowNullPointerExceptionForMethodAccess(AbstractMethod* caller, uint32_t method_idx, InvokeType type)
Ian Rogersb726dcb2012-09-05 08:57:23 -070031 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers87e552d2012-08-31 15:54:48 -070032
Mathieu Chartier66f19252012-09-18 08:57:04 -070033void ThrowNullPointerExceptionFromDexPC(AbstractMethod* throw_method, uint32_t dex_pc)
Ian Rogersb726dcb2012-09-05 08:57:23 -070034 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers87e552d2012-08-31 15:54:48 -070035
36// IllegalAccessError
37
38void ThrowIllegalAccessErrorClass(Class* referrer, Class* accessed)
Ian Rogersb726dcb2012-09-05 08:57:23 -070039 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers87e552d2012-08-31 15:54:48 -070040
41void ThrowIllegalAccessErrorClassForMethodDispatch(Class* referrer, Class* accessed,
Mathieu Chartier66f19252012-09-18 08:57:04 -070042 const AbstractMethod* caller, const AbstractMethod* called,
Ian Rogers87e552d2012-08-31 15:54:48 -070043 InvokeType type)
Ian Rogersb726dcb2012-09-05 08:57:23 -070044 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers87e552d2012-08-31 15:54:48 -070045
Mathieu Chartier66f19252012-09-18 08:57:04 -070046void ThrowIllegalAccessErrorMethod(Class* referrer, AbstractMethod* accessed)
Ian Rogersb726dcb2012-09-05 08:57:23 -070047 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers87e552d2012-08-31 15:54:48 -070048
49void ThrowIllegalAccessErrorField(Class* referrer, Field* accessed)
Ian Rogersb726dcb2012-09-05 08:57:23 -070050 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers87e552d2012-08-31 15:54:48 -070051
Mathieu Chartier66f19252012-09-18 08:57:04 -070052void ThrowIllegalAccessErrorFinalField(const AbstractMethod* referrer, Field* accessed)
Ian Rogersb726dcb2012-09-05 08:57:23 -070053 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers87e552d2012-08-31 15:54:48 -070054
55// IncompatibleClassChangeError
56
57void ThrowIncompatibleClassChangeError(InvokeType expected_type, InvokeType found_type,
Mathieu Chartier66f19252012-09-18 08:57:04 -070058 AbstractMethod* method, const AbstractMethod* referrer)
Ian Rogersb726dcb2012-09-05 08:57:23 -070059 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers87e552d2012-08-31 15:54:48 -070060
Mathieu Chartier66f19252012-09-18 08:57:04 -070061void ThrowIncompatibleClassChangeErrorClassForInterfaceDispatch(const AbstractMethod* interface_method,
Ian Rogers87e552d2012-08-31 15:54:48 -070062 Object* this_object,
Mathieu Chartier66f19252012-09-18 08:57:04 -070063 const AbstractMethod* referrer)
Ian Rogersb726dcb2012-09-05 08:57:23 -070064 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers87e552d2012-08-31 15:54:48 -070065
66void ThrowIncompatibleClassChangeErrorField(const Field* resolved_field, bool is_static,
Mathieu Chartier66f19252012-09-18 08:57:04 -070067 const AbstractMethod* referrer)
Ian Rogersb726dcb2012-09-05 08:57:23 -070068 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers87e552d2012-08-31 15:54:48 -070069
70// NoSuchMethodError
71
72void ThrowNoSuchMethodError(InvokeType type, Class* c, const StringPiece& name,
Mathieu Chartier66f19252012-09-18 08:57:04 -070073 const StringPiece& signature, const AbstractMethod* referrer)
Ian Rogersb726dcb2012-09-05 08:57:23 -070074 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers87e552d2012-08-31 15:54:48 -070075
Mathieu Chartier66f19252012-09-18 08:57:04 -070076void ThrowNoSuchMethodError(uint32_t method_idx, const AbstractMethod* referrer)
Ian Rogersb726dcb2012-09-05 08:57:23 -070077 SHARED_LOCKS_REQUIRED(Locks::mutator_lock_);
Ian Rogers87e552d2012-08-31 15:54:48 -070078
79} // namespace art
80
81#endif // ART_SRC_COMMON_THROWS_H_