Top Inners Fields Constructors Methods
org.jruby.compiler

public Class JITCompiler

extends Object
implements JITCompilerMBean
Class Inheritance
All Implemented Interfaces
org.jruby.compiler.JITCompilerMBean
Imports
org.jruby.Ruby, .RubyEncoding, .RubyInstanceConfig, .RubyModule, org.jruby.exceptions.RaiseException, org.jruby.internal.runtime.methods.CompiledIRMethod, .MixedModeIRMethod, org.jruby.ir.IRScope, org.jruby.ir.interpreter.InterpreterContext, org.jruby.ir.targets.JVMVisitor, .JVMVisitorMethodContext, org.jruby.runtime.MethodIndex, .MixedModeIRBlockBody, .ThreadContext, org.jruby.threading.DaemonThreadFactory, org.jruby.util.ClassDefiningClassLoader, .ClassDefiningJRubyClassLoader, .OneShotClassLoader, org.jruby.util.cli.Options, org.jruby.util.collections.WeakValuedMap, org.jruby.util.log.Logger, .LoggerFactory, java.lang.invoke.MethodHandles, java.security.MessageDigest, .NoSuchAlgorithmException, java.util.AbstractMap, .Arrays, .Locale, .Map, .Set, java.util.concurrent.ExecutorService, .LinkedBlockingQueue, .RejectedExecutionException, .ThreadPoolExecutor, .TimeUnit

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
pack-priv abstract static class

Field Summary

Modifier and TypeField and Description
pack-priv final RubyInstanceConfig
pack-priv final JITCounts
private final ExecutorService
pack-priv final Map<String, ClassDefiningClassLoader>
private static final Logger
pack-priv static final MethodHandles.Lookup
public static final String
pack-priv final Ruby

Constructor Summary

AccessConstructor and Description
public
JITCompiler(Ruby runtime)

Method Summary

Modifier and TypeMethod and Description
public void
buildThresholdReached(ThreadContext context, final Compilable<T> method, boolean force)

public long
public long
public long
public long
public long
public long
public long
public long
public String[]
public static String
getHashForBytes(byte[] bytes)

public static String
public long
public long
public long
pack-priv ClassDefiningClassLoader
getLoaderFor(final String source)

public String[]
public long
public Runnable
getTaskFor(ThreadContext context, Compilable<T> method)

public boolean

Returns:

true if already shut down, false otherwise
isShutdown
()

Return the shutdown status of the JIT compiler.

pack-priv static void
log(Compilable<?> target, String name, String message, Object... reason)
Deprecated since 10.0.

pack-priv static void
log(ThreadContext context, Compilable<?> target, String name, String message, Object... reason)

public void
shutdown()

Shut down this JIT compiler and its resources.

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

configback to summary
pack-priv final RubyInstanceConfig config
countsback to summary
pack-priv final JITCounts counts
executorback to summary
private final ExecutorService executor
loaderMapback to summary
pack-priv final Map<String, ClassDefiningClassLoader> loaderMap
LOGback to summary
private static final Logger LOG
PUBLIC_LOOKUPback to summary
pack-priv static final MethodHandles.Lookup PUBLIC_LOOKUP
RUBY_JIT_PREFIXback to summary
public static final String RUBY_JIT_PREFIX
runtimeback to summary
pack-priv final Ruby runtime

Constructor Detail

JITCompilerback to summary
public JITCompiler(Ruby runtime)

Method Detail

buildThresholdReachedback to summary
public void buildThresholdReached(ThreadContext context, final Compilable<T> method, boolean force)
getAbandonCountback to summary
public long getAbandonCount()

Implements org.jruby.compiler.JITCompilerMBean.getAbandonCount.

getCodeAverageSizeback to summary
public long getCodeAverageSize()

Implements org.jruby.compiler.JITCompilerMBean.getCodeAverageSize.

getCodeLargestSizeback to summary
public long getCodeLargestSize()

Implements org.jruby.compiler.JITCompilerMBean.getCodeLargestSize.

getCodeSizeback to summary
public long getCodeSize()

Implements org.jruby.compiler.JITCompilerMBean.getCodeSize.

getCompileCountback to summary
public long getCompileCount()

Implements org.jruby.compiler.JITCompilerMBean.getCompileCount.

getCompileTimeback to summary
public long getCompileTime()

