public class MethodBinding extends Object
Constructor and Description |
---|
MethodBinding(FunctionSymbol sym,
String delegationImplName,
JavaType javaReturnType,
List<JavaType> javaArgumentTypes,
JavaType containingType,
Type containingCType)
Constructor for calling a C function or a function pointer contained in a struct.
|
MethodBinding(MethodBinding bindingToCopy)
Constructs a new MethodBinding that is an exact clone of the
argument, including the java return type and java argument
types.
|
Modifier and Type | Method and Description |
---|---|
void |
addJavaArgumentType(JavaType type) |
boolean |
argumentsUseNIO()
Returns true if any of the outgoing arguments in the method's
signature require conversion or checking due to the use of New
I/O.
|
void |
clearThisPointer()
Clears any record of a this pointer for this MethodBinding.
|
protected void |
computeSignatureProperties()
Computes summary information about the method's C and Java
signatures.
|
boolean |
equals(Object obj) |
protected String |
erasedTypeDescriptor(JavaType type,
boolean eraseBufferAndArrayTypes,
boolean skipBuffers) |
void |
findThisPointer()
Find the leftmost argument matching the type of the containing
type (for function pointer MethodBindings) and record that as a
"this" pointer, meaning that it does not need to be explicitly
passed at the Java level.
|
String |
getArgumentName(int i)
Returns either the argument name specified by the underlying
FunctionSymbol or a fabricated argument name based on the
position.
|
Type |
getCArgumentType(int i) |
Type |
getContainingCType()
Retrieves the containing C type of this MethodBinding if it is for
a function pointer contained in a struct.
|
JavaType |
getContainingType()
Retrieves the containing type of this MethodBinding if it is for
a function pointer contained in a struct.
|
Type |
getCReturnType() |
FunctionSymbol |
getCSymbol()
Returns the
FunctionSymbol . |
String |
getDelegationImplName()
The
implementation delegation
name, or null for no delegation. |
String |
getDescriptor(boolean forImplementingMethodCall,
boolean eraseBufferAndArrayTypes)
Returns a String containing the descriptor (signature in
internal format) of this MethodBinding as it will be
emitted.
|
String |
getImplName()
Returns the
FunctionSymbol 's name for the implementation,
which is the current aliased API name per default,
or the delegation name. |
String |
getInterfaceName()
Returns the
FunctionSymbol 's current aliased API name for the interface. |
JavaType |
getJavaArgumentType(int i) |
JavaType |
getJavaReturnType() |
String |
getName()
Returns the
FunctionSymbol 's current aliased API name. |
String |
getNativeName()
Returns the
FunctionSymbol 's name for the native function
which is the original C API name per default,
but may be overridden via setNativeName(String) . |
int |
getNumArguments() |
boolean |
hasContainingType()
Indicates whether this MethodBinding is for a function pointer
contained in a struct, or to access array- or pointer-data from a struct.
|
int |
hashCode() |
boolean |
isArgumentThisPointer(int i)
Indicates whether the ith argument to this MethodBinding
is actually a "this" pointer.
|
boolean |
needsNIOWrappingOrUnwrapping()
Returns true if the function needs NIO-related
wrapping/unwrapping or conversion of various arguments.
|
MethodBinding |
replaceJavaArgumentType(int argumentNumber,
JavaType newArgType)
Creates a new MethodBinding replacing the specified Java
argument type with a new argument type.
|
void |
setJavaReturnType(JavaType type) |
void |
setNativeName(String s) |
boolean |
signatureCanUseIndirectNIO()
Returns true if it is possible for any of the outgoing arguments
to be indirect NIO buffers.
|
boolean |
signatureRequiresStaticInitialization()
Returns true if the wrapper implementation requires
static native code to be initialized, see
JavaConfiguration.forceStaticInitCode(String) . |
boolean |
signatureUsesArraysOfCompoundTypeWrappers()
Returns true if the return type or any of the outgoing arguments
in the method's signature use arrays of "compound type wrappers",
or NIO-based wrappers for C data structures.
|
boolean |
signatureUsesCArrays()
Returns true if the return type or any of the outgoing arguments
in the method's signature represent C arrays.
|
boolean |
signatureUsesCompoundTypeWrappers()
Returns true if the return type or any of the outgoing arguments
in the method's signature use "compound type wrappers", or
NIO-based wrappers for C data structures.
|
boolean |
signatureUsesCPrimitivePointers()
Returns true if the return type or any of the outgoing arguments
in the method's signature represent C primitive pointers.
|
boolean |
signatureUsesCVoidPointers()
Returns true if the return type or any of the outgoing arguments
in the method's signature represent C void* pointers.
|
boolean |
signatureUsesJavaPrimitiveArrays()
Returns true if the return type or any of the outgoing arguments
in the method's signature represent Java primitive arrays.
|
boolean |
signatureUsesNIO()
Returns true if the return type or any of the outgoing arguments
in the method's signature require conversion or checking due to
the use of New I/O.
|
String |
toString()
Returns the signature of this binding.
|
public MethodBinding(MethodBinding bindingToCopy)
public MethodBinding(FunctionSymbol sym, String delegationImplName, JavaType javaReturnType, List<JavaType> javaArgumentTypes, JavaType containingType, Type containingCType)
In case of the latter, a struct function pointer,
the arguments containingType
and containingCType
must not be null
!
public void setJavaReturnType(JavaType type)
public void addJavaArgumentType(JavaType type)
public JavaType getJavaReturnType()
public int getNumArguments()
public JavaType getJavaArgumentType(int i)
public Type getCReturnType()
public Type getCArgumentType(int i)
public FunctionSymbol getCSymbol()
FunctionSymbol
.public String getArgumentName(int i)
public String getName()
FunctionSymbol
's current aliased
API name.public String getDelegationImplName()
implementation delegation
name, or null
for no delegation.getImplName()
public String getInterfaceName()
FunctionSymbol
's current aliased
API name for the interface.public String getImplName()
FunctionSymbol
's name for the implementation,
which is the current aliased
API name per default,
or the delegation
name.getDelegationImplName()
public String getNativeName()
FunctionSymbol
's name for the native function
which is the original
C API name per default,
but may be overridden via setNativeName(String)
.public void setNativeName(String s)
public MethodBinding replaceJavaArgumentType(int argumentNumber, JavaType newArgType)
public boolean argumentsUseNIO()
public boolean signatureUsesNIO()
public boolean signatureCanUseIndirectNIO()
public boolean signatureUsesCompoundTypeWrappers()
public boolean signatureRequiresStaticInitialization()
JavaConfiguration.forceStaticInitCode(String)
.
Currently triggered by:
public boolean signatureUsesArraysOfCompoundTypeWrappers()
public boolean needsNIOWrappingOrUnwrapping()
public boolean signatureUsesCVoidPointers()
public boolean signatureUsesCPrimitivePointers()
public boolean signatureUsesCArrays()
public boolean signatureUsesJavaPrimitiveArrays()
protected void computeSignatureProperties()
public boolean hasContainingType()
The native calling convention, i.e. via a 'this' function pointer
or by a static native function must be decided in the
JavaEmitter
handling structs and
passed to the CMethodBindingEmitter.setIsCStructFunctionPointer(boolean)
.
public JavaType getContainingType()
public Type getContainingCType()
public void findThisPointer()
public void clearThisPointer()
public boolean isArgumentThisPointer(int i)
public String toString()
public String getDescriptor(boolean forImplementingMethodCall, boolean eraseBufferAndArrayTypes)