Merge
This commit is contained in:
commit
b1991afdf4
@ -849,8 +849,8 @@ class StubGenerator: public StubCodeGenerator {
|
||||
__ bind(L1);
|
||||
|
||||
if (direction == copy_forwards) {
|
||||
__ add(s, s, 2 * wordSize);
|
||||
__ add(d, d, 2 * wordSize);
|
||||
__ add(s, s, bias);
|
||||
__ add(d, d, bias);
|
||||
}
|
||||
|
||||
__ tbz(count, 1, L2);
|
||||
|
@ -339,7 +339,7 @@ public class HotSpotConstantReflectionProvider implements ConstantReflectionProv
|
||||
|
||||
public JavaConstant readStableFieldValue(ResolvedJavaField field, JavaConstant receiver, boolean isDefaultStable) {
|
||||
JavaConstant fieldValue = readNonStableFieldValue(field, receiver);
|
||||
if (fieldValue.isNonNull()) {
|
||||
if (fieldValue != null && fieldValue.isNonNull()) {
|
||||
JavaType declaredType = field.getType();
|
||||
if (declaredType.getComponentType() != null) {
|
||||
int stableDimension = getArrayDimension(declaredType);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 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
|
||||
@ -25,6 +25,7 @@ package jdk.vm.ci.hotspot;
|
||||
import jdk.vm.ci.code.CompilationRequest;
|
||||
import jdk.vm.ci.code.CompilationRequestResult;
|
||||
import jdk.vm.ci.common.JVMCIError;
|
||||
import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.Option;
|
||||
import jdk.vm.ci.runtime.JVMCICompiler;
|
||||
import jdk.vm.ci.runtime.JVMCICompilerFactory;
|
||||
import jdk.vm.ci.runtime.JVMCIRuntime;
|
||||
@ -47,29 +48,33 @@ final class HotSpotJVMCICompilerConfig {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory of the selected system compiler.
|
||||
*/
|
||||
private static JVMCICompilerFactory compilerFactory;
|
||||
|
||||
/**
|
||||
* Selects the system compiler.
|
||||
* Gets the selected system compiler factory.
|
||||
*
|
||||
* Called from VM. This method has an object return type to allow it to be called with a VM
|
||||
* utility function used to call other static initialization methods.
|
||||
* @return the selected system compiler factory
|
||||
*/
|
||||
static Boolean selectCompiler(String compilerName) {
|
||||
assert compilerFactory == null;
|
||||
for (JVMCICompilerFactory factory : Services.load(JVMCICompilerFactory.class)) {
|
||||
if (factory.getCompilerName().equals(compilerName)) {
|
||||
compilerFactory = factory;
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
throw new JVMCIError("JVMCI compiler '%s' not found", compilerName);
|
||||
}
|
||||
|
||||
static JVMCICompilerFactory getCompilerFactory() {
|
||||
if (compilerFactory == null) {
|
||||
compilerFactory = new DummyCompilerFactory();
|
||||
JVMCICompilerFactory factory = null;
|
||||
String compilerName = Option.Compiler.getString();
|
||||
if (compilerName != null) {
|
||||
for (JVMCICompilerFactory f : Services.load(JVMCICompilerFactory.class)) {
|
||||
if (f.getCompilerName().equals(compilerName)) {
|
||||
factory = f;
|
||||
}
|
||||
}
|
||||
if (factory == null) {
|
||||
throw new JVMCIError("JVMCI compiler '%s' not found", compilerName);
|
||||
}
|
||||
} else {
|
||||
factory = new DummyCompilerFactory();
|
||||
}
|
||||
compilerFactory = factory;
|
||||
}
|
||||
return compilerFactory;
|
||||
}
|
||||
|
@ -91,6 +91,7 @@ public final class HotSpotJVMCIRuntime implements HotSpotJVMCIRuntimeProvider, H
|
||||
* A list of all supported JVMCI options.
|
||||
*/
|
||||
public enum Option {
|
||||
Compiler(String.class, null, "Selects the system compiler."),
|
||||
ImplicitStableValues(boolean.class, true, "Mark well-known stable fields as such."),
|
||||
// Note: The following one is not used (see InitTimer.ENABLED).
|
||||
InitTimer(boolean.class, false, "Specifies if initialization timing is enabled."),
|
||||
|
@ -336,13 +336,13 @@ char* os::build_agent_function_name(const char *sym_name, const char *lib_name,
|
||||
const char *start;
|
||||
|
||||
if (lib_name != NULL) {
|
||||
len = name_len = strlen(lib_name);
|
||||
name_len = strlen(lib_name);
|
||||
if (is_absolute_path) {
|
||||
// Need to strip path, prefix and suffix
|
||||
if ((start = strrchr(lib_name, *os::file_separator())) != NULL) {
|
||||
lib_name = ++start;
|
||||
}
|
||||
if (len <= (prefix_len + suffix_len)) {
|
||||
if (strlen(lib_name) <= (prefix_len + suffix_len)) {
|
||||
return NULL;
|
||||
}
|
||||
lib_name += prefix_len;
|
||||
|
@ -951,11 +951,11 @@ bool os::getTimesSecs(double* process_real_time,
|
||||
FILETIME wt;
|
||||
GetSystemTimeAsFileTime(&wt);
|
||||
jlong rtc_millis = windows_to_java_time(wt);
|
||||
jlong user_millis = windows_to_java_time(user_time);
|
||||
jlong system_millis = windows_to_java_time(kernel_time);
|
||||
*process_real_time = ((double) rtc_millis) / ((double) MILLIUNITS);
|
||||
*process_user_time = ((double) user_millis) / ((double) MILLIUNITS);
|
||||
*process_system_time = ((double) system_millis) / ((double) MILLIUNITS);
|
||||
*process_user_time =
|
||||
(double) jlong_from(user_time.dwHighDateTime, user_time.dwLowDateTime) / (10 * MICROUNITS);
|
||||
*process_system_time =
|
||||
(double) jlong_from(kernel_time.dwHighDateTime, kernel_time.dwLowDateTime) / (10 * MICROUNITS);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -26,44 +26,108 @@
|
||||
#ifndef OS_CPU_LINUX_AARCH64_VM_COPY_LINUX_AARCH64_INLINE_HPP
|
||||
#define OS_CPU_LINUX_AARCH64_VM_COPY_LINUX_AARCH64_INLINE_HPP
|
||||
|
||||
#define COPY_SMALL(from, to, count) \
|
||||
{ \
|
||||
long tmp0, tmp1, tmp2, tmp3; \
|
||||
long tmp4, tmp5, tmp6, tmp7; \
|
||||
__asm volatile( \
|
||||
" adr %[t0], 0f;" \
|
||||
" add %[t0], %[t0], %[cnt], lsl #5;" \
|
||||
" br %[t0];" \
|
||||
" .align 5;" \
|
||||
"0:" \
|
||||
" b 1f;" \
|
||||
" .align 5;" \
|
||||
" ldr %[t0], [%[s], #0];" \
|
||||
" str %[t0], [%[d], #0];" \
|
||||
" b 1f;" \
|
||||
" .align 5;" \
|
||||
" ldp %[t0], %[t1], [%[s], #0];" \
|
||||
" stp %[t0], %[t1], [%[d], #0];" \
|
||||
" b 1f;" \
|
||||
" .align 5;" \
|
||||
" ldp %[t0], %[t1], [%[s], #0];" \
|
||||
" ldr %[t2], [%[s], #16];" \
|
||||
" stp %[t0], %[t1], [%[d], #0];" \
|
||||
" str %[t2], [%[d], #16];" \
|
||||
" b 1f;" \
|
||||
" .align 5;" \
|
||||
" ldp %[t0], %[t1], [%[s], #0];" \
|
||||
" ldp %[t2], %[t3], [%[s], #16];" \
|
||||
" stp %[t0], %[t1], [%[d], #0];" \
|
||||
" stp %[t2], %[t3], [%[d], #16];" \
|
||||
" b 1f;" \
|
||||
" .align 5;" \
|
||||
" ldp %[t0], %[t1], [%[s], #0];" \
|
||||
" ldp %[t2], %[t3], [%[s], #16];" \
|
||||
" ldr %[t4], [%[s], #32];" \
|
||||
" stp %[t0], %[t1], [%[d], #0];" \
|
||||
" stp %[t2], %[t3], [%[d], #16];" \
|
||||
" str %[t4], [%[d], #32];" \
|
||||
" b 1f;" \
|
||||
" .align 5;" \
|
||||
" ldp %[t0], %[t1], [%[s], #0];" \
|
||||
" ldp %[t2], %[t3], [%[s], #16];" \
|
||||
" ldp %[t4], %[t5], [%[s], #32];" \
|
||||
"2:" \
|
||||
" stp %[t0], %[t1], [%[d], #0];" \
|
||||
" stp %[t2], %[t3], [%[d], #16];" \
|
||||
" stp %[t4], %[t5], [%[d], #32];" \
|
||||
" b 1f;" \
|
||||
" .align 5;" \
|
||||
" ldr %[t6], [%[s], #0];" \
|
||||
" ldp %[t0], %[t1], [%[s], #8];" \
|
||||
" ldp %[t2], %[t3], [%[s], #24];" \
|
||||
" ldp %[t4], %[t5], [%[s], #40];" \
|
||||
" str %[t6], [%[d]], #8;" \
|
||||
" b 2b;" \
|
||||
" .align 5;" \
|
||||
" ldp %[t0], %[t1], [%[s], #0];" \
|
||||
" ldp %[t2], %[t3], [%[s], #16];" \
|
||||
" ldp %[t4], %[t5], [%[s], #32];" \
|
||||
" ldp %[t6], %[t7], [%[s], #48];" \
|
||||
" stp %[t0], %[t1], [%[d], #0];" \
|
||||
" stp %[t2], %[t3], [%[d], #16];" \
|
||||
" stp %[t4], %[t5], [%[d], #32];" \
|
||||
" stp %[t6], %[t7], [%[d], #48];" \
|
||||
"1:" \
|
||||
\
|
||||
: [s]"+r"(from), [d]"+r"(to), [cnt]"+r"(count), \
|
||||
[t0]"=&r"(tmp0), [t1]"=&r"(tmp1), [t2]"=&r"(tmp2), [t3]"=&r"(tmp3), \
|
||||
[t4]"=&r"(tmp4), [t5]"=&r"(tmp5), [t6]"=&r"(tmp6), [t7]"=&r"(tmp7) \
|
||||
: \
|
||||
: "memory", "cc"); \
|
||||
}
|
||||
|
||||
static void pd_conjoint_words(HeapWord* from, HeapWord* to, size_t count) {
|
||||
(void)memmove(to, from, count * HeapWordSize);
|
||||
__asm volatile( "prfm pldl1strm, [%[s], #0];" :: [s]"r"(from) : "memory");
|
||||
if (__builtin_expect(count <= 8, 1)) {
|
||||
COPY_SMALL(from, to, count);
|
||||
return;
|
||||
}
|
||||
_Copy_conjoint_words(from, to, count);
|
||||
}
|
||||
|
||||
static void pd_disjoint_words(HeapWord* from, HeapWord* to, size_t count) {
|
||||
switch (count) {
|
||||
case 8: to[7] = from[7];
|
||||
case 7: to[6] = from[6];
|
||||
case 6: to[5] = from[5];
|
||||
case 5: to[4] = from[4];
|
||||
case 4: to[3] = from[3];
|
||||
case 3: to[2] = from[2];
|
||||
case 2: to[1] = from[1];
|
||||
case 1: to[0] = from[0];
|
||||
case 0: break;
|
||||
default:
|
||||
(void)memcpy(to, from, count * HeapWordSize);
|
||||
break;
|
||||
if (__builtin_constant_p(count)) {
|
||||
memcpy(to, from, count * sizeof(HeapWord));
|
||||
return;
|
||||
}
|
||||
__asm volatile( "prfm pldl1strm, [%[s], #0];" :: [s]"r"(from) : "memory");
|
||||
if (__builtin_expect(count <= 8, 1)) {
|
||||
COPY_SMALL(from, to, count);
|
||||
return;
|
||||
}
|
||||
_Copy_disjoint_words(from, to, count);
|
||||
}
|
||||
|
||||
static void pd_disjoint_words_atomic(HeapWord* from, HeapWord* to, size_t count) {
|
||||
switch (count) {
|
||||
case 8: to[7] = from[7];
|
||||
case 7: to[6] = from[6];
|
||||
case 6: to[5] = from[5];
|
||||
case 5: to[4] = from[4];
|
||||
case 4: to[3] = from[3];
|
||||
case 3: to[2] = from[2];
|
||||
case 2: to[1] = from[1];
|
||||
case 1: to[0] = from[0];
|
||||
case 0: break;
|
||||
default:
|
||||
while (count-- > 0) {
|
||||
*to++ = *from++;
|
||||
}
|
||||
break;
|
||||
__asm volatile( "prfm pldl1strm, [%[s], #0];" :: [s]"r"(from) : "memory");
|
||||
if (__builtin_expect(count <= 8, 1)) {
|
||||
COPY_SMALL(from, to, count);
|
||||
return;
|
||||
}
|
||||
_Copy_disjoint_words(from, to, count);
|
||||
}
|
||||
|
||||
static void pd_aligned_conjoint_words(HeapWord* from, HeapWord* to, size_t count) {
|
||||
|
236
hotspot/src/os_cpu/linux_aarch64/vm/copy_linux_aarch64.s
Normal file
236
hotspot/src/os_cpu/linux_aarch64/vm/copy_linux_aarch64.s
Normal file
@ -0,0 +1,236 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Linaro Ltd. 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.
|
||||
*
|
||||
*/
|
||||
.global _Copy_conjoint_words
|
||||
.global _Copy_disjoint_words
|
||||
|
||||
s .req x0
|
||||
d .req x1
|
||||
count .req x2
|
||||
t0 .req x3
|
||||
t1 .req x4
|
||||
t2 .req x5
|
||||
t3 .req x6
|
||||
t4 .req x7
|
||||
t5 .req x8
|
||||
t6 .req x9
|
||||
t7 .req x10
|
||||
|
||||
.align 6
|
||||
_Copy_disjoint_words:
|
||||
// Ensure 2 word aligned
|
||||
tbz s, #3, fwd_copy_aligned
|
||||
ldr t0, [s], #8
|
||||
str t0, [d], #8
|
||||
sub count, count, #1
|
||||
|
||||
fwd_copy_aligned:
|
||||
// Bias s & d so we only pre index on the last copy
|
||||
sub s, s, #16
|
||||
sub d, d, #16
|
||||
|
||||
ldp t0, t1, [s, #16]
|
||||
ldp t2, t3, [s, #32]
|
||||
ldp t4, t5, [s, #48]
|
||||
ldp t6, t7, [s, #64]!
|
||||
|
||||
subs count, count, #16
|
||||
blo fwd_copy_drain
|
||||
|
||||
fwd_copy_again:
|
||||
prfm pldl1keep, [s, #256]
|
||||
stp t0, t1, [d, #16]
|
||||
ldp t0, t1, [s, #16]
|
||||
stp t2, t3, [d, #32]
|
||||
ldp t2, t3, [s, #32]
|
||||
stp t4, t5, [d, #48]
|
||||
ldp t4, t5, [s, #48]
|
||||
stp t6, t7, [d, #64]!
|
||||
ldp t6, t7, [s, #64]!
|
||||
subs count, count, #8
|
||||
bhs fwd_copy_again
|
||||
|
||||
fwd_copy_drain:
|
||||
stp t0, t1, [d, #16]
|
||||
stp t2, t3, [d, #32]
|
||||
stp t4, t5, [d, #48]
|
||||
stp t6, t7, [d, #64]!
|
||||
|
||||
// count is now -8..-1 for 0..7 words to copy
|
||||
adr t0, 0f
|
||||
add t0, t0, count, lsl #5
|
||||
br t0
|
||||
|
||||
.align 5
|
||||
ret // -8 == 0 words
|
||||
.align 5
|
||||
ldr t0, [s, #16] // -7 == 1 word
|
||||
str t0, [d, #16]
|
||||
ret
|
||||
.align 5
|
||||
ldp t0, t1, [s, #16] // -6 = 2 words
|
||||
stp t0, t1, [d, #16]
|
||||
ret
|
||||
.align 5
|
||||
ldp t0, t1, [s, #16] // -5 = 3 words
|
||||
ldr t2, [s, #32]
|
||||
stp t0, t1, [d, #16]
|
||||
str t2, [d, #32]
|
||||
ret
|
||||
.align 5
|
||||
ldp t0, t1, [s, #16] // -4 = 4 words
|
||||
ldp t2, t3, [s, #32]
|
||||
stp t0, t1, [d, #16]
|
||||
stp t2, t3, [d, #32]
|
||||
ret
|
||||
.align 5
|
||||
ldp t0, t1, [s, #16] // -3 = 5 words
|
||||
ldp t2, t3, [s, #32]
|
||||
ldr t4, [s, #48]
|
||||
stp t0, t1, [d, #16]
|
||||
stp t2, t3, [d, #32]
|
||||
str t4, [d, #48]
|
||||
ret
|
||||
.align 5
|
||||
ldp t0, t1, [s, #16] // -2 = 6 words
|
||||
ldp t2, t3, [s, #32]
|
||||
ldp t4, t5, [s, #48]
|
||||
stp t0, t1, [d, #16]
|
||||
stp t2, t3, [d, #32]
|
||||
stp t4, t5, [d, #48]
|
||||
ret
|
||||
.align 5
|
||||
ldp t0, t1, [s, #16] // -1 = 7 words
|
||||
ldp t2, t3, [s, #32]
|
||||
ldp t4, t5, [s, #48]
|
||||
ldr t6, [s, #64]
|
||||
stp t0, t1, [d, #16]
|
||||
stp t2, t3, [d, #32]
|
||||
stp t4, t5, [d, #48]
|
||||
str t6, [d, #64]
|
||||
// Is always aligned here, code for 7 words is one instruction
|
||||
// too large so it just falls through.
|
||||
.align 5
|
||||
0:
|
||||
ret
|
||||
|
||||
.align 6
|
||||
_Copy_conjoint_words:
|
||||
sub t0, d, s
|
||||
cmp t0, count, lsl #3
|
||||
bhs _Copy_disjoint_words
|
||||
|
||||
add s, s, count, lsl #3
|
||||
add d, d, count, lsl #3
|
||||
|
||||
// Ensure 2 word aligned
|
||||
tbz s, #3, bwd_copy_aligned
|
||||
ldr t0, [s, #-8]!
|
||||
str t0, [d, #-8]!
|
||||
sub count, count, #1
|
||||
|
||||
bwd_copy_aligned:
|
||||
ldp t0, t1, [s, #-16]
|
||||
ldp t2, t3, [s, #-32]
|
||||
ldp t4, t5, [s, #-48]
|
||||
ldp t6, t7, [s, #-64]!
|
||||
|
||||
subs count, count, #16
|
||||
blo bwd_copy_drain
|
||||
|
||||
bwd_copy_again:
|
||||
prfm pldl1keep, [s, #-256]
|
||||
stp t0, t1, [d, #-16]
|
||||
ldp t0, t1, [s, #-16]
|
||||
stp t2, t3, [d, #-32]
|
||||
ldp t2, t3, [s, #-32]
|
||||
stp t4, t5, [d, #-48]
|
||||
ldp t4, t5, [s, #-48]
|
||||
stp t6, t7, [d, #-64]!
|
||||
ldp t6, t7, [s, #-64]!
|
||||
subs count, count, #8
|
||||
bhs bwd_copy_again
|
||||
|
||||
bwd_copy_drain:
|
||||
stp t0, t1, [d, #-16]
|
||||
stp t2, t3, [d, #-32]
|
||||
stp t4, t5, [d, #-48]
|
||||
stp t6, t7, [d, #-64]!
|
||||
|
||||
// count is now -8..-1 for 0..7 words to copy
|
||||
adr t0, 0f
|
||||
add t0, t0, count, lsl #5
|
||||
br t0
|
||||
|
||||
.align 5
|
||||
ret // -8 == 0 words
|
||||
.align 5
|
||||
ldr t0, [s, #-8] // -7 == 1 word
|
||||
str t0, [d, #-8]
|
||||
ret
|
||||
.align 5
|
||||
ldp t0, t1, [s, #-16] // -6 = 2 words
|
||||
stp t0, t1, [d, #-16]
|
||||
ret
|
||||
.align 5
|
||||
ldp t0, t1, [s, #-16] // -5 = 3 words
|
||||
ldr t2, [s, #-24]
|
||||
stp t0, t1, [d, #-16]
|
||||
str t2, [d, #-24]
|
||||
ret
|
||||
.align 5
|
||||
ldp t0, t1, [s, #-16] // -4 = 4 words
|
||||
ldp t2, t3, [s, #-32]
|
||||
stp t0, t1, [d, #-16]
|
||||
stp t2, t3, [d, #-32]
|
||||
ret
|
||||
.align 5
|
||||
ldp t0, t1, [s, #-16] // -3 = 5 words
|
||||
ldp t2, t3, [s, #-32]
|
||||
ldr t4, [s, #-40]
|
||||
stp t0, t1, [d, #-16]
|
||||
stp t2, t3, [d, #-32]
|
||||
str t4, [d, #-40]
|
||||
ret
|
||||
.align 5
|
||||
ldp t0, t1, [s, #-16] // -2 = 6 words
|
||||
ldp t2, t3, [s, #-32]
|
||||
ldp t4, t5, [s, #-48]
|
||||
stp t0, t1, [d, #-16]
|
||||
stp t2, t3, [d, #-32]
|
||||
stp t4, t5, [d, #-48]
|
||||
ret
|
||||
.align 5
|
||||
ldp t0, t1, [s, #-16] // -1 = 7 words
|
||||
ldp t2, t3, [s, #-32]
|
||||
ldp t4, t5, [s, #-48]
|
||||
ldr t6, [s, #-56]
|
||||
stp t0, t1, [d, #-16]
|
||||
stp t2, t3, [d, #-32]
|
||||
stp t4, t5, [d, #-48]
|
||||
str t6, [d, #-56]
|
||||
// Is always aligned here, code for 7 words is one instruction
|
||||
// too large so it just falls through.
|
||||
.align 5
|
||||
0:
|
||||
ret
|
@ -257,7 +257,38 @@ void Canonicalizer::do_ArrayLength (ArrayLength* x) {
|
||||
}
|
||||
}
|
||||
|
||||
void Canonicalizer::do_LoadIndexed (LoadIndexed* x) {}
|
||||
void Canonicalizer::do_LoadIndexed (LoadIndexed* x) {
|
||||
StableArrayConstant* array = x->array()->type()->as_StableArrayConstant();
|
||||
IntConstant* index = x->index()->type()->as_IntConstant();
|
||||
|
||||
assert(array == NULL || FoldStableValues, "not enabled");
|
||||
|
||||
// Constant fold loads from stable arrays.
|
||||
if (array != NULL && index != NULL) {
|
||||
jint idx = index->value();
|
||||
if (idx < 0 || idx >= array->value()->length()) {
|
||||
// Leave the load as is. The range check will handle it.
|
||||
return;
|
||||
}
|
||||
|
||||
ciConstant field_val = array->value()->element_value(idx);
|
||||
if (!field_val.is_null_or_zero()) {
|
||||
jint dimension = array->dimension();
|
||||
assert(dimension <= array->value()->array_type()->dimension(), "inconsistent info");
|
||||
ValueType* value = NULL;
|
||||
if (dimension > 1) {
|
||||
// Preserve information about the dimension for the element.
|
||||
assert(field_val.as_object()->is_array(), "not an array");
|
||||
value = new StableArrayConstant(field_val.as_object()->as_array(), dimension - 1);
|
||||
} else {
|
||||
assert(dimension == 1, "sanity");
|
||||
value = as_ValueType(field_val);
|
||||
}
|
||||
set_canonical(new Constant(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Canonicalizer::do_StoreIndexed (StoreIndexed* x) {
|
||||
// If a value is going to be stored into a field or array some of
|
||||
// the conversions emitted by javac are unneeded because the fields
|
||||
|
@ -1519,6 +1519,29 @@ void GraphBuilder::method_return(Value x) {
|
||||
append(new Return(x));
|
||||
}
|
||||
|
||||
Value GraphBuilder::make_constant(ciConstant field_value, ciField* field) {
|
||||
BasicType field_type = field_value.basic_type();
|
||||
ValueType* value = as_ValueType(field_value);
|
||||
|
||||
// Attach dimension info to stable arrays.
|
||||
if (FoldStableValues &&
|
||||
field->is_stable() && field_type == T_ARRAY && !field_value.is_null_or_zero()) {
|
||||
ciArray* array = field_value.as_object()->as_array();
|
||||
jint dimension = field->type()->as_array_klass()->dimension();
|
||||
value = new StableArrayConstant(array, dimension);
|
||||
}
|
||||
|
||||
switch (field_type) {
|
||||
case T_ARRAY:
|
||||
case T_OBJECT:
|
||||
if (field_value.as_object()->should_be_constant()) {
|
||||
return new Constant(value);
|
||||
}
|
||||
return NULL; // Not a constant.
|
||||
default:
|
||||
return new Constant(value);
|
||||
}
|
||||
}
|
||||
|
||||
void GraphBuilder::access_field(Bytecodes::Code code) {
|
||||
bool will_link;
|
||||
@ -1563,22 +1586,13 @@ void GraphBuilder::access_field(Bytecodes::Code code) {
|
||||
switch (code) {
|
||||
case Bytecodes::_getstatic: {
|
||||
// check for compile-time constants, i.e., initialized static final fields
|
||||
Instruction* constant = NULL;
|
||||
Value constant = NULL;
|
||||
if (field->is_constant() && !PatchALot) {
|
||||
ciConstant field_val = field->constant_value();
|
||||
BasicType field_type = field_val.basic_type();
|
||||
switch (field_type) {
|
||||
case T_ARRAY:
|
||||
case T_OBJECT:
|
||||
if (field_val.as_object()->should_be_constant()) {
|
||||
constant = new Constant(as_ValueType(field_val));
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
constant = new Constant(as_ValueType(field_val));
|
||||
}
|
||||
ciConstant field_value = field->constant_value();
|
||||
// Stable static fields are checked for non-default values in ciField::initialize_from().
|
||||
assert(!field->is_stable() || !field_value.is_null_or_zero(),
|
||||
"stable static w/ default value shouldn't be a constant");
|
||||
constant = make_constant(field_value, field);
|
||||
}
|
||||
if (constant != NULL) {
|
||||
push(type, append(constant));
|
||||
@ -1591,38 +1605,29 @@ void GraphBuilder::access_field(Bytecodes::Code code) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Bytecodes::_putstatic:
|
||||
{ Value val = pop(type);
|
||||
if (state_before == NULL) {
|
||||
state_before = copy_state_for_exception();
|
||||
}
|
||||
append(new StoreField(append(obj), offset, field, val, true, state_before, needs_patching));
|
||||
case Bytecodes::_putstatic: {
|
||||
Value val = pop(type);
|
||||
if (state_before == NULL) {
|
||||
state_before = copy_state_for_exception();
|
||||
}
|
||||
append(new StoreField(append(obj), offset, field, val, true, state_before, needs_patching));
|
||||
break;
|
||||
}
|
||||
case Bytecodes::_getfield: {
|
||||
// Check for compile-time constants, i.e., trusted final non-static fields.
|
||||
Instruction* constant = NULL;
|
||||
Value constant = NULL;
|
||||
obj = apop();
|
||||
ObjectType* obj_type = obj->type()->as_ObjectType();
|
||||
if (obj_type->is_constant() && !PatchALot) {
|
||||
ciObject* const_oop = obj_type->constant_value();
|
||||
if (!const_oop->is_null_object() && const_oop->is_loaded()) {
|
||||
if (field->is_constant()) {
|
||||
ciConstant field_val = field->constant_value_of(const_oop);
|
||||
BasicType field_type = field_val.basic_type();
|
||||
switch (field_type) {
|
||||
case T_ARRAY:
|
||||
case T_OBJECT:
|
||||
if (field_val.as_object()->should_be_constant()) {
|
||||
constant = new Constant(as_ValueType(field_val));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
constant = new Constant(as_ValueType(field_val));
|
||||
}
|
||||
if (FoldStableValues && field->is_stable() && field_val.is_null_or_zero()) {
|
||||
ciConstant field_value = field->constant_value_of(const_oop);
|
||||
if (FoldStableValues && field->is_stable() && field_value.is_null_or_zero()) {
|
||||
// Stable field with default value can't be constant.
|
||||
constant = NULL;
|
||||
} else {
|
||||
constant = make_constant(field_value, field);
|
||||
}
|
||||
} else {
|
||||
// For CallSite objects treat the target field as a compile time constant.
|
||||
@ -3942,7 +3947,7 @@ bool GraphBuilder::try_inline_full(ciMethod* callee, bool holder_known, Bytecode
|
||||
|
||||
|
||||
bool GraphBuilder::try_method_handle_inline(ciMethod* callee) {
|
||||
ValueStack* state_before = state()->copy_for_parsing();
|
||||
ValueStack* state_before = copy_state_before();
|
||||
vmIntrinsics::ID iid = callee->intrinsic_id();
|
||||
switch (iid) {
|
||||
case vmIntrinsics::_invokeBasic:
|
||||
@ -4032,7 +4037,7 @@ bool GraphBuilder::try_method_handle_inline(ciMethod* callee) {
|
||||
fatal("unexpected intrinsic %d: %s", iid, vmIntrinsics::name_at(iid));
|
||||
break;
|
||||
}
|
||||
set_state(state_before);
|
||||
set_state(state_before->copy_for_parsing());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -276,6 +276,7 @@ class GraphBuilder VALUE_OBJ_CLASS_SPEC {
|
||||
void iterate_all_blocks(bool start_in_current_block_for_inlining = false);
|
||||
Dependencies* dependency_recorder() const; // = compilation()->dependencies()
|
||||
bool direct_compare(ciKlass* k);
|
||||
Value make_constant(ciConstant value, ciField* field);
|
||||
|
||||
void kill_all();
|
||||
|
||||
|
@ -335,6 +335,7 @@ JRT_ENTRY(void, Runtime1::new_instance(JavaThread* thread, Klass* klass))
|
||||
NOT_PRODUCT(_new_instance_slowcase_cnt++;)
|
||||
|
||||
assert(klass->is_klass(), "not a class");
|
||||
Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
|
||||
instanceKlassHandle h(thread, klass);
|
||||
h->check_valid_for_instantiation(true, CHECK);
|
||||
// make sure klass is initialized
|
||||
@ -370,6 +371,7 @@ JRT_ENTRY(void, Runtime1::new_object_array(JavaThread* thread, Klass* array_klas
|
||||
// anymore after new_objArray() and no GC can happen before.
|
||||
// (This may have to change if this code changes!)
|
||||
assert(array_klass->is_klass(), "not a class");
|
||||
Handle holder(THREAD, array_klass->klass_holder()); // keep the klass alive
|
||||
Klass* elem_klass = ObjArrayKlass::cast(array_klass)->element_klass();
|
||||
objArrayOop obj = oopFactory::new_objArray(elem_klass, length, CHECK);
|
||||
thread->set_vm_result(obj);
|
||||
@ -386,6 +388,7 @@ JRT_ENTRY(void, Runtime1::new_multi_array(JavaThread* thread, Klass* klass, int
|
||||
|
||||
assert(klass->is_klass(), "not a class");
|
||||
assert(rank >= 1, "rank must be nonzero");
|
||||
Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
|
||||
oop obj = ArrayKlass::cast(klass)->multi_allocate(rank, dims, CHECK);
|
||||
thread->set_vm_result(obj);
|
||||
JRT_END
|
||||
|
@ -45,6 +45,7 @@ class ObjectType;
|
||||
class ObjectConstant;
|
||||
class ArrayType;
|
||||
class ArrayConstant;
|
||||
class StableArrayConstant;
|
||||
class InstanceType;
|
||||
class InstanceConstant;
|
||||
class MetadataType;
|
||||
@ -168,6 +169,7 @@ class ValueType: public CompilationResourceObj {
|
||||
virtual MethodConstant* as_MethodConstant() { return NULL; }
|
||||
virtual MethodDataConstant* as_MethodDataConstant() { return NULL; }
|
||||
virtual ArrayConstant* as_ArrayConstant() { return NULL; }
|
||||
virtual StableArrayConstant* as_StableArrayConstant() { return NULL; }
|
||||
virtual AddressConstant* as_AddressConstant() { return NULL; }
|
||||
|
||||
// type operations
|
||||
@ -355,6 +357,20 @@ class ArrayConstant: public ArrayType {
|
||||
virtual ciType* exact_type() const;
|
||||
};
|
||||
|
||||
class StableArrayConstant: public ArrayConstant {
|
||||
private:
|
||||
jint _dimension;
|
||||
|
||||
public:
|
||||
StableArrayConstant(ciArray* value, jint dimension) : ArrayConstant(value) {
|
||||
assert(dimension > 0, "not a stable array");
|
||||
_dimension = dimension;
|
||||
}
|
||||
|
||||
jint dimension() const { return _dimension; }
|
||||
|
||||
virtual StableArrayConstant* as_StableArrayConstant() { return this; }
|
||||
};
|
||||
|
||||
class InstanceType: public ObjectType {
|
||||
public:
|
||||
|
@ -81,7 +81,7 @@ ciMethodData::ciMethodData() : ciMetadata(NULL) {
|
||||
void ciMethodData::load_extra_data() {
|
||||
MethodData* mdo = get_MethodData();
|
||||
|
||||
MutexLocker(mdo->extra_data_lock());
|
||||
MutexLocker ml(mdo->extra_data_lock());
|
||||
|
||||
// speculative trap entries also hold a pointer to a Method so need to be translated
|
||||
DataLayout* dp_src = mdo->extra_data_base();
|
||||
@ -103,16 +103,13 @@ void ciMethodData::load_extra_data() {
|
||||
|
||||
switch(tag) {
|
||||
case DataLayout::speculative_trap_data_tag: {
|
||||
ciSpeculativeTrapData* data_dst = new ciSpeculativeTrapData(dp_dst);
|
||||
SpeculativeTrapData* data_src = new SpeculativeTrapData(dp_src);
|
||||
|
||||
data_dst->translate_from(data_src);
|
||||
|
||||
#ifdef ASSERT
|
||||
SpeculativeTrapData* data_src2 = new SpeculativeTrapData(dp_src);
|
||||
assert(data_src2->method() == data_src->method() && data_src2->bci() == data_src->bci(), "entries changed while translating");
|
||||
#endif
|
||||
ciSpeculativeTrapData data_dst(dp_dst);
|
||||
SpeculativeTrapData data_src(dp_src);
|
||||
|
||||
{ // During translation a safepoint can happen or VM lock can be taken (e.g., Compile_lock).
|
||||
MutexUnlocker ml(mdo->extra_data_lock());
|
||||
data_dst.translate_from(&data_src);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DataLayout::bit_data_tag:
|
||||
@ -120,9 +117,11 @@ void ciMethodData::load_extra_data() {
|
||||
case DataLayout::no_tag:
|
||||
case DataLayout::arg_info_data_tag:
|
||||
// An empty slot or ArgInfoData entry marks the end of the trap data
|
||||
return;
|
||||
{
|
||||
return; // Need a block to avoid SS compiler bug
|
||||
}
|
||||
default:
|
||||
fatal("bad tag = %d", dp_dst->tag());
|
||||
fatal("bad tag = %d", tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -637,16 +637,19 @@ void CodeCache::blobs_do(CodeBlobClosure* f) {
|
||||
}
|
||||
|
||||
// Walk the list of methods which might contain non-perm oops.
|
||||
void CodeCache::scavenge_root_nmethods_do(CodeBlobClosure* f) {
|
||||
void CodeCache::scavenge_root_nmethods_do(CodeBlobToOopClosure* f) {
|
||||
assert_locked_or_safepoint(CodeCache_lock);
|
||||
|
||||
if (UseG1GC) {
|
||||
return;
|
||||
}
|
||||
|
||||
const bool fix_relocations = f->fix_relocations();
|
||||
debug_only(mark_scavenge_root_nmethods());
|
||||
|
||||
for (nmethod* cur = scavenge_root_nmethods(); cur != NULL; cur = cur->scavenge_root_link()) {
|
||||
nmethod* prev = NULL;
|
||||
nmethod* cur = scavenge_root_nmethods();
|
||||
while (cur != NULL) {
|
||||
debug_only(cur->clear_scavenge_root_marked());
|
||||
assert(cur->scavenge_root_not_marked(), "");
|
||||
assert(cur->on_scavenge_root_list(), "else shouldn't be on this list");
|
||||
@ -659,6 +662,18 @@ void CodeCache::scavenge_root_nmethods_do(CodeBlobClosure* f) {
|
||||
// Perform cur->oops_do(f), maybe just once per nmethod.
|
||||
f->do_code_blob(cur);
|
||||
}
|
||||
nmethod* const next = cur->scavenge_root_link();
|
||||
// The scavengable nmethod list must contain all methods with scavengable
|
||||
// oops. It is safe to include more nmethod on the list, but we do not
|
||||
// expect any live non-scavengable nmethods on the list.
|
||||
if (fix_relocations) {
|
||||
if (!is_live || !cur->detect_scavenge_root_oops()) {
|
||||
unlink_scavenge_root_nmethod(cur, prev);
|
||||
} else {
|
||||
prev = cur;
|
||||
}
|
||||
}
|
||||
cur = next;
|
||||
}
|
||||
|
||||
// Check for stray marks.
|
||||
@ -678,6 +693,24 @@ void CodeCache::add_scavenge_root_nmethod(nmethod* nm) {
|
||||
print_trace("add_scavenge_root", nm);
|
||||
}
|
||||
|
||||
void CodeCache::unlink_scavenge_root_nmethod(nmethod* nm, nmethod* prev) {
|
||||
assert_locked_or_safepoint(CodeCache_lock);
|
||||
|
||||
assert((prev == NULL && scavenge_root_nmethods() == nm) ||
|
||||
(prev != NULL && prev->scavenge_root_link() == nm), "precondition");
|
||||
|
||||
assert(!UseG1GC, "G1 does not use the scavenge_root_nmethods list");
|
||||
|
||||
print_trace("unlink_scavenge_root", nm);
|
||||
if (prev == NULL) {
|
||||
set_scavenge_root_nmethods(nm->scavenge_root_link());
|
||||
} else {
|
||||
prev->set_scavenge_root_link(nm->scavenge_root_link());
|
||||
}
|
||||
nm->set_scavenge_root_link(NULL);
|
||||
nm->clear_on_scavenge_root_list();
|
||||
}
|
||||
|
||||
void CodeCache::drop_scavenge_root_nmethod(nmethod* nm) {
|
||||
assert_locked_or_safepoint(CodeCache_lock);
|
||||
|
||||
@ -686,20 +719,13 @@ void CodeCache::drop_scavenge_root_nmethod(nmethod* nm) {
|
||||
}
|
||||
|
||||
print_trace("drop_scavenge_root", nm);
|
||||
nmethod* last = NULL;
|
||||
nmethod* cur = scavenge_root_nmethods();
|
||||
while (cur != NULL) {
|
||||
nmethod* next = cur->scavenge_root_link();
|
||||
nmethod* prev = NULL;
|
||||
for (nmethod* cur = scavenge_root_nmethods(); cur != NULL; cur = cur->scavenge_root_link()) {
|
||||
if (cur == nm) {
|
||||
if (last != NULL)
|
||||
last->set_scavenge_root_link(next);
|
||||
else set_scavenge_root_nmethods(next);
|
||||
nm->set_scavenge_root_link(NULL);
|
||||
nm->clear_on_scavenge_root_list();
|
||||
unlink_scavenge_root_nmethod(cur, prev);
|
||||
return;
|
||||
}
|
||||
last = cur;
|
||||
cur = next;
|
||||
prev = cur;
|
||||
}
|
||||
assert(false, "should have been on list");
|
||||
}
|
||||
@ -728,11 +754,7 @@ void CodeCache::prune_scavenge_root_nmethods() {
|
||||
} else {
|
||||
// Prune it from the list, so we don't have to look at it any more.
|
||||
print_trace("prune_scavenge_root", cur);
|
||||
cur->set_scavenge_root_link(NULL);
|
||||
cur->clear_on_scavenge_root_list();
|
||||
if (last != NULL)
|
||||
last->set_scavenge_root_link(next);
|
||||
else set_scavenge_root_nmethods(next);
|
||||
unlink_scavenge_root_nmethod(cur, last);
|
||||
}
|
||||
cur = next;
|
||||
}
|
||||
|
@ -116,6 +116,10 @@ class CodeCache : AllStatic {
|
||||
static int allocated_segments();
|
||||
static size_t freelists_length();
|
||||
|
||||
static void set_scavenge_root_nmethods(nmethod* nm) { _scavenge_root_nmethods = nm; }
|
||||
static void prune_scavenge_root_nmethods();
|
||||
static void unlink_scavenge_root_nmethod(nmethod* nm, nmethod* prev);
|
||||
|
||||
public:
|
||||
// Initialization
|
||||
static void initialize();
|
||||
@ -153,13 +157,17 @@ class CodeCache : AllStatic {
|
||||
// to "true" iff some code got unloaded.
|
||||
static void do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred);
|
||||
static void asserted_non_scavengable_nmethods_do(CodeBlobClosure* f = NULL) PRODUCT_RETURN;
|
||||
static void scavenge_root_nmethods_do(CodeBlobClosure* f);
|
||||
|
||||
// Apply f to every live code blob in scavengable nmethods. Prune nmethods
|
||||
// from the list of scavengable nmethods if f->fix_relocations() and a nmethod
|
||||
// no longer has scavengable oops. If f->fix_relocations(), then f must copy
|
||||
// objects to their new location immediately to avoid fixing nmethods on the
|
||||
// basis of the old object locations.
|
||||
static void scavenge_root_nmethods_do(CodeBlobToOopClosure* f);
|
||||
|
||||
static nmethod* scavenge_root_nmethods() { return _scavenge_root_nmethods; }
|
||||
static void set_scavenge_root_nmethods(nmethod* nm) { _scavenge_root_nmethods = nm; }
|
||||
static void add_scavenge_root_nmethod(nmethod* nm);
|
||||
static void drop_scavenge_root_nmethod(nmethod* nm);
|
||||
static void prune_scavenge_root_nmethods();
|
||||
|
||||
// Printing/debugging
|
||||
static void print(); // prints summary
|
||||
|
@ -369,7 +369,6 @@ void DebugInformationRecorder::describe_scope(int pc_offset,
|
||||
assert(method == NULL ||
|
||||
(method->is_native() && bci == 0) ||
|
||||
(!method->is_native() && 0 <= bci && bci < method->code_size()) ||
|
||||
(method->is_compiled_lambda_form() && bci == -99) || // this might happen in C1
|
||||
bci == -1, "illegal bci");
|
||||
|
||||
// serialize the locals/expressions/monitors
|
||||
|
@ -1381,7 +1381,6 @@ void nmethod::make_unloaded(BoolObjectClosure* is_alive, oop cause) {
|
||||
assert(_method == NULL, "Tautology");
|
||||
|
||||
set_osr_link(NULL);
|
||||
//set_scavenge_root_link(NULL); // done by prune_scavenge_root_nmethods
|
||||
NMethodSweeper::report_state_change(this);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 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
|
||||
@ -838,12 +838,8 @@ void CompileBroker::compile_method_base(const methodHandle& method,
|
||||
const methodHandle& hot_method,
|
||||
int hot_count,
|
||||
const char* comment,
|
||||
bool blocking,
|
||||
Thread* thread) {
|
||||
// do nothing if compiler thread(s) is not available
|
||||
if (!_initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
guarantee(!method->is_abstract(), "cannot compile abstract methods");
|
||||
assert(method->method_holder()->is_instance_klass(),
|
||||
"sanity check");
|
||||
@ -916,7 +912,6 @@ void CompileBroker::compile_method_base(const methodHandle& method,
|
||||
|
||||
// Outputs from the following MutexLocker block:
|
||||
CompileTask* task = NULL;
|
||||
bool blocking = false;
|
||||
CompileQueue* queue = compile_queue(comp_level);
|
||||
|
||||
// Acquire our lock.
|
||||
@ -946,9 +941,6 @@ void CompileBroker::compile_method_base(const methodHandle& method,
|
||||
return;
|
||||
}
|
||||
|
||||
// Should this thread wait for completion of the compile?
|
||||
blocking = is_compile_blocking();
|
||||
|
||||
#if INCLUDE_JVMCI
|
||||
if (UseJVMCICompiler) {
|
||||
if (blocking) {
|
||||
@ -1034,11 +1026,28 @@ void CompileBroker::compile_method_base(const methodHandle& method,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci,
|
||||
int comp_level,
|
||||
const methodHandle& hot_method, int hot_count,
|
||||
const char* comment, Thread* THREAD) {
|
||||
// do nothing if compilebroker is not available
|
||||
if (!_initialized) {
|
||||
return NULL;
|
||||
}
|
||||
AbstractCompiler *comp = CompileBroker::compiler(comp_level);
|
||||
assert(comp != NULL, "Ensure we don't compile before compilebroker init");
|
||||
DirectiveSet* directive = DirectivesStack::getMatchingDirective(method, comp);
|
||||
nmethod* nm = CompileBroker::compile_method(method, osr_bci, comp_level, hot_method, hot_count, comment, directive, THREAD);
|
||||
DirectivesStack::release(directive);
|
||||
return nm;
|
||||
}
|
||||
|
||||
nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci,
|
||||
int comp_level,
|
||||
const methodHandle& hot_method, int hot_count,
|
||||
const char* comment, DirectiveSet* directive,
|
||||
Thread* THREAD) {
|
||||
|
||||
// make sure arguments make sense
|
||||
assert(method->method_holder()->is_instance_klass(), "not an instance method");
|
||||
assert(osr_bci == InvocationEntryBci || (0 <= osr_bci && osr_bci < method->code_size()), "bci out of range");
|
||||
@ -1051,8 +1060,8 @@ nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci,
|
||||
// lock, make sure that the compilation
|
||||
// isn't prohibited in a straightforward way.
|
||||
AbstractCompiler *comp = CompileBroker::compiler(comp_level);
|
||||
if (comp == NULL || !comp->can_compile_method(method) ||
|
||||
compilation_is_prohibited(method, osr_bci, comp_level)) {
|
||||
if (!comp->can_compile_method(method) ||
|
||||
compilation_is_prohibited(method, osr_bci, comp_level, directive->ExcludeOption)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -1160,7 +1169,7 @@ nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci,
|
||||
CompilationPolicy::policy()->delay_compilation(method());
|
||||
return NULL;
|
||||
}
|
||||
compile_method_base(method, osr_bci, comp_level, hot_method, hot_count, comment, THREAD);
|
||||
compile_method_base(method, osr_bci, comp_level, hot_method, hot_count, comment, !directive->BackgroundCompilationOption, THREAD);
|
||||
}
|
||||
|
||||
// return requested nmethod
|
||||
@ -1217,7 +1226,7 @@ bool CompileBroker::compilation_is_in_queue(const methodHandle& method) {
|
||||
// CompileBroker::compilation_is_prohibited
|
||||
//
|
||||
// See if this compilation is not allowed.
|
||||
bool CompileBroker::compilation_is_prohibited(const methodHandle& method, int osr_bci, int comp_level) {
|
||||
bool CompileBroker::compilation_is_prohibited(const methodHandle& method, int osr_bci, int comp_level, bool excluded) {
|
||||
bool is_native = method->is_native();
|
||||
// Some compilers may not support the compilation of natives.
|
||||
AbstractCompiler *comp = compiler(comp_level);
|
||||
@ -1235,11 +1244,6 @@ bool CompileBroker::compilation_is_prohibited(const methodHandle& method, int os
|
||||
return true;
|
||||
}
|
||||
|
||||
// Breaking the abstraction - directives are only used inside a compilation otherwise.
|
||||
DirectiveSet* directive = DirectivesStack::getMatchingDirective(method, comp);
|
||||
bool excluded = directive->ExcludeOption;
|
||||
DirectivesStack::release(directive);
|
||||
|
||||
// The method may be explicitly excluded by the user.
|
||||
double scale;
|
||||
if (excluded || (CompilerOracle::has_option_value(method, "CompileThresholdScaling", scale) && scale == 0)) {
|
||||
@ -1304,16 +1308,6 @@ uint CompileBroker::assign_compile_id_unlocked(Thread* thread, const methodHandl
|
||||
return assign_compile_id(method, osr_bci);
|
||||
}
|
||||
|
||||
/**
|
||||
* Should the current thread block until this compilation request
|
||||
* has been fulfilled?
|
||||
*/
|
||||
bool CompileBroker::is_compile_blocking() {
|
||||
assert(!InstanceRefKlass::owns_pending_list_lock(JavaThread::current()), "possible deadlock");
|
||||
return !BackgroundCompilation;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
// CompileBroker::preload_classes
|
||||
void CompileBroker::preload_classes(const methodHandle& method, TRAPS) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 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
|
||||
@ -222,8 +222,7 @@ class CompileBroker: AllStatic {
|
||||
static JavaThread* make_thread(const char* name, CompileQueue* queue, CompilerCounters* counters, AbstractCompiler* comp, bool compiler_thread, TRAPS);
|
||||
static void init_compiler_sweeper_threads(int c1_compiler_count, int c2_compiler_count);
|
||||
static bool compilation_is_complete (const methodHandle& method, int osr_bci, int comp_level);
|
||||
static bool compilation_is_prohibited(const methodHandle& method, int osr_bci, int comp_level);
|
||||
static bool is_compile_blocking();
|
||||
static bool compilation_is_prohibited(const methodHandle& method, int osr_bci, int comp_level, bool excluded);
|
||||
static void preload_classes (const methodHandle& method, TRAPS);
|
||||
|
||||
static CompileTask* create_compile_task(CompileQueue* queue,
|
||||
@ -253,6 +252,7 @@ class CompileBroker: AllStatic {
|
||||
const methodHandle& hot_method,
|
||||
int hot_count,
|
||||
const char* comment,
|
||||
bool blocking,
|
||||
Thread* thread);
|
||||
|
||||
static CompileQueue* compile_queue(int comp_level);
|
||||
@ -291,6 +291,15 @@ public:
|
||||
int hot_count,
|
||||
const char* comment, Thread* thread);
|
||||
|
||||
static nmethod* compile_method(const methodHandle& method,
|
||||
int osr_bci,
|
||||
int comp_level,
|
||||
const methodHandle& hot_method,
|
||||
int hot_count,
|
||||
const char* comment,
|
||||
DirectiveSet* directive,
|
||||
Thread* thread);
|
||||
|
||||
// Acquire any needed locks and assign a compile id
|
||||
static uint assign_compile_id_unlocked(Thread* thread, const methodHandle& method, int osr_bci);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 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
|
||||
@ -472,9 +472,12 @@ void DirectivesStack::push(CompilerDirectives* directive) {
|
||||
_depth++;
|
||||
}
|
||||
|
||||
void DirectivesStack::pop() {
|
||||
void DirectivesStack::pop(int count) {
|
||||
MutexLockerEx locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
|
||||
pop_inner();
|
||||
assert(count > -1, "No negative values");
|
||||
for (int i = 0; i < count; i++) {
|
||||
pop_inner();
|
||||
}
|
||||
}
|
||||
|
||||
void DirectivesStack::pop_inner() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 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
|
||||
@ -42,6 +42,7 @@
|
||||
cflags(PrintAssembly, bool, PrintAssembly, PrintAssembly) \
|
||||
cflags(PrintInlining, bool, PrintInlining, PrintInlining) \
|
||||
cflags(PrintNMethods, bool, PrintNMethods, PrintNMethods) \
|
||||
cflags(BackgroundCompilation, bool, BackgroundCompilation, BackgroundCompilation) \
|
||||
cflags(ReplayInline, bool, false, ReplayInline) \
|
||||
cflags(DumpReplay, bool, false, DumpReplay) \
|
||||
cflags(DumpInline, bool, false, DumpInline) \
|
||||
@ -87,7 +88,7 @@ public:
|
||||
static DirectiveSet* getMatchingDirective(methodHandle mh, AbstractCompiler* comp);
|
||||
static DirectiveSet* getDefaultDirective(AbstractCompiler* comp);
|
||||
static void push(CompilerDirectives* directive);
|
||||
static void pop();
|
||||
static void pop(int count);
|
||||
static bool check_capacity(int request_size, outputStream* st);
|
||||
static void clear();
|
||||
static void print(outputStream* st);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 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
|
||||
@ -55,7 +55,7 @@ void DirectivesParser::clean_tmp() {
|
||||
assert(_tmp_depth == 0, "Consistency");
|
||||
}
|
||||
|
||||
bool DirectivesParser::parse_string(const char* text, outputStream* st) {
|
||||
int DirectivesParser::parse_string(const char* text, outputStream* st) {
|
||||
DirectivesParser cd(text, st);
|
||||
if (cd.valid()) {
|
||||
return cd.install_directives();
|
||||
@ -63,7 +63,7 @@ bool DirectivesParser::parse_string(const char* text, outputStream* st) {
|
||||
cd.clean_tmp();
|
||||
st->flush();
|
||||
st->print_cr("Parsing of compiler directives failed");
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,17 +97,17 @@ bool DirectivesParser::parse_from_file_inner(const char* filename, outputStream*
|
||||
buffer[num_read] = '\0';
|
||||
// close file
|
||||
os::close(file_handle);
|
||||
return parse_string(buffer, stream);
|
||||
return parse_string(buffer, stream) > 0;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DirectivesParser::install_directives() {
|
||||
int DirectivesParser::install_directives() {
|
||||
// Check limit
|
||||
if (!DirectivesStack::check_capacity(_tmp_depth, _st)) {
|
||||
clean_tmp();
|
||||
return false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Pop from internal temporary stack and push to compileBroker.
|
||||
@ -120,14 +120,14 @@ bool DirectivesParser::install_directives() {
|
||||
}
|
||||
if (i == 0) {
|
||||
_st->print_cr("No directives in file");
|
||||
return false;
|
||||
return 0;
|
||||
} else {
|
||||
_st->print_cr("%i compiler directives added", i);
|
||||
if (CompilerDirectivesPrint) {
|
||||
// Print entire directives stack after new has been pushed.
|
||||
DirectivesStack::print(_st);
|
||||
}
|
||||
return true;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 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
|
||||
@ -51,8 +51,8 @@ public:
|
||||
static bool has_file();
|
||||
static bool parse_from_flag();
|
||||
static bool parse_from_file(const char* filename, outputStream* st);
|
||||
static bool parse_string(const char* string, outputStream* st);
|
||||
bool install_directives();
|
||||
static int parse_string(const char* string, outputStream* st);
|
||||
int install_directives();
|
||||
|
||||
private:
|
||||
DirectivesParser(const char* text, outputStream* st);
|
||||
|
@ -2329,9 +2329,13 @@ void G1CollectedHeap::register_concurrent_cycle_end() {
|
||||
GCIdMarkAndRestore conc_gc_id_mark(_cmThread->gc_id());
|
||||
if (_cm->has_aborted()) {
|
||||
_gc_tracer_cm->report_concurrent_mode_failure();
|
||||
|
||||
// ConcurrentGCTimer will be ended as well.
|
||||
_cm->register_concurrent_gc_end_and_stop_timer();
|
||||
} else {
|
||||
_gc_timer_cm->register_gc_end();
|
||||
}
|
||||
|
||||
_gc_timer_cm->register_gc_end();
|
||||
_gc_tracer_cm->report_gc_end(_gc_timer_cm->gc_end(), _gc_timer_cm->time_partitions());
|
||||
|
||||
// Clear state variables to prepare for the next concurrent cycle.
|
||||
|
@ -269,6 +269,8 @@ G1CollectorPolicy::G1CollectorPolicy() :
|
||||
_reserve_regions = 0;
|
||||
|
||||
_cset_chooser = new CollectionSetChooser();
|
||||
|
||||
_ihop_control = create_ihop_control();
|
||||
}
|
||||
|
||||
G1CollectorPolicy::~G1CollectorPolicy() {
|
||||
@ -469,8 +471,6 @@ void G1CollectorPolicy::post_heap_initialize() {
|
||||
if (max_young_size != MaxNewSize) {
|
||||
FLAG_SET_ERGO(size_t, MaxNewSize, max_young_size);
|
||||
}
|
||||
|
||||
_ihop_control = create_ihop_control();
|
||||
}
|
||||
|
||||
void G1CollectorPolicy::initialize_flags() {
|
||||
@ -565,6 +565,8 @@ void G1CollectorPolicy::record_new_heap_size(uint new_number_of_regions) {
|
||||
_reserve_regions = (uint) ceil(reserve_regions_d);
|
||||
|
||||
_young_gen_sizer->heap_size_changed(new_number_of_regions);
|
||||
|
||||
_ihop_control->update_target_occupancy(new_number_of_regions * HeapRegion::GrainBytes);
|
||||
}
|
||||
|
||||
uint G1CollectorPolicy::calculate_young_list_desired_min_length(
|
||||
@ -1234,13 +1236,11 @@ void G1CollectorPolicy::record_collection_pause_end(double pause_time_ms, size_t
|
||||
G1IHOPControl* G1CollectorPolicy::create_ihop_control() const {
|
||||
if (G1UseAdaptiveIHOP) {
|
||||
return new G1AdaptiveIHOPControl(InitiatingHeapOccupancyPercent,
|
||||
G1CollectedHeap::heap()->max_capacity(),
|
||||
&_predictor,
|
||||
G1ReservePercent,
|
||||
G1HeapWastePercent);
|
||||
} else {
|
||||
return new G1StaticIHOPControl(InitiatingHeapOccupancyPercent,
|
||||
G1CollectedHeap::heap()->max_capacity());
|
||||
return new G1StaticIHOPControl(InitiatingHeapOccupancyPercent);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -441,7 +441,7 @@ G1ConcurrentMark::G1ConcurrentMark(G1CollectedHeap* g1h, G1RegionToSpaceMapper*
|
||||
_has_aborted(false),
|
||||
_restart_for_overflow(false),
|
||||
_concurrent_marking_in_progress(false),
|
||||
_concurrent_phase_started(false),
|
||||
_concurrent_phase_status(ConcPhaseNotStarted),
|
||||
|
||||
// _verbose_level set below
|
||||
|
||||
@ -1008,16 +1008,43 @@ void G1ConcurrentMark::scanRootRegions() {
|
||||
}
|
||||
|
||||
void G1ConcurrentMark::register_concurrent_phase_start(const char* title) {
|
||||
assert(!_concurrent_phase_started, "Sanity");
|
||||
_concurrent_phase_started = true;
|
||||
uint old_val = 0;
|
||||
do {
|
||||
old_val = Atomic::cmpxchg(ConcPhaseStarted, &_concurrent_phase_status, ConcPhaseNotStarted);
|
||||
} while (old_val != ConcPhaseNotStarted);
|
||||
_g1h->gc_timer_cm()->register_gc_concurrent_start(title);
|
||||
}
|
||||
|
||||
void G1ConcurrentMark::register_concurrent_phase_end() {
|
||||
if (_concurrent_phase_started) {
|
||||
_concurrent_phase_started = false;
|
||||
_g1h->gc_timer_cm()->register_gc_concurrent_end();
|
||||
void G1ConcurrentMark::register_concurrent_phase_end_common(bool end_timer) {
|
||||
if (_concurrent_phase_status == ConcPhaseNotStarted) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint old_val = Atomic::cmpxchg(ConcPhaseStopping, &_concurrent_phase_status, ConcPhaseStarted);
|
||||
if (old_val == ConcPhaseStarted) {
|
||||
_g1h->gc_timer_cm()->register_gc_concurrent_end();
|
||||
// If 'end_timer' is true, we came here to end timer which needs concurrent phase ended.
|
||||
// We need to end it before changing the status to 'ConcPhaseNotStarted' to prevent
|
||||
// starting a new concurrent phase by 'ConcurrentMarkThread'.
|
||||
if (end_timer) {
|
||||
_g1h->gc_timer_cm()->register_gc_end();
|
||||
}
|
||||
old_val = Atomic::cmpxchg(ConcPhaseNotStarted, &_concurrent_phase_status, ConcPhaseStopping);
|
||||
assert(old_val == ConcPhaseStopping, "Should not have changed since we entered this scope.");
|
||||
} else {
|
||||
do {
|
||||
// Let other thread finish changing '_concurrent_phase_status' to 'ConcPhaseNotStarted'.
|
||||
os::naked_short_sleep(1);
|
||||
} while (_concurrent_phase_status != ConcPhaseNotStarted);
|
||||
}
|
||||
}
|
||||
|
||||
void G1ConcurrentMark::register_concurrent_phase_end() {
|
||||
register_concurrent_phase_end_common(false);
|
||||
}
|
||||
|
||||
void G1ConcurrentMark::register_concurrent_gc_end_and_stop_timer() {
|
||||
register_concurrent_phase_end_common(true);
|
||||
}
|
||||
|
||||
void G1ConcurrentMark::markFromRoots() {
|
||||
@ -2605,9 +2632,6 @@ void G1ConcurrentMark::abort() {
|
||||
|
||||
_g1h->trace_heap_after_concurrent_cycle();
|
||||
|
||||
// Close any open concurrent phase timing
|
||||
register_concurrent_phase_end();
|
||||
|
||||
_g1h->register_concurrent_cycle_end();
|
||||
}
|
||||
|
||||
|
@ -352,8 +352,17 @@ protected:
|
||||
// time of remark.
|
||||
volatile bool _concurrent_marking_in_progress;
|
||||
|
||||
// Keep track of whether we have started concurrent phase or not.
|
||||
bool _concurrent_phase_started;
|
||||
// There would be a race between ConcurrentMarkThread and VMThread(ConcurrentMark::abort())
|
||||
// to call ConcurrentGCTimer::register_gc_concurrent_end().
|
||||
// And this variable is used to keep track of concurrent phase.
|
||||
volatile uint _concurrent_phase_status;
|
||||
// Concurrent phase is not yet started.
|
||||
static const uint ConcPhaseNotStarted = 0;
|
||||
// Concurrent phase is started.
|
||||
static const uint ConcPhaseStarted = 1;
|
||||
// Caller thread of ConcurrentGCTimer::register_gc_concurrent_end() is ending concurrent phase.
|
||||
// So other thread should wait until the status to be changed to ConcPhaseNotStarted.
|
||||
static const uint ConcPhaseStopping = 2;
|
||||
|
||||
// All of these times are in ms
|
||||
NumberSeq _init_times;
|
||||
@ -485,6 +494,9 @@ protected:
|
||||
// Set to true when initialization is complete
|
||||
bool _completed_initialization;
|
||||
|
||||
// end_timer, true to end gc timer after ending concurrent phase.
|
||||
void register_concurrent_phase_end_common(bool end_timer);
|
||||
|
||||
public:
|
||||
// Manipulation of the global mark stack.
|
||||
// The push and pop operations are used by tasks for transfers
|
||||
@ -520,6 +532,8 @@ public:
|
||||
|
||||
void register_concurrent_phase_start(const char* title);
|
||||
void register_concurrent_phase_end();
|
||||
// Ends both concurrent phase and timer.
|
||||
void register_concurrent_gc_end_and_stop_timer();
|
||||
|
||||
void update_accum_task_vtime(int i, double vtime) {
|
||||
_accum_task_vtime[i] += vtime;
|
||||
|
@ -29,15 +29,21 @@
|
||||
#include "gc/shared/gcTrace.hpp"
|
||||
#include "logging/log.hpp"
|
||||
|
||||
G1IHOPControl::G1IHOPControl(double initial_ihop_percent, size_t target_occupancy) :
|
||||
G1IHOPControl::G1IHOPControl(double initial_ihop_percent) :
|
||||
_initial_ihop_percent(initial_ihop_percent),
|
||||
_target_occupancy(target_occupancy),
|
||||
_target_occupancy(0),
|
||||
_last_allocated_bytes(0),
|
||||
_last_allocation_time_s(0.0)
|
||||
{
|
||||
assert(_initial_ihop_percent >= 0.0 && _initial_ihop_percent <= 100.0, "Initial IHOP value must be between 0 and 100 but is %.3f", initial_ihop_percent);
|
||||
}
|
||||
|
||||
void G1IHOPControl::update_target_occupancy(size_t new_target_occupancy) {
|
||||
log_debug(gc, ihop)("Target occupancy update: old: " SIZE_FORMAT "B, new: " SIZE_FORMAT "B",
|
||||
_target_occupancy, new_target_occupancy);
|
||||
_target_occupancy = new_target_occupancy;
|
||||
}
|
||||
|
||||
void G1IHOPControl::update_allocation_info(double allocation_time_s, size_t allocated_bytes, size_t additional_buffer_size) {
|
||||
assert(allocation_time_s >= 0.0, "Allocation time must be positive but is %.3f", allocation_time_s);
|
||||
|
||||
@ -46,6 +52,7 @@ void G1IHOPControl::update_allocation_info(double allocation_time_s, size_t allo
|
||||
}
|
||||
|
||||
void G1IHOPControl::print() {
|
||||
assert(_target_occupancy > 0, "Target occupancy still not updated yet.");
|
||||
size_t cur_conc_mark_start_threshold = get_conc_mark_start_threshold();
|
||||
log_debug(gc, ihop)("Basic information (value update), threshold: " SIZE_FORMAT "B (%1.2f), target occupancy: " SIZE_FORMAT "B, current occupancy: " SIZE_FORMAT "B, "
|
||||
"recent allocation size: " SIZE_FORMAT "B, recent allocation duration: %1.2fms, recent old gen allocation rate: %1.2fB/s, recent marking phase length: %1.2fms",
|
||||
@ -60,6 +67,7 @@ void G1IHOPControl::print() {
|
||||
}
|
||||
|
||||
void G1IHOPControl::send_trace_event(G1NewTracer* tracer) {
|
||||
assert(_target_occupancy > 0, "Target occupancy still not updated yet.");
|
||||
tracer->report_basic_ihop_statistics(get_conc_mark_start_threshold(),
|
||||
_target_occupancy,
|
||||
G1CollectedHeap::heap()->used(),
|
||||
@ -68,10 +76,9 @@ void G1IHOPControl::send_trace_event(G1NewTracer* tracer) {
|
||||
last_marking_length_s());
|
||||
}
|
||||
|
||||
G1StaticIHOPControl::G1StaticIHOPControl(double ihop_percent, size_t target_occupancy) :
|
||||
G1IHOPControl(ihop_percent, target_occupancy),
|
||||
G1StaticIHOPControl::G1StaticIHOPControl(double ihop_percent) :
|
||||
G1IHOPControl(ihop_percent),
|
||||
_last_marking_length_s(0.0) {
|
||||
assert(_target_occupancy > 0, "Target occupancy must be larger than zero.");
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
@ -85,7 +92,8 @@ static void test_update(G1IHOPControl* ctrl, double alloc_time, size_t alloc_amo
|
||||
void G1StaticIHOPControl::test() {
|
||||
size_t const initial_ihop = 45;
|
||||
|
||||
G1StaticIHOPControl ctrl(initial_ihop, 100);
|
||||
G1StaticIHOPControl ctrl(initial_ihop);
|
||||
ctrl.update_target_occupancy(100);
|
||||
|
||||
size_t threshold = ctrl.get_conc_mark_start_threshold();
|
||||
assert(threshold == initial_ihop,
|
||||
@ -115,11 +123,10 @@ void G1StaticIHOPControl::test() {
|
||||
#endif
|
||||
|
||||
G1AdaptiveIHOPControl::G1AdaptiveIHOPControl(double ihop_percent,
|
||||
size_t initial_target_occupancy,
|
||||
G1Predictions const* predictor,
|
||||
size_t heap_reserve_percent,
|
||||
size_t heap_waste_percent) :
|
||||
G1IHOPControl(ihop_percent, initial_target_occupancy),
|
||||
G1IHOPControl(ihop_percent),
|
||||
_predictor(predictor),
|
||||
_marking_times_s(10, 0.95),
|
||||
_allocation_rate_s(10, 0.95),
|
||||
@ -130,6 +137,7 @@ G1AdaptiveIHOPControl::G1AdaptiveIHOPControl(double ihop_percent,
|
||||
}
|
||||
|
||||
size_t G1AdaptiveIHOPControl::actual_target_threshold() const {
|
||||
guarantee(_target_occupancy > 0, "Target occupancy still not updated yet.");
|
||||
// The actual target threshold takes the heap reserve and the expected waste in
|
||||
// free space into account.
|
||||
// _heap_reserve is that part of the total heap capacity that is reserved for
|
||||
@ -227,7 +235,8 @@ void G1AdaptiveIHOPControl::test() {
|
||||
// target_size - (young_size + alloc_amount/alloc_time * marking_time)
|
||||
|
||||
G1Predictions pred(0.95);
|
||||
G1AdaptiveIHOPControl ctrl(initial_threshold, target_size, &pred, 0, 0);
|
||||
G1AdaptiveIHOPControl ctrl(initial_threshold, &pred, 0, 0);
|
||||
ctrl.update_target_occupancy(target_size);
|
||||
|
||||
// First "load".
|
||||
size_t const alloc_time1 = 2;
|
||||
@ -288,5 +297,6 @@ void G1AdaptiveIHOPControl::test() {
|
||||
|
||||
void IHOP_test() {
|
||||
G1StaticIHOPControl::test();
|
||||
G1AdaptiveIHOPControl::test();
|
||||
}
|
||||
#endif
|
||||
|
@ -38,7 +38,8 @@ class G1IHOPControl : public CHeapObj<mtGC> {
|
||||
protected:
|
||||
// The initial IHOP value relative to the target occupancy.
|
||||
double _initial_ihop_percent;
|
||||
// The target maximum occupancy of the heap.
|
||||
// The target maximum occupancy of the heap. The target occupancy is the number
|
||||
// of bytes when marking should be finished and reclaim started.
|
||||
size_t _target_occupancy;
|
||||
|
||||
// Most recent complete mutator allocation period in seconds.
|
||||
@ -46,10 +47,9 @@ class G1IHOPControl : public CHeapObj<mtGC> {
|
||||
// Amount of bytes allocated during _last_allocation_time_s.
|
||||
size_t _last_allocated_bytes;
|
||||
|
||||
// Initialize an instance with the initial IHOP value in percent and the target
|
||||
// occupancy. The target occupancy is the number of bytes when marking should
|
||||
// be finished and reclaim started.
|
||||
G1IHOPControl(double initial_ihop_percent, size_t target_occupancy);
|
||||
// Initialize an instance with the initial IHOP value in percent. The target
|
||||
// occupancy will be updated at the first heap expansion.
|
||||
G1IHOPControl(double initial_ihop_percent);
|
||||
|
||||
// Most recent time from the end of the initial mark to the start of the first
|
||||
// mixed gc.
|
||||
@ -60,6 +60,8 @@ class G1IHOPControl : public CHeapObj<mtGC> {
|
||||
// Get the current non-young occupancy at which concurrent marking should start.
|
||||
virtual size_t get_conc_mark_start_threshold() = 0;
|
||||
|
||||
// Adjust target occupancy.
|
||||
virtual void update_target_occupancy(size_t new_target_occupancy);
|
||||
// Update information about time during which allocations in the Java heap occurred,
|
||||
// how large these allocations were in bytes, and an additional buffer.
|
||||
// The allocations should contain any amount of space made unusable for further
|
||||
@ -86,9 +88,12 @@ class G1StaticIHOPControl : public G1IHOPControl {
|
||||
protected:
|
||||
double last_marking_length_s() const { return _last_marking_length_s; }
|
||||
public:
|
||||
G1StaticIHOPControl(double ihop_percent, size_t target_occupancy);
|
||||
G1StaticIHOPControl(double ihop_percent);
|
||||
|
||||
size_t get_conc_mark_start_threshold() { return (size_t) (_initial_ihop_percent * _target_occupancy / 100.0); }
|
||||
size_t get_conc_mark_start_threshold() {
|
||||
guarantee(_target_occupancy > 0, "Target occupancy must have been initialized.");
|
||||
return (size_t) (_initial_ihop_percent * _target_occupancy / 100.0);
|
||||
}
|
||||
|
||||
virtual void update_marking_length(double marking_length_s) {
|
||||
assert(marking_length_s > 0.0, "Marking length must be larger than zero but is %.3f", marking_length_s);
|
||||
@ -132,7 +137,6 @@ class G1AdaptiveIHOPControl : public G1IHOPControl {
|
||||
virtual double last_marking_length_s() const { return _marking_times_s.last(); }
|
||||
public:
|
||||
G1AdaptiveIHOPControl(double ihop_percent,
|
||||
size_t initial_target_occupancy,
|
||||
G1Predictions const* predictor,
|
||||
size_t heap_reserve_percent, // The percentage of total heap capacity that should not be tapped into.
|
||||
size_t heap_waste_percent); // The percentage of the free space in the heap that we think is not usable for allocation.
|
||||
|
@ -171,14 +171,7 @@ inline void G1UpdateRSOrPushRefOopClosure::do_oop_work(T* p) {
|
||||
#ifdef ASSERT
|
||||
// can't do because of races
|
||||
// assert(obj == NULL || obj->is_oop(), "expected an oop");
|
||||
|
||||
// Do the safe subset of is_oop
|
||||
#ifdef CHECK_UNHANDLED_OOPS
|
||||
oopDesc* o = obj.obj();
|
||||
#else
|
||||
oopDesc* o = obj;
|
||||
#endif // CHECK_UNHANDLED_OOPS
|
||||
assert((intptr_t)o % MinObjAlignmentInBytes == 0, "not oop aligned");
|
||||
assert(check_obj_alignment(obj), "not oop aligned");
|
||||
assert(_g1->is_in_reserved(obj), "must be in heap");
|
||||
#endif // ASSERT
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 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
|
||||
@ -44,14 +44,7 @@ inline void G1RemSet::par_write_ref(HeapRegion* from, T* p, uint tid) {
|
||||
#ifdef ASSERT
|
||||
// can't do because of races
|
||||
// assert(obj == NULL || obj->is_oop(), "expected an oop");
|
||||
|
||||
// Do the safe subset of is_oop
|
||||
#ifdef CHECK_UNHANDLED_OOPS
|
||||
oopDesc* o = obj.obj();
|
||||
#else
|
||||
oopDesc* o = obj;
|
||||
#endif // CHECK_UNHANDLED_OOPS
|
||||
assert((intptr_t)o % MinObjAlignmentInBytes == 0, "not oop aligned");
|
||||
assert(check_obj_alignment(obj), "not oop aligned");
|
||||
assert(_g1->is_in_reserved(obj), "must be in heap");
|
||||
#endif // ASSERT
|
||||
|
||||
|
@ -125,14 +125,14 @@ inline void oop_pc_follow_contents_specialized(objArrayOop obj, int index, ParCo
|
||||
T* const beg = base + beg_index;
|
||||
T* const end = base + end_index;
|
||||
|
||||
if (end_index < len) {
|
||||
cm->push_objarray(obj, end_index); // Push the continuation.
|
||||
}
|
||||
|
||||
// Push the non-NULL elements of the next stride on the marking stack.
|
||||
for (T* e = beg; e < end; e++) {
|
||||
cm->mark_and_push<T>(e);
|
||||
}
|
||||
|
||||
if (end_index < len) {
|
||||
cm->push_objarray(obj, end_index); // Push the continuation.
|
||||
}
|
||||
}
|
||||
|
||||
inline void ParCompactionManager::follow_contents(objArrayOop obj, int index) {
|
||||
|
@ -1483,17 +1483,6 @@ void PSParallelCompact::fill_dense_prefix_end(SpaceId id)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PSParallelCompact::clear_source_region(HeapWord* beg_addr, HeapWord* end_addr)
|
||||
{
|
||||
RegionData* const beg_ptr = _summary_data.addr_to_region_ptr(beg_addr);
|
||||
HeapWord* const end_aligned_up = _summary_data.region_align_up(end_addr);
|
||||
RegionData* const end_ptr = _summary_data.addr_to_region_ptr(end_aligned_up);
|
||||
for (RegionData* cur = beg_ptr; cur < end_ptr; ++cur) {
|
||||
cur->set_source_region(0);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PSParallelCompact::summarize_space(SpaceId id, bool maximum_compaction)
|
||||
{
|
||||
|
@ -1065,9 +1065,6 @@ class PSParallelCompact : AllStatic {
|
||||
// non-empty.
|
||||
static void fill_dense_prefix_end(SpaceId id);
|
||||
|
||||
// Clear the summary data source_region field for the specified addresses.
|
||||
static void clear_source_region(HeapWord* beg_addr, HeapWord* end_addr);
|
||||
|
||||
static void summarize_spaces_quick();
|
||||
static void summarize_space(SpaceId id, bool maximum_compaction);
|
||||
static void summary_phase(ParCompactionManager* cm, bool maximum_compaction);
|
||||
|
@ -600,12 +600,6 @@ bool PSScavenge::invoke_no_policy() {
|
||||
|
||||
NOT_PRODUCT(reference_processor()->verify_no_references_recorded());
|
||||
|
||||
{
|
||||
GCTraceTime(Debug, gc, phases) tm("Prune Scavenge Root Methods", &_gc_timer);
|
||||
|
||||
CodeCache::prune_scavenge_root_nmethods();
|
||||
}
|
||||
|
||||
// Re-verify object start arrays
|
||||
if (VerifyObjectStartArray &&
|
||||
VerifyAfterGC) {
|
||||
|
@ -561,7 +561,7 @@ void GenCollectedHeap::process_roots(StrongRootsScope* scope,
|
||||
OopClosure* weak_roots,
|
||||
CLDClosure* strong_cld_closure,
|
||||
CLDClosure* weak_cld_closure,
|
||||
CodeBlobClosure* code_roots) {
|
||||
CodeBlobToOopClosure* code_roots) {
|
||||
// General roots.
|
||||
assert(Threads::thread_claim_parity() != 0, "must have called prologue code");
|
||||
assert(code_roots != NULL, "code root closure should always be set");
|
||||
@ -578,7 +578,7 @@ void GenCollectedHeap::process_roots(StrongRootsScope* scope,
|
||||
// Don't process them if they will be processed during the ClassLoaderDataGraph phase.
|
||||
CLDClosure* roots_from_clds_p = (strong_cld_closure != weak_cld_closure) ? strong_cld_closure : NULL;
|
||||
// Only process code roots from thread stacks if we aren't visiting the entire CodeCache anyway
|
||||
CodeBlobClosure* roots_from_code_p = (so & SO_AllCodeCache) ? NULL : code_roots;
|
||||
CodeBlobToOopClosure* roots_from_code_p = (so & SO_AllCodeCache) ? NULL : code_roots;
|
||||
|
||||
bool is_par = scope->n_threads() > 1;
|
||||
Threads::possibly_parallel_oops_do(is_par, strong_roots, roots_from_clds_p, roots_from_code_p);
|
||||
|
@ -399,7 +399,7 @@ public:
|
||||
OopClosure* weak_roots,
|
||||
CLDClosure* strong_cld_closure,
|
||||
CLDClosure* weak_cld_closure,
|
||||
CodeBlobClosure* code_roots);
|
||||
CodeBlobToOopClosure* code_roots);
|
||||
|
||||
public:
|
||||
static const bool StrongAndWeakRoots = false;
|
||||
|
@ -162,6 +162,9 @@ void JVMCICompiler::compile_method(const methodHandle& method, int entry_bci, JV
|
||||
CLEAR_PENDING_EXCEPTION;
|
||||
|
||||
java_lang_Throwable::java_printStackTrace(exception, THREAD);
|
||||
if (HAS_PENDING_EXCEPTION) {
|
||||
CLEAR_PENDING_EXCEPTION;
|
||||
}
|
||||
|
||||
env->set_failure("exception throw", false);
|
||||
} else {
|
||||
|
@ -51,7 +51,6 @@
|
||||
jobject JVMCIRuntime::_HotSpotJVMCIRuntime_instance = NULL;
|
||||
bool JVMCIRuntime::_HotSpotJVMCIRuntime_initialized = false;
|
||||
bool JVMCIRuntime::_well_known_classes_initialized = false;
|
||||
const char* JVMCIRuntime::_compiler = NULL;
|
||||
int JVMCIRuntime::_trivial_prefixes_count = 0;
|
||||
char** JVMCIRuntime::_trivial_prefixes = NULL;
|
||||
bool JVMCIRuntime::_shutdown_called = false;
|
||||
@ -104,6 +103,7 @@ static void deopt_caller() {
|
||||
JRT_BLOCK_ENTRY(void, JVMCIRuntime::new_instance(JavaThread* thread, Klass* klass))
|
||||
JRT_BLOCK;
|
||||
assert(klass->is_klass(), "not a class");
|
||||
Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
|
||||
instanceKlassHandle h(thread, klass);
|
||||
h->check_valid_for_instantiation(true, CHECK);
|
||||
// make sure klass is initialized
|
||||
@ -129,6 +129,7 @@ JRT_BLOCK_ENTRY(void, JVMCIRuntime::new_array(JavaThread* thread, Klass* array_k
|
||||
BasicType elt_type = TypeArrayKlass::cast(array_klass)->element_type();
|
||||
obj = oopFactory::new_typeArray(elt_type, length, CHECK);
|
||||
} else {
|
||||
Handle holder(THREAD, array_klass->klass_holder()); // keep the klass alive
|
||||
Klass* elem_klass = ObjArrayKlass::cast(array_klass)->element_klass();
|
||||
obj = oopFactory::new_objArray(elem_klass, length, CHECK);
|
||||
}
|
||||
@ -172,6 +173,7 @@ void JVMCIRuntime::new_store_pre_barrier(JavaThread* thread) {
|
||||
JRT_ENTRY(void, JVMCIRuntime::new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims))
|
||||
assert(klass->is_klass(), "not a class");
|
||||
assert(rank >= 1, "rank must be nonzero");
|
||||
Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
|
||||
oop obj = ArrayKlass::cast(klass)->multi_allocate(rank, dims, CHECK);
|
||||
thread->set_vm_result(obj);
|
||||
JRT_END
|
||||
@ -642,15 +644,6 @@ void JVMCIRuntime::initialize_HotSpotJVMCIRuntime(TRAPS) {
|
||||
"HotSpotJVMCIRuntime initialization should only be triggered through JVMCI initialization");
|
||||
#endif
|
||||
|
||||
if (_compiler != NULL) {
|
||||
JavaCallArguments args;
|
||||
oop compiler = java_lang_String::create_oop_from_str(_compiler, CHECK);
|
||||
args.push_oop(compiler);
|
||||
callStatic("jdk/vm/ci/hotspot/HotSpotJVMCICompilerConfig",
|
||||
"selectCompiler",
|
||||
"(Ljava/lang/String;)Ljava/lang/Boolean;", &args, CHECK);
|
||||
}
|
||||
|
||||
Handle result = callStatic("jdk/vm/ci/hotspot/HotSpotJVMCIRuntime",
|
||||
"runtime",
|
||||
"()Ljdk/vm/ci/hotspot/HotSpotJVMCIRuntime;", NULL, CHECK);
|
||||
@ -783,66 +776,6 @@ JVM_ENTRY(void, JVM_RegisterJVMCINatives(JNIEnv *env, jclass c2vmClass))
|
||||
}
|
||||
JVM_END
|
||||
|
||||
/**
|
||||
* Closure for parsing a line from a *.properties file in jre/lib/jvmci/properties.
|
||||
* The line must match the regular expression "[^=]+=.*". That is one or more
|
||||
* characters other than '=' followed by '=' followed by zero or more characters.
|
||||
* Everything before the '=' is the property name and everything after '=' is the value.
|
||||
* Lines that start with '#' are treated as comments and ignored.
|
||||
* No special processing of whitespace or any escape characters is performed.
|
||||
* The last definition of a property "wins" (i.e., it overrides all earlier
|
||||
* definitions of the property).
|
||||
*/
|
||||
class JVMCIPropertiesFileClosure : public ParseClosure {
|
||||
SystemProperty** _plist;
|
||||
public:
|
||||
JVMCIPropertiesFileClosure(SystemProperty** plist) : _plist(plist) {}
|
||||
void do_line(char* line) {
|
||||
if (line[0] == '#') {
|
||||
// skip comment
|
||||
return;
|
||||
}
|
||||
size_t len = strlen(line);
|
||||
char* sep = strchr(line, '=');
|
||||
if (sep == NULL) {
|
||||
warn_and_abort("invalid format: could not find '=' character");
|
||||
return;
|
||||
}
|
||||
if (sep == line) {
|
||||
warn_and_abort("invalid format: name cannot be empty");
|
||||
return;
|
||||
}
|
||||
*sep = '\0';
|
||||
const char* name = line;
|
||||
char* value = sep + 1;
|
||||
Arguments::PropertyList_unique_add(_plist, name, value);
|
||||
}
|
||||
};
|
||||
|
||||
void JVMCIRuntime::init_system_properties(SystemProperty** plist) {
|
||||
char jvmciDir[JVM_MAXPATHLEN];
|
||||
const char* fileSep = os::file_separator();
|
||||
jio_snprintf(jvmciDir, sizeof(jvmciDir), "%s%slib%sjvmci",
|
||||
Arguments::get_java_home(), fileSep, fileSep, fileSep);
|
||||
DIR* dir = os::opendir(jvmciDir);
|
||||
if (dir != NULL) {
|
||||
struct dirent *entry;
|
||||
char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(jvmciDir), mtInternal);
|
||||
JVMCIPropertiesFileClosure closure(plist);
|
||||
const unsigned suffix_len = (unsigned)strlen(".properties");
|
||||
while ((entry = os::readdir(dir, (dirent *) dbuf)) != NULL && !closure.is_aborted()) {
|
||||
const char* name = entry->d_name;
|
||||
if (strlen(name) > suffix_len && strcmp(name + strlen(name) - suffix_len, ".properties") == 0) {
|
||||
char propertiesFilePath[JVM_MAXPATHLEN];
|
||||
jio_snprintf(propertiesFilePath, sizeof(propertiesFilePath), "%s%s%s",jvmciDir, fileSep, name);
|
||||
JVMCIRuntime::parse_lines(propertiesFilePath, &closure, false);
|
||||
}
|
||||
}
|
||||
FREE_C_HEAP_ARRAY(char, dbuf);
|
||||
os::closedir(dir);
|
||||
}
|
||||
}
|
||||
|
||||
#define CHECK_WARN_ABORT_(message) THREAD); \
|
||||
if (HAS_PENDING_EXCEPTION) { \
|
||||
warning(message); \
|
||||
@ -853,12 +786,6 @@ void JVMCIRuntime::init_system_properties(SystemProperty** plist) {
|
||||
} \
|
||||
(void)(0
|
||||
|
||||
void JVMCIRuntime::save_compiler(const char* compiler) {
|
||||
assert(compiler != NULL, "npe");
|
||||
assert(_compiler == NULL, "cannot reassign JVMCI compiler");
|
||||
_compiler = compiler;
|
||||
}
|
||||
|
||||
void JVMCIRuntime::shutdown(TRAPS) {
|
||||
if (_HotSpotJVMCIRuntime_instance != NULL) {
|
||||
_shutdown_called = true;
|
||||
@ -884,69 +811,3 @@ bool JVMCIRuntime::treat_as_trivial(Method* method) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void JVMCIRuntime::parse_lines(char* path, ParseClosure* closure, bool warnStatFailure) {
|
||||
struct stat st;
|
||||
if (::stat(path, &st) == 0 && (st.st_mode & S_IFREG) == S_IFREG) { // exists & is regular file
|
||||
int file_handle = ::open(path, os::default_file_open_flags(), 0);
|
||||
if (file_handle != -1) {
|
||||
char* buffer = NEW_C_HEAP_ARRAY(char, st.st_size + 1, mtInternal);
|
||||
int num_read;
|
||||
num_read = (int) ::read(file_handle, (char*) buffer, st.st_size);
|
||||
if (num_read == -1) {
|
||||
warning("Error reading file %s due to %s", path, strerror(errno));
|
||||
} else if (num_read != st.st_size) {
|
||||
warning("Only read %d of " SIZE_FORMAT " bytes from %s", num_read, (size_t) st.st_size, path);
|
||||
}
|
||||
::close(file_handle);
|
||||
closure->set_filename(path);
|
||||
if (num_read == st.st_size) {
|
||||
buffer[num_read] = '\0';
|
||||
|
||||
char* line = buffer;
|
||||
while (line - buffer < num_read && !closure->is_aborted()) {
|
||||
// find line end (\r, \n or \r\n)
|
||||
char* nextline = NULL;
|
||||
char* cr = strchr(line, '\r');
|
||||
char* lf = strchr(line, '\n');
|
||||
if (cr != NULL && lf != NULL) {
|
||||
char* min = MIN2(cr, lf);
|
||||
*min = '\0';
|
||||
if (lf == cr + 1) {
|
||||
nextline = lf + 1;
|
||||
} else {
|
||||
nextline = min + 1;
|
||||
}
|
||||
} else if (cr != NULL) {
|
||||
*cr = '\0';
|
||||
nextline = cr + 1;
|
||||
} else if (lf != NULL) {
|
||||
*lf = '\0';
|
||||
nextline = lf + 1;
|
||||
}
|
||||
// trim left
|
||||
while (*line == ' ' || *line == '\t') line++;
|
||||
char* end = line + strlen(line);
|
||||
// trim right
|
||||
while (end > line && (*(end -1) == ' ' || *(end -1) == '\t')) end--;
|
||||
*end = '\0';
|
||||
// skip comments and empty lines
|
||||
if (*line != '#' && strlen(line) > 0) {
|
||||
closure->parse_line(line);
|
||||
}
|
||||
if (nextline != NULL) {
|
||||
line = nextline;
|
||||
} else {
|
||||
// File without newline at the end
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
FREE_C_HEAP_ARRAY(char, buffer);
|
||||
} else {
|
||||
warning("Error opening file %s due to %s", path, strerror(errno));
|
||||
}
|
||||
} else if (warnStatFailure) {
|
||||
warning("Could not stat file %s due to %s", path, strerror(errno));
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 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
|
||||
@ -70,7 +70,6 @@ class JVMCIRuntime: public AllStatic {
|
||||
static jobject _HotSpotJVMCIRuntime_instance;
|
||||
static bool _HotSpotJVMCIRuntime_initialized;
|
||||
static bool _well_known_classes_initialized;
|
||||
static const char* _compiler;
|
||||
|
||||
static int _trivial_prefixes_count;
|
||||
static char** _trivial_prefixes;
|
||||
@ -85,19 +84,9 @@ class JVMCIRuntime: public AllStatic {
|
||||
static Handle create_Service(const char* name, TRAPS);
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Parses *.properties files in jre/lib/jvmci/ and adds the properties to plist.
|
||||
*/
|
||||
static void init_system_properties(SystemProperty** plist);
|
||||
|
||||
/**
|
||||
* Saves the value of the "jvmci.compiler" system property for processing
|
||||
* when JVMCI is initialized.
|
||||
*/
|
||||
static void save_compiler(const char* compiler);
|
||||
|
||||
static bool is_HotSpotJVMCIRuntime_initialized() { return _HotSpotJVMCIRuntime_initialized; }
|
||||
static bool is_HotSpotJVMCIRuntime_initialized() {
|
||||
return _HotSpotJVMCIRuntime_initialized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the singleton HotSpotJVMCIRuntime instance, initializing it if necessary
|
||||
@ -136,7 +125,6 @@ class JVMCIRuntime: public AllStatic {
|
||||
}
|
||||
|
||||
static bool treat_as_trivial(Method* method);
|
||||
static void parse_lines(char* path, ParseClosure* closure, bool warnStatFailure);
|
||||
|
||||
static BasicType kindToBasicType(Handle kind, TRAPS);
|
||||
|
||||
|
@ -107,18 +107,25 @@ class Log VALUE_OBJ_CLASS_SPEC {
|
||||
return LogTagSetMapping<T0, T1, T2, T3, T4>::tagset().is_level(level);
|
||||
}
|
||||
|
||||
ATTRIBUTE_PRINTF(2, 3)
|
||||
static void write(LogLevelType level, const char* fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vwrite(level, fmt, args);
|
||||
va_end(args);
|
||||
};
|
||||
|
||||
template <LogLevelType Level>
|
||||
ATTRIBUTE_PRINTF(1, 2)
|
||||
static void write(const char* fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
vwrite<Level>(fmt, args);
|
||||
vwrite(Level, fmt, args);
|
||||
va_end(args);
|
||||
};
|
||||
|
||||
template <LogLevelType Level>
|
||||
ATTRIBUTE_PRINTF(1, 0)
|
||||
static void vwrite(const char* fmt, va_list args) {
|
||||
ATTRIBUTE_PRINTF(2, 0)
|
||||
static void vwrite(LogLevelType level, const char* fmt, va_list args) {
|
||||
char buf[LogBufferSize];
|
||||
va_list saved_args; // For re-format on buf overflow.
|
||||
va_copy(saved_args, args);
|
||||
@ -132,27 +139,26 @@ class Log VALUE_OBJ_CLASS_SPEC {
|
||||
prefix_len = LogPrefix<T0, T1, T2, T3, T4>::prefix(newbuf, newbuf_len);
|
||||
ret = os::log_vsnprintf(newbuf + prefix_len, newbuf_len - prefix_len, fmt, saved_args);
|
||||
assert(ret >= 0, "Log message buffer issue");
|
||||
puts<Level>(newbuf);
|
||||
puts(level, newbuf);
|
||||
FREE_C_HEAP_ARRAY(char, newbuf);
|
||||
} else {
|
||||
puts<Level>(buf);
|
||||
puts(level, buf);
|
||||
}
|
||||
}
|
||||
|
||||
template <LogLevelType Level>
|
||||
static void puts(const char* string) {
|
||||
LogTagSetMapping<T0, T1, T2, T3, T4>::tagset().log(Level, string);
|
||||
static void puts(LogLevelType level, const char* string) {
|
||||
LogTagSetMapping<T0, T1, T2, T3, T4>::tagset().log(level, string);
|
||||
}
|
||||
|
||||
#define LOG_LEVEL(level, name) ATTRIBUTE_PRINTF(2, 0) \
|
||||
Log& v##name(const char* fmt, va_list args) { \
|
||||
vwrite<LogLevel::level>(fmt, args); \
|
||||
vwrite(LogLevel::level, fmt, args); \
|
||||
return *this; \
|
||||
} \
|
||||
Log& name(const char* fmt, ...) ATTRIBUTE_PRINTF(2, 3) { \
|
||||
va_list args; \
|
||||
va_start(args, fmt); \
|
||||
vwrite<LogLevel::level>(fmt, args); \
|
||||
vwrite(LogLevel::level, fmt, args); \
|
||||
va_end(args); \
|
||||
return *this; \
|
||||
} \
|
||||
|
@ -285,9 +285,12 @@ class CodeBlobToOopClosure : public CodeBlobClosure {
|
||||
protected:
|
||||
void do_nmethod(nmethod* nm);
|
||||
public:
|
||||
// If fix_relocations(), then cl must copy objects to their new location immediately to avoid
|
||||
// patching nmethods with the old locations.
|
||||
CodeBlobToOopClosure(OopClosure* cl, bool fix_relocations) : _cl(cl), _fix_relocations(fix_relocations) {}
|
||||
virtual void do_code_blob(CodeBlob* cb);
|
||||
|
||||
bool fix_relocations() const { return _fix_relocations; }
|
||||
const static bool FixRelocations = true;
|
||||
};
|
||||
|
||||
|
@ -295,7 +295,7 @@ address* oopDesc::address_field_addr(int offset) const { return (address*) f
|
||||
// in inner GC loops so these are separated.
|
||||
|
||||
inline bool check_obj_alignment(oop obj) {
|
||||
return cast_from_oop<intptr_t>(obj) % MinObjAlignmentInBytes == 0;
|
||||
return (cast_from_oop<intptr_t>(obj) & MinObjAlignmentInBytesMask) == 0;
|
||||
}
|
||||
|
||||
oop oopDesc::decode_heap_oop_not_null(narrowOop v) {
|
||||
|
@ -158,9 +158,21 @@ void Symbol::print_utf8_on(outputStream* st) const {
|
||||
}
|
||||
|
||||
void Symbol::print_symbol_on(outputStream* st) const {
|
||||
ResourceMark rm;
|
||||
char *s;
|
||||
st = st ? st : tty;
|
||||
st->print("%s", as_quoted_ascii());
|
||||
{
|
||||
// ResourceMark may not affect st->print(). If st is a string
|
||||
// stream it could resize, using the same resource arena.
|
||||
ResourceMark rm;
|
||||
s = as_quoted_ascii();
|
||||
s = os::strdup(s);
|
||||
}
|
||||
if (s == NULL) {
|
||||
st->print("(null)");
|
||||
} else {
|
||||
st->print("%s", s);
|
||||
os::free(s);
|
||||
}
|
||||
}
|
||||
|
||||
char* Symbol::as_quoted_ascii() const {
|
||||
|
@ -1243,13 +1243,13 @@ void SafePointNode::pop_monitor() {
|
||||
|
||||
Node *SafePointNode::peek_monitor_box() const {
|
||||
int mon = jvms()->nof_monitors() - 1;
|
||||
assert(mon >= 0, "most have a monitor");
|
||||
assert(mon >= 0, "must have a monitor");
|
||||
return monitor_box(jvms(), mon);
|
||||
}
|
||||
|
||||
Node *SafePointNode::peek_monitor_obj() const {
|
||||
int mon = jvms()->nof_monitors() - 1;
|
||||
assert(mon >= 0, "most have a monitor");
|
||||
assert(mon >= 0, "must have a monitor");
|
||||
return monitor_obj(jvms(), mon);
|
||||
}
|
||||
|
||||
|
@ -1665,7 +1665,7 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) {
|
||||
|
||||
bool uncasted = false;
|
||||
Node* uin = unique_input(phase, false);
|
||||
if (uin == NULL) {
|
||||
if (uin == NULL && can_reshape) {
|
||||
uncasted = true;
|
||||
uin = unique_input(phase, true);
|
||||
}
|
||||
@ -1702,6 +1702,8 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) {
|
||||
}
|
||||
|
||||
if (uncasted) {
|
||||
// Wait until after parsing for the type information to propagate from the casts
|
||||
assert(can_reshape, "Invalid during parsing");
|
||||
const Type* phi_type = bottom_type();
|
||||
assert(phi_type->isa_int() || phi_type->isa_ptr(), "bad phi type");
|
||||
int opcode;
|
||||
@ -1720,8 +1722,9 @@ Node *PhiNode::Ideal(PhaseGVN *phase, bool can_reshape) {
|
||||
Node* cast = ConstraintCastNode::make_cast(opcode, r, uin, phi_type, true);
|
||||
cast = phase->transform(cast);
|
||||
// set all inputs to the new cast so the Phi is removed by Identity
|
||||
PhaseIterGVN* igvn = phase->is_IterGVN();
|
||||
for (uint i = 1; i < req(); i++) {
|
||||
set_req(i, cast);
|
||||
set_req_X(i, cast, igvn);
|
||||
}
|
||||
uin = cast;
|
||||
}
|
||||
|
@ -220,22 +220,17 @@ JRT_BLOCK_ENTRY(void, OptoRuntime::new_instance_C(Klass* klass, JavaThread* thre
|
||||
|
||||
// These checks are cheap to make and support reflective allocation.
|
||||
int lh = klass->layout_helper();
|
||||
if (Klass::layout_helper_needs_slow_path(lh)
|
||||
|| !InstanceKlass::cast(klass)->is_initialized()) {
|
||||
KlassHandle kh(THREAD, klass);
|
||||
kh->check_valid_for_instantiation(false, THREAD);
|
||||
if (Klass::layout_helper_needs_slow_path(lh) || !InstanceKlass::cast(klass)->is_initialized()) {
|
||||
Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
|
||||
klass->check_valid_for_instantiation(false, THREAD);
|
||||
if (!HAS_PENDING_EXCEPTION) {
|
||||
InstanceKlass::cast(kh())->initialize(THREAD);
|
||||
}
|
||||
if (!HAS_PENDING_EXCEPTION) {
|
||||
klass = kh();
|
||||
} else {
|
||||
klass = NULL;
|
||||
InstanceKlass::cast(klass)->initialize(THREAD);
|
||||
}
|
||||
}
|
||||
|
||||
if (klass != NULL) {
|
||||
if (!HAS_PENDING_EXCEPTION) {
|
||||
// Scavenge and allocate an instance.
|
||||
Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
|
||||
oop result = InstanceKlass::cast(klass)->allocate_instance(THREAD);
|
||||
thread->set_vm_result(result);
|
||||
|
||||
@ -275,6 +270,7 @@ JRT_BLOCK_ENTRY(void, OptoRuntime::new_array_C(Klass* array_type, int len, JavaT
|
||||
// Although the oopFactory likes to work with the elem_type,
|
||||
// the compiler prefers the array_type, since it must already have
|
||||
// that latter value in hand for the fast path.
|
||||
Handle holder(THREAD, array_type->klass_holder()); // keep the array klass alive
|
||||
Klass* elem_type = ObjArrayKlass::cast(array_type)->element_klass();
|
||||
result = oopFactory::new_objArray(elem_type, len, THREAD);
|
||||
}
|
||||
@ -353,6 +349,7 @@ JRT_ENTRY(void, OptoRuntime::multianewarray2_C(Klass* elem_type, int len1, int l
|
||||
jint dims[2];
|
||||
dims[0] = len1;
|
||||
dims[1] = len2;
|
||||
Handle holder(THREAD, elem_type->klass_holder()); // keep the klass alive
|
||||
oop obj = ArrayKlass::cast(elem_type)->multi_allocate(2, dims, THREAD);
|
||||
deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION);
|
||||
thread->set_vm_result(obj);
|
||||
@ -369,6 +366,7 @@ JRT_ENTRY(void, OptoRuntime::multianewarray3_C(Klass* elem_type, int len1, int l
|
||||
dims[0] = len1;
|
||||
dims[1] = len2;
|
||||
dims[2] = len3;
|
||||
Handle holder(THREAD, elem_type->klass_holder()); // keep the klass alive
|
||||
oop obj = ArrayKlass::cast(elem_type)->multi_allocate(3, dims, THREAD);
|
||||
deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION);
|
||||
thread->set_vm_result(obj);
|
||||
@ -386,6 +384,7 @@ JRT_ENTRY(void, OptoRuntime::multianewarray4_C(Klass* elem_type, int len1, int l
|
||||
dims[1] = len2;
|
||||
dims[2] = len3;
|
||||
dims[3] = len4;
|
||||
Handle holder(THREAD, elem_type->klass_holder()); // keep the klass alive
|
||||
oop obj = ArrayKlass::cast(elem_type)->multi_allocate(4, dims, THREAD);
|
||||
deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION);
|
||||
thread->set_vm_result(obj);
|
||||
@ -404,6 +403,7 @@ JRT_ENTRY(void, OptoRuntime::multianewarray5_C(Klass* elem_type, int len1, int l
|
||||
dims[2] = len3;
|
||||
dims[3] = len4;
|
||||
dims[4] = len5;
|
||||
Handle holder(THREAD, elem_type->klass_holder()); // keep the klass alive
|
||||
oop obj = ArrayKlass::cast(elem_type)->multi_allocate(5, dims, THREAD);
|
||||
deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION);
|
||||
thread->set_vm_result(obj);
|
||||
@ -421,6 +421,7 @@ JRT_ENTRY(void, OptoRuntime::multianewarrayN_C(Klass* elem_type, arrayOopDesc* d
|
||||
jint *c_dims = NEW_RESOURCE_ARRAY(jint, len);
|
||||
Copy::conjoint_jints_atomic(j_dims, c_dims, len);
|
||||
|
||||
Handle holder(THREAD, elem_type->klass_holder()); // keep the klass alive
|
||||
oop obj = ArrayKlass::cast(elem_type)->multi_allocate(len, c_dims, THREAD);
|
||||
deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION);
|
||||
thread->set_vm_result(obj);
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "classfile/stringTable.hpp"
|
||||
#include "code/codeCache.hpp"
|
||||
#include "compiler/methodMatcher.hpp"
|
||||
#include "compiler/directivesParser.hpp"
|
||||
#include "jvmtifiles/jvmtiEnv.hpp"
|
||||
#include "memory/metadataFactory.hpp"
|
||||
#include "memory/metaspaceShared.hpp"
|
||||
@ -636,6 +637,10 @@ WB_ENTRY(jboolean, WB_TestSetForceInlineMethod(JNIEnv* env, jobject o, jobject m
|
||||
WB_END
|
||||
|
||||
WB_ENTRY(jboolean, WB_EnqueueMethodForCompilation(JNIEnv* env, jobject o, jobject method, jint comp_level, jint bci))
|
||||
// Screen for unavailable/bad comp level
|
||||
if (CompileBroker::compiler(comp_level) == NULL) {
|
||||
return false;
|
||||
}
|
||||
jmethodID jmid = reflected_method_to_jmid(thread, env, method);
|
||||
CHECK_JNI_EXCEPTION_(env, JNI_FALSE);
|
||||
methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
|
||||
@ -1502,6 +1507,27 @@ void WhiteBox::register_methods(JNIEnv* env, jclass wbclass, JavaThread* thread,
|
||||
}
|
||||
}
|
||||
|
||||
WB_ENTRY(jint, WB_AddCompilerDirective(JNIEnv* env, jobject o, jstring compDirect))
|
||||
// can't be in VM when we call JNI
|
||||
ThreadToNativeFromVM ttnfv(thread);
|
||||
const char* dir = env->GetStringUTFChars(compDirect, NULL);
|
||||
int ret;
|
||||
{
|
||||
ThreadInVMfromNative ttvfn(thread); // back to VM
|
||||
ret = DirectivesParser::parse_string(dir, tty);
|
||||
}
|
||||
env->ReleaseStringUTFChars(compDirect, dir);
|
||||
// -1 for error parsing directive. Return 0 as number of directives added.
|
||||
if (ret == -1) {
|
||||
ret = 0;
|
||||
}
|
||||
return (jint) ret;
|
||||
WB_END
|
||||
|
||||
WB_ENTRY(void, WB_RemoveCompilerDirective(JNIEnv* env, jobject o, jint count))
|
||||
DirectivesStack::pop(count);
|
||||
WB_END
|
||||
|
||||
#define CC (char*)
|
||||
|
||||
static JNINativeMethod methods[] = {
|
||||
@ -1677,6 +1703,9 @@ static JNINativeMethod methods[] = {
|
||||
{CC"isShared", CC"(Ljava/lang/Object;)Z", (void*)&WB_IsShared },
|
||||
{CC"areSharedStringsIgnored", CC"()Z", (void*)&WB_AreSharedStringsIgnored },
|
||||
{CC"clearInlineCaches", CC"()V", (void*)&WB_ClearInlineCaches },
|
||||
{CC"addCompilerDirective", CC"(Ljava/lang/String;)I",
|
||||
(void*)&WB_AddCompilerDirective },
|
||||
{CC"removeCompilerDirective", CC"(I)V", (void*)&WB_RemoveCompilerDirective },
|
||||
};
|
||||
|
||||
#undef CC
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 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
|
||||
@ -177,9 +177,7 @@ bool AdvancedThresholdPolicy::is_method_profiled(Method* method) {
|
||||
|
||||
// Called with the queue locked and with at least one element
|
||||
CompileTask* AdvancedThresholdPolicy::select_task(CompileQueue* compile_queue) {
|
||||
#if INCLUDE_JVMCI
|
||||
CompileTask *max_blocking_task = NULL;
|
||||
#endif
|
||||
CompileTask *max_task = NULL;
|
||||
Method* max_method = NULL;
|
||||
jlong t = os::javaTimeMillis();
|
||||
@ -193,7 +191,8 @@ CompileTask* AdvancedThresholdPolicy::select_task(CompileQueue* compile_queue) {
|
||||
max_method = method;
|
||||
} else {
|
||||
// If a method has been stale for some time, remove it from the queue.
|
||||
if (is_stale(t, TieredCompileTaskTimeout, method) && !is_old(method)) {
|
||||
// Blocking tasks don't become stale
|
||||
if (!task->is_blocking() && is_stale(t, TieredCompileTaskTimeout, method) && !is_old(method)) {
|
||||
if (PrintTieredEvents) {
|
||||
print_event(REMOVE_FROM_QUEUE, method, method, task->osr_bci(), (CompLevel)task->comp_level());
|
||||
}
|
||||
@ -210,29 +209,25 @@ CompileTask* AdvancedThresholdPolicy::select_task(CompileQueue* compile_queue) {
|
||||
max_method = method;
|
||||
}
|
||||
}
|
||||
#if INCLUDE_JVMCI
|
||||
if (UseJVMCICompiler && task->is_blocking()) {
|
||||
|
||||
if (task->is_blocking()) {
|
||||
if (max_blocking_task == NULL || compare_methods(method, max_blocking_task->method())) {
|
||||
max_blocking_task = task;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
task = next_task;
|
||||
}
|
||||
|
||||
#if INCLUDE_JVMCI
|
||||
if (UseJVMCICompiler) {
|
||||
if (max_blocking_task != NULL) {
|
||||
// In blocking compilation mode, the CompileBroker will make
|
||||
// compilations submitted by a JVMCI compiler thread non-blocking. These
|
||||
// compilations should be scheduled after all blocking compilations
|
||||
// to service non-compiler related compilations sooner and reduce the
|
||||
// chance of such compilations timing out.
|
||||
max_task = max_blocking_task;
|
||||
max_method = max_task->method();
|
||||
}
|
||||
if (max_blocking_task != NULL) {
|
||||
// In blocking compilation mode, the CompileBroker will make
|
||||
// compilations submitted by a JVMCI compiler thread non-blocking. These
|
||||
// compilations should be scheduled after all blocking compilations
|
||||
// to service non-compiler related compilations sooner and reduce the
|
||||
// chance of such compilations timing out.
|
||||
max_task = max_blocking_task;
|
||||
max_method = max_task->method();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (max_task->comp_level() == CompLevel_full_profile && TieredStopAtLevel > CompLevel_full_profile
|
||||
&& is_method_profiled(max_method)) {
|
||||
|
@ -221,8 +221,6 @@ void Arguments::init_system_properties() {
|
||||
|
||||
// Set OS specific system properties values
|
||||
os::init_system_properties_values();
|
||||
|
||||
JVMCI_ONLY(JVMCIRuntime::init_system_properties(&_system_properties);)
|
||||
}
|
||||
|
||||
// Update/Initialize System properties after JDK version number is known
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 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
|
||||
@ -247,6 +247,9 @@ void emit_range_size_t(const char* /*name*/) { /* NOP */ }
|
||||
void emit_range_double(const char* /*name*/) { /* NOP */ }
|
||||
|
||||
// CommandLineFlagRange emitting code functions if range arguments are provided
|
||||
void emit_range_int(const char* name, int min, int max) {
|
||||
CommandLineFlagRangeList::add(new CommandLineFlagRange_int(name, min, max));
|
||||
}
|
||||
void emit_range_intx(const char* name, intx min, intx max) {
|
||||
CommandLineFlagRangeList::add(new CommandLineFlagRange_intx(name, min, max));
|
||||
}
|
||||
|
@ -891,9 +891,6 @@ public:
|
||||
notproduct(bool, VerifyLastFrame, false, \
|
||||
"Verify oops on last frame on entry to VM") \
|
||||
\
|
||||
develop(bool, TraceHandleAllocation, false, \
|
||||
"Print out warnings when suspiciously many handles are allocated")\
|
||||
\
|
||||
product(bool, FailOverToOldVerifier, true, \
|
||||
"Fail over to old verifier when split verifier fails") \
|
||||
\
|
||||
@ -1603,10 +1600,10 @@ public:
|
||||
product(bool, ResizePLAB, true, \
|
||||
"Dynamically resize (survivor space) promotion LAB's") \
|
||||
\
|
||||
product(intx, ParGCArrayScanChunk, 50, \
|
||||
product(int, ParGCArrayScanChunk, 50, \
|
||||
"Scan a subset of object array and push remainder, if array is " \
|
||||
"bigger than this") \
|
||||
range(1, max_intx) \
|
||||
range(1, max_jint/3) \
|
||||
\
|
||||
product(bool, ParGCUseLocalOverflow, false, \
|
||||
"Instead of a global overflow list, use local overflow stacks") \
|
||||
@ -3024,14 +3021,6 @@ public:
|
||||
notproduct(ccstrlist, SuppressErrorAt, "", \
|
||||
"List of assertions (file:line) to muzzle") \
|
||||
\
|
||||
notproduct(size_t, HandleAllocationLimit, 1024, \
|
||||
"Threshold for HandleMark allocation when +TraceHandleAllocation "\
|
||||
"is used") \
|
||||
\
|
||||
develop(size_t, TotalHandleAllocationLimit, 1024, \
|
||||
"Threshold for total handle allocation when " \
|
||||
"+TraceHandleAllocation is used") \
|
||||
\
|
||||
develop(intx, StackPrintLimit, 100, \
|
||||
"number of stack frames to print in VM-level stack dump") \
|
||||
\
|
||||
|
@ -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
|
||||
@ -129,14 +129,6 @@ void HandleArea::oops_do(OopClosure* f) {
|
||||
k = k->next();
|
||||
}
|
||||
|
||||
// The thread local handle areas should not get very large
|
||||
if (TraceHandleAllocation && (size_t)handles_visited > TotalHandleAllocationLimit) {
|
||||
#ifdef ASSERT
|
||||
warning("%d: Visited in HandleMark : " SIZE_FORMAT, _nof_handlemarks, handles_visited);
|
||||
#else
|
||||
warning("Visited in HandleMark : " SIZE_FORMAT, handles_visited);
|
||||
#endif
|
||||
}
|
||||
if (_prev != NULL) _prev->oops_do(f);
|
||||
}
|
||||
|
||||
@ -165,31 +157,6 @@ HandleMark::~HandleMark() {
|
||||
assert(area->_handle_mark_nesting > 0, "must stack allocate HandleMarks" );
|
||||
debug_only(area->_handle_mark_nesting--);
|
||||
|
||||
// Debug code to trace the number of handles allocated per mark/
|
||||
#ifdef ASSERT
|
||||
if (TraceHandleAllocation) {
|
||||
size_t handles = 0;
|
||||
Chunk *c = _chunk->next();
|
||||
if (c == NULL) {
|
||||
handles = area->_hwm - _hwm; // no new chunk allocated
|
||||
} else {
|
||||
handles = _max - _hwm; // add rest in first chunk
|
||||
while(c != NULL) {
|
||||
handles += c->length();
|
||||
c = c->next();
|
||||
}
|
||||
handles -= area->_max - area->_hwm; // adjust for last trunk not full
|
||||
}
|
||||
handles /= sizeof(void *); // Adjust for size of a handle
|
||||
if (handles > HandleAllocationLimit) {
|
||||
// Note: _nof_handlemarks is only set in debug mode
|
||||
warning("%d: Allocated in HandleMark : " SIZE_FORMAT, _nof_handlemarks, handles);
|
||||
}
|
||||
|
||||
tty->print_cr("Handles " SIZE_FORMAT, handles);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Delete later chunks
|
||||
if( _chunk->next() ) {
|
||||
// reset arena size before delete chunks. Otherwise, the total
|
||||
|
@ -3696,15 +3696,6 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
|
||||
Chunk::start_chunk_pool_cleaner_task();
|
||||
}
|
||||
|
||||
#if INCLUDE_JVMCI
|
||||
if (EnableJVMCI) {
|
||||
const char* jvmciCompiler = Arguments::PropertyList_get_value(Arguments::system_properties(), "jvmci.compiler");
|
||||
if (jvmciCompiler != NULL) {
|
||||
JVMCIRuntime::save_compiler(jvmciCompiler);
|
||||
}
|
||||
}
|
||||
#endif // INCLUDE_JVMCI
|
||||
|
||||
// initialize compiler(s)
|
||||
#if defined(COMPILER1) || defined(COMPILER2) || defined(SHARK) || INCLUDE_JVMCI
|
||||
CompileBroker::compilation_init(CHECK_JNI_ERR);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 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
|
||||
@ -931,7 +931,7 @@ int CompilerDirectivesAddDCmd::num_arguments() {
|
||||
}
|
||||
|
||||
void CompilerDirectivesRemoveDCmd::execute(DCmdSource source, TRAPS) {
|
||||
DirectivesStack::pop();
|
||||
DirectivesStack::pop(1);
|
||||
}
|
||||
|
||||
void CompilerDirectivesClearDCmd::execute(DCmdSource source, TRAPS) {
|
||||
|
@ -313,7 +313,7 @@ inline size_t pointer_delta(const MetaWord* left, const MetaWord* right) {
|
||||
// ANSI C++ does not allow casting from one pointer type to a function pointer
|
||||
// directly without at best a warning. This macro accomplishes it silently
|
||||
// In every case that is present at this point the value be cast is a pointer
|
||||
// to a C linkage function. In somecase the type used for the cast reflects
|
||||
// to a C linkage function. In some case the type used for the cast reflects
|
||||
// that linkage and a picky compiler would not complain. In other cases because
|
||||
// there is no convenient place to place a typedef with extern C linkage (i.e
|
||||
// a platform dependent header file) it doesn't. At this point no compiler seems
|
||||
@ -678,7 +678,7 @@ extern const char* type2name_tab[T_CONFLICT+1]; // Map a BasicType to a jcha
|
||||
inline const char* type2name(BasicType t) { return (uint)t < T_CONFLICT+1 ? type2name_tab[t] : NULL; }
|
||||
extern BasicType name2type(const char* name);
|
||||
|
||||
// Auxilary math routines
|
||||
// Auxiliary math routines
|
||||
// least common multiple
|
||||
extern size_t lcm(size_t a, size_t b);
|
||||
|
||||
@ -801,7 +801,7 @@ class JavaValue {
|
||||
|
||||
// TosState describes the top-of-stack state before and after the execution of
|
||||
// a bytecode or method. The top-of-stack value may be cached in one or more CPU
|
||||
// registers. The TosState corresponds to the 'machine represention' of this cached
|
||||
// registers. The TosState corresponds to the 'machine representation' of this cached
|
||||
// value. There's 4 states corresponding to the JAVA types int, long, float & double
|
||||
// as well as a 5th state in case the top-of-stack value is actually on the top
|
||||
// of stack (in memory) and thus not cached. The atos state corresponds to the itos
|
||||
@ -876,7 +876,7 @@ TosState as_TosState(BasicType type);
|
||||
// a transition from one state to another. These extra states makes it possible for the safepoint code to
|
||||
// handle certain thread_states without having to suspend the thread - making the safepoint code faster.
|
||||
//
|
||||
// Given a state, the xxx_trans state can always be found by adding 1.
|
||||
// Given a state, the xxxx_trans state can always be found by adding 1.
|
||||
//
|
||||
enum JavaThreadState {
|
||||
_thread_uninitialized = 0, // should never happen (missing initialization)
|
||||
@ -1425,7 +1425,7 @@ template<class T> static void swap(T& a, T& b) {
|
||||
// operations.
|
||||
|
||||
// The goal of this code to avoid undefined or implementation-defined
|
||||
// behaviour. The use of an lvalue to reference cast is explicitly
|
||||
// behavior. The use of an lvalue to reference cast is explicitly
|
||||
// permitted by Lvalues and rvalues [basic.lval]. [Section 3.10 Para
|
||||
// 15 in C++03]
|
||||
#define JAVA_INTEGER_OP(OP, NAME, TYPE, UNSIGNED_TYPE) \
|
||||
|
@ -338,7 +338,9 @@ void stringStream::write(const char* s, size_t len) {
|
||||
}
|
||||
char* oldbuf = buffer;
|
||||
assert(rm == NULL || Thread::current()->current_resource_mark() == rm,
|
||||
"stringStream is re-allocated with a different ResourceMark");
|
||||
"StringStream is re-allocated with a different ResourceMark. Current: "
|
||||
PTR_FORMAT " original: " PTR_FORMAT,
|
||||
p2i(Thread::current()->current_resource_mark()), p2i(rm));
|
||||
buffer = NEW_RESOURCE_ARRAY(char, end);
|
||||
if (buffer_pos > 0) {
|
||||
memcpy(buffer, oldbuf, buffer_pos);
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# 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
|
||||
@ -230,8 +230,10 @@ compact1_minimal = \
|
||||
#
|
||||
needs_g1gc = \
|
||||
compiler/regalloc/C1ObjectSpillInLogicOp.java \
|
||||
gc/TestSmallHeap.java \
|
||||
gc/TestSystemGC.java \
|
||||
gc/arguments/TestAlignmentToUseLargePages.java \
|
||||
gc/arguments/TestG1ConcRefinementThreads.java \
|
||||
gc/arguments/TestG1HeapRegionSize.java \
|
||||
gc/arguments/TestG1HeapSizeFlags.java \
|
||||
gc/arguments/TestG1PercentageOptions.java \
|
||||
@ -242,11 +244,11 @@ needs_g1gc = \
|
||||
gc/class_unloading/TestG1ClassUnloadingHWM.java \
|
||||
gc/ergonomics/TestDynamicNumberOfGCThreads.java \
|
||||
gc/g1/ \
|
||||
gc/logging/TestGCId.java \
|
||||
gc/metaspace/G1AddMetaspaceDependency.java \
|
||||
gc/metaspace/TestMetaspacePerfCounters.java \
|
||||
gc/startup_warnings/TestG1.java \
|
||||
gc/whitebox/TestConcMarkCycleWB.java \
|
||||
gc/arguments/TestG1ConcRefinementThreads.java
|
||||
gc/whitebox/TestConcMarkCycleWB.java
|
||||
|
||||
hotspot_native_sanity = \
|
||||
native_sanity
|
||||
|
@ -53,8 +53,8 @@ public class MultiCommand extends AbstractTestBase {
|
||||
List<CompileCommand> testCases = new ArrayList<>();
|
||||
for (Command cmd : commands) {
|
||||
if (validOnly && cmd == Command.NONEXISTENT) {
|
||||
// skip invalid command
|
||||
continue;
|
||||
// replace with a valid command
|
||||
cmd = Command.EXCLUDE;
|
||||
}
|
||||
Executable exec = Utils.getRandomElement(METHODS).first;
|
||||
MethodDescriptor md;
|
||||
|
58
hotspot/test/compiler/jvmci/meta/StableFieldTest.java
Normal file
58
hotspot/test/compiler/jvmci/meta/StableFieldTest.java
Normal file
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 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.
|
||||
*
|
||||
* 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 8151664
|
||||
* @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
|
||||
* @library /testlibrary /test/lib /
|
||||
* @compile StableFieldTest.java
|
||||
* @run main ClassFileInstaller compiler.jvmci.meta.StableFieldTest
|
||||
* @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Xbootclasspath/a:. compiler.jvmci.meta.StableFieldTest
|
||||
*/
|
||||
|
||||
package compiler.jvmci.meta;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import jdk.internal.vm.annotation.Stable;
|
||||
import jdk.vm.ci.hotspot.HotSpotResolvedJavaField;
|
||||
import jdk.vm.ci.meta.MetaAccessProvider;
|
||||
import jdk.vm.ci.meta.ResolvedJavaField;
|
||||
import jdk.vm.ci.runtime.JVMCI;
|
||||
|
||||
public class StableFieldTest {
|
||||
|
||||
@Stable static int myStaticField = 5;
|
||||
@Stable int myInstanceField = 10;
|
||||
|
||||
public static void main(String[] args) throws Throwable {
|
||||
MetaAccessProvider metaAccess = JVMCI.getRuntime().getHostJVMCIBackend().getMetaAccess();
|
||||
for (String name : new String[] {"myStaticField", "myInstanceField"}) {
|
||||
java.lang.reflect.Field javaField = StableFieldTest.class.getDeclaredField(name);
|
||||
HotSpotResolvedJavaField field = (HotSpotResolvedJavaField) metaAccess.lookupJavaField(javaField);
|
||||
if (!field.isStable()) {
|
||||
throw new AssertionError("Expected HotSpotResolvedJavaField.isStable() to return true for " + javaField);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -31,54 +31,10 @@ import sun.hotspot.WhiteBox;
|
||||
public class StableConfiguration {
|
||||
static final WhiteBox WB = WhiteBox.getWhiteBox();
|
||||
static final boolean isStableEnabled;
|
||||
static final boolean isServerWithStable;
|
||||
|
||||
static {
|
||||
Boolean value = WB.getBooleanVMFlag("FoldStableValues");
|
||||
isStableEnabled = (value == null ? false : value);
|
||||
isServerWithStable = isStableEnabled && get();
|
||||
System.out.println("@Stable: " + (isStableEnabled ? "enabled" : "disabled"));
|
||||
System.out.println("Server Compiler: " + get());
|
||||
}
|
||||
|
||||
// The method 'get' below returns true if the method is server compiled
|
||||
// and is used by the Stable tests to determine whether methods in
|
||||
// general are being server compiled or not as the -XX:+FoldStableValues
|
||||
// option is only applicable to -server.
|
||||
//
|
||||
// On aarch64 we DeOptimize when patching. This means that when the
|
||||
// method is compiled as a result of -Xcomp it DeOptimizes immediately.
|
||||
// The result is that getMethodCompilationLevel returns 0. This means
|
||||
// the method returns true based on java.vm.name.
|
||||
//
|
||||
// However when the tests are run with -XX:+TieredCompilation and
|
||||
// -XX:TieredStopAtLevel=1 this fails because methods will always
|
||||
// be client compiled.
|
||||
//
|
||||
// Solution is to add a simple method 'get1' which should never be
|
||||
// DeOpted and use that to determine the compilation level instead.
|
||||
static void get1() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ::get() is among immediately compiled methods.
|
||||
static boolean get() {
|
||||
try {
|
||||
get1();
|
||||
Method m = StableConfiguration.class.getDeclaredMethod("get1");
|
||||
int level = WB.getMethodCompilationLevel(m);
|
||||
if (level > 0) {
|
||||
return (level == 4);
|
||||
} else {
|
||||
String javaVM = System.getProperty("java.vm.name", "");
|
||||
if (javaVM.contains("Server")) return true;
|
||||
if (javaVM.contains("Client")) return false;
|
||||
throw new Error("Unknown VM type: "+javaVM);
|
||||
}
|
||||
} catch (NoSuchMethodException e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -87,8 +87,7 @@ import jdk.internal.vm.annotation.Stable;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
public class TestStableBoolean {
|
||||
static final boolean isStableEnabled = StableConfiguration.isStableEnabled;
|
||||
static final boolean isServerWithStable = StableConfiguration.isServerWithStable;
|
||||
static final boolean isStableEnabled = StableConfiguration.isStableEnabled;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
run(DefaultValue.class);
|
||||
@ -209,14 +208,14 @@ public class TestStableBoolean {
|
||||
c.v = new boolean[1]; c.v[0] = true; boolean val1 = get();
|
||||
c.v[0] = false; boolean val2 = get();
|
||||
assertEquals(val1, true);
|
||||
assertEquals(val2, (isServerWithStable ? true : false));
|
||||
assertEquals(val2, (isStableEnabled ? true : false));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new boolean[20]; c.v[10] = true; boolean val1 = get1();
|
||||
c.v[10] = false; boolean val2 = get1();
|
||||
assertEquals(val1, true);
|
||||
assertEquals(val2, (isServerWithStable ? true : false));
|
||||
assertEquals(val2, (isStableEnabled ? true : false));
|
||||
}
|
||||
|
||||
{
|
||||
@ -241,19 +240,19 @@ public class TestStableBoolean {
|
||||
c.v = new boolean[1][1]; c.v[0][0] = true; boolean val1 = get();
|
||||
c.v[0][0] = false; boolean val2 = get();
|
||||
assertEquals(val1, true);
|
||||
assertEquals(val2, (isServerWithStable ? true : false));
|
||||
assertEquals(val2, (isStableEnabled ? true : false));
|
||||
|
||||
c.v = new boolean[1][1]; c.v[0][0] = false; boolean val3 = get();
|
||||
assertEquals(val3, (isServerWithStable ? true : false));
|
||||
assertEquals(val3, (isStableEnabled ? true : false));
|
||||
|
||||
c.v[0] = new boolean[1]; c.v[0][0] = false; boolean val4 = get();
|
||||
assertEquals(val4, (isServerWithStable ? true : false));
|
||||
assertEquals(val4, (isStableEnabled ? true : false));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new boolean[1][1]; boolean[] val1 = get1();
|
||||
c.v[0] = new boolean[1]; boolean[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -279,28 +278,28 @@ public class TestStableBoolean {
|
||||
c.v = new boolean[1][1][1]; c.v[0][0][0] = true; boolean val1 = get();
|
||||
c.v[0][0][0] = false; boolean val2 = get();
|
||||
assertEquals(val1, true);
|
||||
assertEquals(val2, (isServerWithStable ? true : false));
|
||||
assertEquals(val2, (isStableEnabled ? true : false));
|
||||
|
||||
c.v = new boolean[1][1][1]; c.v[0][0][0] = false; boolean val3 = get();
|
||||
assertEquals(val3, (isServerWithStable ? true : false));
|
||||
assertEquals(val3, (isStableEnabled ? true : false));
|
||||
|
||||
c.v[0] = new boolean[1][1]; c.v[0][0][0] = false; boolean val4 = get();
|
||||
assertEquals(val4, (isServerWithStable ? true : false));
|
||||
assertEquals(val4, (isStableEnabled ? true : false));
|
||||
|
||||
c.v[0][0] = new boolean[1]; c.v[0][0][0] = false; boolean val5 = get();
|
||||
assertEquals(val5, (isServerWithStable ? true : false));
|
||||
assertEquals(val5, (isStableEnabled ? true : false));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new boolean[1][1][1]; boolean[] val1 = get1();
|
||||
c.v[0][0] = new boolean[1]; boolean[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new boolean[1][1][1]; boolean[][] val1 = get2();
|
||||
c.v[0] = new boolean[1][1]; boolean[][] val2 = get2();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -327,37 +326,37 @@ public class TestStableBoolean {
|
||||
c.v = new boolean[1][1][1][1]; c.v[0][0][0][0] = true; boolean val1 = get();
|
||||
c.v[0][0][0][0] = false; boolean val2 = get();
|
||||
assertEquals(val1, true);
|
||||
assertEquals(val2, (isServerWithStable ? true : false));
|
||||
assertEquals(val2, (isStableEnabled ? true : false));
|
||||
|
||||
c.v = new boolean[1][1][1][1]; c.v[0][0][0][0] = false; boolean val3 = get();
|
||||
assertEquals(val3, (isServerWithStable ? true : false));
|
||||
assertEquals(val3, (isStableEnabled ? true : false));
|
||||
|
||||
c.v[0] = new boolean[1][1][1]; c.v[0][0][0][0] = false; boolean val4 = get();
|
||||
assertEquals(val4, (isServerWithStable ? true : false));
|
||||
assertEquals(val4, (isStableEnabled ? true : false));
|
||||
|
||||
c.v[0][0] = new boolean[1][1]; c.v[0][0][0][0] = false; boolean val5 = get();
|
||||
assertEquals(val5, (isServerWithStable ? true : false));
|
||||
assertEquals(val5, (isStableEnabled ? true : false));
|
||||
|
||||
c.v[0][0][0] = new boolean[1]; c.v[0][0][0][0] = false; boolean val6 = get();
|
||||
assertEquals(val6, (isServerWithStable ? true : false));
|
||||
assertEquals(val6, (isStableEnabled ? true : false));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new boolean[1][1][1][1]; boolean[] val1 = get1();
|
||||
c.v[0][0][0] = new boolean[1]; boolean[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new boolean[1][1][1][1]; boolean[][] val1 = get2();
|
||||
c.v[0][0] = new boolean[1][1]; boolean[][] val2 = get2();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new boolean[1][1][1][1]; boolean[][][] val1 = get3();
|
||||
c.v[0] = new boolean[1][1][1]; boolean[][][] val2 = get3();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -420,7 +419,7 @@ public class TestStableBoolean {
|
||||
c.v = new boolean[1][1]; c.v[0] = new boolean[0]; boolean[] val1 = get1();
|
||||
c.v[0] = new boolean[0]; boolean[] val2 = get1();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -456,14 +455,14 @@ public class TestStableBoolean {
|
||||
c.v = new boolean[1][1][1]; c.v[0][0] = new boolean[0]; boolean[] val1 = get1();
|
||||
c.v[0][0] = new boolean[0]; boolean[] val2 = get1();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new boolean[1][1][1]; c.v[0] = new boolean[0][0]; boolean[][] val1 = get2();
|
||||
c.v[0] = new boolean[0][0]; boolean[][] val2 = get2();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -598,7 +597,7 @@ public class TestStableBoolean {
|
||||
elem.a = false; boolean val3 = get(); boolean val4 = get1();
|
||||
|
||||
assertEquals(val1, true);
|
||||
assertEquals(val3, (isServerWithStable ? true : false));
|
||||
assertEquals(val3, (isStableEnabled ? true : false));
|
||||
|
||||
assertEquals(val2, true);
|
||||
assertEquals(val4, false);
|
||||
|
@ -88,7 +88,6 @@ import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
public class TestStableByte {
|
||||
static final boolean isStableEnabled = StableConfiguration.isStableEnabled;
|
||||
static final boolean isServerWithStable = StableConfiguration.isServerWithStable;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
run(DefaultValue.class);
|
||||
@ -209,10 +208,10 @@ public class TestStableByte {
|
||||
c.v = new byte[1]; c.v[0] = 1; byte val1 = get();
|
||||
c.v[0] = 2; byte val2 = get();
|
||||
assertEquals(val1, 1);
|
||||
assertEquals(val2, (isServerWithStable ? 1 : 2));
|
||||
assertEquals(val2, (isStableEnabled ? 1 : 2));
|
||||
|
||||
c.v = new byte[1]; c.v[0] = 3; byte val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 3));
|
||||
}
|
||||
|
||||
@ -220,10 +219,10 @@ public class TestStableByte {
|
||||
c.v = new byte[20]; c.v[10] = 1; byte val1 = get1();
|
||||
c.v[10] = 2; byte val2 = get1();
|
||||
assertEquals(val1, 1);
|
||||
assertEquals(val2, (isServerWithStable ? 1 : 2));
|
||||
assertEquals(val2, (isStableEnabled ? 1 : 2));
|
||||
|
||||
c.v = new byte[20]; c.v[10] = 3; byte val3 = get1();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 3));
|
||||
}
|
||||
|
||||
@ -249,21 +248,21 @@ public class TestStableByte {
|
||||
c.v = new byte[1][1]; c.v[0][0] = 1; byte val1 = get();
|
||||
c.v[0][0] = 2; byte val2 = get();
|
||||
assertEquals(val1, 1);
|
||||
assertEquals(val2, (isServerWithStable ? 1 : 2));
|
||||
assertEquals(val2, (isStableEnabled ? 1 : 2));
|
||||
|
||||
c.v = new byte[1][1]; c.v[0][0] = 3; byte val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 3));
|
||||
|
||||
c.v[0] = new byte[1]; c.v[0][0] = 4; byte val4 = get();
|
||||
assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 4));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new byte[1][1]; byte[] val1 = get1();
|
||||
c.v[0] = new byte[1]; byte[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -289,31 +288,31 @@ public class TestStableByte {
|
||||
c.v = new byte[1][1][1]; c.v[0][0][0] = 1; byte val1 = get();
|
||||
c.v[0][0][0] = 2; byte val2 = get();
|
||||
assertEquals(val1, 1);
|
||||
assertEquals(val2, (isServerWithStable ? 1 : 2));
|
||||
assertEquals(val2, (isStableEnabled ? 1 : 2));
|
||||
|
||||
c.v = new byte[1][1][1]; c.v[0][0][0] = 3; byte val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 3));
|
||||
|
||||
c.v[0] = new byte[1][1]; c.v[0][0][0] = 4; byte val4 = get();
|
||||
assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 4));
|
||||
|
||||
c.v[0][0] = new byte[1]; c.v[0][0][0] = 5; byte val5 = get();
|
||||
assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 5));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new byte[1][1][1]; byte[] val1 = get1();
|
||||
c.v[0][0] = new byte[1]; byte[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new byte[1][1][1]; byte[][] val1 = get2();
|
||||
c.v[0] = new byte[1][1]; byte[][] val2 = get2();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -340,41 +339,41 @@ public class TestStableByte {
|
||||
c.v = new byte[1][1][1][1]; c.v[0][0][0][0] = 1; byte val1 = get();
|
||||
c.v[0][0][0][0] = 2; byte val2 = get();
|
||||
assertEquals(val1, 1);
|
||||
assertEquals(val2, (isServerWithStable ? 1 : 2));
|
||||
assertEquals(val2, (isStableEnabled ? 1 : 2));
|
||||
|
||||
c.v = new byte[1][1][1][1]; c.v[0][0][0][0] = 3; byte val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 3));
|
||||
|
||||
c.v[0] = new byte[1][1][1]; c.v[0][0][0][0] = 4; byte val4 = get();
|
||||
assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 4));
|
||||
|
||||
c.v[0][0] = new byte[1][1]; c.v[0][0][0][0] = 5; byte val5 = get();
|
||||
assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 5));
|
||||
|
||||
c.v[0][0][0] = new byte[1]; c.v[0][0][0][0] = 6; byte val6 = get();
|
||||
assertEquals(val6, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val6, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 6));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new byte[1][1][1][1]; byte[] val1 = get1();
|
||||
c.v[0][0][0] = new byte[1]; byte[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new byte[1][1][1][1]; byte[][] val1 = get2();
|
||||
c.v[0][0] = new byte[1][1]; byte[][] val2 = get2();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new byte[1][1][1][1]; byte[][][] val1 = get3();
|
||||
c.v[0] = new byte[1][1][1]; byte[][][] val2 = get3();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -436,7 +435,7 @@ public class TestStableByte {
|
||||
c.v = new byte[1][1]; c.v[0] = new byte[0]; byte[] val1 = get1();
|
||||
c.v[0] = new byte[0]; byte[] val2 = get1();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -472,14 +471,14 @@ public class TestStableByte {
|
||||
c.v = new byte[1][1][1]; c.v[0][0] = new byte[0]; byte[] val1 = get1();
|
||||
c.v[0][0] = new byte[0]; byte[] val2 = get1();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new byte[1][1][1]; c.v[0] = new byte[0][0]; byte[][] val1 = get2();
|
||||
c.v[0] = new byte[0][0]; byte[][] val2 = get2();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -614,7 +613,7 @@ public class TestStableByte {
|
||||
elem.a = 2; byte val3 = get(); byte val4 = get1();
|
||||
|
||||
assertEquals(val1, 1);
|
||||
assertEquals(val3, (isServerWithStable ? 1 : 2));
|
||||
assertEquals(val3, (isStableEnabled ? 1 : 2));
|
||||
|
||||
assertEquals(val2, 1);
|
||||
assertEquals(val4, 2);
|
||||
|
@ -88,7 +88,6 @@ import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
public class TestStableChar {
|
||||
static final boolean isStableEnabled = StableConfiguration.isStableEnabled;
|
||||
static final boolean isServerWithStable = StableConfiguration.isServerWithStable;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
run(DefaultValue.class);
|
||||
@ -209,10 +208,10 @@ public class TestStableChar {
|
||||
c.v = new char[1]; c.v[0] = 'a'; char val1 = get();
|
||||
c.v[0] = 'b'; char val2 = get();
|
||||
assertEquals(val1, 'a');
|
||||
assertEquals(val2, (isServerWithStable ? 'a' : 'b'));
|
||||
assertEquals(val2, (isStableEnabled ? 'a' : 'b'));
|
||||
|
||||
c.v = new char[1]; c.v[0] = 'c'; char val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 'a' : 'b')
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 'a' : 'b')
|
||||
: 'c'));
|
||||
}
|
||||
|
||||
@ -220,10 +219,10 @@ public class TestStableChar {
|
||||
c.v = new char[20]; c.v[10] = 'a'; char val1 = get1();
|
||||
c.v[10] = 'b'; char val2 = get1();
|
||||
assertEquals(val1, 'a');
|
||||
assertEquals(val2, (isServerWithStable ? 'a' : 'b'));
|
||||
assertEquals(val2, (isStableEnabled ? 'a' : 'b'));
|
||||
|
||||
c.v = new char[20]; c.v[10] = 'c'; char val3 = get1();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 'a' : 'b')
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 'a' : 'b')
|
||||
: 'c'));
|
||||
}
|
||||
|
||||
@ -249,21 +248,21 @@ public class TestStableChar {
|
||||
c.v = new char[1][1]; c.v[0][0] = 'a'; char val1 = get();
|
||||
c.v[0][0] = 'b'; char val2 = get();
|
||||
assertEquals(val1, 'a');
|
||||
assertEquals(val2, (isServerWithStable ? 'a' : 'b'));
|
||||
assertEquals(val2, (isStableEnabled ? 'a' : 'b'));
|
||||
|
||||
c.v = new char[1][1]; c.v[0][0] = 'c'; char val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 'a' : 'b')
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 'a' : 'b')
|
||||
: 'c'));
|
||||
|
||||
c.v[0] = new char[1]; c.v[0][0] = 'd'; char val4 = get();
|
||||
assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 'a' : 'b')
|
||||
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 'a' : 'b')
|
||||
: 'd'));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new char[1][1]; char[] val1 = get1();
|
||||
c.v[0] = new char[1]; char[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -289,31 +288,31 @@ public class TestStableChar {
|
||||
c.v = new char[1][1][1]; c.v[0][0][0] = 'a'; char val1 = get();
|
||||
c.v[0][0][0] = 'b'; char val2 = get();
|
||||
assertEquals(val1, 'a');
|
||||
assertEquals(val2, (isServerWithStable ? 'a' : 'b'));
|
||||
assertEquals(val2, (isStableEnabled ? 'a' : 'b'));
|
||||
|
||||
c.v = new char[1][1][1]; c.v[0][0][0] = 'c'; char val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 'a' : 'b')
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 'a' : 'b')
|
||||
: 'c'));
|
||||
|
||||
c.v[0] = new char[1][1]; c.v[0][0][0] = 'd'; char val4 = get();
|
||||
assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 'a' : 'b')
|
||||
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 'a' : 'b')
|
||||
: 'd'));
|
||||
|
||||
c.v[0][0] = new char[1]; c.v[0][0][0] = 'e'; char val5 = get();
|
||||
assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 'a' : 'b')
|
||||
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 'a' : 'b')
|
||||
: 'e'));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new char[1][1][1]; char[] val1 = get1();
|
||||
c.v[0][0] = new char[1]; char[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new char[1][1][1]; char[][] val1 = get2();
|
||||
c.v[0] = new char[1][1]; char[][] val2 = get2();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -340,41 +339,41 @@ public class TestStableChar {
|
||||
c.v = new char[1][1][1][1]; c.v[0][0][0][0] = 'a'; char val1 = get();
|
||||
c.v[0][0][0][0] = 'b'; char val2 = get();
|
||||
assertEquals(val1, 'a');
|
||||
assertEquals(val2, (isServerWithStable ? 'a' : 'b'));
|
||||
assertEquals(val2, (isStableEnabled ? 'a' : 'b'));
|
||||
|
||||
c.v = new char[1][1][1][1]; c.v[0][0][0][0] = 'c'; char val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 'a' : 'b')
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 'a' : 'b')
|
||||
: 'c'));
|
||||
|
||||
c.v[0] = new char[1][1][1]; c.v[0][0][0][0] = 'd'; char val4 = get();
|
||||
assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 'a' : 'b')
|
||||
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 'a' : 'b')
|
||||
: 'd'));
|
||||
|
||||
c.v[0][0] = new char[1][1]; c.v[0][0][0][0] = 'e'; char val5 = get();
|
||||
assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 'a' : 'b')
|
||||
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 'a' : 'b')
|
||||
: 'e'));
|
||||
|
||||
c.v[0][0][0] = new char[1]; c.v[0][0][0][0] = 'f'; char val6 = get();
|
||||
assertEquals(val6, (isStableEnabled ? (isServerWithStable ? 'a' : 'b')
|
||||
assertEquals(val6, (isStableEnabled ? (isStableEnabled ? 'a' : 'b')
|
||||
: 'f'));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new char[1][1][1][1]; char[] val1 = get1();
|
||||
c.v[0][0][0] = new char[1]; char[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new char[1][1][1][1]; char[][] val1 = get2();
|
||||
c.v[0][0] = new char[1][1]; char[][] val2 = get2();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new char[1][1][1][1]; char[][][] val1 = get3();
|
||||
c.v[0] = new char[1][1][1]; char[][][] val2 = get3();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -434,7 +433,7 @@ public class TestStableChar {
|
||||
c.v = new char[1][1]; c.v[0] = new char[0]; char[] val1 = get1();
|
||||
c.v[0] = new char[0]; char[] val2 = get1();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -470,14 +469,14 @@ public class TestStableChar {
|
||||
c.v = new char[1][1][1]; c.v[0][0] = new char[0]; char[] val1 = get1();
|
||||
c.v[0][0] = new char[0]; char[] val2 = get1();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new char[1][1][1]; c.v[0] = new char[0][0]; char[][] val1 = get2();
|
||||
c.v[0] = new char[0][0]; char[][] val2 = get2();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -612,7 +611,7 @@ public class TestStableChar {
|
||||
elem.a = 'b'; char val3 = get(); char val4 = get1();
|
||||
|
||||
assertEquals(val1, 'a');
|
||||
assertEquals(val3, (isServerWithStable ? 'a' : 'b'));
|
||||
assertEquals(val3, (isStableEnabled ? 'a' : 'b'));
|
||||
|
||||
assertEquals(val2, 'a');
|
||||
assertEquals(val4, 'b');
|
||||
|
@ -88,7 +88,6 @@ import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
public class TestStableDouble {
|
||||
static final boolean isStableEnabled = StableConfiguration.isStableEnabled;
|
||||
static final boolean isServerWithStable = StableConfiguration.isServerWithStable;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
run(DefaultValue.class);
|
||||
@ -209,10 +208,10 @@ public class TestStableDouble {
|
||||
c.v = new double[1]; c.v[0] = 1.0; double val1 = get();
|
||||
c.v[0] = 2.0; double val2 = get();
|
||||
assertEquals(val1, 1.0);
|
||||
assertEquals(val2, (isServerWithStable ? 1.0 : 2.0));
|
||||
assertEquals(val2, (isStableEnabled ? 1.0 : 2.0));
|
||||
|
||||
c.v = new double[1]; c.v[0] = 3.0; double val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1.0 : 2.0)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
|
||||
: 3.0));
|
||||
}
|
||||
|
||||
@ -220,10 +219,10 @@ public class TestStableDouble {
|
||||
c.v = new double[20]; c.v[10] = 1.0; double val1 = get1();
|
||||
c.v[10] = 2.0; double val2 = get1();
|
||||
assertEquals(val1, 1.0);
|
||||
assertEquals(val2, (isServerWithStable ? 1.0 : 2.0));
|
||||
assertEquals(val2, (isStableEnabled ? 1.0 : 2.0));
|
||||
|
||||
c.v = new double[20]; c.v[10] = 3.0; double val3 = get1();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1.0 : 2.0)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
|
||||
: 3.0));
|
||||
}
|
||||
|
||||
@ -249,21 +248,21 @@ public class TestStableDouble {
|
||||
c.v = new double[1][1]; c.v[0][0] = 1.0; double val1 = get();
|
||||
c.v[0][0] = 2.0; double val2 = get();
|
||||
assertEquals(val1, 1.0);
|
||||
assertEquals(val2, (isServerWithStable ? 1.0 : 2.0));
|
||||
assertEquals(val2, (isStableEnabled ? 1.0 : 2.0));
|
||||
|
||||
c.v = new double[1][1]; c.v[0][0] = 3.0; double val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1.0 : 2.0)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
|
||||
: 3.0));
|
||||
|
||||
c.v[0] = new double[1]; c.v[0][0] = 4.0; double val4 = get();
|
||||
assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1.0 : 2.0)
|
||||
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
|
||||
: 4.0));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new double[1][1]; double[] val1 = get1();
|
||||
c.v[0] = new double[1]; double[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -289,31 +288,31 @@ public class TestStableDouble {
|
||||
c.v = new double[1][1][1]; c.v[0][0][0] = 1.0; double val1 = get();
|
||||
c.v[0][0][0] = 2.0; double val2 = get();
|
||||
assertEquals(val1, 1.0);
|
||||
assertEquals(val2, (isServerWithStable ? 1.0 : 2.0));
|
||||
assertEquals(val2, (isStableEnabled ? 1.0 : 2.0));
|
||||
|
||||
c.v = new double[1][1][1]; c.v[0][0][0] = 3.0; double val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1.0 : 2.0)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
|
||||
: 3.0));
|
||||
|
||||
c.v[0] = new double[1][1]; c.v[0][0][0] = 4.0; double val4 = get();
|
||||
assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1.0 : 2.0)
|
||||
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
|
||||
: 4.0));
|
||||
|
||||
c.v[0][0] = new double[1]; c.v[0][0][0] = 5.0; double val5 = get();
|
||||
assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 1.0 : 2.0)
|
||||
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
|
||||
: 5.0));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new double[1][1][1]; double[] val1 = get1();
|
||||
c.v[0][0] = new double[1]; double[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new double[1][1][1]; double[][] val1 = get2();
|
||||
c.v[0] = new double[1][1]; double[][] val2 = get2();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -340,41 +339,41 @@ public class TestStableDouble {
|
||||
c.v = new double[1][1][1][1]; c.v[0][0][0][0] = 1.0; double val1 = get();
|
||||
c.v[0][0][0][0] = 2.0; double val2 = get();
|
||||
assertEquals(val1, 1.0);
|
||||
assertEquals(val2, (isServerWithStable ? 1.0 : 2.0));
|
||||
assertEquals(val2, (isStableEnabled ? 1.0 : 2.0));
|
||||
|
||||
c.v = new double[1][1][1][1]; c.v[0][0][0][0] = 3.0; double val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1.0 : 2.0)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
|
||||
: 3.0));
|
||||
|
||||
c.v[0] = new double[1][1][1]; c.v[0][0][0][0] = 4.0; double val4 = get();
|
||||
assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1.0 : 2.0)
|
||||
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
|
||||
: 4.0));
|
||||
|
||||
c.v[0][0] = new double[1][1]; c.v[0][0][0][0] = 5.0; double val5 = get();
|
||||
assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 1.0 : 2.0)
|
||||
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
|
||||
: 5.0));
|
||||
|
||||
c.v[0][0][0] = new double[1]; c.v[0][0][0][0] = 6.0; double val6 = get();
|
||||
assertEquals(val6, (isStableEnabled ? (isServerWithStable ? 1.0 : 2.0)
|
||||
assertEquals(val6, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
|
||||
: 6.0));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new double[1][1][1][1]; double[] val1 = get1();
|
||||
c.v[0][0][0] = new double[1]; double[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new double[1][1][1][1]; double[][] val1 = get2();
|
||||
c.v[0][0] = new double[1][1]; double[][] val2 = get2();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new double[1][1][1][1]; double[][][] val1 = get3();
|
||||
c.v[0] = new double[1][1][1]; double[][][] val2 = get3();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -434,7 +433,7 @@ public class TestStableDouble {
|
||||
c.v = new double[1][1]; c.v[0] = new double[0]; double[] val1 = get1();
|
||||
c.v[0] = new double[0]; double[] val2 = get1();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -470,14 +469,14 @@ public class TestStableDouble {
|
||||
c.v = new double[1][1][1]; c.v[0][0] = new double[0]; double[] val1 = get1();
|
||||
c.v[0][0] = new double[0]; double[] val2 = get1();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new double[1][1][1]; c.v[0] = new double[0][0]; double[][] val1 = get2();
|
||||
c.v[0] = new double[0][0]; double[][] val2 = get2();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -612,7 +611,7 @@ public class TestStableDouble {
|
||||
elem.a = 2.0; double val3 = get(); double val4 = get1();
|
||||
|
||||
assertEquals(val1, 1.0);
|
||||
assertEquals(val3, (isServerWithStable ? 1.0 : 2.0));
|
||||
assertEquals(val3, (isStableEnabled ? 1.0 : 2.0));
|
||||
|
||||
assertEquals(val2, 1.0);
|
||||
assertEquals(val4, 2.0);
|
||||
|
@ -88,7 +88,6 @@ import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
public class TestStableFloat {
|
||||
static final boolean isStableEnabled = StableConfiguration.isStableEnabled;
|
||||
static final boolean isServerWithStable = StableConfiguration.isServerWithStable;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
run(DefaultValue.class);
|
||||
@ -209,10 +208,10 @@ public class TestStableFloat {
|
||||
c.v = new float[1]; c.v[0] = 1.0F; float val1 = get();
|
||||
c.v[0] = 2.0F; float val2 = get();
|
||||
assertEquals(val1, 1.0F);
|
||||
assertEquals(val2, (isServerWithStable ? 1.0F : 2.0F));
|
||||
assertEquals(val2, (isStableEnabled ? 1.0F : 2.0F));
|
||||
|
||||
c.v = new float[1]; c.v[0] = 3.0F; float val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1.0F : 2.0F)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1.0F : 2.0F)
|
||||
: 3.0F));
|
||||
}
|
||||
|
||||
@ -220,10 +219,10 @@ public class TestStableFloat {
|
||||
c.v = new float[20]; c.v[10] = 1.0F; float val1 = get1();
|
||||
c.v[10] = 2.0F; float val2 = get1();
|
||||
assertEquals(val1, 1.0F);
|
||||
assertEquals(val2, (isServerWithStable ? 1.0F : 2.0F));
|
||||
assertEquals(val2, (isStableEnabled ? 1.0F : 2.0F));
|
||||
|
||||
c.v = new float[20]; c.v[10] = 3.0F; float val3 = get1();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1.0F : 2.0F)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1.0F : 2.0F)
|
||||
: 3.0F));
|
||||
}
|
||||
|
||||
@ -249,21 +248,21 @@ public class TestStableFloat {
|
||||
c.v = new float[1][1]; c.v[0][0] = 1.0F; float val1 = get();
|
||||
c.v[0][0] = 2.0F; float val2 = get();
|
||||
assertEquals(val1, 1.0F);
|
||||
assertEquals(val2, (isServerWithStable ? 1.0F : 2.0F));
|
||||
assertEquals(val2, (isStableEnabled ? 1.0F : 2.0F));
|
||||
|
||||
c.v = new float[1][1]; c.v[0][0] = 3.0F; float val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1.0F : 2.0F)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1.0F : 2.0F)
|
||||
: 3.0F));
|
||||
|
||||
c.v[0] = new float[1]; c.v[0][0] = 4.0F; float val4 = get();
|
||||
assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1.0F : 2.0F)
|
||||
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1.0F : 2.0F)
|
||||
: 4.0F));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new float[1][1]; float[] val1 = get1();
|
||||
c.v[0] = new float[1]; float[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -289,31 +288,31 @@ public class TestStableFloat {
|
||||
c.v = new float[1][1][1]; c.v[0][0][0] = 1.0F; float val1 = get();
|
||||
c.v[0][0][0] = 2.0F; float val2 = get();
|
||||
assertEquals(val1, 1.0F);
|
||||
assertEquals(val2, (isServerWithStable ? 1.0F : 2.0F));
|
||||
assertEquals(val2, (isStableEnabled ? 1.0F : 2.0F));
|
||||
|
||||
c.v = new float[1][1][1]; c.v[0][0][0] = 3.0F; float val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1.0F : 2.0F)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1.0F : 2.0F)
|
||||
: 3.0F));
|
||||
|
||||
c.v[0] = new float[1][1]; c.v[0][0][0] = 4.0F; float val4 = get();
|
||||
assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1.0F : 2.0F)
|
||||
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1.0F : 2.0F)
|
||||
: 4.0F));
|
||||
|
||||
c.v[0][0] = new float[1]; c.v[0][0][0] = 5.0F; float val5 = get();
|
||||
assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 1.0F : 2.0F)
|
||||
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 1.0F : 2.0F)
|
||||
: 5.0F));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new float[1][1][1]; float[] val1 = get1();
|
||||
c.v[0][0] = new float[1]; float[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new float[1][1][1]; float[][] val1 = get2();
|
||||
c.v[0] = new float[1][1]; float[][] val2 = get2();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -340,41 +339,41 @@ public class TestStableFloat {
|
||||
c.v = new float[1][1][1][1]; c.v[0][0][0][0] = 1.0F; float val1 = get();
|
||||
c.v[0][0][0][0] = 2.0F; float val2 = get();
|
||||
assertEquals(val1, 1.0F);
|
||||
assertEquals(val2, (isServerWithStable ? 1.0F : 2.0F));
|
||||
assertEquals(val2, (isStableEnabled ? 1.0F : 2.0F));
|
||||
|
||||
c.v = new float[1][1][1][1]; c.v[0][0][0][0] = 3.0F; float val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1.0F : 2.0F)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1.0F : 2.0F)
|
||||
: 3.0F));
|
||||
|
||||
c.v[0] = new float[1][1][1]; c.v[0][0][0][0] = 4.0F; float val4 = get();
|
||||
assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1.0F : 2.0F)
|
||||
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1.0F : 2.0F)
|
||||
: 4.0F));
|
||||
|
||||
c.v[0][0] = new float[1][1]; c.v[0][0][0][0] = 5.0F; float val5 = get();
|
||||
assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 1.0F : 2.0F)
|
||||
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 1.0F : 2.0F)
|
||||
: 5.0F));
|
||||
|
||||
c.v[0][0][0] = new float[1]; c.v[0][0][0][0] = 6.0F; float val6 = get();
|
||||
assertEquals(val6, (isStableEnabled ? (isServerWithStable ? 1.0F : 2.0F)
|
||||
assertEquals(val6, (isStableEnabled ? (isStableEnabled ? 1.0F : 2.0F)
|
||||
: 6.0F));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new float[1][1][1][1]; float[] val1 = get1();
|
||||
c.v[0][0][0] = new float[1]; float[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new float[1][1][1][1]; float[][] val1 = get2();
|
||||
c.v[0][0] = new float[1][1]; float[][] val2 = get2();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new float[1][1][1][1]; float[][][] val1 = get3();
|
||||
c.v[0] = new float[1][1][1]; float[][][] val2 = get3();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -434,7 +433,7 @@ public class TestStableFloat {
|
||||
c.v = new float[1][1]; c.v[0] = new float[0]; float[] val1 = get1();
|
||||
c.v[0] = new float[0]; float[] val2 = get1();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -470,14 +469,14 @@ public class TestStableFloat {
|
||||
c.v = new float[1][1][1]; c.v[0][0] = new float[0]; float[] val1 = get1();
|
||||
c.v[0][0] = new float[0]; float[] val2 = get1();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new float[1][1][1]; c.v[0] = new float[0][0]; float[][] val1 = get2();
|
||||
c.v[0] = new float[0][0]; float[][] val2 = get2();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -612,7 +611,7 @@ public class TestStableFloat {
|
||||
elem.a = 2.0F; float val3 = get(); float val4 = get1();
|
||||
|
||||
assertEquals(val1, 1.0F);
|
||||
assertEquals(val3, (isServerWithStable ? 1.0F : 2.0F));
|
||||
assertEquals(val3, (isStableEnabled ? 1.0F : 2.0F));
|
||||
|
||||
assertEquals(val2, 1.0F);
|
||||
assertEquals(val4, 2.0F);
|
||||
|
@ -88,7 +88,6 @@ import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
public class TestStableInt {
|
||||
static final boolean isStableEnabled = StableConfiguration.isStableEnabled;
|
||||
static final boolean isServerWithStable = StableConfiguration.isServerWithStable;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
run(DefaultValue.class);
|
||||
@ -209,10 +208,10 @@ public class TestStableInt {
|
||||
c.v = new int[1]; c.v[0] = 1; int val1 = get();
|
||||
c.v[0] = 2; int val2 = get();
|
||||
assertEquals(val1, 1);
|
||||
assertEquals(val2, (isServerWithStable ? 1 : 2));
|
||||
assertEquals(val2, (isStableEnabled ? 1 : 2));
|
||||
|
||||
c.v = new int[1]; c.v[0] = 3; int val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 3));
|
||||
}
|
||||
|
||||
@ -220,10 +219,10 @@ public class TestStableInt {
|
||||
c.v = new int[20]; c.v[10] = 1; int val1 = get1();
|
||||
c.v[10] = 2; int val2 = get1();
|
||||
assertEquals(val1, 1);
|
||||
assertEquals(val2, (isServerWithStable ? 1 : 2));
|
||||
assertEquals(val2, (isStableEnabled ? 1 : 2));
|
||||
|
||||
c.v = new int[20]; c.v[10] = 3; int val3 = get1();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 3));
|
||||
}
|
||||
|
||||
@ -249,21 +248,21 @@ public class TestStableInt {
|
||||
c.v = new int[1][1]; c.v[0][0] = 1; int val1 = get();
|
||||
c.v[0][0] = 2; int val2 = get();
|
||||
assertEquals(val1, 1);
|
||||
assertEquals(val2, (isServerWithStable ? 1 : 2));
|
||||
assertEquals(val2, (isStableEnabled ? 1 : 2));
|
||||
|
||||
c.v = new int[1][1]; c.v[0][0] = 3; int val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 3));
|
||||
|
||||
c.v[0] = new int[1]; c.v[0][0] = 4; int val4 = get();
|
||||
assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 4));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new int[1][1]; int[] val1 = get1();
|
||||
c.v[0] = new int[1]; int[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -289,31 +288,31 @@ public class TestStableInt {
|
||||
c.v = new int[1][1][1]; c.v[0][0][0] = 1; int val1 = get();
|
||||
c.v[0][0][0] = 2; int val2 = get();
|
||||
assertEquals(val1, 1);
|
||||
assertEquals(val2, (isServerWithStable ? 1 : 2));
|
||||
assertEquals(val2, (isStableEnabled ? 1 : 2));
|
||||
|
||||
c.v = new int[1][1][1]; c.v[0][0][0] = 3; int val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 3));
|
||||
|
||||
c.v[0] = new int[1][1]; c.v[0][0][0] = 4; int val4 = get();
|
||||
assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 4));
|
||||
|
||||
c.v[0][0] = new int[1]; c.v[0][0][0] = 5; int val5 = get();
|
||||
assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 5));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new int[1][1][1]; int[] val1 = get1();
|
||||
c.v[0][0] = new int[1]; int[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new int[1][1][1]; int[][] val1 = get2();
|
||||
c.v[0] = new int[1][1]; int[][] val2 = get2();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -340,41 +339,41 @@ public class TestStableInt {
|
||||
c.v = new int[1][1][1][1]; c.v[0][0][0][0] = 1; int val1 = get();
|
||||
c.v[0][0][0][0] = 2; int val2 = get();
|
||||
assertEquals(val1, 1);
|
||||
assertEquals(val2, (isServerWithStable ? 1 : 2));
|
||||
assertEquals(val2, (isStableEnabled ? 1 : 2));
|
||||
|
||||
c.v = new int[1][1][1][1]; c.v[0][0][0][0] = 3; int val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 3));
|
||||
|
||||
c.v[0] = new int[1][1][1]; c.v[0][0][0][0] = 4; int val4 = get();
|
||||
assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 4));
|
||||
|
||||
c.v[0][0] = new int[1][1]; c.v[0][0][0][0] = 5; int val5 = get();
|
||||
assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 5));
|
||||
|
||||
c.v[0][0][0] = new int[1]; c.v[0][0][0][0] = 6; int val6 = get();
|
||||
assertEquals(val6, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val6, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 6));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new int[1][1][1][1]; int[] val1 = get1();
|
||||
c.v[0][0][0] = new int[1]; int[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new int[1][1][1][1]; int[][] val1 = get2();
|
||||
c.v[0][0] = new int[1][1]; int[][] val2 = get2();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new int[1][1][1][1]; int[][][] val1 = get3();
|
||||
c.v[0] = new int[1][1][1]; int[][][] val2 = get3();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -434,7 +433,7 @@ public class TestStableInt {
|
||||
c.v = new int[1][1]; c.v[0] = new int[0]; int[] val1 = get1();
|
||||
c.v[0] = new int[0]; int[] val2 = get1();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -470,14 +469,14 @@ public class TestStableInt {
|
||||
c.v = new int[1][1][1]; c.v[0][0] = new int[0]; int[] val1 = get1();
|
||||
c.v[0][0] = new int[0]; int[] val2 = get1();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new int[1][1][1]; c.v[0] = new int[0][0]; int[][] val1 = get2();
|
||||
c.v[0] = new int[0][0]; int[][] val2 = get2();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -612,7 +611,7 @@ public class TestStableInt {
|
||||
elem.a = 2; int val3 = get(); int val4 = get1();
|
||||
|
||||
assertEquals(val1, 1);
|
||||
assertEquals(val3, (isServerWithStable ? 1 : 2));
|
||||
assertEquals(val3, (isStableEnabled ? 1 : 2));
|
||||
|
||||
assertEquals(val2, 1);
|
||||
assertEquals(val4, 2);
|
||||
|
@ -88,7 +88,6 @@ import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
public class TestStableLong {
|
||||
static final boolean isStableEnabled = StableConfiguration.isStableEnabled;
|
||||
static final boolean isServerWithStable = StableConfiguration.isServerWithStable;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
run(DefaultValue.class);
|
||||
@ -209,10 +208,10 @@ public class TestStableLong {
|
||||
c.v = new long[1]; c.v[0] = 1; long val1 = get();
|
||||
c.v[0] = 2; long val2 = get();
|
||||
assertEquals(val1, 1);
|
||||
assertEquals(val2, (isServerWithStable ? 1 : 2));
|
||||
assertEquals(val2, (isStableEnabled ? 1 : 2));
|
||||
|
||||
c.v = new long[1]; c.v[0] = 3; long val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 3));
|
||||
}
|
||||
|
||||
@ -220,10 +219,10 @@ public class TestStableLong {
|
||||
c.v = new long[20]; c.v[10] = 1; long val1 = get1();
|
||||
c.v[10] = 2; long val2 = get1();
|
||||
assertEquals(val1, 1);
|
||||
assertEquals(val2, (isServerWithStable ? 1 : 2));
|
||||
assertEquals(val2, (isStableEnabled ? 1 : 2));
|
||||
|
||||
c.v = new long[20]; c.v[10] = 3; long val3 = get1();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 3));
|
||||
}
|
||||
|
||||
@ -249,21 +248,21 @@ public class TestStableLong {
|
||||
c.v = new long[1][1]; c.v[0][0] = 1; long val1 = get();
|
||||
c.v[0][0] = 2; long val2 = get();
|
||||
assertEquals(val1, 1);
|
||||
assertEquals(val2, (isServerWithStable ? 1 : 2));
|
||||
assertEquals(val2, (isStableEnabled ? 1 : 2));
|
||||
|
||||
c.v = new long[1][1]; c.v[0][0] = 3; long val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 3));
|
||||
|
||||
c.v[0] = new long[1]; c.v[0][0] = 4; long val4 = get();
|
||||
assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 4));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new long[1][1]; long[] val1 = get1();
|
||||
c.v[0] = new long[1]; long[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -289,31 +288,31 @@ public class TestStableLong {
|
||||
c.v = new long[1][1][1]; c.v[0][0][0] = 1; long val1 = get();
|
||||
c.v[0][0][0] = 2; long val2 = get();
|
||||
assertEquals(val1, 1);
|
||||
assertEquals(val2, (isServerWithStable ? 1 : 2));
|
||||
assertEquals(val2, (isStableEnabled ? 1 : 2));
|
||||
|
||||
c.v = new long[1][1][1]; c.v[0][0][0] = 3; long val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 3));
|
||||
|
||||
c.v[0] = new long[1][1]; c.v[0][0][0] = 4; long val4 = get();
|
||||
assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 4));
|
||||
|
||||
c.v[0][0] = new long[1]; c.v[0][0][0] = 5; long val5 = get();
|
||||
assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 5));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new long[1][1][1]; long[] val1 = get1();
|
||||
c.v[0][0] = new long[1]; long[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new long[1][1][1]; long[][] val1 = get2();
|
||||
c.v[0] = new long[1][1]; long[][] val2 = get2();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -340,41 +339,41 @@ public class TestStableLong {
|
||||
c.v = new long[1][1][1][1]; c.v[0][0][0][0] = 1; long val1 = get();
|
||||
c.v[0][0][0][0] = 2; long val2 = get();
|
||||
assertEquals(val1, 1);
|
||||
assertEquals(val2, (isServerWithStable ? 1 : 2));
|
||||
assertEquals(val2, (isStableEnabled ? 1 : 2));
|
||||
|
||||
c.v = new long[1][1][1][1]; c.v[0][0][0][0] = 3; long val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 3));
|
||||
|
||||
c.v[0] = new long[1][1][1]; c.v[0][0][0][0] = 4; long val4 = get();
|
||||
assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 4));
|
||||
|
||||
c.v[0][0] = new long[1][1]; c.v[0][0][0][0] = 5; long val5 = get();
|
||||
assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 5));
|
||||
|
||||
c.v[0][0][0] = new long[1]; c.v[0][0][0][0] = 6; long val6 = get();
|
||||
assertEquals(val6, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val6, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 6));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new long[1][1][1][1]; long[] val1 = get1();
|
||||
c.v[0][0][0] = new long[1]; long[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new long[1][1][1][1]; long[][] val1 = get2();
|
||||
c.v[0][0] = new long[1][1]; long[][] val2 = get2();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new long[1][1][1][1]; long[][][] val1 = get3();
|
||||
c.v[0] = new long[1][1][1]; long[][][] val2 = get3();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -434,7 +433,7 @@ public class TestStableLong {
|
||||
c.v = new long[1][1]; c.v[0] = new long[0]; long[] val1 = get1();
|
||||
c.v[0] = new long[0]; long[] val2 = get1();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -470,14 +469,14 @@ public class TestStableLong {
|
||||
c.v = new long[1][1][1]; c.v[0][0] = new long[0]; long[] val1 = get1();
|
||||
c.v[0][0] = new long[0]; long[] val2 = get1();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new long[1][1][1]; c.v[0] = new long[0][0]; long[][] val1 = get2();
|
||||
c.v[0] = new long[0][0]; long[][] val2 = get2();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -612,7 +611,7 @@ public class TestStableLong {
|
||||
elem.a = 2; long val3 = get(); long val4 = get1();
|
||||
|
||||
assertEquals(val1, 1);
|
||||
assertEquals(val3, (isServerWithStable ? 1 : 2));
|
||||
assertEquals(val3, (isStableEnabled ? 1 : 2));
|
||||
|
||||
assertEquals(val2, 1);
|
||||
assertEquals(val4, 2);
|
||||
|
@ -89,7 +89,6 @@ import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
public class TestStableObject {
|
||||
static final boolean isStableEnabled = StableConfiguration.isStableEnabled;
|
||||
static final boolean isServerWithStable = StableConfiguration.isServerWithStable;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
run(DefaultValue.class);
|
||||
@ -212,10 +211,10 @@ public class TestStableObject {
|
||||
c.v = new Object[1]; c.v[0] = Values.A; Object val1 = get();
|
||||
c.v[0] = Values.B; Object val2 = get();
|
||||
assertEquals(val1, Values.A);
|
||||
assertEquals(val2, (isServerWithStable ? Values.A : Values.B));
|
||||
assertEquals(val2, (isStableEnabled ? Values.A : Values.B));
|
||||
|
||||
c.v = new Object[1]; c.v[0] = Values.C; Object val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? Values.A : Values.B)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? Values.A : Values.B)
|
||||
: Values.C));
|
||||
}
|
||||
|
||||
@ -223,10 +222,10 @@ public class TestStableObject {
|
||||
c.v = new Object[20]; c.v[10] = Values.A; Object val1 = get1();
|
||||
c.v[10] = Values.B; Object val2 = get1();
|
||||
assertEquals(val1, Values.A);
|
||||
assertEquals(val2, (isServerWithStable ? Values.A : Values.B));
|
||||
assertEquals(val2, (isStableEnabled ? Values.A : Values.B));
|
||||
|
||||
c.v = new Object[20]; c.v[10] = Values.C; Object val3 = get1();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? Values.A : Values.B)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? Values.A : Values.B)
|
||||
: Values.C));
|
||||
}
|
||||
|
||||
@ -252,21 +251,21 @@ public class TestStableObject {
|
||||
c.v = new Object[1][1]; c.v[0][0] = Values.A; Object val1 = get();
|
||||
c.v[0][0] = Values.B; Object val2 = get();
|
||||
assertEquals(val1, Values.A);
|
||||
assertEquals(val2, (isServerWithStable ? Values.A : Values.B));
|
||||
assertEquals(val2, (isStableEnabled ? Values.A : Values.B));
|
||||
|
||||
c.v = new Object[1][1]; c.v[0][0] = Values.C; Object val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? Values.A : Values.B)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? Values.A : Values.B)
|
||||
: Values.C));
|
||||
|
||||
c.v[0] = new Object[1]; c.v[0][0] = Values.D; Object val4 = get();
|
||||
assertEquals(val4, (isStableEnabled ? (isServerWithStable ? Values.A : Values.B)
|
||||
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? Values.A : Values.B)
|
||||
: Values.D));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new Object[1][1]; Object[] val1 = get1();
|
||||
c.v[0] = new Object[1]; Object[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -292,31 +291,31 @@ public class TestStableObject {
|
||||
c.v = new Object[1][1][1]; c.v[0][0][0] = Values.A; Object val1 = get();
|
||||
c.v[0][0][0] = Values.B; Object val2 = get();
|
||||
assertEquals(val1, Values.A);
|
||||
assertEquals(val2, (isServerWithStable ? Values.A : Values.B));
|
||||
assertEquals(val2, (isStableEnabled ? Values.A : Values.B));
|
||||
|
||||
c.v = new Object[1][1][1]; c.v[0][0][0] = Values.C; Object val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? Values.A : Values.B)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? Values.A : Values.B)
|
||||
: Values.C));
|
||||
|
||||
c.v[0] = new Object[1][1]; c.v[0][0][0] = Values.D; Object val4 = get();
|
||||
assertEquals(val4, (isStableEnabled ? (isServerWithStable ? Values.A : Values.B)
|
||||
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? Values.A : Values.B)
|
||||
: Values.D));
|
||||
|
||||
c.v[0][0] = new Object[1]; c.v[0][0][0] = Values.E; Object val5 = get();
|
||||
assertEquals(val5, (isStableEnabled ? (isServerWithStable ? Values.A : Values.B)
|
||||
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? Values.A : Values.B)
|
||||
: Values.E));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new Object[1][1][1]; Object[] val1 = get1();
|
||||
c.v[0][0] = new Object[1]; Object[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new Object[1][1][1]; Object[][] val1 = get2();
|
||||
c.v[0] = new Object[1][1]; Object[][] val2 = get2();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -343,41 +342,41 @@ public class TestStableObject {
|
||||
c.v = new Object[1][1][1][1]; c.v[0][0][0][0] = Values.A; Object val1 = get();
|
||||
c.v[0][0][0][0] = Values.B; Object val2 = get();
|
||||
assertEquals(val1, Values.A);
|
||||
assertEquals(val2, (isServerWithStable ? Values.A : Values.B));
|
||||
assertEquals(val2, (isStableEnabled ? Values.A : Values.B));
|
||||
|
||||
c.v = new Object[1][1][1][1]; c.v[0][0][0][0] = Values.C; Object val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? Values.A : Values.B)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? Values.A : Values.B)
|
||||
: Values.C));
|
||||
|
||||
c.v[0] = new Object[1][1][1]; c.v[0][0][0][0] = Values.D; Object val4 = get();
|
||||
assertEquals(val4, (isStableEnabled ? (isServerWithStable ? Values.A : Values.B)
|
||||
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? Values.A : Values.B)
|
||||
: Values.D));
|
||||
|
||||
c.v[0][0] = new Object[1][1]; c.v[0][0][0][0] = Values.E; Object val5 = get();
|
||||
assertEquals(val5, (isStableEnabled ? (isServerWithStable ? Values.A : Values.B)
|
||||
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? Values.A : Values.B)
|
||||
: Values.E));
|
||||
|
||||
c.v[0][0][0] = new Object[1]; c.v[0][0][0][0] = Values.F; Object val6 = get();
|
||||
assertEquals(val6, (isStableEnabled ? (isServerWithStable ? Values.A : Values.B)
|
||||
assertEquals(val6, (isStableEnabled ? (isStableEnabled ? Values.A : Values.B)
|
||||
: Values.F));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new Object[1][1][1][1]; Object[] val1 = get1();
|
||||
c.v[0][0][0] = new Object[1]; Object[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new Object[1][1][1][1]; Object[][] val1 = get2();
|
||||
c.v[0][0] = new Object[1][1]; Object[][] val2 = get2();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new Object[1][1][1][1]; Object[][][] val1 = get3();
|
||||
c.v[0] = new Object[1][1][1]; Object[][][] val2 = get3();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -437,7 +436,7 @@ public class TestStableObject {
|
||||
c.v = new Object[1][1]; c.v[0] = new Object[0]; Object[] val1 = get1();
|
||||
c.v[0] = new Object[0]; Object[] val2 = get1();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -473,14 +472,14 @@ public class TestStableObject {
|
||||
c.v = new Object[1][1][1]; c.v[0][0] = new Object[0]; Object[] val1 = get1();
|
||||
c.v[0][0] = new Object[0]; Object[] val2 = get1();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new Object[1][1][1]; c.v[0] = new Object[0][0]; Object[][] val1 = get2();
|
||||
c.v[0] = new Object[0][0]; Object[][] val2 = get2();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -615,7 +614,7 @@ public class TestStableObject {
|
||||
elem.a = Values.B; Object val3 = get(); Object val4 = get1();
|
||||
|
||||
assertEquals(val1, Values.A);
|
||||
assertEquals(val3, (isServerWithStable ? Values.A : Values.B));
|
||||
assertEquals(val3, (isStableEnabled ? Values.A : Values.B));
|
||||
|
||||
assertEquals(val2, Values.A);
|
||||
assertEquals(val4, Values.B);
|
||||
|
@ -88,7 +88,6 @@ import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
public class TestStableShort {
|
||||
static final boolean isStableEnabled = StableConfiguration.isStableEnabled;
|
||||
static final boolean isServerWithStable = StableConfiguration.isServerWithStable;
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
run(DefaultValue.class);
|
||||
@ -209,10 +208,10 @@ public class TestStableShort {
|
||||
c.v = new short[1]; c.v[0] = 1; short val1 = get();
|
||||
c.v[0] = 2; short val2 = get();
|
||||
assertEquals(val1, 1);
|
||||
assertEquals(val2, (isServerWithStable ? 1 : 2));
|
||||
assertEquals(val2, (isStableEnabled ? 1 : 2));
|
||||
|
||||
c.v = new short[1]; c.v[0] = 3; short val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 3));
|
||||
}
|
||||
|
||||
@ -220,10 +219,10 @@ public class TestStableShort {
|
||||
c.v = new short[20]; c.v[10] = 1; short val1 = get1();
|
||||
c.v[10] = 2; short val2 = get1();
|
||||
assertEquals(val1, 1);
|
||||
assertEquals(val2, (isServerWithStable ? 1 : 2));
|
||||
assertEquals(val2, (isStableEnabled ? 1 : 2));
|
||||
|
||||
c.v = new short[20]; c.v[10] = 3; short val3 = get1();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 3));
|
||||
}
|
||||
|
||||
@ -249,21 +248,21 @@ public class TestStableShort {
|
||||
c.v = new short[1][1]; c.v[0][0] = 1; short val1 = get();
|
||||
c.v[0][0] = 2; short val2 = get();
|
||||
assertEquals(val1, 1);
|
||||
assertEquals(val2, (isServerWithStable ? 1 : 2));
|
||||
assertEquals(val2, (isStableEnabled ? 1 : 2));
|
||||
|
||||
c.v = new short[1][1]; c.v[0][0] = 3; short val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 3));
|
||||
|
||||
c.v[0] = new short[1]; c.v[0][0] = 4; short val4 = get();
|
||||
assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 4));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new short[1][1]; short[] val1 = get1();
|
||||
c.v[0] = new short[1]; short[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -289,31 +288,31 @@ public class TestStableShort {
|
||||
c.v = new short[1][1][1]; c.v[0][0][0] = 1; short val1 = get();
|
||||
c.v[0][0][0] = 2; short val2 = get();
|
||||
assertEquals(val1, 1);
|
||||
assertEquals(val2, (isServerWithStable ? 1 : 2));
|
||||
assertEquals(val2, (isStableEnabled ? 1 : 2));
|
||||
|
||||
c.v = new short[1][1][1]; c.v[0][0][0] = 3; short val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 3));
|
||||
|
||||
c.v[0] = new short[1][1]; c.v[0][0][0] = 4; short val4 = get();
|
||||
assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 4));
|
||||
|
||||
c.v[0][0] = new short[1]; c.v[0][0][0] = 5; short val5 = get();
|
||||
assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 5));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new short[1][1][1]; short[] val1 = get1();
|
||||
c.v[0][0] = new short[1]; short[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new short[1][1][1]; short[][] val1 = get2();
|
||||
c.v[0] = new short[1][1]; short[][] val2 = get2();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -340,41 +339,41 @@ public class TestStableShort {
|
||||
c.v = new short[1][1][1][1]; c.v[0][0][0][0] = 1; short val1 = get();
|
||||
c.v[0][0][0][0] = 2; short val2 = get();
|
||||
assertEquals(val1, 1);
|
||||
assertEquals(val2, (isServerWithStable ? 1 : 2));
|
||||
assertEquals(val2, (isStableEnabled ? 1 : 2));
|
||||
|
||||
c.v = new short[1][1][1][1]; c.v[0][0][0][0] = 3; short val3 = get();
|
||||
assertEquals(val3, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 3));
|
||||
|
||||
c.v[0] = new short[1][1][1]; c.v[0][0][0][0] = 4; short val4 = get();
|
||||
assertEquals(val4, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 4));
|
||||
|
||||
c.v[0][0] = new short[1][1]; c.v[0][0][0][0] = 5; short val5 = get();
|
||||
assertEquals(val5, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 5));
|
||||
|
||||
c.v[0][0][0] = new short[1]; c.v[0][0][0][0] = 6; short val6 = get();
|
||||
assertEquals(val6, (isStableEnabled ? (isServerWithStable ? 1 : 2)
|
||||
assertEquals(val6, (isStableEnabled ? (isStableEnabled ? 1 : 2)
|
||||
: 6));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new short[1][1][1][1]; short[] val1 = get1();
|
||||
c.v[0][0][0] = new short[1]; short[] val2 = get1();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new short[1][1][1][1]; short[][] val1 = get2();
|
||||
c.v[0][0] = new short[1][1]; short[][] val2 = get2();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new short[1][1][1][1]; short[][][] val1 = get3();
|
||||
c.v[0] = new short[1][1][1]; short[][][] val2 = get3();
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -434,7 +433,7 @@ public class TestStableShort {
|
||||
c.v = new short[1][1]; c.v[0] = new short[0]; short[] val1 = get1();
|
||||
c.v[0] = new short[0]; short[] val2 = get1();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -470,14 +469,14 @@ public class TestStableShort {
|
||||
c.v = new short[1][1][1]; c.v[0][0] = new short[0]; short[] val1 = get1();
|
||||
c.v[0][0] = new short[0]; short[] val2 = get1();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
c.v = new short[1][1][1]; c.v[0] = new short[0][0]; short[][] val1 = get2();
|
||||
c.v[0] = new short[0][0]; short[][] val2 = get2();
|
||||
|
||||
assertTrue((isServerWithStable ? (val1 == val2) : (val1 != val2)));
|
||||
assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
|
||||
}
|
||||
|
||||
{
|
||||
@ -612,7 +611,7 @@ public class TestStableShort {
|
||||
elem.a = 2; short val3 = get(); short val4 = get1();
|
||||
|
||||
assertEquals(val1, 1);
|
||||
assertEquals(val3, (isServerWithStable ? 1 : 2));
|
||||
assertEquals(val3, (isStableEnabled ? 1 : 2));
|
||||
|
||||
assertEquals(val2, 1);
|
||||
assertEquals(val4, 2);
|
||||
|
112
hotspot/test/compiler/types/TestPhiElimination.java
Normal file
112
hotspot/test/compiler/types/TestPhiElimination.java
Normal file
@ -0,0 +1,112 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* 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 8150804
|
||||
* @summary Tests elimination of Phi nodes without losing type information.
|
||||
* @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestPhiElimination
|
||||
*/
|
||||
public class TestPhiElimination {
|
||||
/*
|
||||
A::get() is inlined into test(obj) producing the following graph:
|
||||
|
||||
Parm (obj)
|
||||
TestPhiElimination
|
||||
|
|
||||
CastPP
|
||||
TestPhiElimination:NotNull
|
||||
|
|
||||
CheckCastPP
|
||||
A:NotNull
|
||||
/ \
|
||||
CheckCastPP |
|
||||
A:NotNull |
|
||||
\ /
|
||||
Phi
|
||||
A
|
||||
|
|
||||
Safepoint
|
||||
|
||||
PhiNode::ideal() then replaces the Phi by a CheckCastPP:
|
||||
|
||||
Parm (obj)
|
||||
TestPhiElimination
|
||||
|
|
||||
CheckCastPP
|
||||
A
|
||||
|
|
||||
Safepoint
|
||||
|
||||
losing the :NotNull information. Therefore, we cannot prove that obj != null
|
||||
when accessing a field and add an uncommon trap. Since obj is used as monitor, we
|
||||
set it to TOP in the uncommon trap branch and later fail in Process_OopMap_Node
|
||||
because the monitor object is TOP.
|
||||
*/
|
||||
public Object test(TestPhiElimination obj) {
|
||||
if (obj instanceof A) {
|
||||
return ((A) obj).get();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static public void main(String[] args) {
|
||||
TestPhiElimination t = new TestPhiElimination();
|
||||
|
||||
// Warmup
|
||||
B b = new B();
|
||||
for (int i = 0; i < 1_000; ++i) {
|
||||
t.test(b);
|
||||
}
|
||||
|
||||
// Compile
|
||||
A a = new A();
|
||||
for (int i = 0; i < 20_000; ++i) {
|
||||
if (i % 2 == 0) {
|
||||
a.f = null;
|
||||
}
|
||||
t.test(a);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class A extends TestPhiElimination {
|
||||
public Object f;
|
||||
|
||||
public A create() {
|
||||
return new A();
|
||||
}
|
||||
|
||||
public synchronized Object get() {
|
||||
if (f == null) {
|
||||
f = create();
|
||||
}
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
||||
class B extends A {
|
||||
|
||||
}
|
156
hotspot/test/compiler/whitebox/BlockingCompilation.java
Normal file
156
hotspot/test/compiler/whitebox/BlockingCompilation.java
Normal file
@ -0,0 +1,156 @@
|
||||
/*
|
||||
* Copyright (c) 2016 SAP SE. 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 8150646
|
||||
* @summary Add support for blocking compiles through whitebox API
|
||||
* @library /testlibrary /test/lib /
|
||||
* @build sun.hotspot.WhiteBox
|
||||
* compiler.testlibrary.CompilerUtils
|
||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||
*
|
||||
* @run main/othervm/timeout=60
|
||||
* -Xbootclasspath/a:.
|
||||
* -Xmixed
|
||||
* -XX:+UnlockDiagnosticVMOptions
|
||||
* -XX:+WhiteBoxAPI
|
||||
* -XX:+PrintCompilation
|
||||
* BlockingCompilation
|
||||
*/
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Random;
|
||||
|
||||
import sun.hotspot.WhiteBox;
|
||||
import compiler.testlibrary.CompilerUtils;
|
||||
|
||||
public class BlockingCompilation {
|
||||
private static final WhiteBox WB = WhiteBox.getWhiteBox();
|
||||
private static final Random RANDOM = new Random();
|
||||
|
||||
public static int foo() {
|
||||
return RANDOM.nextInt();
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
Method m = BlockingCompilation.class.getMethod("foo");
|
||||
int[] levels = CompilerUtils.getAvailableCompilationLevels();
|
||||
int highest_level = levels[levels.length-1];
|
||||
|
||||
// If there are no compilers available these tests don't make any sense.
|
||||
if (levels.length == 0) return;
|
||||
|
||||
// Make sure no compilations can progress, blocking compiles will hang
|
||||
WB.lockCompilation();
|
||||
|
||||
// Verify method state before test
|
||||
if (WB.isMethodCompiled(m)) {
|
||||
throw new Exception("Should not be compiled after deoptimization");
|
||||
}
|
||||
if (WB.isMethodQueuedForCompilation(m)) {
|
||||
throw new Exception("Should not be enqueued on any level");
|
||||
}
|
||||
|
||||
// Try compiling on highest available comp level.
|
||||
// If the compiles are blocking, this call will block until the test time out,
|
||||
// Progress == success
|
||||
// (Don't run with -Xcomp since that can cause long timeouts due to many compiles)
|
||||
WB.enqueueMethodForCompilation(m, highest_level);
|
||||
|
||||
// restore state
|
||||
WB.unlockCompilation();
|
||||
while (!WB.isMethodCompiled(m)) {
|
||||
Thread.sleep(100);
|
||||
}
|
||||
WB.deoptimizeMethod(m);
|
||||
WB.clearMethodState(m);
|
||||
|
||||
// Blocking compilations on all levels, using the default versions of
|
||||
// WB.enqueueMethodForCompilation() and manually setting compiler directives.
|
||||
String directive = "[{ match: \"BlockingCompilation.foo\", BackgroundCompilation: false }]";
|
||||
if (WB.addCompilerDirective(directive) != 1) {
|
||||
throw new Exception("Failed to add compiler directive");
|
||||
}
|
||||
|
||||
try {
|
||||
for (int l : levels) {
|
||||
// Make uncompiled
|
||||
WB.deoptimizeMethod(m);
|
||||
|
||||
// Verify that it's not compiled
|
||||
if (WB.isMethodCompiled(m)) {
|
||||
throw new Exception("Should not be compiled after deoptimization");
|
||||
}
|
||||
if (WB.isMethodQueuedForCompilation(m)) {
|
||||
throw new Exception("Should not be enqueued on any level");
|
||||
}
|
||||
|
||||
// Add to queue and verify that it went well
|
||||
if (!WB.enqueueMethodForCompilation(m, l)) {
|
||||
throw new Exception("Could not be enqueued for compilation");
|
||||
}
|
||||
|
||||
// Verify that it is compiled
|
||||
if (!WB.isMethodCompiled(m)) {
|
||||
throw new Exception("Must be compiled here");
|
||||
}
|
||||
// And verify the level
|
||||
if (WB.getMethodCompilationLevel(m) != l) {
|
||||
String msg = m + " should be compiled at level " + l +
|
||||
"(but is actually compiled at level " +
|
||||
WB.getMethodCompilationLevel(m) + ")";
|
||||
System.out.println("==> " + msg);
|
||||
throw new Exception(msg);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
WB.removeCompilerDirective(1);
|
||||
}
|
||||
|
||||
// Clean up
|
||||
WB.deoptimizeMethod(m);
|
||||
WB.clearMethodState(m);
|
||||
|
||||
// Make sure no compilations can progress, blocking compiles will hang
|
||||
WB.lockCompilation();
|
||||
|
||||
// Verify method state before test
|
||||
if (WB.isMethodCompiled(m)) {
|
||||
throw new Exception("Should not be compiled after deoptimization");
|
||||
}
|
||||
if (WB.isMethodQueuedForCompilation(m)) {
|
||||
throw new Exception("Should not be enqueued on any level");
|
||||
}
|
||||
|
||||
// Try compiling on highest available comp level.
|
||||
// If the compiles are blocking, this call will block until the test time out,
|
||||
// Progress == success
|
||||
// (Don't run with -Xcomp since that can cause long timeouts due to many compiles)
|
||||
WB.enqueueMethodForCompilation(m, highest_level);
|
||||
|
||||
// restore state
|
||||
WB.unlockCompilation();
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@
|
||||
*/
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import compiler.whitebox.CompilerWhiteBoxTest;
|
||||
|
||||
/*
|
||||
@ -32,14 +33,24 @@ import compiler.whitebox.CompilerWhiteBoxTest;
|
||||
* @build ClearMethodStateTest
|
||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* ClearMethodStateTest
|
||||
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ClearMethodStateTest
|
||||
* @summary testing of WB::clearMethodState()
|
||||
* @author igor.ignatyev@oracle.com
|
||||
*/
|
||||
public class ClearMethodStateTest extends CompilerWhiteBoxTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
CompilerWhiteBoxTest.main(ClearMethodStateTest::new, args);
|
||||
String directive =
|
||||
"[{ match:\"*SimpleTestCase$Helper.*\", BackgroundCompilation: false }, " +
|
||||
" { match:\"*.*\", inline:\"-*SimpleTestCase$Helper.*\"}]";
|
||||
if (WHITE_BOX.addCompilerDirective(directive) != 2) {
|
||||
throw new RuntimeException("Could not add directive");
|
||||
}
|
||||
try {
|
||||
CompilerWhiteBoxTest.main(ClearMethodStateTest::new, args);
|
||||
} finally {
|
||||
WHITE_BOX.removeCompilerDirective(2);
|
||||
}
|
||||
}
|
||||
|
||||
private ClearMethodStateTest(TestCase testCase) {
|
||||
@ -58,6 +69,7 @@ public class ClearMethodStateTest extends CompilerWhiteBoxTest {
|
||||
*/
|
||||
@Override
|
||||
protected void test() throws Exception {
|
||||
|
||||
checkNotCompiled();
|
||||
compile();
|
||||
WHITE_BOX.clearMethodState(method);
|
||||
|
@ -213,6 +213,7 @@ public abstract class CompilerWhiteBoxTest {
|
||||
* compilation level.
|
||||
*/
|
||||
protected final void checkNotCompiled() {
|
||||
waitBackgroundCompilation();
|
||||
checkNotCompiled(true);
|
||||
checkNotCompiled(false);
|
||||
}
|
||||
@ -226,7 +227,6 @@ public abstract class CompilerWhiteBoxTest {
|
||||
* compilation level.
|
||||
*/
|
||||
protected final void checkNotCompiled(boolean isOsr) {
|
||||
waitBackgroundCompilation();
|
||||
if (WHITE_BOX.isMethodQueuedForCompilation(method)) {
|
||||
throw new RuntimeException(method + " must not be in queue");
|
||||
}
|
||||
@ -315,11 +315,11 @@ public abstract class CompilerWhiteBoxTest {
|
||||
return;
|
||||
}
|
||||
final Object obj = new Object();
|
||||
for (int i = 0; i < 10
|
||||
for (int i = 0; i < 100
|
||||
&& WHITE_BOX.isMethodQueuedForCompilation(executable); ++i) {
|
||||
synchronized (obj) {
|
||||
try {
|
||||
obj.wait(1000);
|
||||
obj.wait(100);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
|
@ -31,14 +31,24 @@ import compiler.whitebox.CompilerWhiteBoxTest;
|
||||
* @build EnqueueMethodForCompilationTest
|
||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||
* @run main/othervm/timeout=600 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* EnqueueMethodForCompilationTest
|
||||
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI EnqueueMethodForCompilationTest
|
||||
* @summary testing of WB::enqueueMethodForCompilation()
|
||||
* @author igor.ignatyev@oracle.com
|
||||
*/
|
||||
public class EnqueueMethodForCompilationTest extends CompilerWhiteBoxTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
CompilerWhiteBoxTest.main(EnqueueMethodForCompilationTest::new, args);
|
||||
String directive =
|
||||
"[{ match:\"*SimpleTestCase$Helper.*\", BackgroundCompilation: false }, " +
|
||||
" { match:\"*.*\", inline:\"-*SimpleTestCase$Helper.*\"}]";
|
||||
if (WHITE_BOX.addCompilerDirective(directive) != 2) {
|
||||
throw new RuntimeException("Could not add directive");
|
||||
}
|
||||
try {
|
||||
CompilerWhiteBoxTest.main(EnqueueMethodForCompilationTest::new, args);
|
||||
} finally {
|
||||
WHITE_BOX.removeCompilerDirective(2);
|
||||
}
|
||||
}
|
||||
|
||||
private EnqueueMethodForCompilationTest(TestCase testCase) {
|
||||
|
@ -29,7 +29,7 @@
|
||||
* @build LockCompilationTest
|
||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||
* @run main/othervm/timeout=600 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* LockCompilationTest
|
||||
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI LockCompilationTest
|
||||
* @summary testing of WB::lock/unlockCompilation()
|
||||
*/
|
||||
|
||||
@ -37,12 +37,15 @@ import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.concurrent.BrokenBarrierException;
|
||||
import java.util.concurrent.CyclicBarrier;
|
||||
|
||||
import compiler.whitebox.CompilerWhiteBoxTest;
|
||||
import jdk.test.lib.Asserts;
|
||||
|
||||
public class LockCompilationTest extends CompilerWhiteBoxTest {
|
||||
public static void main(String[] args) throws Exception {
|
||||
CompilerWhiteBoxTest.main(LockCompilationTest::new, args);
|
||||
// This case waits for 10 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"});
|
||||
}
|
||||
|
||||
private LockCompilationTest(TestCase testCase) {
|
||||
|
@ -31,14 +31,24 @@ import compiler.whitebox.CompilerWhiteBoxTest;
|
||||
* @build MakeMethodNotCompilableTest
|
||||
* @run main ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||
* @run main/othervm/timeout=2400 -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,compiler.whitebox.SimpleTestCase$Helper::* MakeMethodNotCompilableTest
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xmixed MakeMethodNotCompilableTest
|
||||
* @summary testing of WB::makeMethodNotCompilable()
|
||||
* @author igor.ignatyev@oracle.com
|
||||
*/
|
||||
public class MakeMethodNotCompilableTest extends CompilerWhiteBoxTest {
|
||||
private int bci;
|
||||
public static void main(String[] args) throws Exception {
|
||||
CompilerWhiteBoxTest.main(MakeMethodNotCompilableTest::new, args);
|
||||
String directive =
|
||||
"[{ match:\"*SimpleTestCase$Helper.*\", BackgroundCompilation: false }, " +
|
||||
" { match:\"*.*\", inline:\"-*SimpleTestCase$Helper.*\"}]";
|
||||
if (WHITE_BOX.addCompilerDirective(directive) != 2) {
|
||||
throw new RuntimeException("Could not add directive");
|
||||
}
|
||||
try {
|
||||
CompilerWhiteBoxTest.main(MakeMethodNotCompilableTest::new, args);
|
||||
} finally {
|
||||
WHITE_BOX.removeCompilerDirective(2);
|
||||
}
|
||||
}
|
||||
|
||||
private MakeMethodNotCompilableTest(TestCase testCase) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 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
|
||||
@ -31,6 +31,7 @@ import jdk.test.lib.Platform;
|
||||
* @key gc
|
||||
* @bug 8059066
|
||||
* @summary Tests that the card table does not commit the same page twice
|
||||
* @requires vm.gc=="Parallel" | vm.gc=="null"
|
||||
* @library /testlibrary
|
||||
* @modules java.base/sun.misc
|
||||
* java.management
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 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
|
||||
@ -25,6 +25,7 @@
|
||||
* @test TestCMSHeapSizeFlags
|
||||
* @key gc
|
||||
* @bug 8006088
|
||||
* @requires vm.gc=="ConcMarkSweep" | vm.gc=="null"
|
||||
* @summary Tests argument processing for initial and maximum heap size for the CMS collector
|
||||
* @library /testlibrary /test/lib
|
||||
* @modules java.base/sun.misc
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 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
|
||||
@ -25,6 +25,7 @@
|
||||
* @test TestG1ConcRefinementThreads
|
||||
* @key gc
|
||||
* @bug 8047976
|
||||
* @requires vm.gc=="G1" | vm.gc=="null"
|
||||
* @summary Tests argument processing for G1ConcRefinementThreads
|
||||
* @library /testlibrary
|
||||
* @modules java.base/sun.misc
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 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
|
||||
@ -25,6 +25,7 @@
|
||||
* @test TestG1HeapSizeFlags
|
||||
* @key gc
|
||||
* @bug 8006088
|
||||
* @requires vm.gc=="G1" | vm.gc=="null"
|
||||
* @summary Tests argument processing for initial and maximum heap size for the G1 collector
|
||||
* @library /testlibrary /test/lib
|
||||
* @modules java.base/sun.misc
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -25,6 +25,7 @@
|
||||
* @test TestG1PercentageOptions
|
||||
* @key gc
|
||||
* @bug 8068942
|
||||
* @requires vm.gc=="G1" | vm.gc=="null"
|
||||
* @summary Test argument processing of various percentage options
|
||||
* @library /testlibrary
|
||||
* @modules java.base/sun.misc
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 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
|
||||
@ -27,6 +27,7 @@
|
||||
* @bug 8006088
|
||||
* @summary Tests argument processing for initial and maximum heap size for the
|
||||
* parallel collectors.
|
||||
* @requires vm.gc=="null"
|
||||
* @library /testlibrary /test/lib
|
||||
* @modules java.base/sun.misc
|
||||
* java.management
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 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
|
||||
@ -27,6 +27,7 @@
|
||||
* @summary Checks that decommitment occurs for JVM with different
|
||||
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
|
||||
* @requires vm.gc=="G1" | vm.gc=="null"
|
||||
* @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null"
|
||||
* @library /testlibrary /test/lib
|
||||
* @modules java.base/sun.misc
|
||||
* java.management
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 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
|
||||
@ -27,6 +27,7 @@
|
||||
* @summary Checks that decommitment occurs for JVM with different
|
||||
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
|
||||
* @requires vm.gc=="G1" | vm.gc=="null"
|
||||
* @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null"
|
||||
* @library /testlibrary /test/lib
|
||||
* @modules java.base/sun.misc
|
||||
* java.management
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 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
|
||||
@ -27,6 +27,7 @@
|
||||
* @summary Checks that decommitment occurs for JVM with different
|
||||
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
|
||||
* @requires vm.gc=="G1" | vm.gc=="null"
|
||||
* @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null"
|
||||
* @library /testlibrary /test/lib
|
||||
* @modules java.base/sun.misc
|
||||
* java.management
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 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
|
||||
@ -27,6 +27,7 @@
|
||||
* @summary Checks that decommitment occurs for JVM with different
|
||||
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
|
||||
* @requires vm.gc=="G1" | vm.gc=="null"
|
||||
* @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null"
|
||||
* @library /testlibrary /test/lib
|
||||
* @modules java.base/sun.misc
|
||||
* java.management
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 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
|
||||
@ -27,6 +27,7 @@
|
||||
* @summary Checks that decommitment occurs for JVM with different
|
||||
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
|
||||
* @requires vm.gc=="G1" | vm.gc=="null"
|
||||
* @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null"
|
||||
* @library /testlibrary /test/lib
|
||||
* @modules java.base/sun.misc
|
||||
* java.management
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 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
|
||||
@ -27,6 +27,7 @@
|
||||
* @summary Checks that decommitment occurs for JVM with different
|
||||
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
|
||||
* @requires vm.gc=="G1" | vm.gc=="null"
|
||||
* @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null"
|
||||
* @library /testlibrary /test/lib
|
||||
* @modules java.base/sun.misc
|
||||
* java.management
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 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
|
||||
@ -27,6 +27,7 @@
|
||||
* @summary Checks that decommitment occurs for JVM with different
|
||||
* G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
|
||||
* @requires vm.gc=="G1" | vm.gc=="null"
|
||||
* @requires vm.opt.AggressiveOpts=="false" | vm.opt.AggressiveOpts=="null"
|
||||
* @library /testlibrary /test/lib
|
||||
* @modules java.base/sun.misc
|
||||
* java.management
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2014, 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
|
||||
@ -25,6 +25,7 @@
|
||||
* @test TestGCId
|
||||
* @bug 8043607
|
||||
* @summary Ensure that the GCId is logged
|
||||
* @requires vm.gc=="null"
|
||||
* @key gc
|
||||
* @library /testlibrary
|
||||
* @modules java.base/sun.misc
|
||||
|
@ -83,13 +83,6 @@ public class TestOptionsWithRanges {
|
||||
setAllowedExitCodes("SharedMiscDataSize", 2);
|
||||
setAllowedExitCodes("SharedMiscCodeSize", 2);
|
||||
|
||||
/*
|
||||
* JDK-8145204
|
||||
* Temporarily remove testing of max range for ParGCArrayScanChunk because
|
||||
* JVM can hang when ParGCArrayScanChunk=4294967296 and ParallelGC is used
|
||||
*/
|
||||
excludeTestMaxRange("ParGCArrayScanChunk");
|
||||
|
||||
/*
|
||||
* Remove CICompilerCount from testing because currently it can hang system
|
||||
*/
|
||||
|
@ -24,26 +24,39 @@
|
||||
/*
|
||||
* @test CodelistTest
|
||||
* @bug 8054889
|
||||
* @library /testlibrary
|
||||
* @library /testlibrary /test/lib /
|
||||
* @modules java.base/sun.misc
|
||||
* java.compiler
|
||||
* java.management
|
||||
* jdk.jvmstat/sun.jvmstat.monitor
|
||||
* @build jdk.test.lib.*
|
||||
* @build jdk.test.lib.dcmd.*
|
||||
* @build MethodIdentifierParser
|
||||
* @run testng CodelistTest
|
||||
* jdk.test.lib.dcmd.*
|
||||
* sun.hotspot.WhiteBox
|
||||
* compiler.testlibrary.CompilerUtils
|
||||
* @run driver ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* sun.hotspot.WhiteBox$WhiteBoxPermission
|
||||
* @run testng/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCodeCacheFlushing -Xmixed CodelistTest
|
||||
* @run testng/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-UseCodeCacheFlushing -Xint CodelistTest
|
||||
* @summary Test of diagnostic command Compiler.codelist
|
||||
*
|
||||
* Flag comment:
|
||||
* -XX:-UseCodeCacheFlushing - to prevent methods from being removed from the code cache before we have checked the results
|
||||
*
|
||||
* This test should never run in the same VM as other tests - the code cache may get huge which will
|
||||
* create an enormous amount of output to parse. Same for -Xcomp.
|
||||
*/
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
import org.testng.Assert;
|
||||
|
||||
import compiler.testlibrary.CompilerUtils;
|
||||
import compiler.whitebox.CompilerWhiteBoxTest;
|
||||
import jdk.test.lib.OutputAnalyzer;
|
||||
import jdk.test.lib.dcmd.CommandExecutor;
|
||||
import jdk.test.lib.dcmd.JMXExecutor;
|
||||
import org.testng.annotations.Test;
|
||||
import org.testng.Assert;
|
||||
import sun.hotspot.WhiteBox;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class CodelistTest {
|
||||
|
||||
@ -62,58 +75,68 @@ public class CodelistTest {
|
||||
*
|
||||
*/
|
||||
|
||||
protected static final WhiteBox WB = WhiteBox.getWhiteBox();
|
||||
|
||||
public void run(CommandExecutor executor) {
|
||||
int ok = 0;
|
||||
int fail = 0;
|
||||
|
||||
TestCase[] testcases = {
|
||||
new TestCase(CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE, "testcaseMethod1"),
|
||||
new TestCase(CompilerWhiteBoxTest.COMP_LEVEL_LIMITED_PROFILE, "testcaseMethod2"),
|
||||
new TestCase(CompilerWhiteBoxTest.COMP_LEVEL_FULL_PROFILE, "testcaseMethod3"),
|
||||
new TestCase(CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION, "testcaseMethod4"),
|
||||
};
|
||||
|
||||
String directive = "{ match: \"CodelistTest.testcaseMethod*\", " +
|
||||
"BackgroundCompilation: false }";
|
||||
Assert.assertTrue(
|
||||
WB.addCompilerDirective(directive) == 1,
|
||||
"Must succeed");
|
||||
|
||||
try {
|
||||
// Enqueue one test method for each available level
|
||||
int[] complevels = CompilerUtils.getAvailableCompilationLevels();
|
||||
for (int level : complevels) {
|
||||
// Only test comp level 1 and 4 - level 1, 2 and 3 may interfere with each other
|
||||
if (level == 1 || level == 4) {
|
||||
TestCase testcase = testcases[level - 1];
|
||||
WB.enqueueMethodForCompilation(testcase.method, testcase.level);
|
||||
// Set results to false for those methods we must to find
|
||||
// We will also assert if we find any test method we don't expect
|
||||
testcase.check = false;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
WB.removeCompilerDirective(1);
|
||||
}
|
||||
|
||||
// Get output from dcmd (diagnostic command)
|
||||
OutputAnalyzer output = executor.execute("Compiler.codelist");
|
||||
Iterator<String> lines = output.asLines().iterator();
|
||||
|
||||
// Grab a method name from the output
|
||||
int count = 0;
|
||||
// Loop over output set result for all found methods
|
||||
while (lines.hasNext()) {
|
||||
String line = lines.next();
|
||||
|
||||
for (String line : output.asLines()) {
|
||||
count++;
|
||||
// Fast check for common part of method name
|
||||
if (line.contains("CodelistTest.testcaseMethod")) {
|
||||
String[] parts = line.split(" ");
|
||||
int compileID = Integer.parseInt(parts[0]);
|
||||
int compileLevel = Integer.parseInt(parts[1]);
|
||||
String str = parts[2];
|
||||
|
||||
String[] parts = line.split(" ");
|
||||
// int compileID = Integer.parseInt(parts[0]);
|
||||
// int compileLevel = Integer.parseInt(parts[1]);
|
||||
String methodPrintedInLogFormat = parts[2];
|
||||
for (TestCase testcase : testcases) {
|
||||
if (str.contains(testcase.methodName)) {
|
||||
Assert.assertFalse(testcase.check, "Must not be found or already found.");
|
||||
Assert.assertTrue(testcase.level == compileLevel, "Must have correct level");
|
||||
testcase.check = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// skip inits, clinits, methodHandles and getUnsafe -
|
||||
// they can not be reflected
|
||||
if (methodPrintedInLogFormat.contains("<init>")) {
|
||||
continue;
|
||||
}
|
||||
if (methodPrintedInLogFormat.contains("<clinit>")) {
|
||||
continue;
|
||||
}
|
||||
if (methodPrintedInLogFormat.contains("MethodHandle")) {
|
||||
continue;
|
||||
}
|
||||
if (methodPrintedInLogFormat.contains("sun.misc.Unsafe.getUnsafe")) {
|
||||
continue;
|
||||
}
|
||||
if (methodPrintedInLogFormat.contains("jdk.internal.misc.Unsafe.getUnsafe")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
MethodIdentifierParser mf = new MethodIdentifierParser(methodPrintedInLogFormat);
|
||||
Method m = null;
|
||||
try {
|
||||
m = mf.getMethod();
|
||||
} catch (NoSuchMethodException e) {
|
||||
m = null;
|
||||
} catch (ClassNotFoundException e) {
|
||||
Assert.fail("Test error: Caught unexpected exception", e);
|
||||
}
|
||||
if (m == null) {
|
||||
Assert.fail("Test failed on: " + methodPrintedInLogFormat);
|
||||
}
|
||||
if (count > 10) {
|
||||
// Testing 10 entries is enough. Lets not waste time.
|
||||
break;
|
||||
}
|
||||
// Check all testcases that was run
|
||||
for (TestCase testcase : testcases) {
|
||||
Assert.assertTrue(testcase.check, "Missing testcase " + testcase.methodName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,4 +144,38 @@ public class CodelistTest {
|
||||
public void jmx() {
|
||||
run(new JMXExecutor());
|
||||
}
|
||||
|
||||
public void testcaseMethod1() {
|
||||
}
|
||||
|
||||
public void testcaseMethod2() {
|
||||
}
|
||||
|
||||
public void testcaseMethod3() {
|
||||
}
|
||||
|
||||
public void testcaseMethod4() {
|
||||
}
|
||||
|
||||
public static Method getMethod(Class klass, String name, Class<?>... parameterTypes) {
|
||||
try {
|
||||
return klass.getDeclaredMethod(name, parameterTypes);
|
||||
} catch (NoSuchMethodException | SecurityException e) {
|
||||
throw new RuntimeException("exception on getting method Helper." + name, e);
|
||||
}
|
||||
}
|
||||
|
||||
class TestCase {
|
||||
Method method;
|
||||
int level;
|
||||
String methodName;
|
||||
Boolean check;
|
||||
|
||||
public TestCase(int level, String methodName) {
|
||||
this.method = getMethod(CodelistTest.class, methodName);
|
||||
this.level = level;
|
||||
this.methodName = methodName;
|
||||
this.check = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user