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 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 17 | #ifndef ART_RUNTIME_COMMON_THROWS_H_ |
| 18 | #define ART_RUNTIME_COMMON_THROWS_H_ |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 19 | |
Vladimir Marko | 7210108 | 2019-02-05 16:16:30 +0000 | [diff] [blame] | 20 | #include <string_view> |
| 21 | |
Andreas Gampe | 7fbc4a5 | 2018-11-28 08:26:47 -0800 | [diff] [blame] | 22 | #include "base/locks.h" |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 23 | #include "obj_ptr.h" |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 24 | |
| 25 | namespace art { |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 26 | namespace mirror { |
Igor Murashkin | 2ffb703 | 2017-11-08 13:35:21 -0800 | [diff] [blame] | 27 | class Class; |
| 28 | class Object; |
| 29 | class MethodType; |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 30 | } // namespace mirror |
Mathieu Chartier | c785344 | 2015-03-27 14:35:38 -0700 | [diff] [blame] | 31 | class ArtField; |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 32 | class ArtMethod; |
Alex Light | 705ad49 | 2015-09-21 11:36:30 -0700 | [diff] [blame] | 33 | class DexFile; |
Andreas Gampe | 04c6ab9 | 2017-06-08 21:49:14 -0700 | [diff] [blame] | 34 | enum InvokeType : uint32_t; |
Ian Rogers | d91d6d6 | 2013-09-25 20:26:14 -0700 | [diff] [blame] | 35 | class Signature; |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 36 | |
Sebastien Hertz | 56adf60 | 2013-07-09 17:27:07 +0200 | [diff] [blame] | 37 | // AbstractMethodError |
| 38 | |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 39 | void ThrowAbstractMethodError(ArtMethod* method) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 40 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Sebastien Hertz | 56adf60 | 2013-07-09 17:27:07 +0200 | [diff] [blame] | 41 | |
Alex Light | 705ad49 | 2015-09-21 11:36:30 -0700 | [diff] [blame] | 42 | void ThrowAbstractMethodError(uint32_t method_idx, const DexFile& dex_file) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 43 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Alex Light | 705ad49 | 2015-09-21 11:36:30 -0700 | [diff] [blame] | 44 | |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 45 | // ArithmeticException |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 46 | |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 47 | void ThrowArithmeticExceptionDivideByZero() REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 48 | |
| 49 | // ArrayIndexOutOfBoundsException |
| 50 | |
| 51 | void ThrowArrayIndexOutOfBoundsException(int index, int length) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 52 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 53 | |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 54 | // ArrayStoreException |
| 55 | |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 56 | void ThrowArrayStoreException(ObjPtr<mirror::Class> element_class, |
| 57 | ObjPtr<mirror::Class> array_class) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 58 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 59 | |
Orion Hodson | c069a30 | 2017-01-18 09:23:12 +0000 | [diff] [blame] | 60 | // BootstrapMethodError |
| 61 | |
| 62 | void ThrowBootstrapMethodError(const char* fmt, ...) |
| 63 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
| 64 | |
| 65 | void ThrowWrappedBootstrapMethodError(const char* fmt, ...) |
| 66 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
| 67 | |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 68 | // ClassCircularityError |
| 69 | |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 70 | void ThrowClassCircularityError(ObjPtr<mirror::Class> c) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 71 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 72 | |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 73 | void ThrowClassCircularityError(ObjPtr<mirror::Class> c, const char* fmt, ...) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 74 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Roland Levillain | 989ab3b | 2016-05-18 15:52:54 +0100 | [diff] [blame] | 75 | |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 76 | // ClassCastException |
| 77 | |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 78 | void ThrowClassCastException(ObjPtr<mirror::Class> dest_type, ObjPtr<mirror::Class> src_type) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 79 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 80 | |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 81 | void ThrowClassCastException(const char* msg) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 82 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 83 | |
| 84 | // ClassFormatError |
| 85 | |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 86 | void ThrowClassFormatError(ObjPtr<mirror::Class> referrer, const char* fmt, ...) |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 87 | __attribute__((__format__(__printf__, 2, 3))) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 88 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 89 | |
| 90 | // IllegalAccessError |
| 91 | |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 92 | void ThrowIllegalAccessErrorClass(ObjPtr<mirror::Class> referrer, ObjPtr<mirror::Class> accessed) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 93 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 94 | |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 95 | void ThrowIllegalAccessErrorClassForMethodDispatch(ObjPtr<mirror::Class> referrer, |
| 96 | ObjPtr<mirror::Class> accessed, |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 97 | ArtMethod* called, |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 98 | InvokeType type) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 99 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 100 | |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 101 | void ThrowIllegalAccessErrorMethod(ObjPtr<mirror::Class> referrer, ArtMethod* accessed) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 102 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 103 | |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 104 | void ThrowIllegalAccessErrorField(ObjPtr<mirror::Class> referrer, ArtField* accessed) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 105 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 106 | |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 107 | void ThrowIllegalAccessErrorFinalField(ArtMethod* referrer, ArtField* accessed) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 108 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 109 | |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 110 | void ThrowIllegalAccessError(ObjPtr<mirror::Class> referrer, const char* fmt, ...) |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 111 | __attribute__((__format__(__printf__, 2, 3))) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 112 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 113 | |
Jeff Hao | 11d5d8f | 2014-03-26 15:08:20 -0700 | [diff] [blame] | 114 | // IllegalAccessException |
| 115 | |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 116 | void ThrowIllegalAccessException(const char* msg) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 117 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Jeff Hao | 11d5d8f | 2014-03-26 15:08:20 -0700 | [diff] [blame] | 118 | |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 119 | // IllegalArgumentException |
| 120 | |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 121 | void ThrowIllegalArgumentException(const char* msg) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 122 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 123 | |
Orion Hodson | 928033d | 2018-02-07 05:30:54 +0000 | [diff] [blame] | 124 | // IllegalAccessException |
| 125 | |
| 126 | void ThrowIllegalStateException(const char* msg) |
| 127 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
| 128 | |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 129 | // IncompatibleClassChangeError |
| 130 | |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 131 | void ThrowIncompatibleClassChangeError(InvokeType expected_type, |
| 132 | InvokeType found_type, |
| 133 | ArtMethod* method, |
| 134 | ArtMethod* referrer) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 135 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 136 | |
Alex Light | 705ad49 | 2015-09-21 11:36:30 -0700 | [diff] [blame] | 137 | void ThrowIncompatibleClassChangeErrorClassForInterfaceSuper(ArtMethod* method, |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 138 | ObjPtr<mirror::Class> target_class, |
| 139 | ObjPtr<mirror::Object> this_object, |
Alex Light | 705ad49 | 2015-09-21 11:36:30 -0700 | [diff] [blame] | 140 | ArtMethod* referrer) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 141 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Alex Light | 705ad49 | 2015-09-21 11:36:30 -0700 | [diff] [blame] | 142 | |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 143 | void ThrowIncompatibleClassChangeErrorClassForInterfaceDispatch(ArtMethod* interface_method, |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 144 | ObjPtr<mirror::Object> this_object, |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 145 | ArtMethod* referrer) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 146 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 147 | |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 148 | void ThrowIncompatibleClassChangeErrorField(ArtField* resolved_field, |
| 149 | bool is_static, |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 150 | ArtMethod* referrer) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 151 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 152 | |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 153 | void ThrowIncompatibleClassChangeError(ObjPtr<mirror::Class> referrer, const char* fmt, ...) |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 154 | __attribute__((__format__(__printf__, 2, 3))) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 155 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 8d31bbd | 2013-10-13 10:44:14 -0700 | [diff] [blame] | 156 | |
Alex Light | 9139e00 | 2015-10-09 15:59:48 -0700 | [diff] [blame] | 157 | void ThrowIncompatibleClassChangeErrorForMethodConflict(ArtMethod* method) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 158 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Alex Light | 9139e00 | 2015-10-09 15:59:48 -0700 | [diff] [blame] | 159 | |
Orion Hodson | 928033d | 2018-02-07 05:30:54 +0000 | [diff] [blame] | 160 | // IndexOutOfBoundsException |
| 161 | |
| 162 | void ThrowIndexOutOfBoundsException(int index, int length) |
| 163 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
| 164 | |
Alex Light | db01a09 | 2017-04-03 15:39:55 -0700 | [diff] [blame] | 165 | // InternalError |
| 166 | |
| 167 | void ThrowInternalError(const char* fmt, ...) |
| 168 | __attribute__((__format__(__printf__, 1, 2))) |
| 169 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
| 170 | |
Ian Rogers | 8d31bbd | 2013-10-13 10:44:14 -0700 | [diff] [blame] | 171 | // IOException |
| 172 | |
| 173 | void ThrowIOException(const char* fmt, ...) __attribute__((__format__(__printf__, 1, 2))) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 174 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 175 | |
Andreas Gampe | 329d188 | 2014-04-08 10:32:19 -0700 | [diff] [blame] | 176 | void ThrowWrappedIOException(const char* fmt, ...) __attribute__((__format__(__printf__, 1, 2))) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 177 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Andreas Gampe | 329d188 | 2014-04-08 10:32:19 -0700 | [diff] [blame] | 178 | |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 179 | // LinkageError |
| 180 | |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 181 | void ThrowLinkageError(ObjPtr<mirror::Class> referrer, const char* fmt, ...) |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 182 | __attribute__((__format__(__printf__, 2, 3))) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 183 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 184 | |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 185 | void ThrowWrappedLinkageError(ObjPtr<mirror::Class> referrer, const char* fmt, ...) |
Vladimir Marko | d5e5a0e | 2015-05-08 12:26:59 +0100 | [diff] [blame] | 186 | __attribute__((__format__(__printf__, 2, 3))) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 187 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Vladimir Marko | d5e5a0e | 2015-05-08 12:26:59 +0100 | [diff] [blame] | 188 | |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 189 | // NegativeArraySizeException |
| 190 | |
Ian Rogers | 8d31bbd | 2013-10-13 10:44:14 -0700 | [diff] [blame] | 191 | void ThrowNegativeArraySizeException(int size) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 192 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 193 | |
Ian Rogers | 8d31bbd | 2013-10-13 10:44:14 -0700 | [diff] [blame] | 194 | void ThrowNegativeArraySizeException(const char* msg) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 195 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 196 | |
| 197 | |
| 198 | // NoSuchFieldError |
| 199 | |
Vladimir Marko | 7210108 | 2019-02-05 16:16:30 +0000 | [diff] [blame] | 200 | void ThrowNoSuchFieldError(std::string_view scope, |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 201 | ObjPtr<mirror::Class> c, |
Vladimir Marko | 7210108 | 2019-02-05 16:16:30 +0000 | [diff] [blame] | 202 | std::string_view type, |
| 203 | std::string_view name) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 204 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 205 | |
Vladimir Marko | 7210108 | 2019-02-05 16:16:30 +0000 | [diff] [blame] | 206 | void ThrowNoSuchFieldException(ObjPtr<mirror::Class> c, std::string_view name) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 207 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Mathieu Chartier | 4e06778 | 2015-05-13 13:13:24 -0700 | [diff] [blame] | 208 | |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 209 | // NoSuchMethodError |
| 210 | |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 211 | void ThrowNoSuchMethodError(InvokeType type, |
| 212 | ObjPtr<mirror::Class> c, |
Vladimir Marko | 7210108 | 2019-02-05 16:16:30 +0000 | [diff] [blame] | 213 | std::string_view name, |
Ian Rogers | d91d6d6 | 2013-09-25 20:26:14 -0700 | [diff] [blame] | 214 | const Signature& signature) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 215 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 216 | |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 217 | // NullPointerException |
| 218 | |
Mathieu Chartier | c785344 | 2015-03-27 14:35:38 -0700 | [diff] [blame] | 219 | void ThrowNullPointerExceptionForFieldAccess(ArtField* field, |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 220 | bool is_read) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 221 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 222 | |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 223 | void ThrowNullPointerExceptionForMethodAccess(uint32_t method_idx, |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 224 | InvokeType type) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 225 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 226 | |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 227 | void ThrowNullPointerExceptionForMethodAccess(ArtMethod* method, |
Sebastien Hertz | 2d6ba51 | 2013-05-17 11:31:37 +0200 | [diff] [blame] | 228 | InvokeType type) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 229 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Sebastien Hertz | 2d6ba51 | 2013-05-17 11:31:37 +0200 | [diff] [blame] | 230 | |
Nicolas Geoffray | e8e1127 | 2016-06-28 18:08:46 +0100 | [diff] [blame] | 231 | void ThrowNullPointerExceptionFromDexPC(bool check_address = false, uintptr_t addr = 0) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 232 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 233 | |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 234 | void ThrowNullPointerException(const char* msg) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 235 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 236 | |
Nicolas Geoffray | 635967b | 2019-08-07 10:15:39 +0100 | [diff] [blame] | 237 | void ThrowNullPointerException() |
| 238 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
| 239 | |
Orion Hodson | 928033d | 2018-02-07 05:30:54 +0000 | [diff] [blame] | 240 | // ReadOnlyBufferException |
| 241 | |
| 242 | void ThrowReadOnlyBufferException() REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
| 243 | |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 244 | // RuntimeException |
| 245 | |
| 246 | void ThrowRuntimeException(const char* fmt, ...) |
| 247 | __attribute__((__format__(__printf__, 1, 2))) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 248 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 249 | |
Leonard Mosescu | eb84221 | 2016-10-06 17:26:36 -0700 | [diff] [blame] | 250 | // SecurityException |
| 251 | |
| 252 | void ThrowSecurityException(const char* fmt, ...) |
| 253 | __attribute__((__format__(__printf__, 1, 2))) |
| 254 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
| 255 | |
Andreas Gampe | 103992b | 2016-01-04 15:32:43 -0800 | [diff] [blame] | 256 | // Stack overflow. |
| 257 | |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 258 | void ThrowStackOverflowError(Thread* self) REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Andreas Gampe | 103992b | 2016-01-04 15:32:43 -0800 | [diff] [blame] | 259 | |
Vladimir Marko | 87f3fcb | 2016-04-28 15:52:11 +0100 | [diff] [blame] | 260 | // StringIndexOutOfBoundsException |
| 261 | |
| 262 | void ThrowStringIndexOutOfBoundsException(int index, int length) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 263 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Vladimir Marko | 87f3fcb | 2016-04-28 15:52:11 +0100 | [diff] [blame] | 264 | |
Orion Hodson | 928033d | 2018-02-07 05:30:54 +0000 | [diff] [blame] | 265 | // UnsupportedOperationException |
| 266 | |
| 267 | void ThrowUnsupportedOperationException() REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
| 268 | |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 269 | // VerifyError |
| 270 | |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 271 | void ThrowVerifyError(ObjPtr<mirror::Class> referrer, const char* fmt, ...) |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 272 | __attribute__((__format__(__printf__, 2, 3))) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 273 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 274 | |
Orion Hodson | c069a30 | 2017-01-18 09:23:12 +0000 | [diff] [blame] | 275 | // WrongMethodTypeException |
Orion Hodson | 928033d | 2018-02-07 05:30:54 +0000 | [diff] [blame] | 276 | |
Orion Hodson | a5dca52 | 2018-02-27 12:42:11 +0000 | [diff] [blame] | 277 | void ThrowWrongMethodTypeException(ObjPtr<mirror::MethodType> callee_type, |
| 278 | ObjPtr<mirror::MethodType> callsite_type) |
Narayan Kamath | 208f857 | 2016-08-03 12:46:58 +0100 | [diff] [blame] | 279 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
| 280 | |
Orion Hodson | 3f38346 | 2018-05-17 14:03:39 +0100 | [diff] [blame] | 281 | void ThrowWrongMethodTypeException(const std::string& expected_descriptor, |
| 282 | const std::string& actual_descriptor) |
| 283 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
| 284 | |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 285 | } // namespace art |
| 286 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 287 | #endif // ART_RUNTIME_COMMON_THROWS_H_ |