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 | |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 137 | void ThrowIncompatibleClassChangeErrorClassForInterfaceDispatch(ArtMethod* interface_method, |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 138 | ObjPtr<mirror::Object> this_object, |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 139 | ArtMethod* referrer) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 140 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 141 | |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 142 | void ThrowIncompatibleClassChangeErrorField(ArtField* resolved_field, |
| 143 | bool is_static, |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 144 | ArtMethod* referrer) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 145 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 146 | |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 147 | void ThrowIncompatibleClassChangeError(ObjPtr<mirror::Class> referrer, const char* fmt, ...) |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 148 | __attribute__((__format__(__printf__, 2, 3))) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 149 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 8d31bbd | 2013-10-13 10:44:14 -0700 | [diff] [blame] | 150 | |
Alex Light | 9139e00 | 2015-10-09 15:59:48 -0700 | [diff] [blame] | 151 | void ThrowIncompatibleClassChangeErrorForMethodConflict(ArtMethod* method) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 152 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Alex Light | 9139e00 | 2015-10-09 15:59:48 -0700 | [diff] [blame] | 153 | |
Orion Hodson | 928033d | 2018-02-07 05:30:54 +0000 | [diff] [blame] | 154 | // IndexOutOfBoundsException |
| 155 | |
| 156 | void ThrowIndexOutOfBoundsException(int index, int length) |
| 157 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
| 158 | |
Alex Light | db01a09 | 2017-04-03 15:39:55 -0700 | [diff] [blame] | 159 | // InternalError |
| 160 | |
| 161 | void ThrowInternalError(const char* fmt, ...) |
| 162 | __attribute__((__format__(__printf__, 1, 2))) |
| 163 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
| 164 | |
Ian Rogers | 8d31bbd | 2013-10-13 10:44:14 -0700 | [diff] [blame] | 165 | // IOException |
| 166 | |
| 167 | void ThrowIOException(const char* fmt, ...) __attribute__((__format__(__printf__, 1, 2))) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 168 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 169 | |
Andreas Gampe | 329d188 | 2014-04-08 10:32:19 -0700 | [diff] [blame] | 170 | void ThrowWrappedIOException(const char* fmt, ...) __attribute__((__format__(__printf__, 1, 2))) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 171 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Andreas Gampe | 329d188 | 2014-04-08 10:32:19 -0700 | [diff] [blame] | 172 | |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 173 | // LinkageError |
| 174 | |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 175 | void ThrowLinkageError(ObjPtr<mirror::Class> referrer, const char* fmt, ...) |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 176 | __attribute__((__format__(__printf__, 2, 3))) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 177 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 178 | |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 179 | void ThrowWrappedLinkageError(ObjPtr<mirror::Class> referrer, const char* fmt, ...) |
Vladimir Marko | d5e5a0e | 2015-05-08 12:26:59 +0100 | [diff] [blame] | 180 | __attribute__((__format__(__printf__, 2, 3))) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 181 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Vladimir Marko | d5e5a0e | 2015-05-08 12:26:59 +0100 | [diff] [blame] | 182 | |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 183 | // NegativeArraySizeException |
| 184 | |
Ian Rogers | 8d31bbd | 2013-10-13 10:44:14 -0700 | [diff] [blame] | 185 | void ThrowNegativeArraySizeException(int size) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 186 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 187 | |
Ian Rogers | 8d31bbd | 2013-10-13 10:44:14 -0700 | [diff] [blame] | 188 | void ThrowNegativeArraySizeException(const char* msg) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 189 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 190 | |
| 191 | |
| 192 | // NoSuchFieldError |
| 193 | |
Vladimir Marko | 7210108 | 2019-02-05 16:16:30 +0000 | [diff] [blame] | 194 | void ThrowNoSuchFieldError(std::string_view scope, |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 195 | ObjPtr<mirror::Class> c, |
Vladimir Marko | 7210108 | 2019-02-05 16:16:30 +0000 | [diff] [blame] | 196 | std::string_view type, |
| 197 | std::string_view name) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 198 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 199 | |
Vladimir Marko | 7210108 | 2019-02-05 16:16:30 +0000 | [diff] [blame] | 200 | void ThrowNoSuchFieldException(ObjPtr<mirror::Class> c, std::string_view name) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 201 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Mathieu Chartier | 4e06778 | 2015-05-13 13:13:24 -0700 | [diff] [blame] | 202 | |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 203 | // NoSuchMethodError |
| 204 | |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 205 | void ThrowNoSuchMethodError(InvokeType type, |
| 206 | ObjPtr<mirror::Class> c, |
Vladimir Marko | 7210108 | 2019-02-05 16:16:30 +0000 | [diff] [blame] | 207 | std::string_view name, |
Ian Rogers | d91d6d6 | 2013-09-25 20:26:14 -0700 | [diff] [blame] | 208 | const Signature& signature) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 209 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 210 | |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 211 | // NullPointerException |
| 212 | |
Santiago Aboy Solanes | 14e8d64 | 2022-02-04 14:15:01 +0000 | [diff] [blame] | 213 | void ThrowNullPointerExceptionForFieldAccess(ArtField* field, ArtMethod* method, bool is_read) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 214 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 215 | |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 216 | void ThrowNullPointerExceptionForMethodAccess(uint32_t method_idx, |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 217 | InvokeType type) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 218 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 219 | |
Mathieu Chartier | e401d14 | 2015-04-22 13:56:20 -0700 | [diff] [blame] | 220 | void ThrowNullPointerExceptionForMethodAccess(ArtMethod* method, |
Sebastien Hertz | 2d6ba51 | 2013-05-17 11:31:37 +0200 | [diff] [blame] | 221 | InvokeType type) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 222 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Sebastien Hertz | 2d6ba51 | 2013-05-17 11:31:37 +0200 | [diff] [blame] | 223 | |
Nicolas Geoffray | e8e1127 | 2016-06-28 18:08:46 +0100 | [diff] [blame] | 224 | void ThrowNullPointerExceptionFromDexPC(bool check_address = false, uintptr_t addr = 0) |
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 | |
Nicolas Geoffray | 0aa50ce | 2015-03-10 11:03:29 +0000 | [diff] [blame] | 227 | void ThrowNullPointerException(const char* msg) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 228 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 229 | |
Nicolas Geoffray | 635967b | 2019-08-07 10:15:39 +0100 | [diff] [blame] | 230 | void ThrowNullPointerException() |
| 231 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
| 232 | |
Orion Hodson | 928033d | 2018-02-07 05:30:54 +0000 | [diff] [blame] | 233 | // ReadOnlyBufferException |
| 234 | |
| 235 | void ThrowReadOnlyBufferException() REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
| 236 | |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 237 | // RuntimeException |
| 238 | |
| 239 | void ThrowRuntimeException(const char* fmt, ...) |
| 240 | __attribute__((__format__(__printf__, 1, 2))) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 241 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 242 | |
Leonard Mosescu | eb84221 | 2016-10-06 17:26:36 -0700 | [diff] [blame] | 243 | // SecurityException |
| 244 | |
| 245 | void ThrowSecurityException(const char* fmt, ...) |
| 246 | __attribute__((__format__(__printf__, 1, 2))) |
| 247 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
| 248 | |
Andreas Gampe | 103992b | 2016-01-04 15:32:43 -0800 | [diff] [blame] | 249 | // Stack overflow. |
| 250 | |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 251 | void ThrowStackOverflowError(Thread* self) REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Andreas Gampe | 103992b | 2016-01-04 15:32:43 -0800 | [diff] [blame] | 252 | |
Vladimir Marko | 87f3fcb | 2016-04-28 15:52:11 +0100 | [diff] [blame] | 253 | // StringIndexOutOfBoundsException |
| 254 | |
| 255 | void ThrowStringIndexOutOfBoundsException(int index, int length) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 256 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Vladimir Marko | 87f3fcb | 2016-04-28 15:52:11 +0100 | [diff] [blame] | 257 | |
Orion Hodson | 928033d | 2018-02-07 05:30:54 +0000 | [diff] [blame] | 258 | // UnsupportedOperationException |
| 259 | |
| 260 | void ThrowUnsupportedOperationException() REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
| 261 | |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 262 | // VerifyError |
| 263 | |
Mathieu Chartier | 6b3d12b | 2016-10-13 13:59:58 -0700 | [diff] [blame] | 264 | void ThrowVerifyError(ObjPtr<mirror::Class> referrer, const char* fmt, ...) |
Ian Rogers | 62d6c77 | 2013-02-27 08:32:07 -0800 | [diff] [blame] | 265 | __attribute__((__format__(__printf__, 2, 3))) |
Andreas Gampe | bdf7f1c | 2016-08-30 16:38:47 -0700 | [diff] [blame] | 266 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 267 | |
Orion Hodson | c069a30 | 2017-01-18 09:23:12 +0000 | [diff] [blame] | 268 | // WrongMethodTypeException |
Orion Hodson | 928033d | 2018-02-07 05:30:54 +0000 | [diff] [blame] | 269 | |
Orion Hodson | a5dca52 | 2018-02-27 12:42:11 +0000 | [diff] [blame] | 270 | void ThrowWrongMethodTypeException(ObjPtr<mirror::MethodType> callee_type, |
| 271 | ObjPtr<mirror::MethodType> callsite_type) |
Narayan Kamath | 208f857 | 2016-08-03 12:46:58 +0100 | [diff] [blame] | 272 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
| 273 | |
Orion Hodson | 3f38346 | 2018-05-17 14:03:39 +0100 | [diff] [blame] | 274 | void ThrowWrongMethodTypeException(const std::string& expected_descriptor, |
| 275 | const std::string& actual_descriptor) |
| 276 | REQUIRES_SHARED(Locks::mutator_lock_) COLD_ATTR; |
| 277 | |
Ian Rogers | 87e552d | 2012-08-31 15:54:48 -0700 | [diff] [blame] | 278 | } // namespace art |
| 279 | |
Brian Carlstrom | fc0e321 | 2013-07-17 14:40:12 -0700 | [diff] [blame] | 280 | #endif // ART_RUNTIME_COMMON_THROWS_H_ |