/*
* This file is part of the Jikes RVM project (http://jikesrvm.org).
*
* This file is licensed to You under the Eclipse Public License (EPL);
* You may not use this file except in compliance with the License. You
* may obtain a copy of the License at
*
* http://www.opensource.org/licenses/eclipse-1.0.php
*
* See the COPYRIGHT.txt file distributed with this work for information
* regarding copyright ownership.
*/
package org.mmtk.plan.semispace.usePrimitiveWriteBarriers;
import org.mmtk.plan.semispace.SSMutator;
import org.mmtk.vm.VM;
import org.vmmagic.unboxed.*;
import org.vmmagic.pragma.*;
/**
* This class extends the {@link SSMutator} class as part of the
* {@link UsePrimitiveWriteBarriers} collector. It overrides various methods in
* {@link SSMutator} to implement primitive write barriers.
*/
@Uninterruptible
public class UsePrimitiveWriteBarriersMutator extends SSMutator {
/**
* Write an Address. Take appropriate write barrier actions.
*/
@Override
public void addressWrite(ObjectReference src, Address slot, Address value, Word metaDataA, Word metaDataB, int mode) {
VM.barriers.addressWrite(src, value, metaDataA, metaDataB, mode);
}
/**
* Attempt to atomically exchange the value in the given slot
* with the passed replacement value.
*/
@Override
public boolean addressTryCompareAndSwap(ObjectReference src, Address slot, Address old, Address value, Word metaDataA, Word metaDataB, int mode) {
return VM.barriers.addressTryCompareAndSwap(src, old, value, metaDataA, metaDataB, mode);
}
/**
* Write a boolean. Take appropriate write barrier actions.
*/
@Override
public void booleanWrite(ObjectReference src, Address slot, boolean value, Word metaDataA, Word metaDataB, int mode) {
VM.barriers.booleanWrite(src, value, metaDataA, metaDataB, mode);
}
@Override
public boolean booleanBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) {
return false;
}
/**
* Write a byte. Take appropriate write barrier actions.
*/
@Override
public void byteWrite(ObjectReference src, Address slot, byte value, Word metaDataA, Word metaDataB, int mode) {
VM.barriers.byteWrite(src, value, metaDataA, metaDataB, mode);
}
@Override
public boolean byteBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) {
return false;
}
/**
* Write a char. Take appropriate write barrier actions.
*/
@Override
public void charWrite(ObjectReference src, Address slot, char value, Word metaDataA, Word metaDataB, int mode) {
VM.barriers.charWrite(src, value, metaDataA, metaDataB, mode);
}
@Override
public boolean charBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) {
return false;
}
/**
* Write a double. Take appropriate write barrier actions.
*/
@Override
public void doubleWrite(ObjectReference src, Address slot, double value, Word metaDataA, Word metaDataB, int mode) {
VM.barriers.doubleWrite(src, value, metaDataA, metaDataB, mode);
}
@Override
public boolean doubleBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) {
return false;
}
/**
* Write an Extent. Take appropriate write barrier actions.
*/
@Override
public void extentWrite(ObjectReference src, Address slot, Extent value, Word metaDataA, Word metaDataB, int mode) {
VM.barriers.extentWrite(src, value, metaDataA, metaDataB, mode);
}
/**
* Write a float. Take appropriate write barrier actions.
*/
@Override
public void floatWrite(ObjectReference src, Address slot, float value, Word metaDataA, Word metaDataB, int mode) {
VM.barriers.floatWrite(src, value, metaDataA, metaDataB, mode);
}
@Override
public boolean floatBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) {
return false;
}
/**
* Write a int. Take appropriate write barrier actions.
*/
@Override
public void intWrite(ObjectReference src, Address slot, int value, Word metaDataA, Word metaDataB, int mode) {
VM.barriers.intWrite(src, value, metaDataA, metaDataB, mode);
}
@Override
public boolean intBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) {
return false;
}
@Override
public boolean intTryCompareAndSwap(ObjectReference src, Address slot, int old, int value, Word metaDataA, Word metaDataB, int mode) {
return VM.barriers.intTryCompareAndSwap(src, old, value, metaDataA, metaDataB, mode);
}
/**
* Write a long. Take appropriate write barrier actions.
*/
@Override
public void longWrite(ObjectReference src, Address slot, long value, Word metaDataA, Word metaDataB, int mode) {
VM.barriers.longWrite(src, value, metaDataA, metaDataB, mode);
}
@Override
public boolean longBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) {
return false;
}
@Override
public boolean longTryCompareAndSwap(ObjectReference src, Address slot, long old, long value, Word metaDataA, Word metaDataB, int mode) {
return VM.barriers.longTryCompareAndSwap(src, old, value, metaDataA, metaDataB, mode);
}
/**
* Write an Offset. Take appropriate write barrier actions.
*/
@Override
public void offsetWrite(ObjectReference src, Address slot, Offset value, Word metaDataA, Word metaDataB, int mode) {
VM.barriers.offsetWrite(src, value, metaDataA, metaDataB, mode);
}
/**
* Write a short. Take appropriate write barrier actions.
*/
@Override
public void shortWrite(ObjectReference src, Address slot, short value, Word metaDataA, Word metaDataB, int mode) {
VM.barriers.shortWrite(src, value, metaDataA, metaDataB, mode);
}
@Override
public boolean shortBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) {
return false;
}
/**
* Write a Word. Take appropriate write barrier actions.
*/
@Override
public void wordWrite(ObjectReference src, Address slot, Word value, Word metaDataA, Word metaDataB, int mode) {
VM.barriers.wordWrite(src, value, metaDataA, metaDataB, mode);
}
@Override
public boolean wordTryCompareAndSwap(ObjectReference src, Address slot, Word old, Word value, Word metaDataA, Word metaDataB, int mode) {
return VM.barriers.wordTryCompareAndSwap(src, old, value, metaDataA, metaDataB, mode);
}
}