Integrated: JDK-8317502 Add asserts to check for non-null in ciInstance::java_lang_Class_klass
Damon Fenacci
dfenacci at openjdk.org
Fri Oct 6 11:03:28 UTC 2023
On Wed, 4 Oct 2023 13:10:53 GMT, Damon Fenacci <dfenacci at openjdk.org> wrote:
> `ciInstance::java_lang_Class_klass` and `ciTypeArrayKlass::make_impl` could potentially return a `null` pointer (solely based on the code). A static code analyzer found out that in other places in the code this could potentially lead to a null pointer dereferencing. However we know that this will never happen: `java_lang_Class::as_Klass(get_oop())` cannot be null and neither can `Universe::typeArrayKlassObj(t)` (there is already an explicit assert in `typeArrayKlassObj`).
>
> So, this change adds an assert in `ciInstance::java_lang_Class_klass` ensuring that `java_lang_Class::as_Klass(get_oop())` don't return `nullptr` (no assert in `ciTypeArrayKlass::make_impl` as `Universe::typeArrayKlassObj(t)`already includes one for `_typeArrayKlassObjs[t] != nullptr`).
This pull request has now been integrated.
Changeset: f0d66d1f
Author: Damon Fenacci <dfenacci at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/f0d66d1fd3fad3baea893423f63c739682955834
Stats: 1 line in 1 file changed: 1 ins; 0 del; 0 mod
8317502: Add asserts to check for non-null in ciInstance::java_lang_Class_klass
Reviewed-by: kvn, thartmann
-------------
PR: https://git.openjdk.org/jdk/pull/16038
More information about the hotspot-compiler-dev
mailing list