Search in sources :

Example 6 with Assembler

use of org.jikesrvm.compilers.common.assembler.ppc.Assembler in project JikesRVM by JikesRVM.

the class Barriers method compilePutfieldBarrier.

// on entry java stack contains ...|target_ref|ref_to_store|
// T2 already contains the offset of the field on entry
static void compilePutfieldBarrier(BaselineCompilerImpl comp, int locationMetadata) {
    Assembler asm = comp.asm;
    asm.emitLAddrToc(S0, Entrypoints.objectFieldWriteBarrierMethod.getOffset());
    asm.emitMTCTR(S0);
    // object base
    comp.peekAddr(T0, 1);
    asm.emitNullCheck(T0);
    // value to store
    comp.peekAddr(T1, 0);
    asm.emitLVAL(T3, locationMetadata);
    // MemoryManager.putfieldWriteBarrier(T0,T1,T2,T3)
    asm.emitBCCTRL();
}
Also used : Assembler(org.jikesrvm.compilers.common.assembler.ppc.Assembler)

Example 7 with Assembler

use of org.jikesrvm.compilers.common.assembler.ppc.Assembler in project JikesRVM by JikesRVM.

the class Barriers method compilePutfieldBarrierFloatImm.

// on entry java stack contains ...|target_ref|value_to_store|
static void compilePutfieldBarrierFloatImm(BaselineCompilerImpl comp, Offset fieldOffset, int locationMetadata) {
    Assembler asm = comp.asm;
    asm.emitLAddrToc(S0, Entrypoints.floatFieldWriteBarrierMethod.getOffset());
    asm.emitMTCTR(S0);
    // store target_ref in T0
    comp.peekAddr(T0, 1);
    asm.emitNullCheck(T0);
    // store value_to_store in F0
    comp.peekFloat(F0, 0);
    // store offset in T1
    asm.emitLVALAddr(T1, fieldOffset);
    // store locationMetaData in T2
    asm.emitLVAL(T2, locationMetadata);
    // call barrier with parameters in (T0,F0,T1,T2)
    asm.emitBCCTRL();
    // clean up stack
    comp.discardSlots(2);
}
Also used : Assembler(org.jikesrvm.compilers.common.assembler.ppc.Assembler)

Example 8 with Assembler

use of org.jikesrvm.compilers.common.assembler.ppc.Assembler in project JikesRVM by JikesRVM.

the class Barriers method compileGetstaticBarrierImm.

// on entry java stack contains ...|
static void compileGetstaticBarrierImm(BaselineCompilerImpl comp, Offset fieldOffset, int locationMetadata) {
    Assembler asm = comp.asm;
    asm.emitLAddrToc(S0, Entrypoints.objectStaticReadBarrierMethod.getOffset());
    asm.emitMTCTR(S0);
    // offset
    asm.emitLVALAddr(T0, fieldOffset);
    asm.emitLVAL(T1, locationMetadata);
    // MemoryManager.getstaticReadBarrier(T0,T1)
    asm.emitBCCTRL();
}
Also used : Assembler(org.jikesrvm.compilers.common.assembler.ppc.Assembler)

Example 9 with Assembler

use of org.jikesrvm.compilers.common.assembler.ppc.Assembler in project JikesRVM by JikesRVM.

the class OutOfLineMachineCode method generateSaveVolatilesInstructions.

// Machine code used to save volatile registers.
// 
// Registers taken at runtime:
// S0 == address of Registers object
// 
// Registers returned at runtime:
// none
// 
// Side effects at runtime:
// S1 destroyed
// 
private static CodeArray generateSaveVolatilesInstructions() {
    Assembler asm = new Assembler(0);
    // save volatile fprs
    // 
    // S1 := registers.fprs[]
    asm.emitLAddrOffset(S1, S0, ArchEntrypoints.registersFPRsField.getOffset());
    for (int i = FIRST_VOLATILE_FPR.value(); i <= LAST_VOLATILE_FPR.value(); ++i) {
        asm.emitSTFD(FPR.lookup(i), i << LOG_BYTES_IN_DOUBLE, S1);
    }
    // save non-volatile gprs
    // 
    // S1 := registers.gprs[]
    asm.emitLAddrOffset(S1, S0, ArchEntrypoints.registersGPRsField.getOffset());
    for (int i = FIRST_VOLATILE_GPR.value(); i <= LAST_VOLATILE_GPR.value(); ++i) {
        asm.emitSTAddr(GPR.lookup(i), i << LOG_BYTES_IN_ADDRESS, S1);
    }
    // return to caller
    // 
    asm.emitBCLR();
    return asm.getMachineCodes();
}
Also used : Assembler(org.jikesrvm.compilers.common.assembler.ppc.Assembler) Entrypoint(org.vmmagic.pragma.Entrypoint)

