8317299: safepoint scalarization doesn't keep track of the depth of the JVM state

Reviewed-by: thartmann, vlivanov
This commit is contained in:
Damon Fenacci 2024-02-06 07:53:03 +00:00
parent 542b0b6656
commit 6d911f68a3
5 changed files with 22 additions and 9 deletions

View File

@ -1463,9 +1463,10 @@ void SafePointNode::disconnect_from_root(PhaseIterGVN *igvn) {
//============== SafePointScalarObjectNode ============== //============== SafePointScalarObjectNode ==============
SafePointScalarObjectNode::SafePointScalarObjectNode(const TypeOopPtr* tp, Node* alloc, uint first_index, uint n_fields) : SafePointScalarObjectNode::SafePointScalarObjectNode(const TypeOopPtr* tp, Node* alloc, uint first_index, uint depth, uint n_fields) :
TypeNode(tp, 1), // 1 control input -- seems required. Get from root. TypeNode(tp, 1), // 1 control input -- seems required. Get from root.
_first_index(first_index), _first_index(first_index),
_depth(depth),
_n_fields(n_fields), _n_fields(n_fields),
_alloc(alloc) _alloc(alloc)
{ {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -508,7 +508,7 @@ public:
class SafePointScalarObjectNode: public TypeNode { class SafePointScalarObjectNode: public TypeNode {
uint _first_index; // First input edge relative index of a SafePoint node where uint _first_index; // First input edge relative index of a SafePoint node where
// states of the scalarized object fields are collected. // states of the scalarized object fields are collected.
// It is relative to the last (youngest) jvms->_scloff. uint _depth; // Depth of the JVM state the _first_index field refers to
uint _n_fields; // Number of non-static fields of the scalarized object. uint _n_fields; // Number of non-static fields of the scalarized object.
Node* _alloc; // Just for debugging purposes. Node* _alloc; // Just for debugging purposes.
@ -519,7 +519,7 @@ class SafePointScalarObjectNode: public TypeNode {
uint first_index() const { return _first_index; } uint first_index() const { return _first_index; }
public: public:
SafePointScalarObjectNode(const TypeOopPtr* tp, Node* alloc, uint first_index, uint n_fields); SafePointScalarObjectNode(const TypeOopPtr* tp, Node* alloc, uint first_index, uint depth, uint n_fields);
virtual int Opcode() const; virtual int Opcode() const;
virtual uint ideal_reg() const; virtual uint ideal_reg() const;
@ -529,7 +529,7 @@ public:
uint first_index(JVMState* jvms) const { uint first_index(JVMState* jvms) const {
assert(jvms != nullptr, "missed JVMS"); assert(jvms != nullptr, "missed JVMS");
return jvms->scloff() + _first_index; return jvms->of_depth(_depth)->scloff() + _first_index;
} }
uint n_fields() const { return _n_fields; } uint n_fields() const { return _n_fields; }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -766,7 +766,7 @@ SafePointScalarObjectNode* PhaseMacroExpand::create_scalarized_object_descriptio
} }
} }
SafePointScalarObjectNode* sobj = new SafePointScalarObjectNode(res_type, alloc, first_ind, nfields); SafePointScalarObjectNode* sobj = new SafePointScalarObjectNode(res_type, alloc, first_ind, sfpt->jvms()->depth(), nfields);
sobj->init_req(0, C->root()); sobj->init_req(0, C->root());
transform_later(sobj); transform_later(sobj);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * 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) {
SafePointNode* sfpt = safepoints.pop()->as_SafePoint(); SafePointNode* sfpt = safepoints.pop()->as_SafePoint();
uint first_ind = (sfpt->req() - sfpt->jvms()->scloff()); uint first_ind = (sfpt->req() - sfpt->jvms()->scloff());
Node* sobj = new SafePointScalarObjectNode(vec_box->box_type(), vec_box, first_ind, n_fields); Node* sobj = new SafePointScalarObjectNode(vec_box->box_type(), vec_box, first_ind, sfpt->jvms()->depth(), n_fields);
sobj->init_req(0, C->root()); sobj->init_req(0, C->root());
sfpt->add_req(vec_value); sfpt->add_req(vec_value);

View File

@ -1,5 +1,6 @@
/* /*
* Copyright (C) 2021, 2022, THL A29 Limited, a Tencent company. All rights reserved. * Copyright (C) 2021, 2022, THL A29 Limited, a Tencent company. All rights reserved.
* Copyright (c) 2024 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -36,6 +37,17 @@ import java.nio.ByteOrder;
* -XX:-TieredCompilation compiler.vectorapi.TestIntrinsicBailOut * -XX:-TieredCompilation compiler.vectorapi.TestIntrinsicBailOut
*/ */
/*
* @test
* @bug 8317299
* @summary Vector API intrinsincs should handle JVM state correctly whith late inlining when compiling with -InlineUnsafeOps
* @modules jdk.incubator.vector
* @requires vm.cpu.features ~= ".*avx512.*"
* @run main/othervm -Xcomp -XX:+UnlockDiagnosticVMOptions -XX:-InlineUnsafeOps -XX:+IgnoreUnrecognizedVMOptions -XX:UseAVX=3
* -XX:CompileCommand=compileonly,compiler.vectorapi.TestIntrinsicBailOut::test -XX:CompileCommand=quiet
* -XX:-TieredCompilation compiler.vectorapi.TestIntrinsicBailOut
*/
public class TestIntrinsicBailOut { public class TestIntrinsicBailOut {
static final VectorSpecies<Double> SPECIES256 = DoubleVector.SPECIES_256; static final VectorSpecies<Double> SPECIES256 = DoubleVector.SPECIES_256;