public class CallSiteDescriptorFactory extends Object
CallSiteDescriptor
internally, and chooses the most space-efficient one based on the input.Modifier and Type | Method and Description |
---|---|
static CallSiteDescriptor |
changeParameterType(CallSiteDescriptor desc,
int num,
Class<?> nptype)
Returns a new call site descriptor that is identical to the passed one, except that it has a single parameter
type changed in its method type.
|
static CallSiteDescriptor |
changeReturnType(CallSiteDescriptor desc,
Class<?> nrtype)
Returns a new call site descriptor that is identical to the passed one, except that it has the return type
changed in its method type.
|
static CallSiteDescriptor |
create(MethodHandles.Lookup lookup,
String name,
MethodType methodType)
Creates a new call site descriptor instance.
|
static CallSiteDescriptor |
dropParameterTypes(CallSiteDescriptor desc,
int start,
int end)
Returns a new call site descriptor that is identical to the passed one, except that it has some parameter types
removed from its method type.
|
static CallSiteDescriptor |
insertParameterTypes(CallSiteDescriptor desc,
int num,
Class<?>... ptypesToInsert)
Returns a new call site descriptor that is identical to the passed one, except that it has additional parameter
types inserted into its method type.
|
static CallSiteDescriptor |
insertParameterTypes(CallSiteDescriptor desc,
int num,
List<Class<?>> ptypesToInsert)
Returns a new call site descriptor that is identical to the passed one, except that it has additional parameter
types inserted into its method type.
|
static String[] |
tokenizeName(String name)
Tokenizes the composite name along colons, as well as
demangles and interns
the tokens. |
static List<String> |
tokenizeOperators(CallSiteDescriptor desc)
Tokenizes a composite operation name along pipe characters.
|
public static CallSiteDescriptor create(MethodHandles.Lookup lookup, String name, MethodType methodType)
lookup
- the lookup that determines access rights at the call site. If your language runtime doesn't have
equivalents of Java access concepts, just use MethodHandles.publicLookup()
. Must not be null.name
- the name of the method at the call site. Must not be null.methodType
- the type of the method at the call site. Must not be null.public static String[] tokenizeName(String name)
demangles
and interns
the tokens. The first two tokens are not demangled as they are supposed to be the naming scheme and the name of
the operation which can be expected to consist of just alphabetical characters.name
- the composite name consisting of colon-separated, possibly mangled tokens.public static List<String> tokenizeOperators(CallSiteDescriptor desc)
desc
- the call site descriptor with the operationpublic static CallSiteDescriptor dropParameterTypes(CallSiteDescriptor desc, int start, int end)
desc
- the original call site descriptorstart
- index of the first parameter to removeend
- index of the first parameter to not removepublic static CallSiteDescriptor changeParameterType(CallSiteDescriptor desc, int num, Class<?> nptype)
desc
- the original call site descriptornum
- index of the parameter to changenptype
- the new parameter typepublic static CallSiteDescriptor changeReturnType(CallSiteDescriptor desc, Class<?> nrtype)
desc
- the original call site descriptornrtype
- the new return typepublic static CallSiteDescriptor insertParameterTypes(CallSiteDescriptor desc, int num, Class<?>... ptypesToInsert)
desc
- the original call site descriptornum
- index at which the new parameters are insertedptypesToInsert
- the new types to insertpublic static CallSiteDescriptor insertParameterTypes(CallSiteDescriptor desc, int num, List<Class<?>> ptypesToInsert)
desc
- the original call site descriptornum
- index at which the new parameters are insertedptypesToInsert
- the new types to insertCopyright © 2019 Attila Szegedi. All rights reserved.