This commit is contained in:
Jesper Wilhelmsson 2022-12-14 21:47:29 +00:00
commit a130c8a668
17 changed files with 175 additions and 84 deletions

View File

@ -29,7 +29,40 @@
# and fix the broken property, if needed.
DIR=`dirname $0`
OUT=`. $DIR/autoconf-config.guess`
OUT=`. $DIR/autoconf-config.guess 2> /dev/null`
# Handle some cases that autoconf-config.guess is not capable of
if [ "x$OUT" = x ]; then
if [ `uname -s` = Linux ]; then
# Test and fix little endian MIPS.
if [ `uname -m` = mipsel ]; then
OUT=mipsel-unknown-linux-gnu
elif [ `uname -m` = mips64el ]; then
OUT=mips64el-unknown-linux-gnu
# Test and fix little endian PowerPC64.
elif [ `uname -m` = ppc64le ]; then
OUT=powerpc64le-unknown-linux-gnu
# Test and fix LoongArch64.
elif [ `uname -m` = loongarch64 ]; then
OUT=loongarch64-unknown-linux-gnu
# Test and fix RISC-V.
elif [ `uname -m` = riscv64 ]; then
OUT=riscv64-unknown-linux-gnu
fi
# Test and fix cygwin machine arch .x86_64
elif [[ `uname -s` = CYGWIN* ]]; then
if [ `uname -m` = ".x86_64" ]; then
OUT=x86_64-unknown-cygwin
fi
fi
if [ "x$OUT" = x ]; then
# Run autoconf-config.guess again to get the error message.
. $DIR/autoconf-config.guess > /dev/null
else
printf "guessed by custom config.guess... " >&2
fi
fi
# Detect C library.
# Use '-gnu' suffix on systems that use glibc.
@ -81,45 +114,6 @@ if test $? = 0; then
OUT=powerpc$KERNEL_BITMODE`echo $OUT | sed -e 's/[^-]*//'`
fi
# Test and fix little endian PowerPC64.
# TODO: should be handled by autoconf-config.guess.
if [ "x$OUT" = x ]; then
if [ `uname -m` = ppc64le ]; then
if [ `uname -s` = Linux ]; then
OUT=powerpc64le-unknown-linux-gnu
fi
fi
fi
# Test and fix little endian MIPS.
if [ "x$OUT" = x ]; then
if [ `uname -s` = Linux ]; then
if [ `uname -m` = mipsel ]; then
OUT=mipsel-unknown-linux-gnu
elif [ `uname -m` = mips64el ]; then
OUT=mips64el-unknown-linux-gnu
fi
fi
fi
# Test and fix LoongArch64.
if [ "x$OUT" = x ]; then
if [ `uname -s` = Linux ]; then
if [ `uname -m` = loongarch64 ]; then
OUT=loongarch64-unknown-linux-gnu
fi
fi
fi
# Test and fix RISC-V.
if [ "x$OUT" = x ]; then
if [ `uname -s` = Linux ]; then
if [ `uname -m` = riscv64 ]; then
OUT=riscv64-unknown-linux-gnu
fi
fi
fi
# Test and fix cpu on macos-aarch64, uname -p reports arm, buildsys expects aarch64
echo $OUT | grep arm-apple-darwin > /dev/null 2> /dev/null
if test $? != 0; then

View File