Example 10 with Assembler

use of org.jikesrvm.compilers.common.assembler.ppc.Assembler in project JikesRVM by JikesRVM.

the class OutOfLineMachineCode method generateRestoreVolatilesInstructions.

/**
 * Machine code used to save volatile registers.
 * <pre>
 * Registers taken at runtime:
 *   S0 == address of Registers object
 *
 * Registers returned at runtime:
 *   none
 *
 * Side effects at runtime:
 *   S1 destroyed
 * </pre>
 */
private static CodeArray generateRestoreVolatilesInstructions() {
    Assembler asm = new Assembler(0);
    // save volatile fprs
    // 
    // S1 := registers.fprs[]
    asm.emitLAddrOffset(S1, S0, ArchEntrypoints.registersFPRsField.getOffset());
    for (int i = FIRST_VOLATILE_FPR.value(); i <= LAST_VOLATILE_FPR.value(); ++i) {
        asm.emitLFD(FPR.lookup(i), i << LOG_BYTES_IN_DOUBLE, S1);
    }
    // save non-volatile gprs
    // 
    // S1 := registers.gprs[]
    asm.emitLAddrOffset(S1, S0, ArchEntrypoints.registersGPRsField.getOffset());
    for (int i = FIRST_VOLATILE_GPR.value(); i <= LAST_VOLATILE_GPR.value(); ++i) {
        asm.emitLAddr(GPR.lookup(i), i << LOG_BYTES_IN_ADDRESS, S1);
    }
    // return to caller
    // 
    asm.emitBCLR();
    return asm.getMachineCodes();
}
Also used : Assembler(org.jikesrvm.compilers.common.assembler.ppc.Assembler) Entrypoint(org.vmmagic.pragma.Entrypoint)

Aggregations

Assembler (org.jikesrvm.compilers.common.assembler.ppc.Assembler)30 Entrypoint (org.vmmagic.pragma.Entrypoint)6 ForwardReference (org.jikesrvm.compilers.common.assembler.ForwardReference)4 Address (org.vmmagic.unboxed.Address)2 Offset (org.vmmagic.unboxed.Offset)2 RVMClass (org.jikesrvm.classloader.RVMClass)1 TypeReference (org.jikesrvm.classloader.TypeReference)1 ArchBaselineCompiledMethod (org.jikesrvm.compilers.baseline.ppc.ArchBaselineCompiledMethod)1 CodeArray (org.jikesrvm.compilers.common.CodeArray)1 CompiledMethod (org.jikesrvm.compilers.common.CompiledMethod)1 OptCompiledMethod (org.jikesrvm.compilers.opt.runtimesupport.OptCompiledMethod)1 JNICompiledMethod (org.jikesrvm.jni.JNICompiledMethod)1 FIRST_NONVOLATILE_GPR (org.jikesrvm.ppc.RegisterConstants.FIRST_NONVOLATILE_GPR)1 FIRST_OS_PARAMETER_FPR (org.jikesrvm.ppc.RegisterConstants.FIRST_OS_PARAMETER_FPR)1 FIRST_OS_PARAMETER_GPR (org.jikesrvm.ppc.RegisterConstants.FIRST_OS_PARAMETER_GPR)1 FIRST_RVM_RESERVED_NV_GPR (org.jikesrvm.ppc.RegisterConstants.FIRST_RVM_RESERVED_NV_GPR)1 FIRST_SCRATCH_FPR (org.jikesrvm.ppc.RegisterConstants.FIRST_SCRATCH_FPR)1 FIRST_VOLATILE_FPR (org.jikesrvm.ppc.RegisterConstants.FIRST_VOLATILE_FPR)1 FIRST_VOLATILE_GPR (org.jikesrvm.ppc.RegisterConstants.FIRST_VOLATILE_GPR)1 FPR (org.jikesrvm.ppc.RegisterConstants.FPR)1