Implements org.jruby.compiler.JITCompilerMBean.getCompileTime.

getCompileTimeAverageback to summary
public long getCompileTimeAverage()

Implements org.jruby.compiler.JITCompilerMBean.getCompileTimeAverage.

getFailCountback to summary
public long getFailCount()

Implements org.jruby.compiler.JITCompilerMBean.getFailCount.

getFrameAwareMethodsback to summary
public String[] getFrameAwareMethods()

Implements org.jruby.compiler.JITCompilerMBean.getFrameAwareMethods.

getHashForBytesback to summary
public static String getHashForBytes(byte[] bytes)
getHashForStringback to summary
public static String getHashForString(String str)
getIRAverageSizeback to summary
public long getIRAverageSize()

Implements org.jruby.compiler.JITCompilerMBean.getIRAverageSize.

getIRLargestSizeback to summary
public long getIRLargestSize()

Implements org.jruby.compiler.JITCompilerMBean.getIRLargestSize.

getIRSizeback to summary
public long getIRSize()

Implements org.jruby.compiler.JITCompilerMBean.getIRSize.

getLoaderForback to summary
pack-priv ClassDefiningClassLoader getLoaderFor(final String source)
getScopeAwareMethodsback to summary
public String[] getScopeAwareMethods()

Implements org.jruby.compiler.JITCompilerMBean.getScopeAwareMethods.

getSuccessCountback to summary
public long getSuccessCount()

Implements org.jruby.compiler.JITCompilerMBean.getSuccessCount.

getTaskForback to summary
public Runnable getTaskFor(ThreadContext context, Compilable<T> method)
isShutdownback to summary
public boolean isShutdown()

Return the shutdown status of the JIT compiler.

Returns:boolean

true if already shut down, false otherwise

logback to summary
pack-priv static void log(Compilable<?> target, String name, String message, Object... reason)

Deprecated

since 10.0.

Annotations
@Deprecated
since:10.0
logback to summary
pack-priv static void log(ThreadContext context, Compilable<?> target, String name, String message, Object... reason)
shutdownback to summary
public void shutdown()

Shut down this JIT compiler and its resources. No more JIT jobs will be submitted for optimization.

tearDownback to summary
public void tearDown()
org.jruby.compiler back to summary

private Class JITCompiler.SharedClassLoaderMap

extends AbstractMap<String, ClassDefiningClassLoader>
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final ClassDefiningClassLoader

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
clear()

Overrides java.util.AbstractMap.clear.

Implements java.util.Map.clear.

Removes all of the mappings from this map (optional operation).

public Set<Map.Entry<String, ClassDefiningClassLoader>>
entrySet()

Implements abstract java.util.AbstractMap.entrySet.

Implements java.util.Map.entrySet.

Returns a Set view of the mappings contained in this map.

public ClassDefiningClassLoader
get(final Object
the key whose associated value is to be returned
key
)

Overrides java.util.AbstractMap.get.

Implements java.util.Map.get.

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

public ClassDefiningClassLoader
put(String
key with which the specified value is to be associated
key
,
ClassDefiningClassLoader
value to be associated with the specified key
value
)

Overrides java.util.AbstractMap.put.

Implements java.util.Map.put.

Associates the specified value with the specified key in this map (optional operation).

public int
size()

Overrides java.util.AbstractMap.size.

Implements java.util.Map.size.

Returns the number of key-value mappings in this map.

Inherited from java.util.AbstractMap:
clonecontainsKeycontainsValueequalshashCodeisEmptykeySetputAllremovetoStringvalues

Field Detail

valueback to summary
pack-priv final ClassDefiningClassLoader value

Constructor Detail

SharedClassLoaderMapback to summary
pack-priv SharedClassLoaderMap(ClassDefiningClassLoader value)

Method Detail

clearback to summary
public void clear()

Overrides java.util.AbstractMap.clear.

Implements java.util.Map.clear.

Doc from java.util.AbstractMap.clear.

Removes all of the mappings from this map (optional operation). The map will be empty after this call returns.

Annotations
@Override
entrySetback to summary
public Set<Map.Entry<String, ClassDefiningClassLoader>> entrySet()

Implements abstract java.util.AbstractMap.entrySet.

Implements java.util.Map.entrySet.

Doc from java.util.Map.entrySet.

