Skip to content

Commit 8317507

Browse files
dafedafepull[bot]
authored andcommitted
8317299: safepoint scalarization doesn't keep track of the depth of the JVM state
Reviewed-by: thartmann, vlivanov
1 parent b60da37 commit 8317507

File tree

5 files changed

+22
-9
lines changed

5 files changed

+22
-9
lines changed

src/hotspot/share/opto/callnode.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1463,9 +1463,10 @@ void SafePointNode::disconnect_from_root(PhaseIterGVN *igvn) {
14631463

14641464
//============== SafePointScalarObjectNode ==============
14651465

1466-
SafePointScalarObjectNode::SafePointScalarObjectNode(const TypeOopPtr* tp, Node* alloc, uint first_index, uint n_fields) :
1466+
SafePointScalarObjectNode::SafePointScalarObjectNode(const TypeOopPtr* tp, Node* alloc, uint first_index, uint depth, uint n_fields) :
14671467
TypeNode(tp, 1), // 1 control input -- seems required. Get from root.
14681468
_first_index(first_index),
1469+
_depth(depth),
14691470
_n_fields(n_fields),
14701471
_alloc(alloc)
14711472
{

src/hotspot/share/opto/callnode.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -508,7 +508,7 @@ class SafePointNode : public MultiNode {
508508
class SafePointScalarObjectNode: public TypeNode {
509509
uint _first_index; // First input edge relative index of a SafePoint node where
510510
// states of the scalarized object fields are collected.
511-
// It is relative to the last (youngest) jvms->_scloff.
511+
uint _depth; // Depth of the JVM state the _first_index field refers to
512512
uint _n_fields; // Number of non-static fields of the scalarized object.
513513

514514
Node* _alloc; // Just for debugging purposes.
@@ -519,7 +519,7 @@ class SafePointScalarObjectNode: public TypeNode {
519519
uint first_index() const { return _first_index; }
520520

521521
public:
522-
SafePointScalarObjectNode(const TypeOopPtr* tp, Node* alloc, uint first_index, uint n_fields);
522+
SafePointScalarObjectNode(const TypeOopPtr* tp, Node* alloc, uint first_index, uint depth, uint n_fields);
523523

524524
virtual int Opcode() const;
525525
virtual uint ideal_reg() const;
@@ -529,7 +529,7 @@ class SafePointScalarObjectNode: public TypeNode {
529529

530530
uint first_index(JVMState* jvms) const {
531531
assert(jvms != nullptr, "missed JVMS");
532-
return jvms->scloff() + _first_index;
532+
return jvms->of_depth(_depth)->scloff() + _first_index;
533533
}
534534
uint n_fields() const { return _n_fields; }
535535

src/hotspot/share/opto/macro.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -766,7 +766,7 @@ SafePointScalarObjectNode* PhaseMacroExpand::create_scalarized_object_descriptio
766766
}
767767
}
768768

769-
SafePointScalarObjectNode* sobj = new SafePointScalarObjectNode(res_type, alloc, first_ind, nfields);
769+
SafePointScalarObjectNode* sobj = new SafePointScalarObjectNode(res_type, alloc, first_ind, sfpt->jvms()->depth(), nfields);
770770
sobj->init_req(0, C->root());
771771
transform_later(sobj);
772772

src/hotspot/share/opto/vector.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -276,7 +276,7 @@ void PhaseVector::scalarize_vbox_node(VectorBoxNode* vec_box) {
276276
SafePointNode* sfpt = safepoints.pop()->as_SafePoint();
277277

278278
uint first_ind = (sfpt->req() - sfpt->jvms()->scloff());
279-
Node* sobj = new SafePointScalarObjectNode(vec_box->box_type(), vec_box, first_ind, n_fields);
279+
Node* sobj = new SafePointScalarObjectNode(vec_box->box_type(), vec_box, first_ind, sfpt->jvms()->depth(), n_fields);
280280
sobj->init_req(0, C->root());
281281
sfpt->add_req(vec_value);
282282

test/hotspot/jtreg/compiler/vectorapi/TestIntrinsicBailOut.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*
22
* Copyright (C) 2021, 2022, THL A29 Limited, a Tencent company. All rights reserved.
3+
* Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved.
34
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
45
*
56
* This code is free software; you can redistribute it and/or modify it
@@ -36,6 +37,17 @@
3637
* -XX:-TieredCompilation compiler.vectorapi.TestIntrinsicBailOut
3738
*/
3839

40+
/*
41+
* @test
42+
* @bug 8317299
43+
* @summary Vector API intrinsincs should handle JVM state correctly whith late inlining when compiling with -InlineUnsafeOps
44+
* @modules jdk.incubator.vector
45+
* @requires vm.cpu.features ~= ".*avx512.*"
46+
* @run main/othervm -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:-InlineUnsafeOps -XX:+IgnoreUnrecognizedVMOptions -XX:UseAVX=3
47+
* -XX:CompileCommand=compileonly,compiler.vectorapi.TestIntrinsicBailOut::test -XX:CompileCommand=quiet
48+
* -XX:-TieredCompilation compiler.vectorapi.TestIntrinsicBailOut
49+
*/
50+
3951

4052
public class TestIntrinsicBailOut {
4153
static final VectorSpecies<Double> SPECIES256 = DoubleVector.SPECIES_256;

0 commit comments

Comments
 (0)