< prev index next >

src/share/vm/compiler/compileBroker.cpp

Print this page
rev 11747 : [mq]: per.hotspot.patch


  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/symbolTable.hpp"
  27 #include "classfile/systemDictionary.hpp"
  28 #include "classfile/vmSymbols.hpp"
  29 #include "code/codeCache.hpp"
  30 #include "code/dependencyContext.hpp"
  31 #include "compiler/compileBroker.hpp"
  32 #include "compiler/compileLog.hpp"
  33 #include "compiler/compilerOracle.hpp"
  34 #include "compiler/directivesParser.hpp"
  35 #include "gc/shared/referencePendingListLocker.hpp"
  36 #include "interpreter/linkResolver.hpp"
  37 #include "memory/allocation.inline.hpp"
  38 #include "memory/resourceArea.hpp"
  39 #include "oops/methodData.hpp"
  40 #include "oops/method.hpp"
  41 #include "oops/oop.inline.hpp"
  42 #include "prims/nativeLookup.hpp"
  43 #include "prims/whitebox.hpp"
  44 #include "runtime/arguments.hpp"
  45 #include "runtime/atomic.inline.hpp"
  46 #include "runtime/compilationPolicy.hpp"
  47 #include "runtime/init.hpp"
  48 #include "runtime/interfaceSupport.hpp"
  49 #include "runtime/javaCalls.hpp"
  50 #include "runtime/os.hpp"
  51 #include "runtime/sharedRuntime.hpp"
  52 #include "runtime/sweeper.hpp"
  53 #include "runtime/timerTrace.hpp"
  54 #include "trace/tracing.hpp"
  55 #include "utilities/dtrace.hpp"


 873 #ifndef PRODUCT
 874   if (osr_bci != -1 && !FLAG_IS_DEFAULT(OSROnlyBCI)) {
 875     if ((OSROnlyBCI > 0) ? (OSROnlyBCI != osr_bci) : (-OSROnlyBCI == osr_bci)) {
 876       // Positive OSROnlyBCI means only compile that bci.  Negative means don't compile that BCI.
 877       return;
 878     }
 879   }
 880 #endif
 881 
 882   // If this method is already in the compile queue, then
 883   // we do not block the current thread.
 884   if (compilation_is_in_queue(method)) {
 885     // We may want to decay our counter a bit here to prevent
 886     // multiple denied requests for compilation.  This is an
 887     // open compilation policy issue. Note: The other possibility,
 888     // in the case that this is a blocking compile request, is to have
 889     // all subsequent blocking requesters wait for completion of
 890     // ongoing compiles. Note that in this case we'll need a protocol
 891     // for freeing the associated compile tasks. [Or we could have
 892     // a single static monitor on which all these waiters sleep.]
 893     return;
 894   }
 895 
 896   // If the requesting thread is holding the pending list lock
 897   // then we just return. We can't risk blocking while holding
 898   // the pending list lock or a 3-way deadlock may occur
 899   // between the reference handler thread, a GC (instigated
 900   // by a compiler thread), and compiled method registration.
 901   if (ReferencePendingListLocker::is_locked_by_self()) {
 902     return;
 903   }
 904 
 905   if (TieredCompilation) {
 906     // Tiered policy requires MethodCounters to exist before adding a method to
 907     // the queue. Create if we don't have them yet.
 908     method->get_method_counters(thread);
 909   }
 910 
 911   // Outputs from the following MutexLocker block:
 912   CompileTask* task     = NULL;
 913   CompileQueue* queue  = compile_queue(comp_level);
 914 
 915   // Acquire our lock.
 916   {
 917     MutexLocker locker(MethodCompileQueue_lock, thread);
 918 
 919     // Make sure the method has not slipped into the queues since
 920     // last we checked; note that those checks were "fast bail-outs".
 921     // Here we need to be more careful, see 14012000 below.




  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/symbolTable.hpp"
  27 #include "classfile/systemDictionary.hpp"
  28 #include "classfile/vmSymbols.hpp"
  29 #include "code/codeCache.hpp"
  30 #include "code/dependencyContext.hpp"
  31 #include "compiler/compileBroker.hpp"
  32 #include "compiler/compileLog.hpp"
  33 #include "compiler/compilerOracle.hpp"
  34 #include "compiler/directivesParser.hpp"

  35 #include "interpreter/linkResolver.hpp"
  36 #include "memory/allocation.inline.hpp"
  37 #include "memory/resourceArea.hpp"
  38 #include "oops/methodData.hpp"
  39 #include "oops/method.hpp"
  40 #include "oops/oop.inline.hpp"
  41 #include "prims/nativeLookup.hpp"
  42 #include "prims/whitebox.hpp"
  43 #include "runtime/arguments.hpp"
  44 #include "runtime/atomic.inline.hpp"
  45 #include "runtime/compilationPolicy.hpp"
  46 #include "runtime/init.hpp"
  47 #include "runtime/interfaceSupport.hpp"
  48 #include "runtime/javaCalls.hpp"
  49 #include "runtime/os.hpp"
  50 #include "runtime/sharedRuntime.hpp"
  51 #include "runtime/sweeper.hpp"
  52 #include "runtime/timerTrace.hpp"
  53 #include "trace/tracing.hpp"
  54 #include "utilities/dtrace.hpp"


 872 #ifndef PRODUCT
 873   if (osr_bci != -1 && !FLAG_IS_DEFAULT(OSROnlyBCI)) {
 874     if ((OSROnlyBCI > 0) ? (OSROnlyBCI != osr_bci) : (-OSROnlyBCI == osr_bci)) {
 875       // Positive OSROnlyBCI means only compile that bci.  Negative means don't compile that BCI.
 876       return;
 877     }
 878   }
 879 #endif
 880 
 881   // If this method is already in the compile queue, then
 882   // we do not block the current thread.
 883   if (compilation_is_in_queue(method)) {
 884     // We may want to decay our counter a bit here to prevent
 885     // multiple denied requests for compilation.  This is an
 886     // open compilation policy issue. Note: The other possibility,
 887     // in the case that this is a blocking compile request, is to have
 888     // all subsequent blocking requesters wait for completion of
 889     // ongoing compiles. Note that in this case we'll need a protocol
 890     // for freeing the associated compile tasks. [Or we could have
 891     // a single static monitor on which all these waiters sleep.]









 892     return;
 893   }
 894 
 895   if (TieredCompilation) {
 896     // Tiered policy requires MethodCounters to exist before adding a method to
 897     // the queue. Create if we don't have them yet.
 898     method->get_method_counters(thread);
 899   }
 900 
 901   // Outputs from the following MutexLocker block:
 902   CompileTask* task     = NULL;
 903   CompileQueue* queue  = compile_queue(comp_level);
 904 
 905   // Acquire our lock.
 906   {
 907     MutexLocker locker(MethodCompileQueue_lock, thread);
 908 
 909     // Make sure the method has not slipped into the queues since
 910     // last we checked; note that those checks were "fast bail-outs".
 911     // Here we need to be more careful, see 14012000 below.


< prev index next >