Search in sources :

Example 61 with Address

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());
}
Also used : RegisterOperand(org.jikesrvm.compilers.opt.ir.operand.RegisterOperand) Address(org.vmmagic.unboxed.Address) MethodOperand(org.jikesrvm.compilers.opt.ir.operand.MethodOperand) TypeOperand(org.jikesrvm.compilers.opt.ir.operand.TypeOperand) RegisterOperand(org.jikesrvm.compilers.opt.ir.operand.RegisterOperand) TrueGuardOperand(org.jikesrvm.compilers.opt.ir.operand.TrueGuardOperand) Operand(org.jikesrvm.compilers.opt.ir.operand.Operand) ObjectConstantOperand(org.jikesrvm.compilers.opt.ir.operand.ObjectConstantOperand) ClassConstantOperand(org.jikesrvm.compilers.opt.ir.operand.ClassConstantOperand) TypeOperand(org.jikesrvm.compilers.opt.ir.operand.TypeOperand) Instruction(org.jikesrvm.compilers.opt.ir.Instruction) MethodOperand(org.jikesrvm.compilers.opt.ir.operand.MethodOperand)

Example 62 with Address

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);
}
Also used : Word(org.vmmagic.unboxed.Word) Address(org.vmmagic.unboxed.Address) TestingTools.createNonMovableWordArray(org.jikesrvm.tests.util.TestingTools.createNonMovableWordArray) WordArray(org.vmmagic.unboxed.WordArray) TypeReference(org.jikesrvm.classloader.TypeReference) Category(org.junit.experimental.categories.Category) Test(org.junit.Test)

Example 63 with Address

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);
}
Also used : Address(org.vmmagic.unboxed.Address) NormalMethod(org.jikesrvm.classloader.NormalMethod) CompiledMethod(org.jikesrvm.compilers.common.CompiledMethod) Test(org.junit.Test)

Example 64 with Address

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();
}
Also used : Address(org.vmmagic.unboxed.Address)

Example 65 with Address

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();
}
Also used : Address(org.vmmagic.unboxed.Address)

Aggregations

Address (org.vmmagic.unboxed.Address)281 Offset (org.vmmagic.unboxed.Offset)48 CompiledMethod (org.jikesrvm.compilers.common.CompiledMethod)30 NoInline (org.vmmagic.pragma.NoInline)30 Test (org.junit.Test)24 Entrypoint (org.vmmagic.pragma.Entrypoint)22 TypeReference (org.jikesrvm.classloader.TypeReference)21 OptCompiledMethod (org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod)17 RVMType (org.jikesrvm.classloader.RVMType)16 Inline (org.vmmagic.pragma.Inline)15 Uninterruptible (org.vmmagic.pragma.Uninterruptible)14 Word (org.vmmagic.unboxed.Word)14 BaseMMTkTest (org.mmtk.harness.tests.BaseMMTkTest)13 Unpreemptible (org.vmmagic.pragma.Unpreemptible)12 ObjectReference (org.vmmagic.unboxed.ObjectReference)12 Interruptible (org.vmmagic.pragma.Interruptible)11 Extent (org.vmmagic.unboxed.Extent)11 RVMClass (org.jikesrvm.classloader.RVMClass)9 AddressConstantOperand (org.jikesrvm.compilers.opt.ir.operand.AddressConstantOperand)8 IntConstantOperand (org.jikesrvm.compilers.opt.ir.operand.IntConstantOperand)8