comparison src/share/vm/compiler/compileBroker.cpp @ 17795:a9becfeecd1b

Merge
author kvn
date Wed, 22 Jan 2014 17:42:23 -0800
parents 7b9127b17b7a 15120a36272d
children 8a9bb7821e28 78bbf4d43a14 364b73402247
comparison
equal deleted inserted replaced
17794:3514ee402842 17795:a9becfeecd1b
130 volatile jint CompileBroker::_should_compile_new_jobs = run_compilation; 130 volatile jint CompileBroker::_should_compile_new_jobs = run_compilation;
131 131
132 // The installed compiler(s) 132 // The installed compiler(s)
133 AbstractCompiler* CompileBroker::_compilers[2]; 133 AbstractCompiler* CompileBroker::_compilers[2];
134 134
135 // These counters are used for assigning id's to each compilation 135 // These counters are used to assign an unique ID to each compilation.
136 uint CompileBroker::_compilation_id = 0; 136 volatile jint CompileBroker::_compilation_id = 0;
137 uint CompileBroker::_osr_compilation_id = 0; 137 volatile jint CompileBroker::_osr_compilation_id = 0;
138 138
139 // Debugging information 139 // Debugging information
140 int CompileBroker::_last_compile_type = no_compile; 140 int CompileBroker::_last_compile_type = no_compile;
141 int CompileBroker::_last_compile_level = CompLevel_none; 141 int CompileBroker::_last_compile_level = CompLevel_none;
142 char CompileBroker::_last_method_compiled[CompileBroker::name_buffer_length]; 142 char CompileBroker::_last_method_compiled[CompileBroker::name_buffer_length];
1156 } 1156 }
1157 1157
1158 // We now know that this compilation is not pending, complete, 1158 // We now know that this compilation is not pending, complete,
1159 // or prohibited. Assign a compile_id to this compilation 1159 // or prohibited. Assign a compile_id to this compilation
1160 // and check to see if it is in our [Start..Stop) range. 1160 // and check to see if it is in our [Start..Stop) range.
1161 uint compile_id = assign_compile_id(method, osr_bci); 1161 int compile_id = assign_compile_id(method, osr_bci);
1162 if (compile_id == 0) { 1162 if (compile_id == 0) {
1163 // The compilation falls outside the allowed range. 1163 // The compilation falls outside the allowed range.
1164 return; 1164 return;
1165 } 1165 }
1166 1166
1303 } 1303 }
1304 1304
1305 // do the compilation 1305 // do the compilation
1306 if (method->is_native()) { 1306 if (method->is_native()) {
1307 if (!PreferInterpreterNativeStubs || method->is_method_handle_intrinsic()) { 1307 if (!PreferInterpreterNativeStubs || method->is_method_handle_intrinsic()) {
1308 // Acquire our lock.
1309 int compile_id;
1310 {
1311 MutexLocker locker(MethodCompileQueue_lock, THREAD);
1312 compile_id = assign_compile_id(method, standard_entry_bci);
1313 }
1314 // To properly handle the appendix argument for out-of-line calls we are using a small trampoline that 1308 // To properly handle the appendix argument for out-of-line calls we are using a small trampoline that
1315 // pops off the appendix argument and jumps to the target (see gen_special_dispatch in SharedRuntime). 1309 // pops off the appendix argument and jumps to the target (see gen_special_dispatch in SharedRuntime).
1316 // 1310 //
1317 // Since normal compiled-to-compiled calls are not able to handle such a thing we MUST generate an adapter 1311 // Since normal compiled-to-compiled calls are not able to handle such a thing we MUST generate an adapter
1318 // in this case. If we can't generate one and use it we can not execute the out-of-line method handle calls. 1312 // in this case. If we can't generate one and use it we can not execute the out-of-line method handle calls.
1319 (void) AdapterHandlerLibrary::create_native_wrapper(method, compile_id); 1313 AdapterHandlerLibrary::create_native_wrapper(method);
1320 } else { 1314 } else {
1321 return NULL; 1315 return NULL;
1322 } 1316 }
1323 } else { 1317 } else {
1324 // If the compiler is shut off due to code cache getting full 1318 // If the compiler is shut off due to code cache getting full
1417 } 1411 }
1418 1412
1419 return false; 1413 return false;
1420 } 1414 }
1421 1415
1422 1416 /**
1423 // ------------------------------------------------------------------ 1417 * Generate serialized IDs for compilation requests. If certain debugging flags are used
1424 // CompileBroker::assign_compile_id 1418 * and the ID is not within the specified range, the method is not compiled and 0 is returned.
1425 // 1419 * The function also allows to generate separate compilation IDs for OSR compilations.
1426 // Assign a serialized id number to this compilation request. If the 1420 */
1427 // number falls out of the allowed range, return a 0. OSR 1421 int CompileBroker::assign_compile_id(methodHandle method, int osr_bci) {
1428 // compilations may be numbered separately from regular compilations 1422 #ifdef ASSERT
1429 // if certain debugging flags are used.
1430 uint CompileBroker::assign_compile_id(methodHandle method, int osr_bci) {
1431 assert(MethodCompileQueue_lock->owner() == Thread::current(),
1432 "must hold the compilation queue lock");
1433 bool is_osr = (osr_bci != standard_entry_bci); 1423 bool is_osr = (osr_bci != standard_entry_bci);
1434 uint id; 1424 int id;
1435 if (CICountOSR && is_osr) { 1425 if (method->is_native()) {
1436 id = ++_osr_compilation_id; 1426 assert(!is_osr, "can't be osr");
1437 if ((uint)CIStartOSR <= id && id < (uint)CIStopOSR) { 1427 // Adapters, native wrappers and method handle intrinsics
1428 // should be generated always.
1429 return Atomic::add(1, &_compilation_id);
1430 } else if (CICountOSR && is_osr) {
1431 id = Atomic::add(1, &_osr_compilation_id);
1432 if (CIStartOSR <= id && id < CIStopOSR) {
1438 return id; 1433 return id;
1439 } 1434 }
1440 } else { 1435 } else {
1441 id = ++_compilation_id; 1436 id = Atomic::add(1, &_compilation_id);
1442 if ((uint)CIStart <= id && id < (uint)CIStop) { 1437 if (CIStart <= id && id < CIStop) {
1443 return id; 1438 return id;
1444 } 1439 }
1445 } 1440 }
1446 1441
1447 // Method was not in the appropriate compilation range. 1442 // Method was not in the appropriate compilation range.
1448 method->set_not_compilable_quietly(); 1443 method->set_not_compilable_quietly();
1449 return 0; 1444 return 0;
1445 #else
1446 // CICountOSR is a develop flag and set to 'false' by default. In a product built,
1447 // only _compilation_id is incremented.
1448 return Atomic::add(1, &_compilation_id);
1449 #endif
1450 } 1450 }
1451 1451
1452 1452
1453 // ------------------------------------------------------------------ 1453 // ------------------------------------------------------------------
1454 // CompileBroker::is_compile_blocking 1454 // CompileBroker::is_compile_blocking