use of org.vmmagic.pragma.NoInline in project JikesRVM by JikesRVM.
the class VM method write.
/**
* Low level print to console.
* @param value what is printed
*/
@NoInline
public static /* don't waste code space inlining these --dave */
void write(String value) {
if (value == null) {
write("null");
} else {
if (runningVM) {
char[] chars = java.lang.JikesRVMSupport.getBackingCharArray(value);
int numChars = java.lang.JikesRVMSupport.getStringLength(value);
int offset = java.lang.JikesRVMSupport.getStringOffset(value);
for (int i = 0; i < numChars; i++) {
write(chars[offset + i]);
}
} else {
writeNotRunningVM(value);
}
}
}
use of org.vmmagic.pragma.NoInline in project JikesRVM by JikesRVM.
the class VM method write.
/**
* Low level print of an <code>int</code> to console.
* @param value what is printed
*/
@NoInline
public static /* don't waste code space inlining these --dave */
void write(int value) {
if (runningVM) {
// hex only or decimal only
int mode = (value < -(1 << 20) || value > (1 << 20)) ? 2 : 0;
sysCall.sysConsoleWriteInteger(value, mode);
} else {
writeNotRunningVM(value);
}
}
use of org.vmmagic.pragma.NoInline in project JikesRVM by JikesRVM.
the class VM method writeField.
/**
* Low level print to console.
* @param value print value
* @param fieldWidth the number of characters that the output should contain. If the value
* is too small, the output will be filled up with enough spaces, starting from the left
*/
@NoInline
public static /* don't waste code space inlining these --dave */
void writeField(int fieldWidth, int value) {
int len = 1, temp = value;
if (temp < 0) {
len++;
temp = -temp;
}
while (temp >= 10) {
len++;
temp /= 10;
}
while (fieldWidth > len++) write(" ");
if (runningVM) {
sysCall.sysConsoleWriteInteger(value, 0);
} else {
writeNotRunningVM(value);
}
}
use of org.vmmagic.pragma.NoInline in project JikesRVM by JikesRVM.
the class JNIHelpers method getVarArgAddress.
/**
* This method supports var args passed from C.<p>
*
* In the Linux Intel C convention, the caller places the args immediately above the
* saved return address, starting with the first arg. <br>
*
* For the JNI functions that takes var args, their prolog code will save the
* var arg in the glue frame because the values in the register may be lost by
* subsequent calls. <br>
*
* This method copies the var arg values that were saved earlier in glue frame into
* the spill area of the original caller, thereby doing the work that the callee
* normally performs in the AIX C convention. <br>
*
* NOTE: This method contains internal stack pointer.
* For now we assume that the stack will not be relocatable while native code is running
* because native code can hold an address into the stack, so this code is OK,
* but this is an issue to be resolved later. <br>
*
* NOTE: this method assumes that it is immediately above the
* invokeWithDotDotVarArg frame, the JNI frame, the glue frame and
* the C caller frame in the respective order.
* Therefore, this method will not work if called from anywhere else.
*
* <pre>
* low address
*
* | fp | <- JNIEnvironment.getVarArgAddress
* | mid |
* | |
* | |
* |------|
* | fp | <- JNIEnvironment.invokeWithDotDotVarArg frame
* | mid |
* | ... |
* | |
* | |
* |------|
* | fp | <- JNI method frame
* | mid |
* | ... |
* | arg 0| args copied by JNI prolog (3 for static, nonvirtual,
* | arg 1| or 4 for virtual)
* | arg 2|
* | |
* | |
* |------|
* | fp | <- Native C caller frame
* |return|
* | arg 0|
* | arg 1|
* | arg 2|
* | arg 3|
* | arg 4|
* | arg 5|
* | arg 6|
* | arg 7|
* | arg 8|
* | arg 9|
* | |
* | |
* | |
*
* high address
* </pre>
*
* @param skip4Args if true, the calling JNI function has 4 args before the vararg
* if false, the calling JNI function has 3 args before the vararg
* @return the starting address of the vararg in the caller stack frame
*/
@NoInline
private static Address getVarArgAddress(boolean skip4Args) {
Address fp = Magic.getFramePointer();
fp = fp.loadAddress();
fp = fp.loadAddress();
return (fp.plus(2 * WORDSIZE + (skip4Args ? 4 * WORDSIZE : 3 * WORDSIZE)));
}
use of org.vmmagic.pragma.NoInline in project JikesRVM by JikesRVM.
the class JNIHelpers method invokeWithDotDotVarArg.
/**
* Common code shared by the JNI functions CallStatic<type>Method
* (static method invocation)
* @param methodID the method ID
* @param expectReturnType the return type of the method to be invoked
* @return an object that may be the return object or a wrapper for the primitive return value
* @throws Exception if the return type doesn't match the expected return type
*/
@NoInline
@NoOptCompile
public static // expect a certain stack frame structure
Object invokeWithDotDotVarArg(int methodID, TypeReference expectReturnType) throws Exception {
MethodReference mr = MemberReference.getMethodRef(methodID);
Address varargAddress = getVarArgAddress(false);
Object[] argObjectArray = packageParameterFromVarArg(mr, varargAddress);
return callMethod(null, mr, argObjectArray, expectReturnType, true);
}
Aggregations