--- a/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp Thu Mar 24 15:53:19 2016 -0700
@@ -211,10 +211,6 @@
return (r->reg2stack() + SharedRuntime::out_preserve_stack_slots()) * VMRegImpl::stack_slot_size;
}
-template <class T> static const T& min (const T& a, const T& b) {
- return (a > b) ? b : a;
-}
-
// ---------------------------------------------------------------------------
// Read the array of BasicTypes from a signature, and compute where the
// arguments should go. Values in the VMRegPair regs array refer to 4-byte
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp Thu Mar 24 15:53:19 2016 -0700
@@ -4666,8 +4666,109 @@
bind(Ldone);
}
+void MacroAssembler::has_negatives(Register inp, Register size, Register result, Register t2, Register t3, Register t4, Register t5) {
+
+ // test for negative bytes in input string of a given size
+ // result 1 if found, 0 otherwise.
+
+ Label Lcore, Ltail, Lreturn, Lcore_rpt;
+
+ assert_different_registers(inp, size, t2, t3, t4, t5, result);
+
+ Register i = result; // result used as integer index i until very end
+ Register lmask = t2; // t2 is aliased to lmask
+
+ // INITIALIZATION
+ // ===========================================================
+ // initialize highbits mask -> lmask = 0x8080808080808080 (8B/64b)
+ // compute unaligned offset -> i
+ // compute core end index -> t5
+ Assembler::sethi(0x80808000, t2); //! sethi macro fails to emit optimal
+ add(t2, 0x80, t2);
+ sllx(t2, 32, t3);
+ or3(t3, t2, lmask); // 0x8080808080808080 -> lmask
+ sra(size,0,size);
+ andcc(inp, 0x7, i); // unaligned offset -> i
+ br(Assembler::zero, true, Assembler::pn, Lcore); // starts 8B aligned?
+ delayed()->add(size, -8, t5); // (annuled) core end index -> t5
+
+ // ===========================================================
+
+ // UNALIGNED HEAD
+ // ===========================================================
+ // * unaligned head handling: grab aligned 8B containing unaligned inp(ut)
+ // * obliterate (ignore) bytes outside string by shifting off reg ends
+ // * compare with bitmask, short circuit return true if one or more high
+ // bits set.
+ cmp(size, 0);
+ br(Assembler::zero, true, Assembler::pn, Lreturn); // short-circuit?
+ delayed()->mov(0,result); // annuled so i not clobbered for following
+ neg(i, t4);
+ add(i, size, t5);
+ ldx(inp, t4, t3); // raw aligned 8B containing unaligned head -> t3
+ mov(8, t4);
+ sub(t4, t5, t4);
+ sra(t4, 31, t5);
+ andn(t4, t5, t5);
+ add(i, t5, t4);
+ sll(t5, 3, t5);
+ sll(t4, 3, t4); // # bits to shift right, left -> t5,t4
+ srlx(t3, t5, t3);
+ sllx(t3, t4, t3); // bytes outside string in 8B header obliterated -> t3
+ andcc(lmask, t3, G0);
+ brx(Assembler::notZero, true, Assembler::pn, Lreturn); // short circuit?
+ delayed()->mov(1,result); // annuled so i not clobbered for following
+ add(size, -8, t5); // core end index -> t5
+ mov(8, t4);
+ sub(t4, i, i); // # bytes examined in unalgn head (<8) -> i
+ // ===========================================================
+
+ // ALIGNED CORE
+ // ===========================================================
+ // * iterate index i over aligned 8B sections of core, comparing with
+ // bitmask, short circuit return true if one or more high bits set
+ // t5 contains core end index/loop limit which is the index
+ // of the MSB of last (unaligned) 8B fully contained in the string.
+ // inp contains address of first byte in string/array
+ // lmask contains 8B high bit mask for comparison
+ // i contains next index to be processed (adr. inp+i is on 8B boundary)
+ bind(Lcore);
+ cmp_and_br_short(i, t5, Assembler::greater, Assembler::pn, Ltail);
+ bind(Lcore_rpt);
+ ldx(inp, i, t3);
+ andcc(t3, lmask, G0);
+ brx(Assembler::notZero, true, Assembler::pn, Lreturn);
+ delayed()->mov(1, result); // annuled so i not clobbered for following
+ add(i, 8, i);
+ cmp_and_br_short(i, t5, Assembler::lessEqual, Assembler::pn, Lcore_rpt);
+ // ===========================================================
+
+ // ALIGNED TAIL (<8B)
+ // ===========================================================
+ // handle aligned tail of 7B or less as complete 8B, obliterating end of
+ // string bytes by shifting them off end, compare what's left with bitmask
+ // inp contains address of first byte in string/array
+ // lmask contains 8B high bit mask for comparison
+ // i contains next index to be processed (adr. inp+i is on 8B boundary)
+ bind(Ltail);
+ subcc(size, i, t4); // # of remaining bytes in string -> t4
+ // return 0 if no more remaining bytes
+ br(Assembler::lessEqual, true, Assembler::pn, Lreturn);
+ delayed()->mov(0, result); // annuled so i not clobbered for following
+ ldx(inp, i, t3); // load final 8B (aligned) containing tail -> t3
+ mov(8, t5);
+ sub(t5, t4, t4);
+ mov(0, result); // ** i clobbered at this point
+ sll(t4, 3, t4); // bits beyond end of string -> t4
+ srlx(t3, t4, t3); // bytes beyond end now obliterated -> t3
+ andcc(lmask, t3, G0);
+ movcc(Assembler::notZero, false, xcc, 1, result);
+ bind(Lreturn);
+}
+
#endif
+
// Use BIS for zeroing (count is in bytes).
void MacroAssembler::bis_zeroing(Register to, Register count, Register temp, Label& Ldone) {
assert(UseBlockZeroing && VM_Version::has_block_zeroing(), "only works with BIS zeroing");
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.hpp Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.hpp Thu Mar 24 15:53:19 2016 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, 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
@@ -1392,6 +1392,11 @@
void array_equals(bool is_array_equ, Register ary1, Register ary2,
Register limit, Register tmp, Register result, bool is_byte);
+ // test for negative bytes in input string of a given size, result 0 if none
+ void has_negatives(Register inp, Register size, Register result,
+ Register t2, Register t3, Register t4,
+ Register t5);
+
#endif
// Use BIS for zeroing
--- a/hotspot/src/cpu/sparc/vm/sparc.ad Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/src/cpu/sparc/vm/sparc.ad Thu Mar 24 15:53:19 2016 -0700
@@ -10168,6 +10168,22 @@
ins_pipe(long_memory_op);
%}
+instruct has_negatives(o0RegP pAryR, g3RegI iSizeR, notemp_iRegI resultR,
+ iRegL tmp1L, iRegL tmp2L, iRegL tmp3L, iRegL tmp4L,
+ flagsReg ccr)
+%{
+ match(Set resultR (HasNegatives pAryR iSizeR));
+ effect(TEMP resultR, TEMP tmp1L, TEMP tmp2L, TEMP tmp3L, TEMP tmp4L, USE pAryR, USE iSizeR, KILL ccr);
+ format %{ "has negatives byte[] $pAryR,$iSizeR -> $resultR // KILL $tmp1L,$tmp2L,$tmp3L,$tmp4L" %}
+ ins_encode %{
+ __ has_negatives($pAryR$$Register, $iSizeR$$Register,
+ $resultR$$Register,
+ $tmp1L$$Register, $tmp2L$$Register,
+ $tmp3L$$Register, $tmp4L$$Register);
+ %}
+ ins_pipe(long_memory_op);
+%}
+
// char[] to byte[] compression
instruct string_compress(o0RegP src, o1RegP dst, g3RegI len, notemp_iRegI result, iRegL tmp, flagsReg ccr) %{
predicate(UseVIS < 3);
--- a/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCICompilerFactory.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/src/jdk.vm.ci/share/classes/jdk.vm.ci.runtime/src/jdk/vm/ci/runtime/JVMCICompilerFactory.java Thu Mar 24 15:53:19 2016 -0700
@@ -28,8 +28,7 @@
public interface JVMCICompilerFactory {
/**
- * Get the name of this compiler. The compiler will be selected when the jvmci.compiler system
- * property is equal to this name.
+ * Get the name of this compiler.
*/
String getCompilerName();
--- a/hotspot/src/share/vm/ci/ciReplay.cpp Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/src/share/vm/ci/ciReplay.cpp Thu Mar 24 15:53:19 2016 -0700
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2013, 2016, 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
@@ -1057,8 +1057,6 @@
int ciReplay::replay_impl(TRAPS) {
HandleMark hm;
ResourceMark rm;
- // Make sure we don't run with background compilation
- BackgroundCompilation = false;
if (ReplaySuppressInitializers > 2) {
// ReplaySuppressInitializers > 2 means that we want to allow
--- a/hotspot/src/share/vm/classfile/classLoader.cpp Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp Thu Mar 24 15:53:19 2016 -0700
@@ -1455,8 +1455,7 @@
EXCEPTION_MARK;
HandleMark hm(THREAD);
ResourceMark rm(THREAD);
- // Make sure we don't run with background compilation
- BackgroundCompilation = false;
+
// Find bootstrap loader
Handle system_class_loader (THREAD, SystemDictionary::java_system_loader());
// Iterate over all bootstrap class path entries
--- a/hotspot/src/share/vm/code/nmethod.cpp Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/src/share/vm/code/nmethod.cpp Thu Mar 24 15:53:19 2016 -0700
@@ -1386,9 +1386,17 @@
void nmethod::invalidate_osr_method() {
assert(_entry_bci != InvocationEntryBci, "wrong kind of nmethod");
+#ifndef ASSERT
+ // Make sure osr nmethod is invalidated only once
+ if (!is_in_use()) {
+ return;
+ }
+#endif
// Remove from list of active nmethods
- if (method() != NULL)
- method()->method_holder()->remove_osr_nmethod(this);
+ if (method() != NULL) {
+ bool removed = method()->method_holder()->remove_osr_nmethod(this);
+ assert(!removed || is_in_use(), "unused osr nmethod should be invalidated");
+ }
}
void nmethod::log_state_change() const {
@@ -1509,7 +1517,7 @@
// happens or they get unloaded.
if (state == zombie) {
{
- // Flushing dependecies must be done before any possible
+ // Flushing dependencies must be done before any possible
// safepoint can sneak in, otherwise the oops used by the
// dependency logic could have become stale.
MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
@@ -1525,7 +1533,7 @@
// zombie only - if a JVMTI agent has enabled the CompiledMethodUnload
// event and it hasn't already been reported for this nmethod then
- // report it now. The event may have been reported earilier if the GC
+ // report it now. The event may have been reported earlier if the GC
// marked it for unloading). JvmtiDeferredEventQueue support means
// we no longer go to a safepoint here.
post_compiled_method_unload();
@@ -1553,8 +1561,10 @@
void nmethod::flush() {
// Note that there are no valid oops in the nmethod anymore.
- assert(is_zombie() || (is_osr_method() && is_unloaded()), "must be a zombie method");
- assert(is_marked_for_reclamation() || (is_osr_method() && is_unloaded()), "must be marked for reclamation");
+ assert(!is_osr_method() || is_unloaded() || is_zombie(),
+ "osr nmethod must be unloaded or zombie before flushing");
+ assert(is_zombie() || is_osr_method(), "must be a zombie method");
+ assert(is_marked_for_reclamation() || is_osr_method(), "must be marked for reclamation");
assert (!is_locked_by_vm(), "locked methods shouldn't be flushed");
assert_locked_or_safepoint(CodeCache_lock);
@@ -1562,9 +1572,9 @@
// completely deallocate this method
Events::log(JavaThread::current(), "flushing nmethod " INTPTR_FORMAT, p2i(this));
if (PrintMethodFlushing) {
- tty->print_cr("*flushing nmethod %3d/" INTPTR_FORMAT ". Live blobs:" UINT32_FORMAT
+ tty->print_cr("*flushing %s nmethod %3d/" INTPTR_FORMAT ". Live blobs:" UINT32_FORMAT
"/Free CodeCache:" SIZE_FORMAT "Kb",
- _compile_id, p2i(this), CodeCache::blob_count(),
+ is_osr_method() ? "osr" : "",_compile_id, p2i(this), CodeCache::blob_count(),
CodeCache::unallocated_capacity(CodeCache::get_code_blob_type(this))/1024);
}
@@ -2916,10 +2926,7 @@
tty->print("((nmethod*) " INTPTR_FORMAT ") ", p2i(this));
tty->print(" for method " INTPTR_FORMAT , p2i(method()));
tty->print(" { ");
- if (is_in_use()) tty->print("in_use ");
- if (is_not_entrant()) tty->print("not_entrant ");
- if (is_zombie()) tty->print("zombie ");
- if (is_unloaded()) tty->print("unloaded ");
+ tty->print_cr("%s ", state());
if (on_scavenge_root_list()) tty->print("scavenge_root ");
tty->print_cr("}:");
}
--- a/hotspot/src/share/vm/code/nmethod.hpp Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/src/share/vm/code/nmethod.hpp Thu Mar 24 15:53:19 2016 -0700
@@ -207,7 +207,7 @@
unsigned int _has_wide_vectors:1; // Preserve wide vectors at safepoints
// Protected by Patching_lock
- volatile unsigned char _state; // {alive, not_entrant, zombie, unloaded}
+ volatile unsigned char _state; // {in_use, not_entrant, zombie, unloaded}
volatile unsigned char _unloading_clock; // Incremented after GC unloaded/cleaned the nmethod
@@ -438,7 +438,20 @@
bool is_alive() const { return _state == in_use || _state == not_entrant; }
bool is_not_entrant() const { return _state == not_entrant; }
bool is_zombie() const { return _state == zombie; }
- bool is_unloaded() const { return _state == unloaded; }
+ bool is_unloaded() const { return _state == unloaded; }
+
+ // returns a string version of the nmethod state
+ const char* state() const {
+ switch(_state) {
+ case in_use: return "in use";
+ case not_entrant: return "not_entrant";
+ case zombie: return "zombie";
+ case unloaded: return "unloaded";
+ default:
+ fatal("unexpected nmethod state: %d", _state);
+ return NULL;
+ }
+ }
#if INCLUDE_RTM_OPT
// rtm state accessing and manipulating
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp Thu Mar 24 15:53:19 2016 -0700
@@ -773,7 +773,8 @@
#endif // !ZERO && !SHARK
// Initialize the compilation queue
if (c2_compiler_count > 0) {
- _c2_compile_queue = new CompileQueue("C2 compile queue");
+ const char* name = JVMCI_ONLY(UseJVMCICompiler ? "JVMCI compile queue" :) "C2 compile queue";
+ _c2_compile_queue = new CompileQueue(name);
_compilers[1]->set_num_compiler_threads(c2_compiler_count);
}
if (c1_compiler_count > 0) {
@@ -1169,7 +1170,8 @@
CompilationPolicy::policy()->delay_compilation(method());
return NULL;
}
- compile_method_base(method, osr_bci, comp_level, hot_method, hot_count, comment, !directive->BackgroundCompilationOption, THREAD);
+ bool is_blocking = !directive->BackgroundCompilationOption || CompileTheWorld || ReplayCompiles;
+ compile_method_base(method, osr_bci, comp_level, hot_method, hot_count, comment, is_blocking, THREAD);
}
// return requested nmethod
--- a/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp Thu Mar 24 15:53:19 2016 -0700
@@ -448,7 +448,10 @@
C2V_VMENTRY(jboolean, canInlineMethod,(JNIEnv *, jobject, jobject jvmci_method))
methodHandle method = CompilerToVM::asMethod(jvmci_method);
- return !method->is_not_compilable() && !CompilerOracle::should_not_inline(method) && !method->dont_inline();
+ // In hosted mode ignore the not_compilable flags since they are never set by
+ // the JVMCI compiler.
+ bool is_compilable = UseJVMCICompiler ? !method->is_not_compilable(CompLevel_full_optimization) : true;
+ return is_compilable && !CompilerOracle::should_not_inline(method) && !method->dont_inline();
C2V_END
C2V_VMENTRY(jboolean, shouldInlineMethod,(JNIEnv *, jobject, jobject jvmci_method))
--- a/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/src/share/vm/jvmci/jvmciRuntime.cpp Thu Mar 24 15:53:19 2016 -0700
@@ -800,12 +800,9 @@
bool JVMCIRuntime::treat_as_trivial(Method* method) {
if (_HotSpotJVMCIRuntime_initialized) {
- oop loader = method->method_holder()->class_loader();
- if (loader == NULL) {
- for (int i = 0; i < _trivial_prefixes_count; i++) {
- if (method->method_holder()->name()->starts_with(_trivial_prefixes[i])) {
- return true;
- }
+ for (int i = 0; i < _trivial_prefixes_count; i++) {
+ if (method->method_holder()->name()->starts_with(_trivial_prefixes[i])) {
+ return true;
}
}
}
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp Thu Mar 24 15:53:19 2016 -0700
@@ -2614,8 +2614,8 @@
}
}
-
-void InstanceKlass::remove_osr_nmethod(nmethod* n) {
+// Remove osr nmethod from the list. Return true if found and removed.
+bool InstanceKlass::remove_osr_nmethod(nmethod* n) {
// This is a short non-blocking critical region, so the no safepoint check is ok.
MutexLockerEx ml(OsrList_lock, Mutex::_no_safepoint_check_flag);
assert(n->is_osr_method(), "wrong kind of nmethod");
@@ -2624,6 +2624,7 @@
int max_level = CompLevel_none; // Find the max comp level excluding n
Method* m = n->method();
// Search for match
+ bool found = false;
while(cur != NULL && cur != n) {
if (TieredCompilation && m == cur->method()) {
// Find max level before n
@@ -2634,6 +2635,7 @@
}
nmethod* next = NULL;
if (cur == n) {
+ found = true;
next = cur->osr_link();
if (last == NULL) {
// Remove first element
@@ -2654,6 +2656,7 @@
}
m->set_highest_osr_comp_level(max_level);
}
+ return found;
}
int InstanceKlass::mark_osr_nmethods(const Method* m) {
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp Thu Mar 24 15:53:19 2016 -0700
@@ -878,7 +878,7 @@
nmethod* osr_nmethods_head() const { return _osr_nmethods_head; };
void set_osr_nmethods_head(nmethod* h) { _osr_nmethods_head = h; };
void add_osr_nmethod(nmethod* n);
- void remove_osr_nmethod(nmethod* n);
+ bool remove_osr_nmethod(nmethod* n);
int mark_osr_nmethods(const Method* m);
nmethod* lookup_osr_nmethod(const Method* m, int bci, int level, bool match_level) const;
--- a/hotspot/src/share/vm/opto/loopTransform.cpp Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/src/share/vm/opto/loopTransform.cpp Thu Mar 24 15:53:19 2016 -0700
@@ -1453,20 +1453,14 @@
Node *opaq = NULL;
if (adjust_min_trip) { // If not maximally unrolling, need adjustment
// Search for zero-trip guard.
- assert( loop_head->is_main_loop(), "" );
- assert( ctrl->Opcode() == Op_IfTrue || ctrl->Opcode() == Op_IfFalse, "" );
- Node *iff = ctrl->in(0);
- assert( iff->Opcode() == Op_If, "" );
- Node *bol = iff->in(1);
- assert( bol->Opcode() == Op_Bool, "" );
- Node *cmp = bol->in(1);
- assert( cmp->Opcode() == Op_CmpI, "" );
- opaq = cmp->in(2);
- // Occasionally it's possible for a zero-trip guard Opaque1 node to be
- // optimized away and then another round of loop opts attempted.
- // We can not optimize this particular loop in that case.
- if (opaq->Opcode() != Op_Opaque1)
- return; // Cannot find zero-trip guard! Bail out!
+
+ // Check the shape of the graph at the loop entry. If an inappropriate
+ // graph shape is encountered, the compiler bails out loop unrolling;
+ // compilation of the method will still succeed.
+ if (!is_canonical_main_loop_entry(loop_head)) {
+ return;
+ }
+ opaq = ctrl->in(0)->in(1)->in(1)->in(2);
// Zero-trip test uses an 'opaque' node which is not shared.
assert(opaq->outcnt() == 1 && opaq->in(1) == limit, "");
}
@@ -2109,7 +2103,6 @@
#endif
assert(RangeCheckElimination, "");
CountedLoopNode *cl = loop->_head->as_CountedLoop();
- assert(cl->is_main_loop(), "");
// protect against stride not being a constant
if (!cl->stride_is_con())
@@ -2121,20 +2114,17 @@
// to not ever trip end tests
Node *main_limit = cl->limit();
+ // Check graph shape. Cannot optimize a loop if zero-trip
+ // Opaque1 node is optimized away and then another round
+ // of loop opts attempted.
+ if (!is_canonical_main_loop_entry(cl)) {
+ return;
+ }
+
// Need to find the main-loop zero-trip guard
Node *ctrl = cl->in(LoopNode::EntryControl);
- assert(ctrl->Opcode() == Op_IfTrue || ctrl->Opcode() == Op_IfFalse, "");
Node *iffm = ctrl->in(0);
- assert(iffm->Opcode() == Op_If, "");
- Node *bolzm = iffm->in(1);
- assert(bolzm->Opcode() == Op_Bool, "");
- Node *cmpzm = bolzm->in(1);
- assert(cmpzm->is_Cmp(), "");
- Node *opqzm = cmpzm->in(2);
- // Can not optimize a loop if zero-trip Opaque1 node is optimized
- // away and then another round of loop opts attempted.
- if (opqzm->Opcode() != Op_Opaque1)
- return;
+ Node *opqzm = iffm->in(1)->in(1)->in(2);
assert(opqzm->in(1) == main_limit, "do not understand situation");
// Find the pre-loop limit; we will expand its iterations to
--- a/hotspot/src/share/vm/opto/loopnode.cpp Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/src/share/vm/opto/loopnode.cpp Thu Mar 24 15:53:19 2016 -0700
@@ -3275,6 +3275,41 @@
return LCA;
}
+// Check the shape of the graph at the loop entry. In some cases,
+// the shape of the graph does not match the shape outlined below.
+// That is caused by the Opaque1 node "protecting" the shape of
+// the graph being removed by, for example, the IGVN performed
+// in PhaseIdealLoop::build_and_optimize().
+//
+// After the Opaque1 node has been removed, optimizations (e.g., split-if,
+// loop unswitching, and IGVN, or a combination of them) can freely change
+// the graph's shape. As a result, the graph shape outlined below cannot
+// be guaranteed anymore.
+bool PhaseIdealLoop::is_canonical_main_loop_entry(CountedLoopNode* cl) {
+ assert(cl->is_main_loop(), "check should be applied to main loops");
+ Node* ctrl = cl->in(LoopNode::EntryControl);
+ if (ctrl == NULL || (!ctrl->is_IfTrue() && !ctrl->is_IfFalse())) {
+ return false;
+ }
+ Node* iffm = ctrl->in(0);
+ if (iffm == NULL || !iffm->is_If()) {
+ return false;
+ }
+ Node* bolzm = iffm->in(1);
+ if (bolzm == NULL || !bolzm->is_Bool()) {
+ return false;
+ }
+ Node* cmpzm = bolzm->in(1);
+ if (cmpzm == NULL || !cmpzm->is_Cmp()) {
+ return false;
+ }
+ Node* opqzm = cmpzm->in(2);
+ if (opqzm == NULL || opqzm->Opcode() != Op_Opaque1) {
+ return false;
+ }
+ return true;
+}
+
//------------------------------get_late_ctrl----------------------------------
// Compute latest legal control.
Node *PhaseIdealLoop::get_late_ctrl( Node *n, Node *early ) {
--- a/hotspot/src/share/vm/opto/loopnode.hpp Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/src/share/vm/opto/loopnode.hpp Thu Mar 24 15:53:19 2016 -0700
@@ -656,6 +656,9 @@
bool cast_incr_before_loop(Node* incr, Node* ctrl, Node* loop);
public:
+
+ static bool is_canonical_main_loop_entry(CountedLoopNode* cl);
+
bool has_node( Node* n ) const {
guarantee(n != NULL, "No Node.");
return _nodes[n->_idx] != NULL;
--- a/hotspot/src/share/vm/opto/reg_split.cpp Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/src/share/vm/opto/reg_split.cpp Thu Mar 24 15:53:19 2016 -0700
@@ -287,7 +287,7 @@
Node* clone_node(Node* def, Block *b, Compile* C) {
if (def->needs_anti_dependence_check()) {
#ifdef ASSERT
- if (Verbose) {
+ if (PrintOpto && WizardMode) {
tty->print_cr("RA attempts to clone node with anti_dependence:");
def->dump(-1); tty->cr();
tty->print_cr("into block:");
--- a/hotspot/src/share/vm/opto/superword.cpp Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/src/share/vm/opto/superword.cpp Thu Mar 24 15:53:19 2016 -0700
@@ -3074,21 +3074,13 @@
//----------------------------get_pre_loop_end---------------------------
// Find pre loop end from main loop. Returns null if none.
CountedLoopEndNode* SuperWord::get_pre_loop_end(CountedLoopNode* cl) {
- Node* ctrl = cl->in(LoopNode::EntryControl);
- if (!ctrl->is_IfTrue() && !ctrl->is_IfFalse()) return NULL;
- Node* iffm = ctrl->in(0);
- if (!iffm->is_If()) return NULL;
- Node* bolzm = iffm->in(1);
- if (!bolzm->is_Bool()) return NULL;
- Node* cmpzm = bolzm->in(1);
- if (!cmpzm->is_Cmp()) return NULL;
- Node* opqzm = cmpzm->in(2);
- // Can not optimize a loop if zero-trip Opaque1 node is optimized
- // away and then another round of loop opts attempted.
- if (opqzm->Opcode() != Op_Opaque1) {
+ // The loop cannot be optimized if the graph shape at
+ // the loop entry is inappropriate.
+ if (!PhaseIdealLoop::is_canonical_main_loop_entry(cl)) {
return NULL;
}
- Node* p_f = iffm->in(0);
+
+ Node* p_f = cl->in(LoopNode::EntryControl)->in(0)->in(0);
if (!p_f->is_IfFalse()) return NULL;
if (!p_f->in(0)->is_CountedLoopEnd()) return NULL;
CountedLoopEndNode* pre_end = p_f->in(0)->as_CountedLoopEnd();
--- a/hotspot/src/share/vm/runtime/arguments.cpp Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/src/share/vm/runtime/arguments.cpp Thu Mar 24 15:53:19 2016 -0700
@@ -2550,6 +2550,13 @@
warning("Reserved Stack Area not supported on this platform");
}
#endif
+
+ if (BackgroundCompilation && (CompileTheWorld || ReplayCompiles)) {
+ if (!FLAG_IS_DEFAULT(BackgroundCompilation)) {
+ warning("BackgroundCompilation disabled due to CompileTheWorld or ReplayCompiles options.");
+ }
+ FLAG_SET_CMDLINE(bool, BackgroundCompilation, false);
+ }
return status;
}
--- a/hotspot/src/share/vm/runtime/sweeper.cpp Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/src/share/vm/runtime/sweeper.cpp Thu Mar 24 15:53:19 2016 -0700
@@ -355,8 +355,8 @@
bool forced = _force_sweep;
// Force stack scanning if there is only 10% free space in the code cache.
- // We force stack scanning only non-profiled code heap gets full, since critical
- // allocation go to the non-profiled heap and we must be make sure that there is
+ // We force stack scanning only if the non-profiled code heap gets full, since critical
+ // allocations go to the non-profiled heap and we must be make sure that there is
// enough space.
double free_percent = 1 / CodeCache::reverse_free_ratio(CodeBlobType::MethodNonProfiled) * 100;
if (free_percent <= StartAggressiveSweepingAt) {
@@ -423,12 +423,19 @@
// Now ready to process nmethod and give up CodeCache_lock
{
MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+ // Save information before potentially flushing the nmethod
int size = nm->total_size();
bool is_c2_method = nm->is_compiled_by_c2();
+ bool is_osr = nm->is_osr_method();
+ int compile_id = nm->compile_id();
+ intptr_t address = p2i(nm);
+ const char* state_before = nm->state();
+ const char* state_after = "";
MethodStateChange type = process_nmethod(nm);
switch (type) {
case Flushed:
+ state_after = "flushed";
freed_memory += size;
++flushed_count;
if (is_c2_method) {
@@ -436,9 +443,11 @@
}
break;
case MarkedForReclamation:
+ state_after = "marked for reclamation";
++marked_for_reclamation_count;
break;
case MadeZombie:
+ state_after = "made zombie";
++zombified_count;
break;
case None:
@@ -446,7 +455,11 @@
default:
ShouldNotReachHere();
}
+ if (PrintMethodFlushing && Verbose && type != None) {
+ tty->print_cr("### %s nmethod %3d/" PTR_FORMAT " (%s) %s", is_osr ? "osr" : "", compile_id, address, state_before, state_after);
+ }
}
+
_seen++;
handle_safepoint_request();
}
@@ -533,7 +546,7 @@
NMethodMarker(nmethod* nm) {
JavaThread* current = JavaThread::current();
assert (current->is_Code_cache_sweeper_thread(), "Must be");
- _thread = (CodeCacheSweeperThread*)JavaThread::current();
+ _thread = (CodeCacheSweeperThread*)current;
if (!nm->is_zombie() && !nm->is_unloaded()) {
// Only expose live nmethods for scanning
_thread->set_scanned_nmethod(nm);
@@ -545,6 +558,10 @@
};
void NMethodSweeper::release_nmethod(nmethod* nm) {
+ // Make sure the released nmethod is no longer referenced by the sweeper thread
+ CodeCacheSweeperThread* thread = (CodeCacheSweeperThread*)JavaThread::current();
+ thread->set_scanned_nmethod(NULL);
+
// Clean up any CompiledICHolders
{
ResourceMark rm;
@@ -575,7 +592,7 @@
if (nm->is_locked_by_vm()) {
// But still remember to clean-up inline caches for alive nmethods
if (nm->is_alive()) {
- // Clean inline caches that point to zombie/non-entrant methods
+ // Clean inline caches that point to zombie/non-entrant/unloaded nmethods
MutexLocker cl(CompiledIC_lock);
nm->cleanup_inline_caches();
SWEEP(nm);
@@ -589,42 +606,44 @@
// there are no inline caches that refer to it.
if (nm->is_marked_for_reclamation()) {
assert(!nm->is_locked_by_vm(), "must not flush locked nmethods");
- if (PrintMethodFlushing && Verbose) {
- tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (marked for reclamation) being flushed", nm->compile_id(), p2i(nm));
- }
release_nmethod(nm);
assert(result == None, "sanity");
result = Flushed;
} else {
- if (PrintMethodFlushing && Verbose) {
- tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (zombie) being marked for reclamation", nm->compile_id(), p2i(nm));
- }
nm->mark_for_reclamation();
// Keep track of code cache state change
_bytes_changed += nm->total_size();
SWEEP(nm);
assert(result == None, "sanity");
result = MarkedForReclamation;
+ assert(nm->is_marked_for_reclamation(), "nmethod must be marked for reclamation");
}
} else if (nm->is_not_entrant()) {
// If there are no current activations of this method on the
// stack we can safely convert it to a zombie method
if (nm->can_convert_to_zombie()) {
- // Clear ICStubs to prevent back patching stubs of zombie or unloaded
+ // Clear ICStubs to prevent back patching stubs of zombie or flushed
// nmethods during the next safepoint (see ICStub::finalize).
{
MutexLocker cl(CompiledIC_lock);
nm->clear_ic_stubs();
}
- if (PrintMethodFlushing && Verbose) {
- tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (not entrant) being made zombie", nm->compile_id(), p2i(nm));
- }
// Code cache state change is tracked in make_zombie()
nm->make_zombie();
SWEEP(nm);
- assert(result == None, "sanity");
- result = MadeZombie;
- assert(nm->is_zombie(), "nmethod must be zombie");
+ if (nm->is_osr_method()) {
+ // No inline caches will ever point to osr methods, so we can just remove it.
+ // Make sure that we unregistered the nmethod with the heap and flushed all
+ // dependencies before removing the nmethod (done in make_zombie()).
+ assert(nm->is_zombie(), "nmethod must be unregistered");
+ release_nmethod(nm);
+ assert(result == None, "sanity");
+ result = Flushed;
+ } else {
+ assert(result == None, "sanity");
+ result = MadeZombie;
+ assert(nm->is_zombie(), "nmethod must be zombie");
+ }
} else {
// Still alive, clean up its inline caches
MutexLocker cl(CompiledIC_lock);
@@ -632,9 +651,13 @@
SWEEP(nm);
}
} else if (nm->is_unloaded()) {
- // Unloaded code, just make it a zombie
- if (PrintMethodFlushing && Verbose) {
- tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (unloaded) being made zombie", nm->compile_id(), p2i(nm));
+ // Code is unloaded, so there are no activations on the stack.
+ // Convert the nmethod to zombie or flush it directly in the OSR case.
+ {
+ // Clean ICs of unloaded nmethods as well because they may reference other
+ // unloaded nmethods that may be flushed earlier in the sweeper cycle.
+ MutexLocker cl(CompiledIC_lock);
+ nm->cleanup_inline_caches();
}
if (nm->is_osr_method()) {
SWEEP(nm);
@@ -643,12 +666,6 @@
assert(result == None, "sanity");
result = Flushed;
} else {
- {
- // Clean ICs of unloaded nmethods as well because they may reference other
- // unloaded nmethods that may be flushed earlier in the sweeper cycle.
- MutexLocker cl(CompiledIC_lock);
- nm->cleanup_inline_caches();
- }
// Code cache state change is tracked in make_zombie()
nm->make_zombie();
SWEEP(nm);
@@ -657,7 +674,7 @@
}
} else {
possibly_flush(nm);
- // Clean-up all inline caches that point to zombie/non-reentrant methods
+ // Clean inline caches that point to zombie/non-entrant/unloaded nmethods
MutexLocker cl(CompiledIC_lock);
nm->cleanup_inline_caches();
SWEEP(nm);
@@ -668,10 +685,10 @@
void NMethodSweeper::possibly_flush(nmethod* nm) {
if (UseCodeCacheFlushing) {
- if (!nm->is_locked_by_vm() && !nm->is_osr_method() && !nm->is_native_method()) {
+ if (!nm->is_locked_by_vm() && !nm->is_native_method()) {
bool make_not_entrant = false;
- // Do not make native methods and OSR-methods not-entrant
+ // Do not make native methods not-entrant
nm->dec_hotness_counter();
// Get the initial value of the hotness counter. This value depends on the
// ReservedCodeCacheSize
--- a/hotspot/src/share/vm/runtime/sweeper.hpp Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/src/share/vm/runtime/sweeper.hpp Thu Mar 24 15:53:19 2016 -0700
@@ -45,12 +45,12 @@
// and sweep_code_cache() cannot execute at the same time.
// To reclaim memory, nmethods are first marked as 'not-entrant'. Methods can
// be made not-entrant by (i) the sweeper, (ii) deoptimization, (iii) dependency
-// invalidation, and (iv) being replaced be a different method version (tiered
-// compilation). Not-entrant nmethod cannot be called by Java threads, but they
-// can still be active on the stack. To ensure that active nmethod are not reclaimed,
+// invalidation, and (iv) being replaced by a different method version (tiered
+// compilation). Not-entrant nmethods cannot be called by Java threads, but they
+// can still be active on the stack. To ensure that active nmethods are not reclaimed,
// we have to wait until the next marking phase has completed. If a not-entrant
// nmethod was NOT marked as active, it can be converted to 'zombie' state. To safely
-// remove the nmethod, all inline caches (IC) that point to the the nmethod must be
+// remove the nmethod, all inline caches (IC) that point to the nmethod must be
// cleared. After that, the nmethod can be evicted from the code cache. Each nmethod's
// state change happens during separate sweeps. It may take at least 3 sweeps before an
// nmethod's space is freed.
--- a/hotspot/test/compiler/compilercontrol/commandfile/CompileOnlyTest.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/commandfile/CompileOnlyTest.java Thu Mar 24 15:53:19 2016 -0700
@@ -29,9 +29,9 @@
* @build compiler.compilercontrol.commandfile.CompileOnlyTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm compiler.compilercontrol.commandfile.CompileOnlyTest
+ * @run driver compiler.compilercontrol.commandfile.CompileOnlyTest
*/
package compiler.compilercontrol.commandfile;
--- a/hotspot/test/compiler/compilercontrol/commandfile/ExcludeTest.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/commandfile/ExcludeTest.java Thu Mar 24 15:53:19 2016 -0700
@@ -29,9 +29,9 @@
* @build compiler.compilercontrol.commandfile.ExcludeTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm compiler.compilercontrol.commandfile.ExcludeTest
+ * @run driver compiler.compilercontrol.commandfile.ExcludeTest
*/
package compiler.compilercontrol.commandfile;
--- a/hotspot/test/compiler/compilercontrol/commandfile/LogTest.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/commandfile/LogTest.java Thu Mar 24 15:53:19 2016 -0700
@@ -29,9 +29,9 @@
* @build compiler.compilercontrol.commandfile.LogTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm compiler.compilercontrol.commandfile.LogTest
+ * @run driver compiler.compilercontrol.commandfile.LogTest
*/
package compiler.compilercontrol.commandfile;
--- a/hotspot/test/compiler/compilercontrol/commandfile/PrintTest.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/commandfile/PrintTest.java Thu Mar 24 15:53:19 2016 -0700
@@ -30,9 +30,9 @@
* @build compiler.compilercontrol.commandfile.PrintTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm compiler.compilercontrol.commandfile.PrintTest
+ * @run driver compiler.compilercontrol.commandfile.PrintTest
*/
package compiler.compilercontrol.commandfile;
--- a/hotspot/test/compiler/compilercontrol/commands/CompileOnlyTest.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/commands/CompileOnlyTest.java Thu Mar 24 15:53:19 2016 -0700
@@ -29,9 +29,9 @@
* @build compiler.compilercontrol.commands.CompileOnlyTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm compiler.compilercontrol.commands.CompileOnlyTest
+ * @run driver compiler.compilercontrol.commands.CompileOnlyTest
*/
package compiler.compilercontrol.commands;
--- a/hotspot/test/compiler/compilercontrol/commands/ExcludeTest.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/commands/ExcludeTest.java Thu Mar 24 15:53:19 2016 -0700
@@ -29,9 +29,9 @@
* @build compiler.compilercontrol.commands.ExcludeTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm compiler.compilercontrol.commands.ExcludeTest
+ * @run driver compiler.compilercontrol.commands.ExcludeTest
*/
package compiler.compilercontrol.commands;
--- a/hotspot/test/compiler/compilercontrol/commands/LogTest.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/commands/LogTest.java Thu Mar 24 15:53:19 2016 -0700
@@ -29,9 +29,9 @@
* @build compiler.compilercontrol.commands.LogTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm compiler.compilercontrol.commands.LogTest
+ * @run driver compiler.compilercontrol.commands.LogTest
*/
package compiler.compilercontrol.commands;
--- a/hotspot/test/compiler/compilercontrol/commands/PrintTest.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/commands/PrintTest.java Thu Mar 24 15:53:19 2016 -0700
@@ -30,9 +30,9 @@
* @build compiler.compilercontrol.commands.PrintTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm compiler.compilercontrol.commands.PrintTest
+ * @run driver compiler.compilercontrol.commands.PrintTest
*/
package compiler.compilercontrol.commands;
--- a/hotspot/test/compiler/compilercontrol/directives/CompileOnlyTest.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/directives/CompileOnlyTest.java Thu Mar 24 15:53:19 2016 -0700
@@ -29,9 +29,9 @@
* @build compiler.compilercontrol.directives.CompileOnlyTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm compiler.compilercontrol.directives.CompileOnlyTest
+ * @run driver compiler.compilercontrol.directives.CompileOnlyTest
*/
package compiler.compilercontrol.directives;
--- a/hotspot/test/compiler/compilercontrol/directives/ExcludeTest.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/directives/ExcludeTest.java Thu Mar 24 15:53:19 2016 -0700
@@ -29,9 +29,9 @@
* @build compiler.compilercontrol.directives.ExcludeTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm compiler.compilercontrol.directives.ExcludeTest
+ * @run driver compiler.compilercontrol.directives.ExcludeTest
*/
package compiler.compilercontrol.directives;
--- a/hotspot/test/compiler/compilercontrol/directives/LogTest.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/directives/LogTest.java Thu Mar 24 15:53:19 2016 -0700
@@ -29,9 +29,9 @@
* @build compiler.compilercontrol.directives.LogTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm compiler.compilercontrol.directives.LogTest
+ * @run driver compiler.compilercontrol.directives.LogTest
*/
package compiler.compilercontrol.directives;
--- a/hotspot/test/compiler/compilercontrol/directives/PrintTest.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/directives/PrintTest.java Thu Mar 24 15:53:19 2016 -0700
@@ -30,9 +30,9 @@
* @build compiler.compilercontrol.directives.PrintTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm compiler.compilercontrol.directives.PrintTest
+ * @run driver compiler.compilercontrol.directives.PrintTest
*/
package compiler.compilercontrol.directives;
--- a/hotspot/test/compiler/compilercontrol/jcmd/AddAndRemoveTest.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/jcmd/AddAndRemoveTest.java Thu Mar 24 15:53:19 2016 -0700
@@ -29,9 +29,9 @@
* @build compiler.compilercontrol.jcmd.AddAndRemoveTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm compiler.compilercontrol.jcmd.AddAndRemoveTest
+ * @run driver compiler.compilercontrol.jcmd.AddAndRemoveTest
*/
package compiler.compilercontrol.jcmd;
--- a/hotspot/test/compiler/compilercontrol/jcmd/AddCompileOnlyTest.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/jcmd/AddCompileOnlyTest.java Thu Mar 24 15:53:19 2016 -0700
@@ -29,9 +29,9 @@
* @build compiler.compilercontrol.jcmd.AddCompileOnlyTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm compiler.compilercontrol.jcmd.AddCompileOnlyTest
+ * @run driver compiler.compilercontrol.jcmd.AddCompileOnlyTest
*/
package compiler.compilercontrol.jcmd;
--- a/hotspot/test/compiler/compilercontrol/jcmd/AddExcludeTest.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/jcmd/AddExcludeTest.java Thu Mar 24 15:53:19 2016 -0700
@@ -29,9 +29,9 @@
* @build compiler.compilercontrol.jcmd.AddExcludeTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm compiler.compilercontrol.jcmd.AddExcludeTest
+ * @run driver compiler.compilercontrol.jcmd.AddExcludeTest
*/
package compiler.compilercontrol.jcmd;
--- a/hotspot/test/compiler/compilercontrol/jcmd/AddLogTest.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/jcmd/AddLogTest.java Thu Mar 24 15:53:19 2016 -0700
@@ -29,9 +29,9 @@
* @build compiler.compilercontrol.jcmd.AddLogTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm compiler.compilercontrol.jcmd.AddLogTest
+ * @run driver compiler.compilercontrol.jcmd.AddLogTest
*/
package compiler.compilercontrol.jcmd;
--- a/hotspot/test/compiler/compilercontrol/jcmd/AddPrintAssemblyTest.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/jcmd/AddPrintAssemblyTest.java Thu Mar 24 15:53:19 2016 -0700
@@ -30,9 +30,9 @@
* @build compiler.compilercontrol.jcmd.AddPrintAssemblyTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm compiler.compilercontrol.jcmd.AddPrintAssemblyTest
+ * @run driver compiler.compilercontrol.jcmd.AddPrintAssemblyTest
*/
package compiler.compilercontrol.jcmd;
--- a/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java Thu Mar 24 15:53:19 2016 -0700
@@ -30,9 +30,9 @@
* @build compiler.compilercontrol.jcmd.ClearDirectivesFileStackTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm compiler.compilercontrol.jcmd.ClearDirectivesFileStackTest
+ * @run driver compiler.compilercontrol.jcmd.ClearDirectivesFileStackTest
*/
package compiler.compilercontrol.jcmd;
--- a/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesStackTest.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/jcmd/ClearDirectivesStackTest.java Thu Mar 24 15:53:19 2016 -0700
@@ -29,9 +29,9 @@
* @build compiler.compilercontrol.jcmd.ClearDirectivesStackTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm compiler.compilercontrol.jcmd.ClearDirectivesStackTest
+ * @run driver compiler.compilercontrol.jcmd.ClearDirectivesStackTest
*/
package compiler.compilercontrol.jcmd;
--- a/hotspot/test/compiler/compilercontrol/jcmd/PrintDirectivesTest.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/jcmd/PrintDirectivesTest.java Thu Mar 24 15:53:19 2016 -0700
@@ -30,9 +30,9 @@
* @build compiler.compilercontrol.jcmd.PrintDirectivesTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm compiler.compilercontrol.jcmd.PrintDirectivesTest
+ * @run driver compiler.compilercontrol.jcmd.PrintDirectivesTest
*/
package compiler.compilercontrol.jcmd;
--- a/hotspot/test/compiler/compilercontrol/jcmd/StressAddMultiThreadedTest.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/jcmd/StressAddMultiThreadedTest.java Thu Mar 24 15:53:19 2016 -0700
@@ -31,7 +31,7 @@
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils
* compiler.compilercontrol.share.actions.*
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run driver compiler.compilercontrol.jcmd.StressAddMultiThreadedTest
*/
--- a/hotspot/test/compiler/compilercontrol/matcher/MethodMatcherTest.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/matcher/MethodMatcherTest.java Thu Mar 24 15:53:19 2016 -0700
@@ -42,7 +42,7 @@
* @summary Tests CompilerCommand's method matcher
* @library /testlibrary /test/lib /compiler/whitebox ../share /
* @build compiler.compilercontrol.matcher.MethodMatcherTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
* -XX:+WhiteBoxAPI compiler.compilercontrol.matcher.MethodMatcherTest
--- a/hotspot/test/compiler/compilercontrol/mixed/RandomCommandsTest.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/mixed/RandomCommandsTest.java Thu Mar 24 15:53:19 2016 -0700
@@ -29,9 +29,9 @@
* @build compiler.compilercontrol.mixed.RandomCommandsTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm/timeout=600 compiler.compilercontrol.mixed.RandomCommandsTest
+ * @run driver/timeout=600 compiler.compilercontrol.mixed.RandomCommandsTest
*/
package compiler.compilercontrol.mixed;
--- a/hotspot/test/compiler/compilercontrol/mixed/RandomValidCommandsTest.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/mixed/RandomValidCommandsTest.java Thu Mar 24 15:53:19 2016 -0700
@@ -30,7 +30,7 @@
* @build compiler.compilercontrol.mixed.RandomValidCommandsTest
* pool.sub.* pool.subpack.* sun.hotspot.WhiteBox
* compiler.testlibrary.CompilerUtils compiler.compilercontrol.share.actions.*
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
* sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm/timeout=600 compiler.compilercontrol.mixed.RandomValidCommandsTest
*/
--- a/hotspot/test/compiler/compilercontrol/share/MultiCommand.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/share/MultiCommand.java Thu Mar 24 15:53:19 2016 -0700
@@ -72,6 +72,7 @@
@Override
public void test() {
Scenario.Builder builder = Scenario.getBuilder();
+ builder.addFlag("-Xmixed");
for (CompileCommand cc : testCases) {
cc.print();
builder.add(cc);
--- a/hotspot/test/compiler/compilercontrol/share/scenario/Scenario.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/compilercontrol/share/scenario/Scenario.java Thu Mar 24 15:53:19 2016 -0700
@@ -200,6 +200,7 @@
private final List<JcmdCommand> jcmdCommands = new ArrayList<>();
public Builder() {
+ addFlag("-Xmixed");
builders.put(Type.FILE, new CommandFileBuilder(Type.FILE.fileName));
builders.put(Type.OPTION, new CommandOptionsBuilder());
builders.put(Type.DIRECTIVE, new DirectiveBuilder(
@@ -207,6 +208,10 @@
jcmdStateBuilder = new JcmdStateBuilder(Type.JCMD.fileName);
}
+ public void addFlag(String flag) {
+ vmopts.add(flag);
+ }
+
public void add(CompileCommand compileCommand) {
String[] vmOptions = compileCommand.command.vmOpts;
Collections.addAll(vmopts, vmOptions);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/string/TestHasNegatives.java Thu Mar 24 15:53:19 2016 -0700
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2016, 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 8054307
+ * @ignore 8152636
+ * @summary Validates StringCoding.hasNegatives intrinsic with a small range of tests.
+ * @run main/bootclasspath java.lang.TestHasNegatives
+ */
+package java.lang;
+
+import java.lang.StringCoding;
+
+/*
+ * @summary Validates StringCoding.hasNegatives intrinsic with a small
+ * range of tests. Must be run with modified bootclasspath
+ * to allow existence in java.lang package.
+ */
+public class TestHasNegatives {
+
+ private static byte[] tBa = new byte[4096 + 16];
+
+ /**
+ * Completely initialize the test array, preparing it for tests of the
+ * StringCoding.hasNegatives method with a given array segment offset,
+ * length, and number of negative bytes.
+ */
+ public static void initialize(int off, int len, int neg) {
+ assert (len + off <= tBa.length);
+ // insert "canary" (negative) values before offset
+ for (int i = 0; i < off; ++i) {
+ tBa[i] = (byte) (((i + 15) & 0x7F) | 0x80);
+ }
+ // fill the array segment
+ for (int i = off; i < len + off; ++i) {
+ tBa[i] = (byte) (((i - off + 15) & 0x7F));
+ }
+ if (neg != 0) {
+ // modify a number (neg) disparate array bytes inside
+ // segment to be negative.
+ int div = (neg > 1) ? (len - 1) / (neg - 1) : 0;
+ int idx;
+ for (int i = 0; i < neg; ++i) {
+ idx = off + (len - 1) - div * i;
+ tBa[idx] = (byte) (0x80 | tBa[idx]);
+ }
+ }
+ // insert "canary" negative values after array segment
+ for (int i = len + off; i < tBa.length; ++i) {
+ tBa[i] = (byte) (((i + 15) & 0x7F) | 0x80);
+ }
+ }
+
+ /** Sizes of array segments to test. */
+ private static int sizes[] = { 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 13, 17, 19, 23, 37, 61, 131,
+ 4099 };
+
+ /**
+ * Test different array segment sizes, offsets, and number of negative
+ * bytes.
+ */
+ public static void test_hasNegatives() throws Exception {
+ int len, off;
+ int ng;
+ boolean r;
+
+ for (ng = 0; ng < 57; ++ng) { // number of negatives in array segment
+ for (off = 0; off < 8; ++off) { // starting offset of array segment
+ for (int i = 0; i < sizes.length; ++i) { // array segment size
+ // choice
+ len = sizes[i];
+ if (len + off > tBa.length)
+ continue;
+ initialize(off, len, ng);
+ r = StringCoding.hasNegatives(tBa, off, len);
+ if (r ^ ((ng == 0) ? false : true)) {
+ throw new Exception("Failed test hasNegatives " + "offset: " + off + " "
+ + "length: " + len + " " + "return: " + r + " " + "negatives: "
+ + ng);
+ }
+ }
+ }
+ }
+ }
+
+ public void run() throws Exception {
+ // iterate to eventually get intrinsic inlined
+ for (int j = 0; j < 1000; ++j) {
+ test_hasNegatives();
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ (new TestHasNegatives()).run();
+ System.out.println("hasNegatives validated");
+ }
+}
--- a/hotspot/test/compiler/whitebox/LockCompilationTest.java Wed Jul 05 21:30:26 2017 +0200
+++ b/hotspot/test/compiler/whitebox/LockCompilationTest.java Thu Mar 24 15:53:19 2016 -0700
@@ -23,12 +23,12 @@
/*
* @test LockCompilationTest
- * @bug 8059624
+ * @bug 8059624 8152169
* @library /testlibrary /test/lib /
* @modules java.management
* @build LockCompilationTest
- * @run main ClassFileInstaller sun.hotspot.WhiteBox
- * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI LockCompilationTest
* @summary testing of WB::lock/unlockCompilation()
*/
@@ -42,10 +42,25 @@
import jdk.test.lib.Asserts;
public class LockCompilationTest extends CompilerWhiteBoxTest {
+
public static void main(String[] args) throws Exception {
- // This case waits for 10 seconds and verifies that the method hasn't been
+ // This case waits for 5 seconds and verifies that the method hasn't been
// compiled during that time. Only do that for one of the test cases.
- CompilerWhiteBoxTest.main(LockCompilationTest::new, new String[] {"METHOD_TEST"});
+
+ // Only compile SimpleTestCase$Helper.method and exclude all other to ensure no
+ // contention on the compile queue causes problems.
+ String directive =
+ "[{ match:\"*SimpleTestCase$Helper.method\", Exclude:false}, " +
+ " { match:\"*.*\", Exclude:true}]";
+ if (WHITE_BOX.addCompilerDirective(directive) != 2) {
+ throw new RuntimeException("Could not add directive");
+ }
+ try {
+ CompilerWhiteBoxTest.main(LockCompilationTest::new, new String[] {"METHOD_TEST"});
+ } finally {
+ WHITE_BOX.removeCompilerDirective(2);
+ }
+
}
private LockCompilationTest(TestCase testCase) {
@@ -66,7 +81,9 @@
// to check if it works correctly w/ safepoints
System.out.println("going to safepoint");
WHITE_BOX.fullGC();
- waitBackgroundCompilation();
+ // Sleep a while and then make sure the compile is still waiting
+ Thread.sleep(5000);
+
Asserts.assertTrue(
WHITE_BOX.isMethodQueuedForCompilation(method),
method + " must be in queue");