Returns a Set view of the mappings contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress (except through the iterator's own remove operation, or through the setValue operation on a map entry returned by the iterator) the results of the iteration are undefined. The set supports element removal, which removes the corresponding mapping from the map, via the Iterator.remove, Set.remove, removeAll, retainAll and clear operations. It does not support the add or addAll operations.

Returns:Set<Map.Entry<String, ClassDefiningClassLoader>>

a set view of the mappings contained in this map

Annotations
@Override
getback to summary
public ClassDefiningClassLoader get(final Object key)

Overrides java.util.AbstractMap.get.

Implements java.util.Map.get.

Doc from java.util.AbstractMap.get.

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

More formally, if this map contains a mapping from a key k to a value v such that Objects.equals(key, k), then this method returns v; otherwise it returns null. (There can be at most one such mapping.)

If this map permits null values, then a return value of null does not necessarily indicate that the map contains no mapping for the key; it's also possible that the map explicitly maps the key to null. The containsKey operation may be used to distinguish these two cases.

Parameters
key:Object

Doc from java.util.Map.get.

the key whose associated value is to be returned

Returns:ClassDefiningClassLoader

Doc from java.util.Map.get.

the value to which the specified key is mapped, or null if this map contains no mapping for the key

Annotations
@Override
putback to summary
public ClassDefiningClassLoader put(String key, ClassDefiningClassLoader value)

Overrides java.util.AbstractMap.put.

Implements java.util.Map.put.

Doc from java.util.AbstractMap.put.

Associates the specified value with the specified key in this map (optional operation). If the map previously contained a mapping for the key, the old value is replaced by the specified value. (A map m is said to contain a mapping for a key k if and only if m.containsKey(k) would return true.)

Parameters
key:String

Doc from java.util.Map.put.

key with which the specified value is to be associated

value:ClassDefiningClassLoader

Doc from java.util.Map.put.

value to be associated with the specified key

Returns:ClassDefiningClassLoader

Doc from java.util.Map.put.

the previous value associated with key, or null if there was no mapping for key. (A null return can also indicate that the map previously associated null with key, if the implementation supports null values.)

Annotations
@Override
sizeback to summary
public int size()

Overrides java.util.AbstractMap.size.

Implements java.util.Map.size.

Doc from java.util.AbstractMap.size.

Returns the number of key-value mappings in this map. If the map contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

Doc from java.util.Map.size.

the number of key-value mappings in this map

Annotations
@Override
org.jruby.compiler back to summary

pack-priv abstract Class JITCompiler.Task

extends Object
implements Runnable
Class Inheritance
All Implemented Interfaces
java.lang.Runnable
Known Direct Subclasses
org.jruby.compiler.MethodCompiledJITTask, org.jruby.compiler.MethodJITTask, org.jruby.compiler.BlockJITTask

Field Summary

Modifier and TypeField and Description
protected final JITCompiler

Constructor Summary

AccessConstructor and Description
public
Task(JITCompiler jitCompiler)

Method Summary

Modifier and TypeMethod and Description
protected Class<?>
defineClass(final JITClassGenerator generator, final JVMVisitor visitor, final IRScope scope, final InterpreterContext interpreterContext)

protected abstract void
pack-priv ClassDefiningClassLoader
protected String
protected void
jitFailed(ThreadContext context, final Throwable ex)

protected void
protected abstract void
logImpl(ThreadContext context, String msg, Object... cause)

protected void
public void
run()

Implements java.lang.Runnable.run.

Runs this operation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

jitCompilerback to summary
protected final JITCompiler jitCompiler

Constructor Detail

Taskback to summary
public Task(JITCompiler jitCompiler)

Method Detail

defineClassback to summary
protected Class<?> defineClass(final JITClassGenerator generator, final JVMVisitor visitor, final IRScope scope, final InterpreterContext interpreterContext)
execback to summary
protected abstract void exec(ThreadContext context) throws Exception
getCodeLoaderback to summary
pack-priv ClassDefiningClassLoader getCodeLoader()
getSourceFileback to summary
protected String getSourceFile()
jitFailedback to summary
protected void jitFailed(ThreadContext context, final Throwable ex)
logFailedback to summary
protected void logFailed(ThreadContext context, Throwable ex)
logImplback to summary
protected abstract void logImpl(ThreadContext context, String msg, Object... cause)
logJittedback to summary
protected void logJitted(ThreadContext context)
runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.