use of org.vmmagic.pragma.Inline in project JikesRVM by JikesRVM.
the class VM method enableGC.
/**
* enableGC(): Re-Enable GC if we're popping off the last
* possibly-recursive {@link #disableGC} request. This enforces a stack discipline;
* we need it for the JNI Get*Critical and Release*Critical functions.
* Should be matched with a preceding call to {@link #disableGC}.
*
* @param recursiveOK unused (!)
*/
@Inline
public static void enableGC(boolean recursiveOK) {
RVMThread myThread = RVMThread.getCurrentThread();
int gcDepth = myThread.getDisableGCDepth();
if (VM.VerifyAssertions) {
VM._assert(gcDepth >= 1);
VM._assert(myThread.getDisallowAllocationsByThisThread());
}
gcDepth--;
myThread.setDisableGCDepth(gcDepth);
if (gcDepth > 0) {
return;
}
// Now the actual work of re-enabling GC.
myThread.clearDisallowAllocationsByThisThread();
myThread.enableYieldpoints();
}
use of org.vmmagic.pragma.Inline in project JikesRVM by JikesRVM.
the class Class method newInstance.
// --- newInstance ---
@Inline(value = Inline.When.ArgumentsAreConstant, arguments = { 0 })
public T newInstance() throws IllegalAccessException, InstantiationException, ExceptionInInitializerError, SecurityException {
// Basic checks
checkMemberAccess(Member.PUBLIC);
if (!type.isClassType())
throw new InstantiationException();
RVMClass cls = type.asClass();
if (cls.isAbstract() || cls.isInterface())
throw new InstantiationException();
// Ensure that the class is initialized
if (!cls.isInitialized()) {
RuntimeEntrypoints.initializeClassForDynamicLink(cls);
}
// Find the defaultConstructor
RVMMethod defaultConstructor = getDefaultConstructor();
if (defaultConstructor == null)
throw new InstantiationException();
// Check that caller is allowed to access it
if (!defaultConstructor.isPublic()) {
RVMClass accessingClass = RVMClass.getClassFromStackFrame(1);
VMCommonLibrarySupport.checkAccess(defaultConstructor, accessingClass);
}
// Allocate an uninitialized instance;
// yes, we're giving an anonymous object a type.
@SuppressWarnings("unchecked") T obj = (T) RuntimeEntrypoints.resolvedNewScalar(cls);
// Run the default constructor on the it.
Reflection.invoke(defaultConstructor, null, obj, null, true);
return obj;
}
use of org.vmmagic.pragma.Inline in project JikesRVM by JikesRVM.
the class Class method forName.
// --- ForName ---
@Inline
public static Class<?> forName(String typeName) throws ClassNotFoundException {
throwNPEWhenNameIsNull(typeName);
ClassLoader parentCL = RVMClass.getClassLoaderFromStackFrame(1);
return forNameInternal(typeName, true, parentCL);
}
use of org.vmmagic.pragma.Inline in project JikesRVM by JikesRVM.
the class Barriers method byteFieldWrite.
/**
* Barrier for writes of bytes into fields of instances (i.e. putfield).
*
* @param ref the object which is the subject of the putfield
* @param value the new value for the field
* @param offset the offset of the field to be modified
* @param locationMetadata an int that encodes the source location being modified
*/
@Inline
@Entrypoint
public static void byteFieldWrite(Object ref, byte value, Offset offset, int locationMetadata) {
if (NEEDS_BYTE_GC_WRITE_BARRIER) {
ObjectReference src = ObjectReference.fromObject(ref);
Selected.Mutator.get().byteWrite(src, src.toAddress().plus(offset), value, offset.toWord(), Word.fromIntZeroExtend(locationMetadata), INSTANCE_FIELD);
} else if (VM.VerifyAssertions)
VM._assert(VM.NOT_REACHED);
}
use of org.vmmagic.pragma.Inline in project JikesRVM by JikesRVM.
the class Barriers method floatArrayRead.
/**
* Barrier for loads of floats from fields of arrays (i.e. faload).
*
* @param ref the array containing the reference.
* @param index the index into the array were the reference resides.
* @return the value read from the array
*/
@Inline
@Entrypoint
public static float floatArrayRead(float[] ref, int index) {
if (NEEDS_FLOAT_GC_READ_BARRIER) {
ObjectReference array = ObjectReference.fromObject(ref);
Offset offset = Offset.fromIntZeroExtend(index << LOG_BYTES_IN_FLOAT);
return Selected.Mutator.get().floatRead(array, array.toAddress().plus(offset), offset.toWord(), Word.zero(), ARRAY_ELEMENT);
} else if (VM.VerifyAssertions)
VM._assert(VM.NOT_REACHED);
return 0;
}
Aggregations