1 /*
2 * Copyright (c) 2018, 2023, Red Hat, Inc. All rights reserved.
3 * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
938 mem_phi->init_req(_heap_stable, mem);
939
940 // Heap is unstable, call into clone barrier stub
941 Node* call = phase->make_leaf_call(unstable_ctrl, mem,
942 ShenandoahBarrierSetC2::clone_barrier_Type(),
943 CAST_FROM_FN_PTR(address, ShenandoahRuntime::clone_barrier),
944 "shenandoah_clone",
945 TypeRawPtr::BOTTOM,
946 src_base);
947 call = phase->transform_later(call);
948
949 ctrl = phase->transform_later(new ProjNode(call, TypeFunc::Control));
950 mem = phase->transform_later(new ProjNode(call, TypeFunc::Memory));
951 region->init_req(_heap_unstable, ctrl);
952 mem_phi->init_req(_heap_unstable, mem);
953
954 // Wire up the actual arraycopy stub now
955 ctrl = phase->transform_later(region);
956 mem = phase->transform_later(mem_phi);
957
958 const char* name = "arraycopy";
959 call = phase->make_leaf_call(ctrl, mem,
960 OptoRuntime::fast_arraycopy_Type(),
961 phase->basictype2arraycopy(T_LONG, nullptr, nullptr, true, name, true),
962 name, TypeRawPtr::BOTTOM,
963 src, dest, length
964 LP64_ONLY(COMMA phase->top()));
965 call = phase->transform_later(call);
966
967 // Hook up the whole thing into the graph
968 phase->igvn().replace_node(ac, call);
969 } else {
970 BarrierSetC2::clone_at_expansion(phase, ac);
971 }
972 }
973
974
975 // Support for macro expanded GC barriers
976 void ShenandoahBarrierSetC2::register_potential_barrier_node(Node* node) const {
977 if (node->Opcode() == Op_ShenandoahLoadReferenceBarrier) {
|
1 /*
2 * Copyright (c) 2018, 2026, Red Hat, Inc. All rights reserved.
3 * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
938 mem_phi->init_req(_heap_stable, mem);
939
940 // Heap is unstable, call into clone barrier stub
941 Node* call = phase->make_leaf_call(unstable_ctrl, mem,
942 ShenandoahBarrierSetC2::clone_barrier_Type(),
943 CAST_FROM_FN_PTR(address, ShenandoahRuntime::clone_barrier),
944 "shenandoah_clone",
945 TypeRawPtr::BOTTOM,
946 src_base);
947 call = phase->transform_later(call);
948
949 ctrl = phase->transform_later(new ProjNode(call, TypeFunc::Control));
950 mem = phase->transform_later(new ProjNode(call, TypeFunc::Memory));
951 region->init_req(_heap_unstable, ctrl);
952 mem_phi->init_req(_heap_unstable, mem);
953
954 // Wire up the actual arraycopy stub now
955 ctrl = phase->transform_later(region);
956 mem = phase->transform_later(mem_phi);
957
958 if (should_copy_int_prefix(phase, ac)) {
959 mem = arraycopy_copy_int_prefix(phase, ctrl, mem, src, dest);
960
961 // We've copied the prefix, bump the pointers.
962 src = phase->basic_plus_adr(src_base, src, BytesPerInt);
963 dest = phase->basic_plus_adr(dest_base, dest, BytesPerInt);
964 }
965
966 // Bulk copy.
967 const char* name = "arraycopy";
968 call = phase->make_leaf_call(ctrl, mem,
969 OptoRuntime::fast_arraycopy_Type(),
970 phase->basictype2arraycopy(T_LONG, nullptr, nullptr, true, name, true),
971 name, TypeRawPtr::BOTTOM,
972 src, dest, length
973 LP64_ONLY(COMMA phase->top()));
974 call = phase->transform_later(call);
975
976 // Hook up the whole thing into the graph
977 phase->igvn().replace_node(ac, call);
978 } else {
979 BarrierSetC2::clone_at_expansion(phase, ac);
980 }
981 }
982
983
984 // Support for macro expanded GC barriers
985 void ShenandoahBarrierSetC2::register_potential_barrier_node(Node* node) const {
986 if (node->Opcode() == Op_ShenandoahLoadReferenceBarrier) {
|