Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8293011: riscv: Duplicated stubs to interpreter for static calls
Reviewed-by: fyang
  • Loading branch information
DingliZhang authored and RealFYang committed Sep 1, 2022
1 parent 6076128 commit 17283cf
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 13 deletions.
32 changes: 32 additions & 0 deletions src/hotspot/cpu/riscv/codeBuffer_riscv.cpp
@@ -0,0 +1,32 @@
/*
* Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
* Copyright (c) 2022, Institute of Software, Chinese Academy of Sciences. 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.
*
*/

#include "precompiled.hpp"
#include "asm/codeBuffer.inline.hpp"
#include "asm/macroAssembler.hpp"

bool CodeBuffer::pd_finalize_stubs() {
return emit_shared_stubs_to_interp<MacroAssembler>(this, _shared_stub_to_interp_requests);
}
9 changes: 2 additions & 7 deletions src/hotspot/cpu/riscv/codeBuffer_riscv.hpp
Expand Up @@ -29,15 +29,10 @@

private:
void pd_initialize() {}
bool pd_finalize_stubs() {
if (_finalize_stubs) {
Unimplemented();
}
return true;
}
bool pd_finalize_stubs();

public:
void flush_bundle(bool start_new_bundle) {}
static constexpr bool supports_shared_stubs() { return false; }
static constexpr bool supports_shared_stubs() { return true; }

#endif // CPU_RISCV_CODEBUFFER_RISCV_HPP
16 changes: 11 additions & 5 deletions src/hotspot/cpu/riscv/riscv.ad
Expand Up @@ -2284,11 +2284,17 @@ encode %{
return;
}

// Emit stub for static call
address stub = CompiledStaticCall::emit_to_interp_stub(cbuf);
if (stub == NULL) {
ciEnv::current()->record_failure("CodeCache is full");
return;
if (CodeBuffer::supports_shared_stubs() && _method->can_be_statically_bound()) {
// Calls of the same statically bound method can share
// a stub to the interpreter.
cbuf.shared_stub_to_interp_for(_method, cbuf.insts()->mark_off());
} else {
// Emit stub for static call
address stub = CompiledStaticCall::emit_to_interp_stub(cbuf);
if (stub == NULL) {
ciEnv::current()->record_failure("CodeCache is full");
return;
}
}
}
%}
Expand Down
Expand Up @@ -28,7 +28,7 @@
* @bug 8280481
* @library /test/lib
*
* @requires os.arch=="amd64" | os.arch=="x86_64" | os.arch=="i386" | os.arch=="x86" | os.arch=="aarch64"
* @requires os.arch=="amd64" | os.arch=="x86_64" | os.arch=="i386" | os.arch=="x86" | os.arch=="aarch64" | os.arch=="riscv64"
*
* @run driver compiler.sharedstubs.SharedStubToInterpTest
*/
Expand Down

1 comment on commit 17283cf

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.