@ -369,6 +369,7 @@ void *Arena::Arealloc(void* old_ptr, size_t old_size, size_t new_size, AllocFail
// Determine if pointer belongs to this Arena or not.
bool Arena::contains( const void *ptr ) const {
if (_chunk == NULL) return false;
if( (void*)_chunk->bottom() <= ptr && ptr < (void*)_hwm )
return true; // Check for in this chunk
for (Chunk *c = _first; c; c = c->next()) {

View File

@ -44,7 +44,7 @@ InlineTree::InlineTree(Compile* c,
JVMState* caller_jvms, int caller_bci,
int max_inline_level) :
C(c),
_caller_jvms(caller_jvms),
_caller_jvms(NULL),
_method(callee),
_late_inline(false),
_caller_tree((InlineTree*) caller_tree),
@ -57,13 +57,13 @@ InlineTree::InlineTree(Compile* c,
_count_inlines = 0;
_forced_inline = false;
#endif
if (_caller_jvms != NULL) {
if (caller_jvms != NULL) {
// Keep a private copy of the caller_jvms:
_caller_jvms = new (C) JVMState(caller_jvms->method(), caller_tree->caller_jvms());
_caller_jvms->set_bci(caller_jvms->bci());
assert(!caller_jvms->should_reexecute(), "there should be no reexecute bytecode with inlining");
}
assert(_caller_jvms->same_calls_as(caller_jvms), "consistent JVMS");
}
assert((caller_tree == NULL ? 0 : caller_tree->stack_depth() + 1) == stack_depth(), "correct (redundant) depth parameter");
assert(caller_bci == this->caller_bci(), "correct (redundant) bci parameter");
// Update hierarchical counts, count_inline_bcs() and count_inlines()

View File

@ -731,8 +731,8 @@ private:
int yank_if_dead_recurse(Node *old, Node *orig_old, Block *current_block,
Node_List *value, Node_List *regnd);
int yank( Node *old, Block *current_block, Node_List *value, Node_List *regnd );
int elide_copy( Node *n, int k, Block *current_block, Node_List &value, Node_List &regnd, bool can_change_regs );
int use_prior_register( Node *copy, uint idx, Node *def, Block *current_block, Node_List &value, Node_List &regnd );
int elide_copy( Node *n, int k, Block *current_block, Node_List *value, Node_List *regnd, bool can_change_regs );
int use_prior_register( Node *copy, uint idx, Node *def, Block *current_block, Node_List *value, Node_List *regnd );
bool may_be_copy_of_callee( Node *def ) const;
// If nreg already contains the same constant as val then eliminate it

View File

@ -2547,6 +2547,7 @@ SafePointNode* CountedLoopNode::outer_safepoint() const {
Node* CountedLoopNode::skip_predicates_from_entry(Node* ctrl) {
while (ctrl != NULL && ctrl->is_Proj() && ctrl->in(0) != NULL && ctrl->in(0)->is_If() &&
!is_zero_trip_guard_if(ctrl->in(0)->as_If()) &&
(ctrl->in(0)->as_If()->proj_out_or_null(1-ctrl->as_Proj()->_con) == NULL ||
(ctrl->in(0)->as_If()->proj_out(1-ctrl->as_Proj()->_con)->outcnt() == 1 &&
ctrl->in(0)->as_If()->proj_out(1-ctrl->as_Proj()->_con)->unique_out()->Opcode() == Op_Halt))) {
@ -2556,6 +2557,22 @@ Node* CountedLoopNode::skip_predicates_from_entry(Node* ctrl) {
return ctrl;
}
bool CountedLoopNode::is_zero_trip_guard_if(const IfNode* iff) {
if (iff->in(1) == NULL || !iff->in(1)->is_Bool()) {
return false;
}
if (iff->in(1)->in(1) == NULL || iff->in(1)->in(1)->Opcode() != Op_CmpI) {
return false;
}
if (iff->in(1)->in(1)->in(1) != NULL && iff->in(1)->in(1)->in(1)->Opcode() == Op_OpaqueZeroTripGuard) {
return true;
}
if (iff->in(1)->in(1)->in(2) != NULL && iff->in(1)->in(1)->in(2)->Opcode() == Op_OpaqueZeroTripGuard) {
return true;
}
return false;
}
Node* CountedLoopNode::skip_predicates() {
Node* ctrl = in(LoopNode::EntryControl);
if (is_main_loop()) {
@ -5436,7 +5453,7 @@ Node* CountedLoopNode::is_canonical_loop_entry() {
return NULL;
}
Node* iffm = ctrl->in(0);
if (iffm == NULL || !iffm->is_If()) {
if (iffm == NULL || iffm->Opcode() != Op_If) {
return NULL;
}
Node* bolzm = iffm->in(1);

View File

@ -355,6 +355,8 @@ public:
#ifndef PRODUCT
virtual void dump_spec(outputStream *st) const;
#endif
static bool is_zero_trip_guard_if(const IfNode* iff);
};
class LongCountedLoopNode : public BaseCountedLoopNode {

View File

@ -30,7 +30,7 @@
// See if this register (or pairs, or vector) already contains the value.
static bool register_contains_value(Node* val, OptoReg::Name reg, int n_regs,
Node_List& value) {
const Node_List &value) {
for (int i = 0; i < n_regs; i++) {
OptoReg::Name nreg = OptoReg::add(reg,-i);
if (value[nreg] != val)
@ -87,7 +87,8 @@ int PhaseChaitin::yank( Node *old, Block *current_block, Node_List *value, Node_
}
_cfg.unmap_node_from_block(old);
OptoReg::Name old_reg = lrgs(_lrg_map.live_range_id(old)).reg();
if( regnd && (*regnd)[old_reg]==old ) { // Instruction is currently available?
assert(value != NULL || regnd == NULL, "sanity");
if (value != NULL && regnd != NULL && regnd->at(old_reg) == old) { // Instruction is currently available?
value->map(old_reg, NULL); // Yank from value/regnd maps
regnd->map(old_reg, NULL); // This register's value is now unknown
}
@ -161,7 +162,7 @@ int PhaseChaitin::yank_if_dead_recurse(Node *old, Node *orig_old, Block *current
// Use the prior value instead of the current value, in an effort to make
// the current value go dead. Return block iterator adjustment, in case
// we yank some instructions from this block.
int PhaseChaitin::use_prior_register( Node *n, uint idx, Node *def, Block *current_block, Node_List &value, Node_List &regnd ) {
int PhaseChaitin::use_prior_register( Node *n, uint idx, Node *def, Block *current_block, Node_List *value, Node_List *regnd ) {
// No effect?
if( def == n->in(idx) ) return 0;
// Def is currently dead and can be removed? Do not resurrect
@ -207,7 +208,7 @@ int PhaseChaitin::use_prior_register( Node *n, uint idx, Node *def, Block *curre
_post_alloc++;
// Is old def now dead? We successfully yanked a copy?
return yank_if_dead(old,current_block,&value,&regnd);
return yank_if_dead(old,current_block,value,regnd);
}
@ -229,7 +230,7 @@ Node *PhaseChaitin::skip_copies( Node *c ) {
//------------------------------elide_copy-------------------------------------
// Remove (bypass) copies along Node n, edge k.
int PhaseChaitin::elide_copy( Node *n, int k, Block *current_block, Node_List &value, Node_List &regnd, bool can_change_regs ) {
int PhaseChaitin::elide_copy( Node *n, int k, Block *current_block, Node_List *value, Node_List *regnd, bool can_change_regs ) {
int blk_adjust = 0;
uint nk_idx = _lrg_map.live_range_id(n->in(k));
@ -253,11 +254,14 @@ int PhaseChaitin::elide_copy( Node *n, int k, Block *current_block, Node_List &v
// Phis and 2-address instructions cannot change registers so easily - their
// outputs must match their input.
if( !can_change_regs )
if (!can_change_regs) {
return blk_adjust; // Only check stupid copies!
}
// Loop backedges won't have a value-mapping yet
if( &value == NULL ) return blk_adjust;
assert(regnd != NULL || value == NULL, "sanity");
if (value == NULL || regnd == NULL) {
return blk_adjust;
}
// Skip through all copies to the _value_ being used. Do not change from
// int to pointer. This attempts to jump through a chain of copies, where
@ -273,10 +277,11 @@ int PhaseChaitin::elide_copy( Node *n, int k, Block *current_block, Node_List &v
// See if it happens to already be in the correct register!
// (either Phi's direct register, or the common case of the name
// never-clobbered original-def register)
if (register_contains_value(val, val_reg, n_regs, value)) {
blk_adjust += use_prior_register(n,k,regnd[val_reg],current_block,value,regnd);
if( n->in(k) == regnd[val_reg] ) // Success! Quit trying
return blk_adjust;
if (register_contains_value(val, val_reg, n_regs, *value)) {
blk_adjust += use_prior_register(n,k,regnd->at(val_reg),current_block,value,regnd);
if (n->in(k) == regnd->at(val_reg)) {
return blk_adjust; // Success! Quit trying
}
}
// See if we can skip the copy by changing registers. Don't change from
@ -304,7 +309,7 @@ int PhaseChaitin::elide_copy( Node *n, int k, Block *current_block, Node_List &v
if (ignore_self) continue;
}
Node *vv = value[reg];
Node *vv = value->at(reg);
// For scalable register, number of registers may be inconsistent between
// "val_reg" and "reg". For example, when "val" resides in register
// but "reg" is located in stack.
@ -325,7 +330,7 @@ int PhaseChaitin::elide_copy( Node *n, int k, Block *current_block, Node_List &v
last = (n_regs-1); // Looking for the last part of a set
}
if ((reg&last) != last) continue; // Wrong part of a set
if (!register_contains_value(vv, reg, n_regs, value)) continue; // Different value
if (!register_contains_value(vv, reg, n_regs, *value)) continue; // Different value
}
if( vv == val || // Got a direct hit?
(t && vv && vv->bottom_type() == t && vv->is_Mach() &&
@ -333,9 +338,9 @@ int PhaseChaitin::elide_copy( Node *n, int k, Block *current_block, Node_List &v
assert( !n->is_Phi(), "cannot change registers at a Phi so easily" );
if( OptoReg::is_stack(nk_reg) || // CISC-loading from stack OR
OptoReg::is_reg(reg) || // turning into a register use OR
regnd[reg]->outcnt()==1 ) { // last use of a spill-load turns into a CISC use
blk_adjust += use_prior_register(n,k,regnd[reg],current_block,value,regnd);
if( n->in(k) == regnd[reg] ) // Success! Quit trying
regnd->at(reg)->outcnt()==1 ) { // last use of a spill-load turns into a CISC use
blk_adjust += use_prior_register(n,k,regnd->at(reg),current_block,value,regnd);
if( n->in(k) == regnd->at(reg) ) // Success! Quit trying
return blk_adjust;
} // End of if not degrading to a stack
} // End of if found value in another register
@ -535,7 +540,7 @@ void PhaseChaitin::post_allocate_copy_removal() {
Block* pb = _cfg.get_block_for_node(block->pred(j));
// Remove copies along phi edges
for (uint k = 1; k < phi_dex; k++) {
elide_copy(block->get_node(k), j, block, *blk2value[pb->_pre_order], *blk2regnd[pb->_pre_order], false);
elide_copy(block->get_node(k), j, block, blk2value[pb->_pre_order], blk2regnd[pb->_pre_order], false);
}
if (blk2value[pb->_pre_order]) { // Have a mapping on this edge?
// See if this predecessor's mappings have been used by everybody
@ -691,7 +696,7 @@ void PhaseChaitin::post_allocate_copy_removal() {
// Remove copies along input edges
for (k = 1; k < n->req(); k++) {
j -= elide_copy(n, k, block, value, regnd, two_adr != k);
j -= elide_copy(n, k, block, &value, &regnd, two_adr != k);
}
// Unallocated Nodes define no registers

View File

@ -188,13 +188,18 @@ private:
#ifdef ASSERT
// This macro checks the type of a VMStructEntry by comparing pointer types
#define CHECK_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \
{typeName *dummyObj = NULL; type* dummy = &dummyObj->fieldName; \
assert(offset_of(typeName, fieldName) < sizeof(typeName), "Illegal nonstatic struct entry, field offset too large"); }
#define CHECK_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) { \
static_assert( \
std::is_convertible< \
std::add_pointer_t<decltype(declval<typeName>().fieldName)>, \
std::add_pointer_t<type>>::value, \
"type mismatch for " XSTR(fieldName) " member of " XSTR(typeName)); \
assert(offset_of(typeName, fieldName) < sizeof(typeName), "..."); \
}
// This macro checks the type of a volatile VMStructEntry by comparing pointer types
#define CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \
{typedef type dummyvtype; typeName *dummyObj = NULL; volatile dummyvtype* dummy = &dummyObj->fieldName; }
CHECK_NONSTATIC_VM_STRUCT_ENTRY(typeName, fieldName, std::add_volatile_t<type>)
// This macro checks the type of a static VMStructEntry by comparing pointer types
#define CHECK_STATIC_VM_STRUCT_ENTRY(typeName, fieldName, type) \

View File

@ -35,6 +35,7 @@
#include COMPILER_HEADER(utilities/globalDefinitions)
#include <cstddef>
#include <type_traits>
class oopDesc;
@ -1288,4 +1289,8 @@ template<typename K> bool primitive_equals(const K& k0, const K& k1) {
// Allow use of C++ thread_local when approved - see JDK-8282469.
#define APPROVED_CPP_THREAD_LOCAL thread_local
// Converts any type T to a reference type.
template<typename T>
std::add_rvalue_reference_t<T> declval() noexcept;
#endif // SHARE_UTILITIES_GLOBALDEFINITIONS_HPP

View File

@ -139,10 +139,21 @@ inline int g_isfinite(jdouble f) { return isfinite(f); }
#endif // _LP64
// gcc warns about applying offsetof() to non-POD object or calculating
// offset directly when base address is NULL. Use 16 to get around the
// warning. The -Wno-invalid-offsetof option could be used to suppress
// this warning, but we instead just avoid the use of offsetof().
#define offset_of(klass,field) (size_t)((intx)&(((klass*)16)->field) - 16)
// offset directly when base address is NULL. The -Wno-invalid-offsetof
// option could be used to suppress this warning, but we instead just
// avoid the use of offsetof().
//
// FIXME: This macro is complex and rather arcane. Perhaps we should
// use offsetof() instead, with the invalid-offsetof warning
// temporarily disabled.
#define offset_of(klass,field) \
[]() { \
char space[sizeof (klass)] ATTRIBUTE_ALIGNED(16); \
klass* dummyObj = (klass*)space; \
char* c = (char*)(void*)&dummyObj->field; \
return (size_t)(c - space); \
}()
#if defined(_LP64) && defined(__APPLE__)
#define JLONG_FORMAT "%ld"

View File

@ -622,6 +622,8 @@ public interface Elements {
* overrides another method.
* When a non-abstract method overrides an abstract one, the
* former is also said to <i>implement</i> the latter.
* As implied by JLS {@jls 8.4.8.1}, a method does <em>not</em>
* override itself. The overrides relation is <i>irreflexive</i>.
*
* <p> In the simplest and most typical usage, the value of the
* {@code type} parameter will simply be the class or interface

View File

@ -227,7 +227,7 @@ public interface DocTree {
SPEC("spec"),
/**
* Used for instances of {@link EndElementTree}
* Used for instances of {@link StartElementTree}
* representing the start of an HTML element.
*/
START_ELEMENT,

View File

@ -48,6 +48,7 @@ import com.sun.jdi.StackFrame;
import com.sun.jdi.ThreadReference;
import com.sun.jdi.VMDisconnectedException;
import com.sun.jdi.VirtualMachine;
import java.util.stream.Stream;
import jdk.jshell.spi.ExecutionControl;
import jdk.jshell.spi.ExecutionEnv;
import static jdk.jshell.execution.Util.remoteInputOutput;
@ -96,10 +97,15 @@ public class JdiDefaultExecutionControl extends JdiExecutionControl {
// timeout on I/O-socket
listener.setSoTimeout(timeout);
int port = listener.getLocalPort();
List<String> augmentedremoteVMOptions =
Stream.concat(env.extraRemoteVMOptions().stream(),
//disable System.console():
List.of("-Djdk.console=java.base").stream())
.toList();
// Set-up the JDI connection
JdiInitiator jdii = new JdiInitiator(port,
env.extraRemoteVMOptions(), remoteAgent, isLaunch, host,
augmentedremoteVMOptions, remoteAgent, isLaunch, host,
timeout, Collections.emptyMap());
VirtualMachine vm = jdii.vm();
Process process = jdii.process();

View File

@ -139,7 +139,7 @@ final class DiskRepository implements Closeable {
private long typeId;
private int typeIdshift;
private int sizeShift;
private int payLoadSize;
private long payLoadSize;
private int longValueshift;
private int eventFieldSize;
private int lastFlush;
@ -225,7 +225,7 @@ final class DiskRepository implements Closeable {
private void processEvent() {
int left = currentByteArray.length - index;
if (left >= payLoadSize) {
index += payLoadSize;
index = index + (int)payLoadSize;
payLoadSize = 0;
state = State.EVENT_SIZE;
} else {
@ -261,7 +261,7 @@ final class DiskRepository implements Closeable {
eventFieldSize++;
byte b = nextByte(false);
int v = (b & 0x7F);
long v = (b & 0x7F);
payLoadSize += (v << sizeShift);
if (b >= 0) {
if (payLoadSize == 0) {

View File

@ -79,7 +79,6 @@ gc/stress/gclocker/TestGCLockerWithParallel.java 8180622 generic-all
gc/stress/gclocker/TestGCLockerWithG1.java 8180622 generic-all
gc/stress/TestJNIBlockFullGC/TestJNIBlockFullGC.java 8192647 generic-all
gc/stress/TestStressG1Humongous.java 8286554 windows-x64
gc/TestFullGCCount.java 8298296 linux-x64
#############################################################################

View File

@ -29,6 +29,8 @@ package gc;
* @summary JMM GC counters overcount in some cases
* @comment Shenandoah has "ExplicitGCInvokesConcurrent" on by default
* @requires !(vm.gc == "Shenandoah" & vm.opt.ExplicitGCInvokesConcurrent != false)
* @comment G1 has separate counters for STW Full GC and concurrent GC.
* @requires !(vm.gc == "G1" & vm.opt.ExplicitGCInvokesConcurrent)
* @requires vm.gc != "Z"
* @modules java.management
* @run main/othervm -Xlog:gc gc.TestFullGCCount

View File

@ -0,0 +1,42 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. 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.
*/
/*
* @test
* @bug 8298425
* @summary Verify behavior of System.console()
* @build KullaTesting TestingInputStream
* @run testng ConsoleTest
*/
import org.testng.annotations.Test;
public class ConsoleTest extends KullaTesting {
@Test
public void testConsole1() {
assertEval("System.console()", "null");
}
}