< prev index next >

src/jdk/nashorn/internal/runtime/CodeInstaller.java

Print this page
rev 1901 : 8135251: Use Unsafe.defineAnonymousClass for loading Nashorn script code
Reviewed-by: hannesw, lagergren, sundar


  84      * @param cacheKey key to use in cache
  85      * @param source the script source
  86      * @param mainClassName the main class name
  87      * @param classBytes map of class names to class bytes
  88      * @param initializers compilation id -&gt; FunctionInitializer map
  89      * @param constants constants array
  90      * @param compilationId compilation id
  91      */
  92     public void storeScript(final String cacheKey, final Source source, final String mainClassName, final Map<String, byte[]> classBytes,
  93             final Map<Integer, FunctionInitializer> initializers, final Object[] constants, final int compilationId);
  94 
  95     /**
  96      * Load a previously compiled script
  97      * @param source the script source
  98      * @param functionKey the function id and signature
  99      * @return compiled script data
 100      */
 101     public StoredScript loadScript(Source source, String functionKey);
 102 
 103     /**
 104      * Returns a new code installer that shares most of the functionality of this code installer, but uses a
 105      * new, independent class loader.
 106      * @return a new code installer with a new independent class loader.
 107      */
 108     public CodeInstaller withNewLoader();








 109 
 110     /**
 111      * Returns true if this code installer is compatible with the other code installer. Compatibility is expected to be
 112      * an equivalence relation, and installers are supposed to be compatible with those they create using
 113      * {@link #withNewLoader()}.
 114      * @param other the other code installer tested for compatibility with this code installer.
 115      * @return true if this code installer is compatible with the other code installer.
 116      */
 117     public boolean isCompatibleWith(CodeInstaller other);
 118 
 119 }


  84      * @param cacheKey key to use in cache
  85      * @param source the script source
  86      * @param mainClassName the main class name
  87      * @param classBytes map of class names to class bytes
  88      * @param initializers compilation id -&gt; FunctionInitializer map
  89      * @param constants constants array
  90      * @param compilationId compilation id
  91      */
  92     public void storeScript(final String cacheKey, final Source source, final String mainClassName, final Map<String, byte[]> classBytes,
  93             final Map<Integer, FunctionInitializer> initializers, final Object[] constants, final int compilationId);
  94 
  95     /**
  96      * Load a previously compiled script
  97      * @param source the script source
  98      * @param functionKey the function id and signature
  99      * @return compiled script data
 100      */
 101     public StoredScript loadScript(Source source, String functionKey);
 102 
 103     /**
 104      * Returns a code installer {@code #isCompatibleWith(CodeInstaller) compatible with} this installer, but
 105      * is suitable for on-demand compilations. Can return itself if it is itself suitable.
 106      * @return a compatible code installer suitable for on-demand compilations.
 107      */
 108     public CodeInstaller getOnDemandCompilationInstaller();
 109 
 110     /**
 111      * Returns a code installer {@code #isCompatibleWith(CodeInstaller) compatible with} this installer, but
 112      * is suitable for installation of multiple classes that reference each other by name. Should be used when
 113      * a compilation job produces multiple compilation units. Can return itself if it is itself suitable.
 114      * @return a compatible code installer suitable for installation of multiple classes.
 115      */
 116     public CodeInstaller getMultiClassCodeInstaller();
 117 
 118     /**
 119      * Returns true if this code installer is compatible with the other code installer. Compatibility is expected to be
 120      * an equivalence relation, and installers are supposed to be compatible with those they create using
 121      * {@link #getOnDemandCompilationInstaller()}.
 122      * @param other the other code installer tested for compatibility with this code installer.
 123      * @return true if this code installer is compatible with the other code installer.
 124      */
 125     public boolean isCompatibleWith(CodeInstaller other);
 126 
 127 }
< prev index next >