
public final class CompilingClassLoader extends ClassLoader implements DispatchIdOracle
ClassLoader for running all user code. All user files are
compiled from source code byte a ByteCodeCompiler. After compilation,
some byte code rewriting is performed to support
JavaScriptObject and its subtypes.
TODO: we should refactor this class to move the getClassInfoByDispId,
getDispId, getMethodDispatch and putMethodDispatch into a separate entity
since they really do not interact with the CompilingClassLoader
functionality.| Constructor and Description |
|---|
CompilingClassLoader(TreeLogger logger,
CompilationState compilationState,
ShellJavaScriptHost javaScriptHost) |
| Modifier and Type | Method and Description |
|---|---|
protected Class<?> |
findClass(String className) |
Object |
getCachedJso(int uniqueId)
Retrieves the mapped JSO for a given unique id, provided the id was
previously cached and the JSO has not been garbage collected.
|
DispatchClassInfo |
getClassInfoByDispId(int dispId)
Returns the
DispatchClassInfo for a given dispatch id. |
int |
getDispId(String jsniMemberRef)
Returns the dispatch id for a JSNI member reference.
|
Object |
getWrapperForObject(Object javaObject)
Retrieves the mapped wrapper for a given Java Object, provided the wrapper
was previously cached and has not been garbage collected.
|
protected Class<?> |
loadClass(String name,
boolean resolve)
Remove some of the excess locking that we'd normally inherit from loadClass.
|
void |
putCachedJso(int uniqueId,
Object jso)
Weakly caches a given JSO by unique id.
|
void |
putWrapperForObject(Object javaObject,
Object wrapper)
Weakly caches a wrapper for a given Java Object.
|
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSignerspublic CompilingClassLoader(TreeLogger logger, CompilationState compilationState, ShellJavaScriptHost javaScriptHost) throws UnableToCompleteException
UnableToCompleteExceptionpublic Object getCachedJso(int uniqueId)
uniqueId - the previously stored unique idnull if the id was not previously
mapped or if the JSO has been garbage collectedpublic DispatchClassInfo getClassInfoByDispId(int dispId)
DispatchClassInfo for a given dispatch id.getClassInfoByDispId in interface DispatchIdOracledispId - dispatch identifierDispatchClassInfo for a given dispatch id or null if one
does not existpublic int getDispId(String jsniMemberRef)
getDispId in interface DispatchIdOraclejsniMemberRef - a JSNI member referencepublic Object getWrapperForObject(Object javaObject)
javaObject - the Object being wrappednull if the Java object mapped
or if the wrapper has been garbage collectedpublic void putCachedJso(int uniqueId,
Object jso)
uniqueId - a unique id associated with the JSOjso - the value to cachepublic void putWrapperForObject(Object javaObject, Object wrapper)
javaObject - the Object being wrappedwrapper - the mapped wrapperprotected Class<?> findClass(String className) throws ClassNotFoundException
findClass in class ClassLoaderClassNotFoundExceptionprotected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException
loadClass in class ClassLoaderClassNotFoundExceptionCopyright © 2018. All rights reserved.