Record Class JitCompiledPassageClass
- Record Components:
lookup- the means of accessing the generated class's elementscls- the generated class as loaded into this JVMconstructor- the reflected constructor having signatureCONSTRUCTOR_TYPE
This is the output of JitCompiler.compilePassage(Lookup, JitPassage), and it will be
cached (indirectly) by JitPcodeEmulator. The emulator actually caches the various entry
points returned by getBlockEntries(). Each of those retains a reference to this object.
An JitCompiledPassage.EntryPointPrototype pairs this with a entry block ID. That prototype can then be
instantiated/bound to a thread, producing an JitCompiledPassage.EntryPoint. That bound entry point is
produced by invoking createInstance(JitPcodeThread) and just copying the block id.
This object wraps the generated (and now loaded) class and provides the mechanisms for reflecting
and processing the ENTRIES field, and for reflecting and invoking the generated
constructor. Note that explicit invocation of the static initializer via reflection is not
necessary.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MethodTypeThe constructor signature:Passage$at_[entry](JitPcodeThread) -
Constructor Summary
ConstructorsConstructorDescriptionJitCompiledPassageClass(MethodHandles.Lookup lookup, Class<? extends JitCompiledPassage> cls, MethodHandle constructor) Creates an instance of aJitCompiledPassageClassrecord class. -
Method Summary
Modifier and TypeMethodDescriptionClass<? extends JitCompiledPassage> cls()Returns the value of theclsrecord component.Returns the value of theconstructorrecord component.createInstance(JitPcodeThread thread) Create an instance bound to the given threadfinal booleanIndicates whether some other object is "equal to" this one.Get the entry points for this compiled passagefinal inthashCode()Returns a hash code value for this object.static JitCompiledPassageClassload(MethodHandles.Lookup lookup, byte[] bytes) Load the generated class from the given byteslookup()Returns the value of thelookuprecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
CONSTRUCTOR_TYPE
The constructor signature:Passage$at_[entry](JitPcodeThread)
-
-
Constructor Details
-
JitCompiledPassageClass
public JitCompiledPassageClass(MethodHandles.Lookup lookup, Class<? extends JitCompiledPassage> cls, MethodHandle constructor) Creates an instance of aJitCompiledPassageClassrecord class.- Parameters:
lookup- the value for thelookuprecord componentcls- the value for theclsrecord componentconstructor- the value for theconstructorrecord component
-
-
Method Details
-
load
Load the generated class from the given bytesThe bytes must define a class that implements
JitCompiledPassage. It must define a constructor having the signatureCONSTRUCTOR_TYPE, and it must define a static fieldList<AddrCtx> ENTRIES.- Parameters:
lookup- a lookup that can see all the elements the generated class needs. Likely, this should be from the emulator implementation, which may be an extension in a script.bytes- the classfile bytes- Returns:
- the wrapped class
-
createInstance
Create an instance bound to the given thread- Parameters:
thread- the thread- Returns:
- the instance, prepared to execute on the given thread
-
getBlockEntries
Get the entry points for this compiled passageThis processes the
ENTRIESfield, which is just a list of targets. The position of each target in the list corresponds to the block id accepted by the generatedJitCompiledPassage.run(int)method.- Returns:
- the map of targets to their corresponding entry point prototypes
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
lookup
Returns the value of thelookuprecord component.- Returns:
- the value of the
lookuprecord component
-
cls
Returns the value of theclsrecord component.- Returns:
- the value of the
clsrecord component
-
constructor
Returns the value of theconstructorrecord component.- Returns:
- the value of the
constructorrecord component
-