comparison src/share/vm/prims/jni.cpp @ 18041:52b4284cb496

Merge with jdk8u20-b26
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 15 Oct 2014 16:02:50 +0200
parents 4481cf549cfc 78bbf4d43a14
children 6a2f814224b1
comparison
equal deleted inserted replaced
17606:45d7b2c7029d 18041:52b4284cb496
1 /* 1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2012 Red Hat, Inc. 3 * Copyright (c) 2012 Red Hat, Inc.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * 5 *
6 * This code is free software; you can redistribute it and/or modify it 6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as 7 * under the terms of the GNU General Public License version 2 only, as
310 Histogram* JNIHistogram; 310 Histogram* JNIHistogram;
311 static volatile jint JNIHistogram_lock = 0; 311 static volatile jint JNIHistogram_lock = 0;
312 312
313 class JNITraceWrapper : public StackObj { 313 class JNITraceWrapper : public StackObj {
314 public: 314 public:
315 JNITraceWrapper(const char* format, ...) { 315 JNITraceWrapper(const char* format, ...) ATTRIBUTE_PRINTF(2, 3) {
316 if (TraceJNICalls) { 316 if (TraceJNICalls) {
317 va_list ap; 317 va_list ap;
318 va_start(ap, format); 318 va_start(ap, format);
319 tty->print("JNI "); 319 tty->print("JNI ");
320 tty->vprint_cr(format, ap); 320 tty->vprint_cr(format, ap);
1358 } 1358 }
1359 } else { 1359 } else {
1360 // interface call 1360 // interface call
1361 KlassHandle h_holder(THREAD, holder); 1361 KlassHandle h_holder(THREAD, holder);
1362 1362
1363 int itbl_index = m->itable_index(); 1363 if (call_type == JNI_VIRTUAL) {
1364 Klass* k = h_recv->klass(); 1364 int itbl_index = m->itable_index();
1365 selected_method = InstanceKlass::cast(k)->method_at_itable(h_holder(), itbl_index, CHECK); 1365 Klass* k = h_recv->klass();
1366 selected_method = InstanceKlass::cast(k)->method_at_itable(h_holder(), itbl_index, CHECK);
1367 } else {
1368 selected_method = m;
1369 }
1366 } 1370 }
1367 } 1371 }
1368 1372
1369 methodHandle method(THREAD, selected_method); 1373 methodHandle method(THREAD, selected_method);
1370 1374
4448 directBufferClass = (jclass) env->NewGlobalRef(directBufferClass); 4452 directBufferClass = (jclass) env->NewGlobalRef(directBufferClass);
4449 directByteBufferClass = (jclass) env->NewGlobalRef(directByteBufferClass); 4453 directByteBufferClass = (jclass) env->NewGlobalRef(directByteBufferClass);
4450 4454
4451 // Get needed field and method IDs 4455 // Get needed field and method IDs
4452 directByteBufferConstructor = env->GetMethodID(directByteBufferClass, "<init>", "(JI)V"); 4456 directByteBufferConstructor = env->GetMethodID(directByteBufferClass, "<init>", "(JI)V");
4457 if (env->ExceptionCheck()) {
4458 env->ExceptionClear();
4459 directBufferSupportInitializeFailed = 1;
4460 return false;
4461 }
4453 directBufferAddressField = env->GetFieldID(bufferClass, "address", "J"); 4462 directBufferAddressField = env->GetFieldID(bufferClass, "address", "J");
4463 if (env->ExceptionCheck()) {
4464 env->ExceptionClear();
4465 directBufferSupportInitializeFailed = 1;
4466 return false;
4467 }
4454 bufferCapacityField = env->GetFieldID(bufferClass, "capacity", "I"); 4468 bufferCapacityField = env->GetFieldID(bufferClass, "capacity", "I");
4469 if (env->ExceptionCheck()) {
4470 env->ExceptionClear();
4471 directBufferSupportInitializeFailed = 1;
4472 return false;
4473 }
4455 4474
4456 if ((directByteBufferConstructor == NULL) || 4475 if ((directByteBufferConstructor == NULL) ||
4457 (directBufferAddressField == NULL) || 4476 (directBufferAddressField == NULL) ||
4458 (bufferCapacityField == NULL)) { 4477 (bufferCapacityField == NULL)) {
4459 directBufferSupportInitializeFailed = 1; 4478 directBufferSupportInitializeFailed = 1;
5063 void TestReserveMemorySpecial_test(); 5082 void TestReserveMemorySpecial_test();
5064 void TestVirtualSpace_test(); 5083 void TestVirtualSpace_test();
5065 void TestMetaspaceAux_test(); 5084 void TestMetaspaceAux_test();
5066 void TestMetachunk_test(); 5085 void TestMetachunk_test();
5067 void TestVirtualSpaceNode_test(); 5086 void TestVirtualSpaceNode_test();
5087 void TestNewSize_test();
5068 #if INCLUDE_ALL_GCS 5088 #if INCLUDE_ALL_GCS
5089 void TestOldFreeSpaceCalculation_test();
5069 void TestG1BiasedArray_test(); 5090 void TestG1BiasedArray_test();
5091 void TestCodeCacheRemSet_test();
5070 #endif 5092 #endif
5071 5093
5072 void execute_internal_vm_tests() { 5094 void execute_internal_vm_tests() {
5073 if (ExecuteInternalVMTests) { 5095 if (ExecuteInternalVMTests) {
5074 tty->print_cr("Running internal VM tests"); 5096 tty->print_cr("Running internal VM tests");
5083 run_unit_test(arrayOopDesc::test_max_array_length()); 5105 run_unit_test(arrayOopDesc::test_max_array_length());
5084 run_unit_test(CollectedHeap::test_is_in()); 5106 run_unit_test(CollectedHeap::test_is_in());
5085 run_unit_test(QuickSort::test_quick_sort()); 5107 run_unit_test(QuickSort::test_quick_sort());
5086 run_unit_test(AltHashing::test_alt_hash()); 5108 run_unit_test(AltHashing::test_alt_hash());
5087 run_unit_test(test_loggc_filename()); 5109 run_unit_test(test_loggc_filename());
5110 run_unit_test(TestNewSize_test());
5088 #if INCLUDE_VM_STRUCTS 5111 #if INCLUDE_VM_STRUCTS
5089 run_unit_test(VMStructs::test()); 5112 run_unit_test(VMStructs::test());
5090 #endif 5113 #endif
5091 #if INCLUDE_ALL_GCS 5114 #if INCLUDE_ALL_GCS
5115 run_unit_test(TestOldFreeSpaceCalculation_test());
5092 run_unit_test(TestG1BiasedArray_test()); 5116 run_unit_test(TestG1BiasedArray_test());
5093 run_unit_test(HeapRegionRemSet::test_prt()); 5117 run_unit_test(HeapRegionRemSet::test_prt());
5118 run_unit_test(TestCodeCacheRemSet_test());
5094 #endif 5119 #endif
5095 tty->print_cr("All internal VM tests passed"); 5120 tty->print_cr("All internal VM tests passed");
5096 } 5121 }
5097 } 5122 }
5098 5123
5194 event.set_javalangthread(java_lang_Thread::thread_id(thread->threadObj())); 5219 event.set_javalangthread(java_lang_Thread::thread_id(thread->threadObj()));
5195 event.commit(); 5220 event.commit();
5196 } 5221 }
5197 5222
5198 #ifndef PRODUCT 5223 #ifndef PRODUCT
5199 #ifndef TARGET_OS_FAMILY_windows 5224 #ifndef CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED
5200 #define CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(f) f() 5225 #define CALL_TEST_FUNC_WITH_WRAPPER_IF_NEEDED(f) f()
5201 #endif 5226 #endif
5202 5227
5203 // Check if we should compile all classes on bootclasspath 5228 // Check if we should compile all classes on bootclasspath
5204 #ifdef GRAAL 5229 #ifdef GRAAL