Skip to content

Commit e210c55

Browse files
committed
Basic RISC-V fast path structure
1 parent bcbf324 commit e210c55

File tree

5 files changed

+118
-12
lines changed

5 files changed

+118
-12
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*
23+
*/
24+
#include "precompiled.hpp"
25+
#include "asm/macroAssembler.inline.hpp"
26+
#include "interpreter/interp_masm.hpp"
27+
#include "mmtkBarrierSet.hpp"
28+
#include "mmtkBarrierSetAssembler_riscv.hpp"
29+
#include "mmtkBarrierSetC1.hpp"
30+
#include "mmtkMutator.hpp"
31+
#include "runtime/sharedRuntime.hpp"
32+
#include "utilities/macros.hpp"
33+
#include "c1/c1_LIRAssembler.hpp"
34+
#include "c1/c1_MacroAssembler.hpp"
35+
36+
#define __ masm->
37+
38+
void MMTkBarrierSetAssembler::eden_allocate(MacroAssembler* masm, Register thread, Register obj, Register var_size_in_bytes, int con_size_in_bytes, Register t1, Label& slow_case) {
39+
// assert(false, "Not implemented");
40+
__ j(slow_case); // just jal with x0/zr
41+
}
42+
43+
#undef __
44+
45+
#define __ sasm->
46+
47+
void MMTkBarrierSetAssembler::generate_c1_write_barrier_runtime_stub(StubAssembler* sasm) const {
48+
// assert(false, "Not implemented");
49+
}
50+
51+
#undef __
52+
53+
#define __ ce->masm()->
54+
55+
void MMTkBarrierSetAssembler::generate_c1_write_barrier_stub_call(LIR_Assembler* ce, MMTkC1BarrierStub* stub) {
56+
// assert(false, "Not implemented");
57+
}
58+
59+
#undef __
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#ifndef MMTK_OPENJDK_MMTK_BARRIER_SET_ASSEMBLER_RISCV_HPP
2+
#define MMTK_OPENJDK_MMTK_BARRIER_SET_ASSEMBLER_RISCV_HPP
3+
4+
#include "asm/macroAssembler.hpp"
5+
#include "gc/shared/barrierSetAssembler.hpp"
6+
7+
class MMTkBarrierSetC1;
8+
class MMTkC1BarrierStub;
9+
class LIR_Assembler;
10+
class StubAssembler;
11+
12+
class MMTkBarrierSetAssembler: public BarrierSetAssembler {
13+
friend class MMTkBarrierSetC1;
14+
15+
protected:
16+
/// Full pre-barrier
17+
virtual void object_reference_write_pre(MacroAssembler* masm, DecoratorSet decorators, Address dst, Register val, Register tmp1, Register tmp2) const {}
18+
/// Full post-barrier
19+
virtual void object_reference_write_post(MacroAssembler* masm, DecoratorSet decorators, Address dst, Register val, Register tmp1, Register tmp2) const {}
20+
21+
/// Barrier elision test
22+
virtual bool can_remove_barrier(DecoratorSet decorators, Register val, bool skip_const_null) const {
23+
bool in_heap = (decorators & IN_HEAP) != 0;
24+
bool as_normal = (decorators & AS_NORMAL) != 0;
25+
assert((decorators & IS_DEST_UNINITIALIZED) == 0, "unsupported");
26+
return !in_heap || (skip_const_null && val == noreg);
27+
}
28+
29+
/// Generate C1 write barrier slow-call assembly code
30+
virtual void generate_c1_write_barrier_runtime_stub(StubAssembler* sasm) const;
31+
32+
public:
33+
virtual void eden_allocate(MacroAssembler* masm, Register thread, Register obj, Register var_size_in_bytes, int con_size_in_bytes, Register t1, Label& slow_case);
34+
virtual void store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, Address dst, Register val, Register tmp1, Register tmp2, Register tmp3) {
35+
if (type == T_OBJECT || type == T_ARRAY) object_reference_write_pre(masm, decorators, dst, val, tmp1, tmp2);
36+
BarrierSetAssembler::store_at(masm, decorators, type, dst, val, tmp1, tmp2, tmp3);
37+
if (type == T_OBJECT || type == T_ARRAY) object_reference_write_post(masm, decorators, dst, val, tmp1, tmp2);
38+
}
39+
40+
/// Generate C1 write barrier slow-call stub
41+
static void generate_c1_write_barrier_stub_call(LIR_Assembler* ce, MMTkC1BarrierStub* stub);
42+
};
43+
#endif // MMTK_OPENJDK_MMTK_BARRIER_SET_ASSEMBLER_RISCV_HPP

