/* * 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 Mutator} to implement primitive write barriers. */ @Uninterruptible public class UsePrimitiveWriteBarriersMutator extends SSMutator { /** * Write an Address. Take appropriate write barrier actions.<p> * * @param src The object into which the Word will be stored * @param slot The address into which the Word will be * stored. * @param value The value of the new Address * @param metaDataA A value that assists the host VM in creating a store * @param metaDataB A value that assists the host VM in creating a store * @param mode The context in which the store occurred */ 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. * * @param src The object into which the Address will be stored * @param slot The address into which the Address will be * stored. * @param old The old Address to be swapped out * @param value The new Address * @param metaDataA A value that assists the host VM in creating a store * @param metaDataB A value that assists the host VM in creating a store * @param mode The context in which the store occurred * @return True if the swap was successful. */ 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.<p> * * @param src The object into which the new reference will be stored * @param slot The address into which the new reference will be * stored. * @param value The value of the new boolean * @param metaDataA A value that assists the host VM in creating a store * @param metaDataB A value that assists the host VM in creating a store * @param mode The context in which the store occurred */ public void booleanWrite(ObjectReference src, Address slot, boolean value, Word metaDataA, Word metaDataB, int mode) { VM.barriers.booleanWrite(src, value, metaDataA, metaDataB, mode); } /** * A number of booleans are about to be copied from object * <code>src</code> to object <code>dst</code> (as in an array * copy). Thus, <code>dst</code> is the mutated object. Take * appropriate write barrier actions.<p> * * @param src The source array * @param srcOffset The starting source offset * @param dst The destination array * @param dstOffset The starting destination offset * @param bytes The number of bytes to be copied * @return True if the update was performed by the barrier, false if * left to the caller */ public boolean booleanBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { return false; } /** * Write a byte. Take appropriate write barrier actions.<p> * * @param src The object into which the new reference will be stored * @param slot The address into which the new reference will be * stored. * @param value The value of the new byte * @param metaDataA A value that assists the host VM in creating a store * @param metaDataB A value that assists the host VM in creating a store * @param mode The context in which the store occurred */ public void byteWrite(ObjectReference src, Address slot, byte value, Word metaDataA, Word metaDataB, int mode) { VM.barriers.byteWrite(src, value, metaDataA, metaDataB, mode); } /** * A number of bytes are about to be copied from object * <code>src</code> to object <code>dst</code> (as in an array * copy). Thus, <code>dst</code> is the mutated object. Take * appropriate write barrier actions.<p> * * @param src The source array * @param srcOffset The starting source offset * @param dst The destination array * @param dstOffset The starting destination offset * @param bytes The number of bytes to be copied * @return True if the update was performed by the barrier, false if * left to the caller */ public boolean byteBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { return false; } /** * Write a char. Take appropriate write barrier actions.<p> * * @param src The object into which the new reference will be stored * @param slot The address into which the new reference will be * stored. * @param value The value of the new char * @param metaDataA A value that assists the host VM in creating a store * @param metaDataB A value that assists the host VM in creating a store * @param mode The context in which the store occurred */ public void charWrite(ObjectReference src, Address slot, char value, Word metaDataA, Word metaDataB, int mode) { VM.barriers.charWrite(src, value, metaDataA, metaDataB, mode); } /** * A number of chars are about to be copied from object * <code>src</code> to object <code>dst</code> (as in an array * copy). Thus, <code>dst</code> is the mutated object. Take * appropriate write barrier actions.<p> * * @param src The source array * @param srcOffset The starting source offset * @param dst The destination array * @param dstOffset The starting destination offset * @param bytes The number of bytes to be copied * @return True if the update was performed by the barrier, false if * left to the caller */ public boolean charBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { return false; } /** * Write a double. Take appropriate write barrier actions.<p> * * @param src The object into which the new reference will be stored * @param slot The address into which the new reference will be * stored. * @param value The value of the new double * @param metaDataA A value that assists the host VM in creating a store * @param metaDataB A value that assists the host VM in creating a store * @param mode The context in which the store occurred */ public void doubleWrite(ObjectReference src, Address slot, double value, Word metaDataA, Word metaDataB, int mode) { VM.barriers.doubleWrite(src, value, metaDataA, metaDataB, mode); } /** * A number of doubles are about to be copied from object * <code>src</code> to object <code>dst</code> (as in an array * copy). Thus, <code>dst</code> is the mutated object. Take * appropriate write barrier actions.<p> * * @param src The source array * @param srcOffset The starting source offset * @param dst The destination array * @param dstOffset The starting destination offset * @param bytes The number of bytes to be copied * @return True if the update was performed by the barrier, false if * left to the caller */ public boolean doubleBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { return false; } /** * Write an Extent. Take appropriate write barrier actions.<p> * * @param src The object into which the new reference will be stored * @param slot The address into which the new reference will be * stored. * @param value The value of the new Extent * @param metaDataA A value that assists the host VM in creating a store * @param metaDataB A value that assists the host VM in creating a store * @param mode The context in which the store occurred */ 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.<p> * * @param src The object into which the new reference will be stored * @param slot The address into which the new reference will be * stored. * @param value The value of the new float * @param metaDataA A value that assists the host VM in creating a store * @param metaDataB A value that assists the host VM in creating a store * @param mode The context in which the store occurred */ public void floatWrite(ObjectReference src, Address slot, float value, Word metaDataA, Word metaDataB, int mode) { VM.barriers.floatWrite(src, value, metaDataA, metaDataB, mode); } /** * A number of floats are about to be copied from object * <code>src</code> to object <code>dst</code> (as in an array * copy). Thus, <code>dst</code> is the mutated object. Take * appropriate write barrier actions.<p> * * @param src The source array * @param srcOffset The starting source offset * @param dst The destination array * @param dstOffset The starting destination offset * @param bytes The number of bytes to be copied * @return True if the update was performed by the barrier, false if * left to the caller */ public boolean floatBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { return false; } /** * Write a int. Take appropriate write barrier actions.<p> * * @param src The object into which the new reference will be stored * @param slot The address into which the new reference will be * stored. * @param value The value of the new int * @param metaDataA A value that assists the host VM in creating a store * @param metaDataB A value that assists the host VM in creating a store * @param mode The context in which the store occurred */ public void intWrite(ObjectReference src, Address slot, int value, Word metaDataA, Word metaDataB, int mode) { VM.barriers.intWrite(src, value, metaDataA, metaDataB, mode); } /** * A number of ints are about to be copied from object * <code>src</code> to object <code>dst</code> (as in an array * copy). Thus, <code>dst</code> is the mutated object. Take * appropriate write barrier actions.<p> * * @param src The source array * @param srcOffset The starting source offset * @param dst The destination array * @param dstOffset The starting destination offset * @param bytes The number of bytes to be copied * @return True if the update was performed by the barrier, false if * left to the caller */ public boolean intBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { return false; } /** * Attempt to atomically exchange the value in the given slot * with the passed replacement value. * * @param src The object into which the value will be stored * @param slot The address into which the value will be * stored. * @param old The old int to be swapped out * @param value The new int * @param metaDataA A value that assists the host VM in creating a store * @param metaDataB A value that assists the host VM in creating a store * @param mode The context in which the store occurred * @return True if the swap was successful. */ 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.<p> * * @param src The object into which the new reference will be stored * @param slot The address into which the new reference will be * stored. * @param value The value of the new long * @param metaDataA A value that assists the host VM in creating a store * @param metaDataB A value that assists the host VM in creating a store * @param mode The context in which the store occurred */ public void longWrite(ObjectReference src, Address slot, long value, Word metaDataA, Word metaDataB, int mode) { VM.barriers.longWrite(src, value, metaDataA, metaDataB, mode); } /** * A number of longs are about to be copied from object * <code>src</code> to object <code>dst</code> (as in an array * copy). Thus, <code>dst</code> is the mutated object. Take * appropriate write barrier actions.<p> * * @param src The source array * @param srcOffset The starting source offset * @param dst The destination array * @param dstOffset The starting destination offset * @param bytes The number of bytes to be copied * @return True if the update was performed by the barrier, false if * left to the caller */ public boolean longBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { return false; } /** * Attempt to atomically exchange the value in the given slot * with the passed replacement value. * * @param src The object into which the value will be stored * @param slot The address into which the value will be * stored. * @param old The old long to be swapped out * @param value The new long * @param metaDataA A value that assists the host VM in creating a store * @param metaDataB A value that assists the host VM in creating a store * @param mode The context in which the store occurred * @return True if the swap was successful. */ 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.<p> * * @param src The object into which the new reference will be stored * @param slot The address into which the new reference will be * stored. * @param value The value of the new Offset * @param metaDataA A value that assists the host VM in creating a store * @param metaDataB A value that assists the host VM in creating a store * @param mode The context in which the store occurred */ 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.<p> * * @param src The object into which the new reference will be stored * @param slot The address into which the new reference will be * stored. * @param value The value of the new short * @param metaDataA A value that assists the host VM in creating a store * @param metaDataB A value that assists the host VM in creating a store * @param mode The context in which the store occurred */ public void shortWrite(ObjectReference src, Address slot, short value, Word metaDataA, Word metaDataB, int mode) { VM.barriers.shortWrite(src, value, metaDataA, metaDataB, mode); } /** * A number of shorts are about to be copied from object * <code>src</code> to object <code>dst</code> (as in an array * copy). Thus, <code>dst</code> is the mutated object. Take * appropriate write barrier actions.<p> * * @param src The source array * @param srcOffset The starting source offset * @param dst The destination array * @param dstOffset The starting destination offset * @param bytes The number of bytes to be copied * @return True if the update was performed by the barrier, false if * left to the caller */ public boolean shortBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) { return false; } /** * Write a Word. Take appropriate write barrier actions.<p> * * @param src The object into which the new reference will be stored * @param slot The address into which the new reference will be * stored. * @param value The value of the new Word * @param metaDataA A value that assists the host VM in creating a store * @param metaDataB A value that assists the host VM in creating a store * @param mode The context in which the store occurred */ public void wordWrite(ObjectReference src, Address slot, Word value, Word metaDataA, Word metaDataB, int mode) { VM.barriers.wordWrite(src, value, metaDataA, metaDataB, mode); } /** * Attempt to atomically exchange the value in the given slot * with the passed replacement value. * * @param src The object into which the new reference will be stored * @param slot The address into which the new reference will be * stored. * @param old The old Word to be swapped out * @param value The new Word * @param metaDataA A value that assists the host VM in creating a store * @param metaDataB A value that assists the host VM in creating a store * @param mode The context in which the store occurred * @return True if the swap was successful. */ 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); } }