RFR: 8307521: Introduce check_oop infrastructure to check oops in the oop class
Coleen Phillimore
coleenp at openjdk.org
Fri May 5 14:58:33 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.
Looks fine.
-------------
Marked as reviewed by coleenp (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/13825#pullrequestreview-1414958102
More information about the hotspot-dev
mailing list