openjdk/cpu/x86/mmtkBarrierSetAssembler_x86.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class MMTkBarrierSetAssembler: public BarrierSetAssembler {
3030
virtual void generate_c1_write_barrier_runtime_stub(StubAssembler* sasm) const;
3131

3232
public:
33-
virtual void eden_allocate(MacroAssembler* masm, Register thread, Register obj, Register var_size_in_bytes, int con_size_in_bytes, Register t1, Label& slow_case);
33+
virtual void eden_allocate(MacroAssembler* masm, Register thread, Register obj, Register var_size_in_bytes, int con_size_in_bytes, Register t1, Label& slow_case) override;
3434
virtual void store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, Address dst, Register val, Register tmp1, Register tmp2, Register tmp3) {
3535
if (type == T_OBJECT || type == T_ARRAY) object_reference_write_pre(masm, decorators, dst, val, tmp1, tmp2);
3636
BarrierSetAssembler::store_at(masm, decorators, type, dst, val, tmp1, tmp2, tmp3);

openjdk/share/barriers/mmtkObjectBarrier.cpp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ void MMTkObjectBarrierSetRuntime::object_reference_write_post(oop src, oop* slot
2121
#define __ masm->
2222

2323
void MMTkObjectBarrierSetAssembler::object_reference_write_post(MacroAssembler* masm, DecoratorSet decorators, Address dst, Register val, Register tmp1, Register tmp2) const {
24-
if (can_remove_barrier(decorators, val, /* skip_const_null */ true)) return;
24+
//if (can_remove_barrier(decorators, val, /* skip_const_null */ true)) return;
25+
/*
2526
#if MMTK_ENABLE_BARRIER_FASTPATH
2627
Label done;
2728
@@ -66,18 +67,21 @@ void MMTkObjectBarrierSetAssembler::object_reference_write_post(MacroAssembler*
6667
__ movptr(c_rarg2, val == noreg ? (int32_t) NULL_WORD : val);
6768
__ call_VM_leaf_base(FN_ADDR(MMTkBarrierSetRuntime::object_reference_write_post_call), 3);
6869
#endif
70+
*/
71+
assert(false, "Not implemented");
6972
}
7073

7174
void MMTkObjectBarrierSetAssembler::arraycopy_epilogue(MacroAssembler* masm, DecoratorSet decorators, BasicType type, Register src, Register dst, Register count) {
72-
const bool dest_uninitialized = (decorators & IS_DEST_UNINITIALIZED) != 0;
73-
if ((type == T_OBJECT || type == T_ARRAY) && !dest_uninitialized) {
74-
__ pusha();
75-
__ movptr(c_rarg0, src);
76-
__ movptr(c_rarg1, dst);
77-
__ movptr(c_rarg2, count);
78-
__ call_VM_leaf_base(FN_ADDR(MMTkBarrierSetRuntime::object_reference_array_copy_post_call), 3);
79-
__ popa();
80-
}
75+
// const bool dest_uninitialized = (decorators & IS_DEST_UNINITIALIZED) != 0;
76+
// if ((type == T_OBJECT || type == T_ARRAY) && !dest_uninitialized) {
77+
// __ pusha();
78+
// __ movptr(c_rarg0, src);
79+
// __ movptr(c_rarg1, dst);
80+
// __ movptr(c_rarg2, count);
81+
// __ call_VM_leaf_base(FN_ADDR(MMTkBarrierSetRuntime::object_reference_array_copy_post_call), 3);
82+
// __ popa();
83+
// }
84+
assert(false, "Not implemented");
8185
}
8286

8387
#undef __

openjdk/share/barriers/mmtkObjectBarrier.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class MMTkObjectBarrierSetAssembler: public MMTkBarrierSetAssembler {
4141
protected:
4242
virtual void object_reference_write_post(MacroAssembler* masm, DecoratorSet decorators, Address dst, Register val, Register tmp1, Register tmp2) const override;
4343
public:
44-
virtual void arraycopy_epilogue(MacroAssembler* masm, DecoratorSet decorators, BasicType type, Register src, Register dst, Register count) override;
44+
virtual void arraycopy_epilogue(MacroAssembler* masm, DecoratorSet decorators, BasicType type, Register src, Register dst, Register count);
4545
};
4646
#endif
4747

0 commit comments

Comments
 (0)