private void compileMethod(HotSpotResolvedJavaMethod method,int counter){
  try {
    long start=System.currentTimeMillis();
    long allocatedAtStart=MemUseTrackerImpl.getCurrentThreadAllocatedBytes();
    int entryBCI=JVMCICompiler.INVOCATION_ENTRY_BCI;
    HotSpotCompilationRequest request=new HotSpotCompilationRequest(method,entryBCI,0L);
    boolean useProfilingInfo=false;
    boolean installAsDefault=false;
    CompilationTask task=new CompilationTask(jvmciRuntime,compiler,request,useProfilingInfo,installAsDefault);
    task.runCompilation();
    HotSpotInstalledCode installedCode=task.getInstalledCode();
    if (installedCode != null) {
      installedCode.invalidate();
    }
    memoryUsed.getAndAdd(MemUseTrackerImpl.getCurrentThreadAllocatedBytes() - allocatedAtStart);
    compileTime.getAndAdd(System.currentTimeMillis() - start);
    compiledMethodsCounter.incrementAndGet();
  }
 catch (  Throwable t) {
    println("CompileTheWorld (%d) : Error compiling method: %s",counter,method.format("%H.%n(%p):%r"));
    printStackTrace(t);
  }
}

private void compileMethod ( HotSpotResolvedJavaMethod method , int counter ) { try { long start = System . currentTimeMillis ( ) ; long allocatedAtStart = MemUseTrackerImpl . getCurrentThreadAllocatedBytes ( ) ; int entryBCI = JVMCICompiler . INVOCATION_ENTRY_BCI ; HotSpotCompilationRequest request = new HotSpotCompilationRequest ( method , entryBCI , 0L ) ; boolean useProfilingInfo = false ; boolean installAsDefault = false ; CompilationTask task = new CompilationTask ( jvmciRuntime , compiler , request , useProfilingInfo , installAsDefault ) ; task . runCompilation ( ) ; HotSpotInstalledCode installedCode = task . getInstalledCode ( ) ; if ( installedCode != null ) { installedCode . invalidate ( ) ; } memoryUsed . getAndAdd ( MemUseTrackerImpl . getCurrentThreadAllocatedBytes ( ) - allocatedAtStart ) ; compileTime . getAndAdd ( System . currentTimeMillis ( ) - start ) ; compiledMethodsCounter . incrementAndGet ( ) ; } catch ( Throwable t ) { println ( "CompileTheWorld (%d) : Error compiling method: %s" , counter , method . format ( "%H.%n(%p):%r" ) ) ; printStackTrace ( t ) ; } }
compiles a method and gathers some statistics .
