public final class ClassfileBytecodeProvider extends Object implements BytecodeProvider
BytecodeProvider that provides bytecode properties of a ResolvedJavaMethod as
parsed from a class file. This avoids all instrumentation and any bytecode rewriting performed by the VM.
This mechanism retrieves class files based on the name and ClassLoader of existing
Class instances. It bypasses all VM parsing and verification of the class file and
assumes the class files are well formed. As such, it should only be used for classes from a
trusted source such as the boot class (or module) path.
A combination of Class.forName(String) and an existing MetaAccessProvider is used
to resolve constant pool references. This opens up the opportunity for linkage errors if the
referee is structurally changed through redefinition (e.g., a referred to method is renamed or
deleted). This will result in an appropriate LinkageError being thrown. The only way to
avoid this is to have a completely isolated jdk.vm.ci.meta implementation for parsing
snippet/intrinsic bytecodes.| Constructor and Description |
|---|
ClassfileBytecodeProvider(MetaAccessProvider metaAccess,
SnippetReflectionProvider snippetReflection) |
ClassfileBytecodeProvider(MetaAccessProvider metaAccess,
SnippetReflectionProvider snippetReflection,
ClassLoader loader) |
| Modifier and Type | Method and Description |
|---|---|
Bytecode |
getBytecode(ResolvedJavaMethod method)
Gets a
Bytecode object that supplies bytecode properties for method. |
boolean |
shouldRecordMethodDependencies()
Determines if methods parsed using this provider should be recorded so that method
redefinition can invalidate the resulting code.
|
boolean |
supportsInvokedynamic()
Determines if this provider supports the INVOKEDYNAMIC bytecode.
|
public ClassfileBytecodeProvider(MetaAccessProvider metaAccess,
SnippetReflectionProvider snippetReflection)
public ClassfileBytecodeProvider(MetaAccessProvider metaAccess,
SnippetReflectionProvider snippetReflection,
ClassLoader loader)
public Bytecode getBytecode(ResolvedJavaMethod method)
BytecodeProviderBytecode object that supplies bytecode properties for method.getBytecode in interface BytecodeProviderpublic boolean supportsInvokedynamic()
BytecodeProvidersupportsInvokedynamic in interface BytecodeProviderpublic boolean shouldRecordMethodDependencies()
BytecodeProvidershouldRecordMethodDependencies in interface BytecodeProvider