Skip to content

Commit e06a683

Browse files
committed
8256497: Zero: enable G1 and Shenandoah GCs
Reviewed-by: rkennke, erikj, ihse
1 parent 037e49c commit e06a683

File tree

5 files changed

+56
-18
lines changed

5 files changed

+56
-18
lines changed

make/autoconf/jvm-features.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ AC_DEFUN([JVM_FEATURES_PREPARE_VARIANT],
476476
JVM_FEATURES_VARIANT_UNAVAILABLE="cds minimal zero"
477477
elif test "x$variant" = "xzero"; then
478478
JVM_FEATURES_VARIANT_UNAVAILABLE="aot cds compiler1 compiler2 \
479-
g1gc graal jvmci minimal shenandoahgc zgc"
479+
graal jvmci minimal zgc"
480480
else
481481
JVM_FEATURES_VARIANT_UNAVAILABLE="minimal zero"
482482
fi
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright (c) 2020, Red Hat, Inc. 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+
25+
#ifndef CPU_ZERO_GC_SHENANDOAH_SHENANDOAHBARRIERSETASSEMBLER_ZERO_HPP
26+
#define CPU_ZERO_GC_SHENANDOAH_SHENANDOAHBARRIERSETASSEMBLER_ZERO_HPP
27+
28+
class ShenandoahBarrierSetAssembler;
29+
30+
#endif // CPU_ZERO_GC_SHENANDOAH_SHENANDOAHBARRIERSETASSEMBLER_ZERO_HPP

src/hotspot/cpu/zero/zeroInterpreter_zero.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "interpreter/zero/bytecodeInterpreter.hpp"
3232
#include "interpreter/zero/zeroInterpreter.hpp"
3333
#include "interpreter/zero/zeroInterpreterGenerator.hpp"
34+
#include "oops/access.inline.hpp"
3435
#include "oops/cpCache.inline.hpp"
3536
#include "oops/methodData.hpp"
3637
#include "oops/method.hpp"
@@ -120,6 +121,28 @@ int ZeroInterpreter::normal_entry(Method* method, intptr_t UNUSED, TRAPS) {
120121
return 0;
121122
}
122123

124+
int ZeroInterpreter::Reference_get_entry(Method* method, intptr_t UNUSED, TRAPS) {
125+
JavaThread* thread = THREAD->as_Java_thread();
126+
ZeroStack* stack = thread->zero_stack();
127+
intptr_t* topOfStack = stack->sp();
128+
129+
oop ref = STACK_OBJECT(0);
130+
131+
// Shortcut if reference is known NULL
132+
if (ref == NULL) {
133+
return normal_entry(method, 0, THREAD);
134+
}
135+
136+
// Read the referent with weaker semantics, and let GCs handle the rest.
137+
const int referent_offset = java_lang_ref_Reference::referent_offset();
138+
oop obj = HeapAccess<IN_HEAP | ON_WEAK_OOP_REF>::oop_load_at(ref, referent_offset);
139+
140+
SET_STACK_OBJECT(obj, 0);
141+
142+
// No deoptimized frames on the stack
143+
return 0;
144+
}
145+
123146
intptr_t narrow(BasicType type, intptr_t result) {
124147
// mask integer result to narrower return type.
125148
switch (type) {

src/hotspot/cpu/zero/zeroInterpreter_zero.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
static int getter_entry(Method* method, intptr_t UNUSED, TRAPS);
3838
static int setter_entry(Method* method, intptr_t UNUSED, TRAPS);
3939
static int empty_entry(Method* method, intptr_t UNUSED, TRAPS);
40+
static int Reference_get_entry(Method* method, intptr_t UNUSED, TRAPS);
4041

4142
public:
4243
// Main loop of normal_entry

src/hotspot/share/interpreter/zero/zeroInterpreterGenerator.cpp

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -173,23 +173,7 @@ address ZeroInterpreterGenerator::generate_setter_entry() {
173173
}
174174

175175
address ZeroInterpreterGenerator::generate_Reference_get_entry(void) {
176-
#if INCLUDE_G1GC
177-
if (UseG1GC) {
178-
// We need to generate have a routine that generates code to:
179-
// * load the value in the referent field
180-
// * passes that value to the pre-barrier.
181-
//
182-
// In the case of G1 this will record the value of the
183-
// referent in an SATB buffer if marking is active.
184-
// This will cause concurrent marking to mark the referent
185-
// field as live.
186-
Unimplemented();
187-
}
188-
#endif // INCLUDE_G1GC
189-
190-
// If G1 is not enabled then attempt to go through the normal entry point
191-
// Reference.get could be instrumented by jvmti
192-
return NULL;
176+
return generate_entry((address) ZeroInterpreter::Reference_get_entry);
193177
}
194178

195179
address ZeroInterpreterGenerator::generate_native_entry(bool synchronized) {

0 commit comments

Comments
 (0)