use of org.vmmagic.unboxed.Address in project JikesRVM by JikesRVM.
the class GenerationContextTest method assertThatRethrowBlockIsCorrect.
private void assertThatRethrowBlockIsCorrect(InlineSequence inlineSequence, Operand lockObject, ExceptionHandlerBasicBlock rethrow) {
Enumeration<TypeOperand> exceptionTypes = rethrow.getExceptionTypes();
TypeOperand firstHandledException = exceptionTypes.nextElement();
assertThat(exceptionTypes.hasMoreElements(), is(false));
assertTrue(firstHandledException.similar(new TypeOperand(RVMType.JavaLangThrowableType)));
Enumeration<Instruction> rethrowInstructions = rethrow.forwardRealInstrEnumerator();
Instruction firstInstructionInRethrow = rethrowInstructions.nextElement();
assertThat(firstInstructionInRethrow.operator(), is(GET_CAUGHT_EXCEPTION));
assertThat(firstInstructionInRethrow.getBytecodeIndex(), is(SYNTH_CATCH_BCI));
assertTrue(firstInstructionInRethrow.position().equals(inlineSequence));
RegisterOperand catchExceptionObject = Nullary.getResult(firstInstructionInRethrow);
assertThat(catchExceptionObject.getType(), is(TypeReference.JavaLangThrowable));
Instruction secondInstructionInRethrow = rethrowInstructions.nextElement();
assertThatNoMoreInstructionsExist(rethrowInstructions);
assertThat(secondInstructionInRethrow.operator(), is(CALL));
MethodOperand methodOp = Call.getMethod(secondInstructionInRethrow);
assertTrue(methodOp.getTarget().equals(Entrypoints.unlockAndThrowMethod));
assertTrue(methodOp.isNonReturningCall());
Operand callAddress = Call.getAddress(secondInstructionInRethrow);
Address actualAddress = callAddress.asAddressConstant().value;
Address expectedAddress = Entrypoints.unlockAndThrowMethod.getOffset().toWord().toAddress();
assertTrue(actualAddress.EQ(expectedAddress));
Operand lockObjectFromRethrow = Call.getParam(secondInstructionInRethrow, 0);
assertTrue(lockObjectFromRethrow.similar(lockObject));
RegisterOperand catchOperand = Call.getParam(secondInstructionInRethrow, 1).asRegister();
assertTrue(catchOperand.sameRegisterPropertiesAs(catchExceptionObject));
assertTrue(rethrow.mayThrowUncaughtException());
assertTrue(rethrow.canThrowExceptions());
}
use of org.vmmagic.unboxed.Address in project JikesRVM by JikesRVM.
the class ArchBridgeDataExtractorTest method longParametersInBridgeMethodsAreProcessedCorrectlyFor64BitAddressing.
@Test
@Category(Requires64BitAddressing.class)
public void longParametersInBridgeMethodsAreProcessedCorrectlyFor64BitAddressing() {
TypeReference[] types = { TypeReference.Long, TypeReference.JavaLangObject };
bridge.setBridgeParameterTypes(types);
Word expected = Word.fromIntSignExtend(11);
int length = 4;
WordArray stackFrame = createNonMovableWordArray(length);
int bridgeRegLocSlotIndex = stackFrame.length() - 1;
stackFrame.set(bridgeRegLocSlotIndex - 1, expected);
Address brideRegLoc = Magic.objectAsAddress(stackFrame).plus(bridgeRegLocSlotIndex * BYTES_IN_WORD);
bridge.setBridgeRegisterLocation(brideRegLoc);
Address bridgeParameterAddr = bridge.getNextBridgeParameterAddress();
Word bridgeParameter = bridgeParameterAddr.loadWord();
assertEquals(expected, bridgeParameter);
}
use of org.vmmagic.unboxed.Address in project JikesRVM by JikesRVM.
the class BaselineGCMapIteratorTest method getNextReturnAddressAddressReturnsZeroIfNoJSRsArePresent.
@Test
public void getNextReturnAddressAddressReturnsZeroIfNoJSRsArePresent() throws Exception {
NormalMethod nm = TestingTools.getNormalMethod(MethodsForTests.class, "emptyStaticMethodWithoutAnnotations");
CompiledMethod cm = nm.getCurrentCompiledMethod();
gcMapIter.setupIterator(cm, NO_OFFSET, NO_FP);
Address returnAddressAddress = gcMapIter.getNextReturnAddressAddress();
assertZero(returnAddressAddress);
}
use of org.vmmagic.unboxed.Address in project JikesRVM by JikesRVM.
the class MemoryTest method doAligned8CopyForBytes.
private void doAligned8CopyForBytes(byte[] largeByteArray, int copyStart, int copyLength, int copyDest) {
VM.disableGC();
Address arrayStart = Magic.objectAsAddress(largeByteArray);
Address copyStartAddress = arrayStart.plus(copyStart * BYTES_IN_BYTE);
Address copyDestAddress = arrayStart.plus(copyDest * BYTES_IN_BYTE);
int copyBytes = copyLength * BYTES_IN_BYTE;
Memory.aligned8Copy(copyDestAddress, copyStartAddress, copyBytes);
VM.enableGC();
}
use of org.vmmagic.unboxed.Address in project JikesRVM by JikesRVM.
the class MemoryTest method doMemcopy.
private void doMemcopy(byte[] largeByteArray, int copyLength, int copyStart, int copyDest) {
VM.disableGC();
Address arrayStart = Magic.objectAsAddress(largeByteArray);
Address copyStartAddress = arrayStart.plus(copyStart * BYTES_IN_BYTE);
Address copyDestAddress = arrayStart.plus(copyDest * BYTES_IN_BYTE);
int copyBytes = copyLength * BYTES_IN_BYTE;
Memory.memcopy(copyDestAddress, copyStartAddress, copyBytes);
VM.enableGC();
}
Aggregations