提交 45eeb66c 编写于 作者: A acorn

Merge

...@@ -287,9 +287,6 @@ ...@@ -287,9 +287,6 @@
develop(bool, InstallMethods, true, \ develop(bool, InstallMethods, true, \
"Install methods at the end of successful compilations") \ "Install methods at the end of successful compilations") \
\ \
product(intx, CompilationRepeat, 0, \
"Number of times to recompile method before returning result") \
\
develop(intx, NMethodSizeLimit, (64*K)*wordSize, \ develop(intx, NMethodSizeLimit, (64*K)*wordSize, \
"Maximum size of a compiled method.") \ "Maximum size of a compiled method.") \
\ \
......
...@@ -559,7 +559,12 @@ ciConstant ciEnv::get_constant_by_index_impl(constantPoolHandle cpool, ...@@ -559,7 +559,12 @@ ciConstant ciEnv::get_constant_by_index_impl(constantPoolHandle cpool,
oop obj = cpool->resolved_references()->obj_at(cache_index); oop obj = cpool->resolved_references()->obj_at(cache_index);
if (obj != NULL) { if (obj != NULL) {
ciObject* ciobj = get_object(obj); ciObject* ciobj = get_object(obj);
return ciConstant(T_OBJECT, ciobj); if (ciobj->is_array()) {
return ciConstant(T_ARRAY, ciobj);
} else {
assert(ciobj->is_instance(), "should be an instance");
return ciConstant(T_OBJECT, ciobj);
}
} }
index = cpool->object_to_cp_index(cache_index); index = cpool->object_to_cp_index(cache_index);
} }
...@@ -586,8 +591,12 @@ ciConstant ciEnv::get_constant_by_index_impl(constantPoolHandle cpool, ...@@ -586,8 +591,12 @@ ciConstant ciEnv::get_constant_by_index_impl(constantPoolHandle cpool,
} }
} }
ciObject* constant = get_object(string); ciObject* constant = get_object(string);
assert (constant->is_instance(), "must be an instance, or not? "); if (constant->is_array()) {
return ciConstant(T_OBJECT, constant); return ciConstant(T_ARRAY, constant);
} else {
assert (constant->is_instance(), "must be an instance, or not? ");
return ciConstant(T_OBJECT, constant);
}
} else if (tag.is_klass() || tag.is_unresolved_klass()) { } else if (tag.is_klass() || tag.is_unresolved_klass()) {
// 4881222: allow ldc to take a class type // 4881222: allow ldc to take a class type
ciKlass* klass = get_klass_by_index_impl(cpool, index, ignore_will_link, accessor); ciKlass* klass = get_klass_by_index_impl(cpool, index, ignore_will_link, accessor);
......
...@@ -730,7 +730,7 @@ void ciTypeFlow::StateVector::do_ldc(ciBytecodeStream* str) { ...@@ -730,7 +730,7 @@ void ciTypeFlow::StateVector::do_ldc(ciBytecodeStream* str) {
if (obj->is_null_object()) { if (obj->is_null_object()) {
push_null(); push_null();
} else { } else {
assert(obj->is_instance(), "must be java_mirror of klass"); assert(obj->is_instance() || obj->is_array(), "must be java_mirror of klass");
push_object(obj->klass()); push_object(obj->klass());
} }
} else { } else {
......
...@@ -1781,22 +1781,6 @@ void CompileBroker::compiler_thread_loop() { ...@@ -1781,22 +1781,6 @@ void CompileBroker::compiler_thread_loop() {
if (method()->number_of_breakpoints() == 0) { if (method()->number_of_breakpoints() == 0) {
// Compile the method. // Compile the method.
if ((UseCompiler || AlwaysCompileLoopMethods) && CompileBroker::should_compile_new_jobs()) { if ((UseCompiler || AlwaysCompileLoopMethods) && CompileBroker::should_compile_new_jobs()) {
#ifdef COMPILER1
// Allow repeating compilations for the purpose of benchmarking
// compile speed. This is not useful for customers.
if (CompilationRepeat != 0) {
int compile_count = CompilationRepeat;
while (compile_count > 0) {
invoke_compiler_on_method(task);
nmethod* nm = method->code();
if (nm != NULL) {
nm->make_zombie();
method->clear_code();
}
compile_count--;
}
}
#endif /* COMPILER1 */
invoke_compiler_on_method(task); invoke_compiler_on_method(task);
} else { } else {
// After compilation is disabled, remove remaining methods from queue // After compilation is disabled, remove remaining methods from queue
......
...@@ -2478,6 +2478,7 @@ void G1CollectedHeap::collect(GCCause::Cause cause) { ...@@ -2478,6 +2478,7 @@ void G1CollectedHeap::collect(GCCause::Cause cause) {
unsigned int gc_count_before; unsigned int gc_count_before;
unsigned int old_marking_count_before; unsigned int old_marking_count_before;
unsigned int full_gc_count_before;
bool retry_gc; bool retry_gc;
do { do {
...@@ -2488,6 +2489,7 @@ void G1CollectedHeap::collect(GCCause::Cause cause) { ...@@ -2488,6 +2489,7 @@ void G1CollectedHeap::collect(GCCause::Cause cause) {
// Read the GC count while holding the Heap_lock // Read the GC count while holding the Heap_lock
gc_count_before = total_collections(); gc_count_before = total_collections();
full_gc_count_before = total_full_collections();
old_marking_count_before = _old_marking_cycles_started; old_marking_count_before = _old_marking_cycles_started;
} }
...@@ -2532,7 +2534,7 @@ void G1CollectedHeap::collect(GCCause::Cause cause) { ...@@ -2532,7 +2534,7 @@ void G1CollectedHeap::collect(GCCause::Cause cause) {
VMThread::execute(&op); VMThread::execute(&op);
} else { } else {
// Schedule a Full GC. // Schedule a Full GC.
VM_G1CollectFull op(gc_count_before, old_marking_count_before, cause); VM_G1CollectFull op(gc_count_before, full_gc_count_before, cause);
VMThread::execute(&op); VMThread::execute(&op);
} }
} }
......
...@@ -60,7 +60,7 @@ public: ...@@ -60,7 +60,7 @@ public:
VM_G1CollectFull(unsigned int gc_count_before, VM_G1CollectFull(unsigned int gc_count_before,
unsigned int full_gc_count_before, unsigned int full_gc_count_before,
GCCause::Cause cause) GCCause::Cause cause)
: VM_GC_Operation(gc_count_before, cause, full_gc_count_before) { } : VM_GC_Operation(gc_count_before, cause, full_gc_count_before, true) { }
virtual VMOp_Type type() const { return VMOp_G1CollectFull; } virtual VMOp_Type type() const { return VMOp_G1CollectFull; }
virtual void doit(); virtual void doit();
virtual const char* name() const { virtual const char* name() const {
......
...@@ -862,7 +862,7 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod* ...@@ -862,7 +862,7 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod*
call_does_dispatch, vtable_index); // out-parameters call_does_dispatch, vtable_index); // out-parameters
// We lack profiling at this call but type speculation may // We lack profiling at this call but type speculation may
// provide us with a type // provide us with a type
speculative_receiver_type = receiver_type->speculative_type(); speculative_receiver_type = (receiver_type != NULL) ? receiver_type->speculative_type() : NULL;
} }
CallGenerator* cg = C->call_generator(target, vtable_index, call_does_dispatch, jvms, true, PROB_ALWAYS, speculative_receiver_type, true, true); CallGenerator* cg = C->call_generator(target, vtable_index, call_does_dispatch, jvms, true, PROB_ALWAYS, speculative_receiver_type, true, true);
......
...@@ -2839,6 +2839,13 @@ void ConnectionGraph::split_unique_types(GrowableArray<Node *> &alloc_worklist) ...@@ -2839,6 +2839,13 @@ void ConnectionGraph::split_unique_types(GrowableArray<Node *> &alloc_worklist)
continue; continue;
} }
} }
const TypeOopPtr *t = igvn->type(n)->isa_oopptr();
if (t == NULL)
continue; // not a TypeOopPtr
if (!t->klass_is_exact())
continue; // not an unique type
if (alloc->is_Allocate()) { if (alloc->is_Allocate()) {
// Set the scalar_replaceable flag for allocation // Set the scalar_replaceable flag for allocation
// so it could be eliminated. // so it could be eliminated.
...@@ -2857,10 +2864,7 @@ void ConnectionGraph::split_unique_types(GrowableArray<Node *> &alloc_worklist) ...@@ -2857,10 +2864,7 @@ void ConnectionGraph::split_unique_types(GrowableArray<Node *> &alloc_worklist)
// - not determined to be ineligible by escape analysis // - not determined to be ineligible by escape analysis
set_map(alloc, n); set_map(alloc, n);
set_map(n, alloc); set_map(n, alloc);
const TypeOopPtr *t = igvn->type(n)->isa_oopptr(); const TypeOopPtr* tinst = t->cast_to_instance_id(ni);
if (t == NULL)
continue; // not a TypeOopPtr
const TypeOopPtr* tinst = t->cast_to_exactness(true)->is_oopptr()->cast_to_instance_id(ni);
igvn->hash_delete(n); igvn->hash_delete(n);
igvn->set_type(n, tinst); igvn->set_type(n, tinst);
n->raise_bottom_type(tinst); n->raise_bottom_type(tinst);
......
...@@ -300,6 +300,7 @@ static ObsoleteFlag obsolete_jvm_flags[] = { ...@@ -300,6 +300,7 @@ static ObsoleteFlag obsolete_jvm_flags[] = {
{ "UseStringCache", JDK_Version::jdk(8), JDK_Version::jdk(9) }, { "UseStringCache", JDK_Version::jdk(8), JDK_Version::jdk(9) },
{ "UseOldInlining", JDK_Version::jdk(9), JDK_Version::jdk(10) }, { "UseOldInlining", JDK_Version::jdk(9), JDK_Version::jdk(10) },
{ "AutoShutdownNMT", JDK_Version::jdk(9), JDK_Version::jdk(10) }, { "AutoShutdownNMT", JDK_Version::jdk(9), JDK_Version::jdk(10) },
{ "CompilationRepeat", JDK_Version::jdk(8), JDK_Version::jdk(9) },
#ifdef PRODUCT #ifdef PRODUCT
{ "DesiredMethodLimit", { "DesiredMethodLimit",
JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) }, JDK_Version::jdk_update(7, 2), JDK_Version::jdk(8) },
......
/*
* Copyright (c) 2014, 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 8059556
* @run main/othervm -Xbatch NullConstantReceiver
*/
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
public class NullConstantReceiver {
static final MethodHandle target;
static {
try {
target = MethodHandles.lookup().findVirtual(NullConstantReceiver.class, "test", MethodType.methodType(void.class));
} catch (ReflectiveOperationException e) {
throw new Error(e);
}
}
public void test() {}
static void run() throws Throwable {
target.invokeExact((NullConstantReceiver) null);
}
public static void main(String[] args) throws Throwable {
for (int i = 0; i<15000; i++) {
try {
run();
} catch (NullPointerException e) {
// expected
continue;
}
throw new AssertionError("NPE wasn't thrown");
}
System.out.println("TEST PASSED");
}
}
/*
* Copyright (c) 2014, 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 8058828
* @run main/bootclasspath -Xbatch VMAnonymousClasses
*/
import jdk.internal.org.objectweb.asm.ClassWriter;
import jdk.internal.org.objectweb.asm.MethodVisitor;
import jdk.internal.org.objectweb.asm.Opcodes;
import sun.misc.Unsafe;
import java.lang.invoke.ConstantCallSite;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.lang.invoke.MutableCallSite;
import java.lang.invoke.VolatileCallSite;
public class VMAnonymousClasses {
static final String TEST_METHOD_NAME = "constant";
static final Unsafe UNSAFE = Unsafe.getUnsafe();
static int getConstantPoolSize(byte[] classFile) {
// The first few bytes:
// u4 magic;
// u2 minor_version;
// u2 major_version;
// u2 constant_pool_count;
return ((classFile[8] & 0xFF) << 8) | (classFile[9] & 0xFF);
}
static void test(Object value) throws ReflectiveOperationException {
System.out.printf("Test: %s", value != null ? value.getClass() : "null");
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
cw.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC | Opcodes.ACC_SUPER, "Test", null, "java/lang/Object", null);
MethodVisitor mv = cw.visitMethod(Opcodes.ACC_STATIC | Opcodes.ACC_PUBLIC, TEST_METHOD_NAME, "()Ljava/lang/Object;", null, null);
String placeholder = "CONSTANT";
int index = cw.newConst(placeholder);
mv.visitLdcInsn(placeholder);
mv.visitInsn(Opcodes.ARETURN);
mv.visitMaxs(0, 0);
mv.visitEnd();
byte[] classFile = cw.toByteArray();
Object[] cpPatches = new Object[getConstantPoolSize(classFile)];
cpPatches[index] = value;
Class<?> test = UNSAFE.defineAnonymousClass(VMAnonymousClasses.class, classFile, cpPatches);
Object expectedResult = (value != null) ? value : placeholder;
for (int i = 0; i<15000; i++) {
Object result = test.getMethod(TEST_METHOD_NAME).invoke(null);
if (result != expectedResult) {
throw new AssertionError(String.format("Wrong value returned: %s != %s", value, result));
}
}
System.out.println(" PASSED");
}
public static void main(String[] args) throws ReflectiveOperationException {
// Objects
test(new Object());
test("TEST");
test(new VMAnonymousClasses());
test(null);
// Class
test(String.class);
// Arrays
test(new boolean[0]);
test(new byte[0]);
test(new char[0]);
test(new short[0]);
test(new int[0]);
test(new long[0]);
test(new float[0]);
test(new double[0]);
test(new Object[0]);
// Multi-dimensional arrays
test(new byte[0][0]);
test(new Object[0][0]);
// MethodHandle-related
MethodType mt = MethodType.methodType(void.class, String[].class);
MethodHandle mh = MethodHandles.lookup().findStatic(VMAnonymousClasses.class, "main", mt);
test(mt);
test(mh);
test(new ConstantCallSite(mh));
test(new MutableCallSite(MethodType.methodType(void.class)));
test(new VolatileCallSite(MethodType.methodType(void.class)));
System.out.println("TEST PASSED");
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册