RFR: JDK-8323190: Segfault during deoptimization of C2-compiled code

Tobias Hartmann thartmann at openjdk.org
Wed Jan 10 08:03:28 UTC 2024


On Wed, 10 Jan 2024 01:22:37 GMT, Cesar Soares Lucas <cslucas at openjdk.org> wrote:

> Currently, if `ReduceAllocationMerges` reduces an allocation merge that is used as a monitor C2 will SIGFAULT in `Process_OopMap_Node` because it's missing code to handle that case.  This patch fixes C2 to properly handle reduced allocation merges that are used as monitors. 
> 
> Tested with Linux x86_64 hotspot_all.

Thanks for quickly jumping on this, Cesar!

The fix looks good to me. I also submitted testing and will report back once it passed.

It's concerning though that we don't have any other test covering this. Would it make sense to extend `AllocationMergesTests.java` to cover some more variants?

src/hotspot/share/opto/output.cpp line 1096:

> 1094: 
> 1095:           int merge_pointer_idx = smerge->merge_pointer_idx(youngest_jvms);
> 1096:           (void)FillLocArray(0, sfn, sfn->in(merge_pointer_idx), &deps, objs);

Suggestion:

          FillLocArray(0, sfn, sfn->in(merge_pointer_idx), &deps, objs);


Also below. I know that this is used in old code but I don't think it has any value.

test/hotspot/jtreg/compiler/escapeAnalysis/TestInvalidLocation.java line 2:

> 1: /* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
> 2:  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

Suggestion:

/* 
 * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

test/hotspot/jtreg/compiler/escapeAnalysis/TestInvalidLocation.java line 27:

> 25:  * @bug 8323190
> 26:  * @summary C2 Segfaults during code generation because of unhandled SafePointScalarMerge monitor debug info.
> 27:  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -Xcomp -Xbatch -XX:+ReduceAllocationMerges TestInvalidLocation

Suggestion:

 * @run main/othervm -XX:+UnlockDiagnosticVMOptions -Xcomp -XX:+ReduceAllocationMerges TestInvalidLocation


`-Xcomp` implies `-Xbatch`.

-------------

PR Review: https://git.openjdk.org/jdk/pull/17333#pullrequestreview-1812601748
PR Review Comment: https://git.openjdk.org/jdk/pull/17333#discussion_r1447003530
PR Review Comment: https://git.openjdk.org/jdk/pull/17333#discussion_r1447001783
PR Review Comment: https://git.openjdk.org/jdk/pull/17333#discussion_r1447002283


More information about the hotspot-compiler-dev mailing list