public class Procedure extends PropertySet
Modifier and Type | Field and Description |
---|---|
static java.lang.invoke.MethodType |
applyMethodType |
static java.lang.invoke.MethodHandle |
applyToConsumerDefault |
protected java.lang.invoke.MethodHandle |
applyToConsumerMethod |
static java.lang.invoke.MethodHandle |
applyToObjectDefault |
protected java.lang.invoke.MethodHandle |
applyToObjectMethod
A static method with signature ??apply(Procedure,CallContext)
|
static LazyPropertyKey<?> |
compilerKey |
static Symbol |
compilerXKey |
static Symbol |
inlineIfConstantSymbol |
static Symbol |
validateApplyKey
Key for a property used by gnu.expr.Inlinecalls.
|
static Symbol |
validateXApplyKey
Same as validateApplyKey but handles splice args.
|
nameKey
Constructor and Description |
---|
Procedure() |
Procedure(boolean resultGoesToConsumer,
java.lang.invoke.MethodHandle applyMethod) |
Procedure(boolean resultGoesToConsumer,
java.lang.invoke.MethodHandle applyMethod,
java.lang.String n) |
Procedure(java.lang.String n) |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
apply0() |
java.lang.Object |
apply1(java.lang.Object arg1) |
java.lang.Object |
apply2(java.lang.Object arg1,
java.lang.Object arg2) |
java.lang.Object |
apply3(java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3) |
java.lang.Object |
apply4(java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4) |
java.lang.Object |
applyL(ArgList args) |
java.lang.Object |
applyN(java.lang.Object[] args) |
static java.lang.Object |
applyToConsumerDefault(Procedure proc,
CallContext ctx) |
static java.lang.Object |
applyToObjectDefault(Procedure proc,
CallContext ctx) |
static void |
checkArgCount(Procedure proc,
int argCount)
Check that the number of arguments in a call is valid.
|
void |
checkBadCode(CallContext ctx) |
java.lang.invoke.MethodHandle |
getApplyMethod() |
java.lang.invoke.MethodHandle |
getApplyToConsumerMethod() |
java.lang.invoke.MethodHandle |
getApplyToObjectMethod() |
Type |
getReturnType(Expression[] args)
Semi-deprecated - instead should be set at Inline time.
|
Procedure |
getSetter() |
java.lang.String |
getSourceLocation() |
boolean |
isSideEffectFree()
True if this Procedure (definitely) has no side-effects.
|
static java.lang.invoke.MethodHandle |
lookupApplyHandle(java.lang.Class clas,
java.lang.String mname) |
int |
maxArgs()
Maximum number of arguments allowed, or -1 for unlimited.
|
static int |
maxArgs(int num)
Extract maximum number of arguments from
numArgs() encoding. |
int |
minArgs()
Minimum number of arguments required.
|
static int |
minArgs(int num)
Extract minimum number of arguments from
numArgs() encoding. |
int |
numArgs()
Return
minArgs()|(maxArgs<<12) . |
void |
set0(java.lang.Object result)
If HasSetter, the Procedure is called in the LHS of an assignment.
|
void |
set1(java.lang.Object arg1,
java.lang.Object value) |
void |
setN(java.lang.Object[] args) |
void |
setSetter(Procedure setter) |
void |
setSourceLocation(java.lang.String file,
int line) |
java.lang.String |
toString() |
getName, getProperty, getSymbol, removeProperty, setName, setProperty, setProperty, setSymbol
protected java.lang.invoke.MethodHandle applyToObjectMethod
protected java.lang.invoke.MethodHandle applyToConsumerMethod
public static final Symbol validateApplyKey
(ApplyExp exp, InlineCalls visitor, Type required, Procedure proc)
and returns a re-written/validated Expression
.public static final Symbol validateXApplyKey
public static final Symbol compilerXKey
public static final Symbol inlineIfConstantSymbol
public static final LazyPropertyKey<?> compilerKey
public static final java.lang.invoke.MethodType applyMethodType
public static final java.lang.invoke.MethodHandle applyToObjectDefault
public static final java.lang.invoke.MethodHandle applyToConsumerDefault
public Procedure()
public Procedure(java.lang.String n)
public Procedure(boolean resultGoesToConsumer, java.lang.invoke.MethodHandle applyMethod)
public Procedure(boolean resultGoesToConsumer, java.lang.invoke.MethodHandle applyMethod, java.lang.String n)
public void setSourceLocation(java.lang.String file, int line)
public java.lang.String getSourceLocation()
public final java.lang.invoke.MethodHandle getApplyToConsumerMethod()
public final java.lang.invoke.MethodHandle getApplyToObjectMethod()
public static java.lang.Object applyToConsumerDefault(Procedure proc, CallContext ctx) throws java.lang.Throwable
java.lang.Throwable
public static java.lang.Object applyToObjectDefault(Procedure proc, CallContext ctx) throws java.lang.Throwable
java.lang.Throwable
public java.lang.invoke.MethodHandle getApplyMethod()
public void checkBadCode(CallContext ctx)
public java.lang.Object applyL(ArgList args) throws java.lang.Throwable
java.lang.Throwable
public java.lang.Object applyN(java.lang.Object[] args) throws java.lang.Throwable
java.lang.Throwable
public java.lang.Object apply0() throws java.lang.Throwable
java.lang.Throwable
public java.lang.Object apply1(java.lang.Object arg1) throws java.lang.Throwable
java.lang.Throwable
public java.lang.Object apply2(java.lang.Object arg1, java.lang.Object arg2) throws java.lang.Throwable
java.lang.Throwable
public java.lang.Object apply3(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3) throws java.lang.Throwable
java.lang.Throwable
public java.lang.Object apply4(java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4) throws java.lang.Throwable
java.lang.Throwable
public final int minArgs()
public final int maxArgs()
public int numArgs()
minArgs()|(maxArgs<<12)
.
We use a single virtual function to reduce the number of methods
in the system, as well as the number of virtual method table entries.
We shift by 12 so the number can normally be represented using a
sipush instruction, without requiring a constant pool entry.public static int minArgs(int num)
numArgs()
encoding.public static int maxArgs(int num)
numArgs()
encoding.public static void checkArgCount(Procedure proc, int argCount)
proc
- the Procedure being calledargCount
- the number of arguments in the callWrongArguments
- there are too many or too
few actual argumentspublic Procedure getSetter()
public void setSetter(Procedure setter)
public void set0(java.lang.Object result) throws java.lang.Throwable
java.lang.Throwable
public void set1(java.lang.Object arg1, java.lang.Object value) throws java.lang.Throwable
java.lang.Throwable
public void setN(java.lang.Object[] args) throws java.lang.Throwable
java.lang.Throwable
public boolean isSideEffectFree()
public Type getReturnType(Expression[] args)
public java.lang.String toString()
toString
in class java.lang.Object
public static java.lang.invoke.MethodHandle lookupApplyHandle(java.lang.Class clas, java.lang.String mname)