public class PrimProcedure extends MethodProc
Modifier and Type | Field and Description |
---|---|
static java.lang.invoke.MethodHandle |
applyToConsumer |
static boolean |
explicitArrayAsVarArgsAllowed
Support passing an explicit array to a varargs function.
|
applyToConsumerDefaultMP, NO_MATCH, NO_MATCH_AMBIGUOUS, NO_MATCH_BAD_TYPE, NO_MATCH_GUARD_FALSE, NO_MATCH_TOO_FEW_ARGS, NO_MATCH_TOO_MANY_ARGS, NO_MATCH_UNUSED_KEYWORD, THROW_ON_EXCEPTION
applyToObject, noArgs
applyMethodType, applyToConsumerDefault, applyToConsumerMethod, applyToObjectDefault, applyToObjectMethod, compilerKey, compilerXKey, inlineIfConstantSymbol, validateApplyKey, validateXApplyKey
nameKey
Constructor and Description |
---|
PrimProcedure(int op_code,
ClassType classtype,
java.lang.String name,
Type retType,
Type[] argTypes) |
PrimProcedure(int opcode,
Type retType,
Type[] argTypes) |
PrimProcedure(Method method) |
PrimProcedure(Method method,
char mode,
Language language,
ParameterizedType parameterizedType) |
PrimProcedure(Method method,
LambdaExp source) |
PrimProcedure(java.lang.reflect.Method method,
Language language) |
PrimProcedure(Method method,
Language language) |
PrimProcedure(Method method,
Type retType,
Type[] argTypes) |
PrimProcedure(java.lang.String className,
java.lang.String methodName,
int numArgs) |
Modifier and Type | Method and Description |
---|---|
static java.lang.Object |
applyToConsumer(Procedure proc,
CallContext ctx) |
java.lang.Object |
applyToConsumerX(CallContext ctx) |
boolean |
canCompile(ApplyExp exp) |
boolean |
compile(ApplyExp exp,
Compilation comp,
Target target) |
static void |
compileInvoke(Compilation comp,
Method method,
Target target,
boolean isTailCall,
int op_code,
Type returnType,
boolean doFixUnsigned)
Emit the actual invoke operation, after arguments have been pushed.
|
static void |
compileReachedUnexpected(CodeAttr code) |
static void |
compileRestArg(Type arg_type,
ApplyExp exp,
int startArg,
int i,
Compilation comp) |
static Type |
decodeType(Type javaType,
java.lang.String[] annotTypes,
int annotIndex,
ParameterizedType parameterizedType,
Language lang) |
static void |
disassemble(Procedure proc,
ClassTypeWriter cwriter) |
static void |
disassemble(Procedure proc,
java.io.Writer out) |
static void |
disassemble$X(Procedure pproc,
CallContext ctx) |
ClassType |
getDeclaringClass() |
Method |
getMethod() |
static PrimProcedure |
getMethodFor(java.lang.Class procClass,
java.lang.String name,
Declaration decl,
Expression[] args,
Language language)
Get PrimProcedure for matching method in given class.
|
static PrimProcedure |
getMethodFor(ClassType procClass,
java.lang.String name,
Declaration decl,
Expression[] args,
Language language) |
static PrimProcedure |
getMethodFor(ClassType procClass,
java.lang.String name,
Declaration decl,
Type[] atypes,
Language language) |
static PrimProcedure |
getMethodFor(Procedure pproc,
Declaration decl,
Expression[] args,
Language language)
Search for a matching static method in a procedure's class.
|
static PrimProcedure |
getMethodFor(Procedure pproc,
Declaration decl,
Type[] atypes,
Language language) |
static PrimProcedure |
getMethodFor(Procedure pproc,
Expression[] args) |
java.lang.String |
getName() |
Type |
getParameterType(int index) |
Type[] |
getParameterTypes() |
static java.lang.Class |
getProcedureClass(java.lang.Object pproc) |
Type |
getReturnType() |
Type |
getReturnType(Expression[] args)
Semi-deprecated - instead should be set at Inline time.
|
boolean |
getStaticFlag()
True if there is no 'this' parameter.
|
java.lang.String |
getVerboseName() |
boolean |
isAbstract() |
int |
isApplicable(Type[] argTypes,
Type restType)
Test if method is applicable to an invocation with given arguments.
|
boolean |
isConstructor() |
boolean |
isSideEffectFree()
True if this Procedure (definitely) has no side-effects.
|
boolean |
isSpecial() |
static PrimProcedure |
makeBuiltinBinary(int opcode,
Type type) |
static PrimProcedure |
makeBuiltinUnary(int opcode,
Type type) |
static int |
mostSpecific(PrimProcedure[] procs,
int length)
Return the index of the most specific method.
|
int |
numArgs()
The (minimum, number) of arguments.
|
int |
opcode() |
void |
print(java.io.PrintWriter ps) |
void |
setMethodForInvoke(Method m) |
void |
setReturnType(Type retType) |
void |
setSideEffectFree() |
boolean |
takesContext() |
static boolean |
takesContext(Method method) |
boolean |
takesTarget()
Whether we are passed an argument for the 'target' / 'receiver' / 'this'.
|
boolean |
takesVarArgs()
Return true iff the last parameter is a "rest" argument.
|
static boolean |
takesVarArgs(Method method) |
java.lang.String |
toString() |
applyToConsumerDefaultMP, matchFailAsException, mostSpecific, numParameters, overrideEquivalent, resolveParameterTypes
applyToObject
apply0, apply1, apply2, apply3, apply4, applyL, applyN, applyToConsumerDefault, applyToObjectDefault, checkArgCount, checkBadCode, getApplyMethod, getApplyToConsumerMethod, getApplyToObjectMethod, getSetter, getSourceLocation, lookupApplyHandle, maxArgs, maxArgs, minArgs, minArgs, set0, set1, setN, setSetter, setSourceLocation
getProperty, getSymbol, removeProperty, setName, setProperty, setProperty, setSymbol
public static boolean explicitArrayAsVarArgsAllowed
public static final java.lang.invoke.MethodHandle applyToConsumer
public PrimProcedure(java.lang.String className, java.lang.String methodName, int numArgs)
public PrimProcedure(java.lang.reflect.Method method, Language language)
public PrimProcedure(Method method)
public PrimProcedure(Method method, char mode, Language language, ParameterizedType parameterizedType)
public final int opcode()
public Type getReturnType()
public void setReturnType(Type retType)
public boolean isSpecial()
public Type getReturnType(Expression[] args)
Procedure
getReturnType
in class Procedure
public ClassType getDeclaringClass()
public Method getMethod()
public void setMethodForInvoke(Method m)
public boolean isSideEffectFree()
Procedure
isSideEffectFree
in class Procedure
public void setSideEffectFree()
public boolean takesVarArgs()
public static boolean takesVarArgs(Method method)
public boolean takesContext()
public static boolean takesContext(Method method)
public int isApplicable(Type[] argTypes, Type restType)
MethodProc
isApplicable
in class MethodProc
argTypes
- array of known "single" arguments.restType
- If null, the arguments are fully specified by argTypes.
If non-null, there may be an unknown number of extra arguments
of the given restType. This is used for splices, where we usually
don't know at compile-time how many argument values we have.public boolean isAbstract()
public final boolean isConstructor()
public boolean takesTarget()
object.name(args...)
(Java syntax) or
(invoke object 'name args...)
(Scheme syntax).
This includes when the object
is implied.
In this case we need to ignore the first argument's value.public int numArgs()
public static java.lang.Object applyToConsumer(Procedure proc, CallContext ctx) throws java.lang.Throwable
java.lang.Throwable
public java.lang.Object applyToConsumerX(CallContext ctx) throws java.lang.Throwable
java.lang.Throwable
public static Type decodeType(Type javaType, java.lang.String[] annotTypes, int annotIndex, ParameterizedType parameterizedType, Language lang)
public static PrimProcedure makeBuiltinUnary(int opcode, Type type)
public static PrimProcedure makeBuiltinBinary(int opcode, Type type)
public final boolean getStaticFlag()
public final Type[] getParameterTypes()
public static final void compileRestArg(Type arg_type, ApplyExp exp, int startArg, int i, Compilation comp)
public boolean canCompile(ApplyExp exp)
public boolean compile(ApplyExp exp, Compilation comp, Target target)
public static void compileInvoke(Compilation comp, Method method, Target target, boolean isTailCall, int op_code, Type returnType, boolean doFixUnsigned)
public static void compileReachedUnexpected(CodeAttr code)
public Type getParameterType(int index)
getParameterType
in class MethodProc
public static int mostSpecific(PrimProcedure[] procs, int length)
public static PrimProcedure getMethodFor(Procedure pproc, Expression[] args)
public static PrimProcedure getMethodFor(Procedure pproc, Declaration decl, Expression[] args, Language language)
public static PrimProcedure getMethodFor(Procedure pproc, Declaration decl, Type[] atypes, Language language)
public static void disassemble$X(Procedure pproc, CallContext ctx) throws java.lang.Exception
java.lang.Exception
public static void disassemble(Procedure proc, java.io.Writer out) throws java.lang.Exception
java.lang.Exception
public static void disassemble(Procedure proc, ClassTypeWriter cwriter) throws java.lang.Exception
java.lang.Exception
public static java.lang.Class getProcedureClass(java.lang.Object pproc)
public static PrimProcedure getMethodFor(java.lang.Class procClass, java.lang.String name, Declaration decl, Expression[] args, Language language)
public static PrimProcedure getMethodFor(ClassType procClass, java.lang.String name, Declaration decl, Expression[] args, Language language)
public static PrimProcedure getMethodFor(ClassType procClass, java.lang.String name, Declaration decl, Type[] atypes, Language language)
public java.lang.String getName()
getName
in interface Named
getName
in class PropertySet
public java.lang.String getVerboseName()
public void print(java.io.PrintWriter ps)