8256497: Zero: enable G1 and Shenandoah GCs

Reviewed-by: rkennke, erikj, ihse
This commit is contained in:
Aleksey Shipilev 2020-11-22 18:10:04 +00:00
parent 037e49cf57
commit e06a68397d
5 changed files with 56 additions and 18 deletions

View file

@ -476,7 +476,7 @@ AC_DEFUN([JVM_FEATURES_PREPARE_VARIANT],
JVM_FEATURES_VARIANT_UNAVAILABLE="cds minimal zero" JVM_FEATURES_VARIANT_UNAVAILABLE="cds minimal zero"
elif test "x$variant" = "xzero"; then elif test "x$variant" = "xzero"; then
JVM_FEATURES_VARIANT_UNAVAILABLE="aot cds compiler1 compiler2 \ JVM_FEATURES_VARIANT_UNAVAILABLE="aot cds compiler1 compiler2 \
g1gc graal jvmci minimal shenandoahgc zgc" graal jvmci minimal zgc"
else else
JVM_FEATURES_VARIANT_UNAVAILABLE="minimal zero" JVM_FEATURES_VARIANT_UNAVAILABLE="minimal zero"
fi fi

View file

@ -0,0 +1,30 @@
/*
* Copyright (c) 2020, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef CPU_ZERO_GC_SHENANDOAH_SHENANDOAHBARRIERSETASSEMBLER_ZERO_HPP
#define CPU_ZERO_GC_SHENANDOAH_SHENANDOAHBARRIERSETASSEMBLER_ZERO_HPP
class ShenandoahBarrierSetAssembler;
#endif // CPU_ZERO_GC_SHENANDOAH_SHENANDOAHBARRIERSETASSEMBLER_ZERO_HPP

View file

@ -31,6 +31,7 @@
#include "interpreter/zero/bytecodeInterpreter.hpp" #include "interpreter/zero/bytecodeInterpreter.hpp"
#include "interpreter/zero/zeroInterpreter.hpp" #include "interpreter/zero/zeroInterpreter.hpp"
#include "interpreter/zero/zeroInterpreterGenerator.hpp" #include "interpreter/zero/zeroInterpreterGenerator.hpp"
#include "oops/access.inline.hpp"
#include "oops/cpCache.inline.hpp" #include "oops/cpCache.inline.hpp"
#include "oops/methodData.hpp" #include "oops/methodData.hpp"
#include "oops/method.hpp" #include "oops/method.hpp"
@ -120,6 +121,28 @@ int ZeroInterpreter::normal_entry(Method* method, intptr_t UNUSED, TRAPS) {
return 0; return 0;
} }
int ZeroInterpreter::Reference_get_entry(Method* method, intptr_t UNUSED, TRAPS) {
JavaThread* thread = THREAD->as_Java_thread();
ZeroStack* stack = thread->zero_stack();
intptr_t* topOfStack = stack->sp();
oop ref = STACK_OBJECT(0);
// Shortcut if reference is known NULL
if (ref == NULL) {
return normal_entry(method, 0, THREAD);
}
// Read the referent with weaker semantics, and let GCs handle the rest.
const int referent_offset = java_lang_ref_Reference::referent_offset();
oop obj = HeapAccess<IN_HEAP | ON_WEAK_OOP_REF>::oop_load_at(ref, referent_offset);
SET_STACK_OBJECT(obj, 0);
// No deoptimized frames on the stack
return 0;
}
intptr_t narrow(BasicType type, intptr_t result) { intptr_t narrow(BasicType type, intptr_t result) {
// mask integer result to narrower return type. // mask integer result to narrower return type.
switch (type) { switch (type) {

View file

@ -37,6 +37,7 @@
static int getter_entry(Method* method, intptr_t UNUSED, TRAPS); static int getter_entry(Method* method, intptr_t UNUSED, TRAPS);
static int setter_entry(Method* method, intptr_t UNUSED, TRAPS); static int setter_entry(Method* method, intptr_t UNUSED, TRAPS);
static int empty_entry(Method* method, intptr_t UNUSED, TRAPS); static int empty_entry(Method* method, intptr_t UNUSED, TRAPS);
static int Reference_get_entry(Method* method, intptr_t UNUSED, TRAPS);
public: public:
// Main loop of normal_entry // Main loop of normal_entry

View file

@ -173,23 +173,7 @@ address ZeroInterpreterGenerator::generate_setter_entry() {
} }
address ZeroInterpreterGenerator::generate_Reference_get_entry(void) { address ZeroInterpreterGenerator::generate_Reference_get_entry(void) {
#if INCLUDE_G1GC return generate_entry((address) ZeroInterpreter::Reference_get_entry);
if (UseG1GC) {
// We need to generate have a routine that generates code to:
// * load the value in the referent field
// * passes that value to the pre-barrier.
//
// In the case of G1 this will record the value of the
// referent in an SATB buffer if marking is active.
// This will cause concurrent marking to mark the referent
// field as live.
Unimplemented();
}
#endif // INCLUDE_G1GC
// If G1 is not enabled then attempt to go through the normal entry point
// Reference.get could be instrumented by jvmti
return NULL;
} }
address ZeroInterpreterGenerator::generate_native_entry(bool synchronized) { address ZeroInterpreterGenerator::generate_native_entry(bool synchronized) {