Integrated: 8307521: Introduce check_oop infrastructure to check oops in the oop class
Stefan Karlsson
stefank at openjdk.org
Mon May 8 07:52:30 UTC 2023
On Fri, 5 May 2023 08:32:35 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:
> I'd like to add some extra verification to our C++ usages of oops. The intention is to quickly find when we are passing around an oop that wasn't fetched via a required load barrier. We have found this kind of verification crucial when developing Generational ZGC.
>
> My proposal is to hook into the CHECK_UNHANDLED_OOPS code, which is only compiled when building fastdebug builds. In release and slowdebug builds, `oops` are simple `oopDesc*`, but with CHECK_UNHANDLED_OOPS oop is a class where we can easily hook in verification code.
>
> The actual verification code is not included in the patch, but the required infrastructure is. Then when we deliver Generational ZGC, it will install a verification function pointer during initialization. See: https://github.com/openjdk/zgc/blob/349cf9ae38664991879402a90c5e23e291f1c1c3/src/hotspot/share/gc/z/zAddress.cpp#L92
>
>
> static void initialize_check_oop_function() {
> #ifdef CHECK_UNHANDLED_OOPS
> if (ZVerifyOops) {
> // Enable extra verification of usages of oops in oopsHierarchy.hpp
> check_oop_function = [](oopDesc* obj) {
> (void)to_zaddress(obj);
> };
> }
> #endif
> }
>
>
> We've separated out this code from the larger Generational ZGC PR, so that it can get a proper review without being hidden together with all other changes.
This pull request has now been integrated.
Changeset: 959e62ca
Author: Stefan Karlsson <stefank at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/959e62ca3ebce4025424a096dacfb3ca3b70d946
Stats: 26 lines in 2 files changed: 11 ins; 0 del; 15 mod
8307521: Introduce check_oop infrastructure to check oops in the oop class
Reviewed-by: eosterlund, aboldtch, coleenp
-------------
PR: https://git.openjdk.org/jdk/pull/13825
More information about the hotspot-dev
mailing list