001/*
002 *  This file is part of the Jikes RVM project (http://jikesrvm.org).
003 *
004 *  This file is licensed to You under the Eclipse Public License (EPL);
005 *  You may not use this file except in compliance with the License. You
006 *  may obtain a copy of the License at
007 *
008 *      http://www.opensource.org/licenses/eclipse-1.0.php
009 *
010 *  See the COPYRIGHT.txt file distributed with this work for information
011 *  regarding copyright ownership.
012 */
013package org.mmtk.plan;
014
015import org.mmtk.policy.MarkSweepLocal;
016import org.mmtk.policy.Space;
017import org.mmtk.policy.ImmortalLocal;
018import org.mmtk.policy.LargeObjectLocal;
019import org.mmtk.utility.alloc.Allocator;
020import org.mmtk.utility.alloc.BumpPointer;
021import org.mmtk.utility.Log;
022
023import org.mmtk.vm.VM;
024
025import org.vmmagic.pragma.*;
026import org.vmmagic.unboxed.*;
027
028/**
029 * This class (and its sub-classes) implement <i>per-mutator thread</i>
030 * behavior.  We assume <i>N</i> collector threads and <i>M</i>
031 * mutator threads, where <i>N</i> is often equal to the number of
032 * available processors, P (for P-way parallelism at GC-time), and
033 * <i>M</i> may simply be the number of mutator (application) threads.
034 * Both <i>N</i> and <i>M</i> are determined by the VM, not MMTk.  In
035 * the case where a VM uses posix threads (pthreads) for each mutator
036 * ("1:1" threading), <i>M</i> will typically be equal to the number of
037 * mutator threads.  When a uses "green threads" or a hybrid threading
038 * scheme (such as Jikes RVM), <i>M</i> will typically be equal to the
039 * level of <i>true</i> parallelism (ie the number of underlying
040 * kernel threads).<p>
041 *
042 * MMTk assumes that the VM instantiates instances of MutatorContext
043 * in thread local storage (TLS) for each thread participating in
044 * collection.  Accesses to this state are therefore assumed to be
045 * low-cost during mutator time.<p>
046 *
047 * This class (and its children) is therefore used for unsynchronized
048 * per-mutator operations such as <i>allocation</i> and <i>write barriers</i>.
049 * The semantics and necessary state for these operations are therefore
050 * specified in the GC-specific subclasses of this class.
051 *
052 * MMTk explicitly separates thread-local (this class) and global
053 * operations (@see Plan), so that syncrhonization is localized
054 * and explicit, and thus hopefully minimized (@see Plan). Gloabl (Plan)
055 * and per-thread (this class) state are also explicitly separated.
056 * Operations in this class (and its children) are therefore strictly
057 * local to each mutator thread, and synchronized operations always
058 * happen via access to explicitly global classes such as Plan and its
059 * children.  Therefore only <i>"fast path"</i> (unsynchronized)
060 * allocation and barrier semantics are defined in MutatorContext and
061 * its subclasses.  These call out to <i>"slow path"</i> (synchronize(d)
062 * methods which have global state and are globally synchronized.  For
063 * example, an allocation fast path may bump a pointer without any
064 * syncrhonization (the "fast path") until a limit is reached, at which
065 * point the "slow path" is called, and more memory is aquired from a
066 * global resource.<p>
067 *
068 * As the super-class of all per-mutator contexts, this class implements
069 * basic per-mutator behavior common to all MMTk collectors, including
070 * support for immortal and large object space allocation, as well as
071 * empty stubs for write barriers (to be overridden by sub-classes as
072 * needed).
073 *
074 * @see CollectorContext
075 * @see org.mmtk.vm.ActivePlan
076 * @see Plan
077 */
078@Uninterruptible
079public abstract class MutatorContext {
080
081  /****************************************************************************
082   * Initialization
083   */
084
085
086  /**
087   * Notify that the mutator context is registered and ready to execute. From
088   * this point it will be included in iterations over mutators.
089   *
090   * @param id The id of this mutator context.
091   */
092  public void initMutator(int id) {
093    this.id = id;
094  }
095
096  /**
097   * The mutator is about to be cleaned up, make sure all local data is returned.
098   */
099  public void deinitMutator() {
100    flush();
101  }
102
103  /****************************************************************************
104   * Instance fields
105   */
106
107  /** Unique mutator identifier */
108  private int id;
109
110  /** Used for printing log information in a thread safe manner */
111  protected final Log log = new Log();
112
113  /** Per-mutator allocator into the immortal space */
114  protected final BumpPointer immortal = new ImmortalLocal(Plan.immortalSpace);
115
116  /** Per-mutator allocator into the large object space */
117  protected final LargeObjectLocal los = new LargeObjectLocal(Plan.loSpace);
118
119  /** Per-mutator allocator into the small code space */
120  protected final MarkSweepLocal smcode = Plan.USE_CODE_SPACE ? new MarkSweepLocal(Plan.smallCodeSpace) : null;
121
122  /** Per-mutator allocator into the large code space */
123  protected final LargeObjectLocal lgcode = Plan.USE_CODE_SPACE ? new LargeObjectLocal(Plan.largeCodeSpace) : null;
124
125  /** Per-mutator allocator into the non moving space */
126  protected final MarkSweepLocal nonmove = new MarkSweepLocal(Plan.nonMovingSpace);
127
128
129  /****************************************************************************
130   *
131   * Collection.
132   */
133
134  /**
135   * Perform a per-mutator collection phase.
136   *
137   * @param phaseId The unique phase identifier
138   * @param primary Should this thread be used to execute any single-threaded
139   * local operations?
140   */
141  public abstract void collectionPhase(short phaseId, boolean primary);
142
143  /****************************************************************************
144   *
145   * Allocation.
146   */
147
148  /**
149   * Run-time check of the allocator to use for a given allocation<p>
150   *
151   * At the moment this method assumes that allocators will use the simple
152   * (worst) method of aligning to determine if the object is a large object
153   * to ensure that no objects are larger than other allocators can handle.
154   *
155   * @param bytes The number of bytes to be allocated
156   * @param align The requested alignment.
157   * @param allocator The allocator statically assigned to this allocation
158   * @return The allocator dynamically assigned to this allocation
159   */
160  @Inline
161  public int checkAllocator(int bytes, int align, int allocator) {
162    int maxBytes = Allocator.getMaximumAlignedSize(bytes, align);
163    if (allocator == Plan.ALLOC_DEFAULT) {
164      return (maxBytes > Plan.MAX_NON_LOS_DEFAULT_ALLOC_BYTES || (maxBytes > Plan.MAX_NON_LOS_COPY_BYTES && maxBytes > Plan.pretenureThreshold)) ? Plan.ALLOC_LOS : Plan.ALLOC_DEFAULT;
165    }
166
167    if (Plan.USE_CODE_SPACE && allocator == Plan.ALLOC_CODE) {
168      return (maxBytes > Plan.MAX_NON_LOS_NONMOVING_ALLOC_BYTES || (maxBytes > Plan.MAX_NON_LOS_COPY_BYTES && maxBytes > Plan.pretenureThreshold)) ? Plan.ALLOC_LARGE_CODE : allocator;
169    }
170
171    if (allocator == Plan.ALLOC_NON_REFERENCE) {
172      return (maxBytes > Plan.MAX_NON_LOS_DEFAULT_ALLOC_BYTES || (maxBytes > Plan.MAX_NON_LOS_COPY_BYTES && maxBytes > Plan.pretenureThreshold)) ? Plan.ALLOC_LOS : Plan.ALLOC_DEFAULT;
173    }
174
175    if (allocator == Plan.ALLOC_NON_MOVING) {
176      return (maxBytes > Plan.MAX_NON_LOS_NONMOVING_ALLOC_BYTES || (maxBytes > Plan.MAX_NON_LOS_COPY_BYTES && maxBytes > Plan.pretenureThreshold)) ? Plan.ALLOC_LOS : allocator;
177    }
178
179    return allocator;
180  }
181
182  /**
183   * Allocate memory for an object.
184   *
185   * @param bytes The number of bytes required for the object.
186   * @param align Required alignment for the object.
187   * @param offset Offset associated with the alignment.
188   * @param allocator The allocator associated with this request.
189   * @param site Allocation site
190   * @return The low address of the allocated chunk.
191   */
192  @Inline
193  public Address alloc(int bytes, int align, int offset, int allocator, int site) {
194    switch (allocator) {
195    case      Plan.ALLOC_LOS: return los.alloc(bytes, align, offset);
196    case      Plan.ALLOC_IMMORTAL: return immortal.alloc(bytes, align, offset);
197    case      Plan.ALLOC_CODE: return smcode.alloc(bytes, align, offset);
198    case      Plan.ALLOC_LARGE_CODE: return lgcode.alloc(bytes, align, offset);
199    case      Plan.ALLOC_NON_MOVING: return nonmove.alloc(bytes, align, offset);
200    default:
201      VM.assertions.fail("No such allocator");
202      return Address.zero();
203    }
204  }
205
206  /**
207   * Perform post-allocation actions.  For many allocators none are
208   * required.
209   *
210   * @param ref The newly allocated object
211   * @param typeRef the type reference for the instance being created
212   * @param bytes The size of the space to be allocated (in bytes)
213   * @param allocator The allocator number to be used for this allocation
214   */
215  @Inline
216  public void postAlloc(ObjectReference ref, ObjectReference typeRef,
217      int bytes, int allocator) {
218    switch (allocator) {
219    case           Plan.ALLOC_LOS: Plan.loSpace.initializeHeader(ref, true); return;
220    case      Plan.ALLOC_IMMORTAL: Plan.immortalSpace.initializeHeader(ref);  return;
221    case          Plan.ALLOC_CODE: Plan.smallCodeSpace.initializeHeader(ref, true); return;
222    case    Plan.ALLOC_LARGE_CODE: Plan.largeCodeSpace.initializeHeader(ref, true); return;
223    case    Plan.ALLOC_NON_MOVING: Plan.nonMovingSpace.initializeHeader(ref, true); return;
224    default:
225      VM.assertions.fail("No such allocator");
226    }
227  }
228
229  /****************************************************************************
230   *
231   * Space - Allocator mapping.
232   */
233
234  /**
235   * Return the allocator instance associated with a space
236   * <code>space</code>, for this plan instance.
237   *
238   * @param space The space for which the allocator instance is desired.
239   * @return The allocator instance associated with this plan instance
240   * which is allocating into <code>space</code>, or <code>null</code>
241   * if no appropriate allocator can be established.
242   */
243  public Allocator getAllocatorFromSpace(Space space) {
244    if (space == Plan.immortalSpace)  return immortal;
245    if (space == Plan.loSpace)        return los;
246    if (space == Plan.nonMovingSpace) return nonmove;
247    if (Plan.USE_CODE_SPACE && space == Plan.smallCodeSpace) return smcode;
248    if (Plan.USE_CODE_SPACE && space == Plan.largeCodeSpace) return lgcode;
249
250    // Invalid request has been made
251    if (space == Plan.metaDataSpace) {
252      VM.assertions.fail("MutatorContext.getAllocatorFromSpace given meta space");
253    } else if (space != null) {
254      VM.assertions.fail("MutatorContext.getAllocatorFromSpace given invalid space");
255    } else {
256      VM.assertions.fail("MutatorContext.getAllocatorFromSpace given null space");
257    }
258
259    return null;
260  }
261
262  /****************************************************************************
263   *
264   * Write and read barriers. By default do nothing, override if
265   * appropriate.
266   */
267
268  /**
269   * Read a reference type. In a concurrent collector this may
270   * involve adding the referent to the marking queue.
271   *
272   * @param referent The referent being read.
273   * @return The new referent.
274   */
275  @Inline
276  public ObjectReference javaLangReferenceReadBarrier(ObjectReference referent) {
277    // Either: read barriers are used and this is overridden, or
278    // read barriers are not used and this is never called
279    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
280    return ObjectReference.nullReference();
281  }
282
283  /**
284   * Write a boolean. Take appropriate write barrier actions.<p>
285   *
286   * <b>By default do nothing, override if appropriate.</b>
287   *
288   * @param src The object into which the new reference will be stored
289   * @param slot The address into which the new reference will be
290   * stored.
291   * @param value The value of the new boolean
292   * @param metaDataA A value that assists the host VM in creating a store
293   * @param metaDataB A value that assists the host VM in creating a store
294   * @param mode The context in which the store occurred
295   */
296  public void booleanWrite(ObjectReference src, Address slot, boolean value, Word metaDataA, Word metaDataB, int mode) {
297    // Either: write barriers are used and this is overridden, or
298    // write barriers are not used and this is never called
299    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
300  }
301
302  /**
303   * Read a boolean. Take appropriate read barrier action, and
304   * return the value that was read.<p> This is a <b>substituting</b>
305   * barrier.  The call to this barrier takes the place of a load.<p>
306   *
307   * @param src The object reference holding the field being read.
308   * @param slot The address of the slot being read.
309   * @param metaDataA A value that assists the host VM in creating a load
310   * @param metaDataB A value that assists the host VM in creating a load
311   * @param mode The context in which the load occurred
312   * @return The boolean that was read.
313   */
314  @Inline
315  public boolean booleanRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) {
316    // Either: read barriers are used and this is overridden, or
317    // read barriers are not used and this is never called
318    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
319    return false;
320  }
321
322  /**
323   * A number of booleans are about to be copied from object
324   * <code>src</code> to object <code>dst</code> (as in an array
325   * copy).  Thus, <code>dst</code> is the mutated object.  Take
326   * appropriate write barrier actions.<p>
327   *
328   * @param src The source array
329   * @param srcOffset The starting source offset
330   * @param dst The destination array
331   * @param dstOffset The starting destination offset
332   * @param bytes The number of bytes to be copied
333   * @return True if the update was performed by the barrier, false if
334   * left to the caller (always false in this case).
335   */
336  public boolean booleanBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) {
337    // Either: bulk copy is supported and this is overridden, or
338    // write barriers are not used and this is never called
339    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
340    return false;
341  }
342
343  /**
344   * Write a byte. Take appropriate write barrier actions.<p>
345   *
346   * <b>By default do nothing, override if appropriate.</b>
347   *
348   * @param src The object into which the new reference will be stored
349   * @param slot The address into which the new reference will be
350   * stored.
351   * @param value The value of the new byte
352   * @param metaDataA A value that assists the host VM in creating a store
353   * @param metaDataB A value that assists the host VM in creating a store
354   * @param mode The context in which the store occurred
355   */
356  public void byteWrite(ObjectReference src, Address slot, byte value, Word metaDataA, Word metaDataB, int mode) {
357    // Either: write barriers are used and this is overridden, or
358    // write barriers are not used and this is never called
359    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
360  }
361
362  /**
363   * Read a byte. Take appropriate read barrier action, and
364   * return the value that was read.<p> This is a <b>substituting</b>
365   * barrier.  The call to this barrier takes the place of a load.<p>
366   *
367   * @param src The object reference holding the field being read.
368   * @param slot The address of the slot being read.
369   * @param metaDataA A value that assists the host VM in creating a load
370   * @param metaDataB A value that assists the host VM in creating a load
371   * @param mode The context in which the load occurred
372   * @return The byte that was read.
373   */
374  @Inline
375  public byte byteRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) {
376    // Either: read barriers are used and this is overridden, or
377    // read barriers are not used and this is never called
378    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
379    return 0;
380  }
381
382  /**
383   * A number of bytes are about to be copied from object
384   * <code>src</code> to object <code>dst</code> (as in an array
385   * copy).  Thus, <code>dst</code> is the mutated object.  Take
386   * appropriate write barrier actions.<p>
387   *
388   * @param src The source array
389   * @param srcOffset The starting source offset
390   * @param dst The destination array
391   * @param dstOffset The starting destination offset
392   * @param bytes The number of bytes to be copied
393   * @return True if the update was performed by the barrier, false if
394   * left to the caller (always false in this case).
395   */
396  public boolean byteBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) {
397    // Either: bulk copy is supported and this is overridden, or
398    // write barriers are not used and this is never called
399    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
400    return false;
401  }
402
403  /**
404   * Write a char. Take appropriate write barrier actions.<p>
405   *
406   * <b>By default do nothing, override if appropriate.</b>
407   *
408   * @param src The object into which the new reference will be stored
409   * @param slot The address into which the new reference will be
410   * stored.
411   * @param value The value of the new char
412   * @param metaDataA A value that assists the host VM in creating a store
413   * @param metaDataB A value that assists the host VM in creating a store
414   * @param mode The context in which the store occurred
415   */
416  public void charWrite(ObjectReference src, Address slot, char value, Word metaDataA, Word metaDataB, int mode) {
417    // Either: write barriers are used and this is overridden, or
418    // write barriers are not used and this is never called
419    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
420  }
421
422  /**
423   * Read a char. Take appropriate read barrier action, and
424   * return the value that was read.<p> This is a <b>substituting</b>
425   * barrier.  The call to this barrier takes the place of a load.<p>
426   *
427   * @param src The object reference holding the field being read.
428   * @param slot The address of the slot being read.
429   * @param metaDataA A value that assists the host VM in creating a load
430   * @param metaDataB A value that assists the host VM in creating a load
431   * @param mode The context in which the load occurred
432   * @return The char that was read.
433   */
434  @Inline
435  public char charRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) {
436    // Either: read barriers are used and this is overridden, or
437    // read barriers are not used and this is never called
438    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
439    return 0;
440  }
441
442  /**
443   * A number of chars are about to be copied from object
444   * <code>src</code> to object <code>dst</code> (as in an array
445   * copy).  Thus, <code>dst</code> is the mutated object.  Take
446   * appropriate write barrier actions.<p>
447   *
448   * @param src The source array
449   * @param srcOffset The starting source offset
450   * @param dst The destination array
451   * @param dstOffset The starting destination offset
452   * @param bytes The number of bytes to be copied
453   * @return True if the update was performed by the barrier, false if
454   * left to the caller (always false in this case).
455   */
456  public boolean charBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) {
457    // Either: bulk copy is supported and this is overridden, or
458    // write barriers are not used and this is never called
459    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
460    return false;
461  }
462
463  /**
464   * Write a short. Take appropriate write barrier actions.<p>
465   *
466   * <b>By default do nothing, override if appropriate.</b>
467   *
468   * @param src The object into which the new reference will be stored
469   * @param slot The address into which the new reference will be
470   * stored.
471   * @param value The value of the new short
472   * @param metaDataA A value that assists the host VM in creating a store
473   * @param metaDataB A value that assists the host VM in creating a store
474   * @param mode The context in which the store occurred
475   */
476  public void shortWrite(ObjectReference src, Address slot, short value, Word metaDataA, Word metaDataB, int mode) {
477    // Either: write barriers are used and this is overridden, or
478    // write barriers are not used and this is never called
479    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
480  }
481
482  /**
483   * Read a short. Take appropriate read barrier action, and
484   * return the value that was read.<p> This is a <b>substituting</b>
485   * barrier.  The call to this barrier takes the place of a load.<p>
486   *
487   * @param src The object reference holding the field being read.
488   * @param slot The address of the slot being read.
489   * @param metaDataA A value that assists the host VM in creating a load
490   * @param metaDataB A value that assists the host VM in creating a load
491   * @param mode The context in which the load occurred
492   * @return The short that was read.
493   */
494  @Inline
495  public short shortRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) {
496    // Either: read barriers are used and this is overridden, or
497    // read barriers are not used and this is never called
498    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
499    return 0;
500  }
501
502  /**
503   * A number of shorts are about to be copied from object
504   * <code>src</code> to object <code>dst</code> (as in an array
505   * copy).  Thus, <code>dst</code> is the mutated object.  Take
506   * appropriate write barrier actions.<p>
507   *
508   * @param src The source array
509   * @param srcOffset The starting source offset
510   * @param dst The destination array
511   * @param dstOffset The starting destination offset
512   * @param bytes The number of bytes to be copied
513   * @return True if the update was performed by the barrier, false if
514   * left to the caller (always false in this case).
515   */
516  public boolean shortBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) {
517    // Either: bulk copy is supported and this is overridden, or
518    // write barriers are not used and this is never called
519    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
520    return false;
521  }
522
523
524  /**
525   * Write a int. Take appropriate write barrier actions.<p>
526   *
527   * <b>By default do nothing, override if appropriate.</b>
528   *
529   * @param src The object into which the new reference will be stored
530   * @param slot The address into which the new reference will be
531   * stored.
532   * @param value The value of the new int
533   * @param metaDataA A value that assists the host VM in creating a store
534   * @param metaDataB A value that assists the host VM in creating a store
535   * @param mode The context in which the store occurred
536   */
537  public void intWrite(ObjectReference src, Address slot, int value, Word metaDataA, Word metaDataB, int mode) {
538    // Either: write barriers are used and this is overridden, or
539    // write barriers are not used and this is never called
540    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
541  }
542
543  /**
544   * Read a int. Take appropriate read barrier action, and
545   * return the value that was read.<p> This is a <b>substituting</b>
546   * barrier.  The call to this barrier takes the place of a load.<p>
547   *
548   * @param src The object reference holding the field being read.
549   * @param slot The address of the slot being read.
550   * @param metaDataA A value that assists the host VM in creating a load
551   * @param metaDataB A value that assists the host VM in creating a load
552   * @param mode The context in which the load occurred
553   * @return The int that was read.
554   */
555  @Inline
556  public int intRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) {
557    // Either: read barriers are used and this is overridden, or
558    // read barriers are not used and this is never called
559    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
560    return 0;
561  }
562
563  /**
564   * A number of ints are about to be copied from object
565   * <code>src</code> to object <code>dst</code> (as in an array
566   * copy).  Thus, <code>dst</code> is the mutated object.  Take
567   * appropriate write barrier actions.<p>
568   *
569   * @param src The source array
570   * @param srcOffset The starting source offset
571   * @param dst The destination array
572   * @param dstOffset The starting destination offset
573   * @param bytes The number of bytes to be copied
574   * @return True if the update was performed by the barrier, false if
575   * left to the caller (always false in this case).
576   */
577  public boolean intBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) {
578    // Either: bulk copy is supported and this is overridden, or
579    // write barriers are not used and this is never called
580    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
581    return false;
582  }
583
584  /**
585   * Attempt to atomically exchange the value in the given slot
586   * with the passed replacement value.
587   *
588   * <b>By default do nothing, override if appropriate.</b>
589   *
590   * @param src The object into which the value will be stored
591   * @param slot The address into which the value will be
592   * stored.
593   * @param old The old int to be swapped out
594   * @param value The new int
595   * @param metaDataA A value that assists the host VM in creating a store
596   * @param metaDataB A value that assists the host VM in creating a store
597   * @param mode The context in which the store occurred
598   * @return True if the swap was successful.
599   */
600  public boolean intTryCompareAndSwap(ObjectReference src, Address slot, int old, int value, Word metaDataA, Word metaDataB, int mode) {
601    // Either: write barriers are used and this is overridden, or
602    // write barriers are not used and this is never called
603    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
604    return false;
605  }
606
607  /**
608   * Write a long. Take appropriate write barrier actions.<p>
609   *
610   * <b>By default do nothing, override if appropriate.</b>
611   *
612   * @param src The object into which the new reference will be stored
613   * @param slot The address into which the new reference will be
614   * stored.
615   * @param value The value of the new long
616   * @param metaDataA A value that assists the host VM in creating a store
617   * @param metaDataB A value that assists the host VM in creating a store
618   * @param mode The context in which the store occurred
619   */
620  public void longWrite(ObjectReference src, Address slot, long value, Word metaDataA, Word metaDataB, int mode) {
621    // Either: write barriers are used and this is overridden, or
622    // write barriers are not used and this is never called
623    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
624  }
625
626  /**
627   * Read a long. Take appropriate read barrier action, and
628   * return the value that was read.<p> This is a <b>substituting</b>
629   * barrier.  The call to this barrier takes the place of a load.<p>
630   *
631   * @param src The object reference holding the field being read.
632   * @param slot The address of the slot being read.
633   * @param metaDataA A value that assists the host VM in creating a load
634   * @param metaDataB A value that assists the host VM in creating a load
635   * @param mode The context in which the load occurred
636   * @return The long that was read.
637   */
638  @Inline
639  public long longRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) {
640    // Either: read barriers are used and this is overridden, or
641    // read barriers are not used and this is never called
642    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
643    return 0;
644  }
645
646  /**
647   * A number of longs are about to be copied from object
648   * <code>src</code> to object <code>dst</code> (as in an array
649   * copy).  Thus, <code>dst</code> is the mutated object.  Take
650   * appropriate write barrier actions.<p>
651   *
652   * @param src The source array
653   * @param srcOffset The starting source offset
654   * @param dst The destination array
655   * @param dstOffset The starting destination offset
656   * @param bytes The number of bytes to be copied
657   * @return True if the update was performed by the barrier, false if
658   * left to the caller (always false in this case).
659   */
660  public boolean longBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) {
661    // Either: bulk copy is supported and this is overridden, or
662    // write barriers are not used and this is never called
663    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
664    return false;
665  }
666
667  /**
668   * Attempt to atomically exchange the value in the given slot
669   * with the passed replacement value.
670   *
671   * <b>By default do nothing, override if appropriate.</b>
672   *
673   * @param src The object into which the value will be stored
674   * @param slot The address into which the value will be
675   * stored.
676   * @param old The old long to be swapped out
677   * @param value The new long
678   * @param metaDataA A value that assists the host VM in creating a store
679   * @param metaDataB A value that assists the host VM in creating a store
680   * @param mode The context in which the store occurred
681   * @return True if the swap was successful.
682   */
683  public boolean longTryCompareAndSwap(ObjectReference src, Address slot, long old, long value, Word metaDataA, Word metaDataB, int mode) {
684    // Either: write barriers are used and this is overridden, or
685    // write barriers are not used and this is never called
686    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
687    return false;
688  }
689
690  /**
691   * Write a float. Take appropriate write barrier actions.<p>
692   *
693   * <b>By default do nothing, override if appropriate.</b>
694   *
695   * @param src The object into which the new reference will be stored
696   * @param slot The address into which the new reference will be
697   * stored.
698   * @param value The value of the new float
699   * @param metaDataA A value that assists the host VM in creating a store
700   * @param metaDataB A value that assists the host VM in creating a store
701   * @param mode The context in which the store occurred
702   */
703  public void floatWrite(ObjectReference src, Address slot, float value, Word metaDataA, Word metaDataB, int mode) {
704    // Either: write barriers are used and this is overridden, or
705    // write barriers are not used and this is never called
706    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
707  }
708
709  /**
710   * Read a float. Take appropriate read barrier action, and
711   * return the value that was read.<p> This is a <b>substituting</b>
712   * barrier.  The call to this barrier takes the place of a load.<p>
713   *
714   * @param src The object reference holding the field being read.
715   * @param slot The address of the slot being read.
716   * @param metaDataA A value that assists the host VM in creating a load
717   * @param metaDataB A value that assists the host VM in creating a load
718   * @param mode The context in which the load occurred
719   * @return The float that was read.
720   */
721  @Inline
722  public float floatRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) {
723    // Either: read barriers are used and this is overridden, or
724    // read barriers are not used and this is never called
725    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
726    return 0;
727  }
728
729  /**
730   * A number of floats are about to be copied from object
731   * <code>src</code> to object <code>dst</code> (as in an array
732   * copy).  Thus, <code>dst</code> is the mutated object.  Take
733   * appropriate write barrier actions.<p>
734   *
735   * @param src The source array
736   * @param srcOffset The starting source offset
737   * @param dst The destination array
738   * @param dstOffset The starting destination offset
739   * @param bytes The number of bytes to be copied
740   * @return True if the update was performed by the barrier, false if
741   * left to the caller (always false in this case).
742   */
743  public boolean floatBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) {
744    // Either: bulk copy is supported and this is overridden, or
745    // write barriers are not used and this is never called
746    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
747    return false;
748  }
749
750  /**
751   * Write a double. Take appropriate write barrier actions.<p>
752   *
753   * <b>By default do nothing, override if appropriate.</b>
754   *
755   * @param src The object into which the new reference will be stored
756   * @param slot The address into which the new reference will be
757   * stored.
758   * @param value The value of the new double
759   * @param metaDataA A value that assists the host VM in creating a store
760   * @param metaDataB A value that assists the host VM in creating a store
761   * @param mode The context in which the store occurred
762   */
763  public void doubleWrite(ObjectReference src, Address slot, double value, Word metaDataA, Word metaDataB, int mode) {
764    // Either: write barriers are used and this is overridden, or
765    // write barriers are not used and this is never called
766    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
767  }
768
769  /**
770   * Read a double. Take appropriate read barrier action, and
771   * return the value that was read.<p> This is a <b>substituting</b>
772   * barrier.  The call to this barrier takes the place of a load.<p>
773   *
774   * @param src The object reference holding the field being read.
775   * @param slot The address of the slot being read.
776   * @param metaDataA A value that assists the host VM in creating a load
777   * @param metaDataB A value that assists the host VM in creating a load
778   * @param mode The context in which the load occurred
779   * @return The double that was read.
780   */
781  @Inline
782  public double doubleRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) {
783    // Either: read barriers are used and this is overridden, or
784    // read barriers are not used and this is never called
785    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
786    return 0;
787  }
788
789  /**
790   * A number of doubles are about to be copied from object
791   * <code>src</code> to object <code>dst</code> (as in an array
792   * copy).  Thus, <code>dst</code> is the mutated object.  Take
793   * appropriate write barrier actions.<p>
794   *
795   * @param src The source array
796   * @param srcOffset The starting source offset
797   * @param dst The destination array
798   * @param dstOffset The starting destination offset
799   * @param bytes The number of bytes to be copied
800   * @return True if the update was performed by the barrier, false if
801   * left to the caller (always false in this case).
802   */
803  public boolean doubleBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) {
804    // Either: bulk copy is supported and this is overridden, or
805    // write barriers are not used and this is never called
806    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
807    return false;
808  }
809
810  /**
811   * Write a Word. Take appropriate write barrier actions.<p>
812   *
813   * <b>By default do nothing, override if appropriate.</b>
814   *
815   * @param src The object into which the new reference will be stored
816   * @param slot The address into which the new reference will be
817   * stored.
818   * @param value The value of the new Word
819   * @param metaDataA A value that assists the host VM in creating a store
820   * @param metaDataB A value that assists the host VM in creating a store
821   * @param mode The context in which the store occurred
822   */
823  public void wordWrite(ObjectReference src, Address slot, Word value, Word metaDataA, Word metaDataB, int mode) {
824    // Either: write barriers are used and this is overridden, or
825    // write barriers are not used and this is never called
826    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
827  }
828
829  /**
830   * Read a Word. Take appropriate read barrier action, and
831   * return the value that was read.<p> This is a <b>substituting</b>
832   * barrier.  The call to this barrier takes the place of a load.<p>
833   *
834   * @param src The object reference holding the field being read.
835   * @param slot The address of the slot being read.
836   * @param metaDataA A value that assists the host VM in creating a load
837   * @param metaDataB A value that assists the host VM in creating a load
838   * @param mode The context in which the load occurred
839   * @return The Word that was read.
840   */
841  @Inline
842  public Word wordRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) {
843    // Either: read barriers are used and this is overridden, or
844    // read barriers are not used and this is never called
845    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
846    return Word.zero();
847  }
848
849  /**
850   * A number of Words are about to be copied from object
851   * <code>src</code> to object <code>dst</code> (as in an array
852   * copy).  Thus, <code>dst</code> is the mutated object.  Take
853   * appropriate write barrier actions.<p>
854   *
855   * @param src The source array
856   * @param srcOffset The starting source offset
857   * @param dst The destination array
858   * @param dstOffset The starting destination offset
859   * @param bytes The number of bytes to be copied
860   * @return True if the update was performed by the barrier, false if
861   * left to the caller (always false in this case).
862   */
863  public boolean wordBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) {
864    // Either: bulk copy is supported and this is overridden, or
865    // write barriers are not used and this is never called
866    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
867    return false;
868  }
869
870  /**
871   * Attempt to atomically exchange the value in the given slot
872   * with the passed replacement value.
873   *
874   * <b>By default do nothing, override if appropriate.</b>
875   *
876   * @param src The object into which the new reference will be stored
877   * @param slot The address into which the new reference will be
878   * stored.
879   * @param old The old Word to be swapped out
880   * @param value The new Word
881   * @param metaDataA A value that assists the host VM in creating a store
882   * @param metaDataB A value that assists the host VM in creating a store
883   * @param mode The context in which the store occurred
884   * @return True if the swap was successful.
885   */
886  public boolean wordTryCompareAndSwap(ObjectReference src, Address slot, Word old, Word value, Word metaDataA, Word metaDataB, int mode) {
887    // Either: write barriers are used and this is overridden, or
888    // write barriers are not used and this is never called
889    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
890    return false;
891  }
892
893  /**
894   * Write an Address. Take appropriate write barrier actions.<p>
895   *
896   * <b>By default do nothing, override if appropriate.</b>
897   *
898   * @param src The object into which the Word will be stored
899   * @param slot The address into which the Word will be
900   * stored.
901   * @param value The value of the new Address
902   * @param metaDataA A value that assists the host VM in creating a store
903   * @param metaDataB A value that assists the host VM in creating a store
904   * @param mode The context in which the store occurred
905   */
906  public void addressWrite(ObjectReference src, Address slot, Address value, Word metaDataA, Word metaDataB, int mode) {
907    // Either: write barriers are used and this is overridden, or
908    // write barriers are not used and this is never called
909    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
910  }
911
912  /**
913   * Read an Address. Take appropriate read barrier action, and
914   * return the value that was read.<p> This is a <b>substituting</b>
915   * barrier.  The call to this barrier takes the place of a load.<p>
916   *
917   * @param src The object reference holding the field being read.
918   * @param slot The address of the slot being read.
919   * @param metaDataA A value that assists the host VM in creating a load
920   * @param metaDataB A value that assists the host VM in creating a load
921   * @param mode The context in which the load occurred
922   * @return The Address that was read.
923   */
924  @Inline
925  public Address addressRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) {
926    // Either: read barriers are used and this is overridden, or
927    // read barriers are not used and this is never called
928    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
929    return Address.zero();
930  }
931
932  /**
933   * A number of Addresse's are about to be copied from object
934   * <code>src</code> to object <code>dst</code> (as in an array
935   * copy).  Thus, <code>dst</code> is the mutated object.  Take
936   * appropriate write barrier actions.<p>
937   *
938   * @param src The source array
939   * @param srcOffset The starting source offset
940   * @param dst The destination array
941   * @param dstOffset The starting destination offset
942   * @param bytes The number of bytes to be copied
943   * @return True if the update was performed by the barrier, false if
944   * left to the caller (always false in this case).
945   */
946  public boolean addressBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) {
947    // Either: bulk copy is supported and this is overridden, or
948    // write barriers are not used and this is never called
949    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
950    return false;
951  }
952
953  /**
954   * Attempt to atomically exchange the value in the given slot
955   * with the passed replacement value.
956   *
957   * <b>By default do nothing, override if appropriate.</b>
958   *
959   * @param src The object into which the Address will be stored
960   * @param slot The address into which the Address will be
961   * stored.
962   * @param old The old Address to be swapped out
963   * @param value The new Address
964   * @param metaDataA A value that assists the host VM in creating a store
965   * @param metaDataB A value that assists the host VM in creating a store
966   * @param mode The context in which the store occurred
967   * @return True if the swap was successful.
968   */
969  public boolean addressTryCompareAndSwap(ObjectReference src, Address slot, Address old, Address value, Word metaDataA, Word metaDataB, int mode) {
970    // Either: write barriers are used and this is overridden, or
971    // write barriers are not used and this is never called
972    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
973    return false;
974  }
975
976  /**
977   * Write an Extent. Take appropriate write barrier actions.<p>
978   *
979   * <b>By default do nothing, override if appropriate.</b>
980   *
981   * @param src The object into which the new reference will be stored
982   * @param slot The address into which the new reference will be
983   * stored.
984   * @param value The value of the new Extent
985   * @param metaDataA A value that assists the host VM in creating a store
986   * @param metaDataB A value that assists the host VM in creating a store
987   * @param mode The context in which the store occurred
988   */
989  public void extentWrite(ObjectReference src, Address slot, Extent value, Word metaDataA, Word metaDataB, int mode) {
990    // Either: write barriers are used and this is overridden, or
991    // write barriers are not used and this is never called
992    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
993  }
994
995  /**
996   * Read an Extent. Take appropriate read barrier action, and
997   * return the value that was read.<p> This is a <b>substituting</b>
998   * barrier.  The call to this barrier takes the place of a load.<p>
999   *
1000   * @param src The object reference holding the field being read.
1001   * @param slot The address of the slot being read.
1002   * @param metaDataA A value that assists the host VM in creating a load
1003   * @param metaDataB A value that assists the host VM in creating a load
1004   * @param mode The context in which the load occurred
1005   * @return The Extent that was read.
1006   */
1007  @Inline
1008  public Extent extentRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) {
1009    // Either: read barriers are used and this is overridden, or
1010    // read barriers are not used and this is never called
1011    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
1012    return Extent.zero();
1013  }
1014
1015  /**
1016   * A number of Extents are about to be copied from object
1017   * <code>src</code> to object <code>dst</code> (as in an array
1018   * copy).  Thus, <code>dst</code> is the mutated object.  Take
1019   * appropriate write barrier actions.<p>
1020   *
1021   * @param src The source array
1022   * @param srcOffset The starting source offset
1023   * @param dst The destination array
1024   * @param dstOffset The starting destination offset
1025   * @param bytes The number of bytes to be copied
1026   * @return True if the update was performed by the barrier, false if
1027   * left to the caller (always false in this case).
1028   */
1029  public boolean extentBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) {
1030    // Either: bulk copy is supported and this is overridden, or
1031    // write barriers are not used and this is never called
1032    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
1033    return false;
1034  }
1035
1036  /**
1037   * Write an Offset. Take appropriate write barrier actions.<p>
1038   *
1039   * <b>By default do nothing, override if appropriate.</b>
1040   *
1041   * @param src The object into which the new reference will be stored
1042   * @param slot The address into which the new reference will be
1043   * stored.
1044   * @param value The value of the new Offset
1045   * @param metaDataA A value that assists the host VM in creating a store
1046   * @param metaDataB A value that assists the host VM in creating a store
1047   * @param mode The context in which the store occurred
1048   */
1049  public void offsetWrite(ObjectReference src, Address slot, Offset value, Word metaDataA, Word metaDataB, int mode) {
1050    // Either: write barriers are used and this is overridden, or
1051    // write barriers are not used and this is never called
1052    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
1053  }
1054
1055  /**
1056   * Read an Offset. Take appropriate read barrier action, and
1057   * return the value that was read.<p> This is a <b>substituting</b>
1058   * barrier.  The call to this barrier takes the place of a load.<p>
1059   *
1060   * @param src The object reference holding the field being read.
1061   * @param slot The address of the slot being read.
1062   * @param metaDataA A value that assists the host VM in creating a load
1063   * @param metaDataB A value that assists the host VM in creating a load
1064   * @param mode The context in which the load occurred
1065   * @return The Offset that was read.
1066   */
1067  @Inline
1068  public Offset offsetRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) {
1069    // Either: read barriers are used and this is overridden, or
1070    // read barriers are not used and this is never called
1071    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
1072    return Offset.zero();
1073  }
1074
1075  /**
1076   * A number of Offsets are about to be copied from object
1077   * <code>src</code> to object <code>dst</code> (as in an array
1078   * copy).  Thus, <code>dst</code> is the mutated object.  Take
1079   * appropriate write barrier actions.<p>
1080   *
1081   * @param src The source array
1082   * @param srcOffset The starting source offset
1083   * @param dst The destination array
1084   * @param dstOffset The starting destination offset
1085   * @param bytes The number of bytes to be copied
1086   * @return True if the update was performed by the barrier, false if
1087   * left to the caller (always false in this case).
1088   */
1089  public boolean offsetBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) {
1090    // Either: bulk copy is supported and this is overridden, or
1091    // write barriers are not used and this is never called
1092    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
1093    return false;
1094  }
1095
1096  /**
1097   * Write an object reference. Take appropriate write barrier actions.<p>
1098   *
1099   * <b>By default do nothing, override if appropriate.</b>
1100   *
1101   * @param src The object into which the new reference will be stored
1102   * @param slot The address into which the new reference will be
1103   * stored.
1104   * @param value The value of the new reference
1105   * @param metaDataA A value that assists the host VM in creating a store
1106   * @param metaDataB A value that assists the host VM in creating a store
1107   * @param mode The context in which the store occurred
1108   */
1109  public void objectReferenceWrite(ObjectReference src, Address slot, ObjectReference value, Word metaDataA, Word metaDataB, int mode) {
1110    // Either: write barriers are used and this is overridden, or
1111    // write barriers are not used and this is never called
1112    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
1113  }
1114
1115  /**
1116   * Read an object reference. Take appropriate read barrier action, and
1117   * return the value that was read.<p> This is a <b>substituting</b>
1118   * barrier.  The call to this barrier takes the place of a load.<p>
1119   *
1120   * @param src The object reference holding the field being read.
1121   * @param slot The address of the slot being read.
1122   * @param metaDataA A value that assists the host VM in creating a load
1123   * @param metaDataB A value that assists the host VM in creating a load
1124   * @param mode The context in which the load occurred
1125   * @return The reference that was read.
1126   */
1127  @Inline
1128  public ObjectReference objectReferenceRead(ObjectReference src, Address slot, Word metaDataA, Word metaDataB, int mode) {
1129    // Either: read barriers are used and this is overridden, or
1130    // read barriers are not used and this is never called
1131    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
1132    return ObjectReference.nullReference();
1133  }
1134
1135  /**
1136   * A number of references are about to be copied from object
1137   * <code>src</code> to object <code>dst</code> (as in an array
1138   * copy).  Thus, <code>dst</code> is the mutated object.  Take
1139   * appropriate write barrier actions.<p>
1140   *
1141   * @param src The source array
1142   * @param srcOffset The starting source offset
1143   * @param dst The destination array
1144   * @param dstOffset The starting destination offset
1145   * @param bytes The number of bytes to be copied
1146   * @return <code>true</code> if the update was performed by the barrier, false if
1147   * left to the caller (always false in this case).
1148   */
1149  public boolean objectReferenceBulkCopy(ObjectReference src, Offset srcOffset, ObjectReference dst, Offset dstOffset, int bytes) {
1150    // Either: bulk copy is supported and this is overridden, or
1151    // write barriers are not used and this is never called
1152    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
1153    return false;
1154  }
1155
1156
1157  /**
1158   * A new reference is about to be created in a location that is not
1159   * a regular heap object.  Take appropriate write barrier actions.<p>
1160   *
1161   * <b>By default do nothing, override if appropriate.</b>
1162   *
1163   * @param slot The address into which the new reference will be
1164   * stored.
1165   * @param tgt The target of the new reference
1166   * @param metaDataA A value that assists the host VM in creating a store
1167   * @param metaDataB A value that assists the host VM in creating a store
1168   */
1169  public void objectReferenceNonHeapWrite(Address slot, ObjectReference tgt, Word metaDataA, Word metaDataB) {
1170    // Either: write barriers are used and this is overridden, or
1171    // write barriers are not used and this is never called
1172    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
1173  }
1174
1175  /**
1176   * Read an object reference. Take appropriate read barrier action, and
1177   * return the value that was read.<p> This is a <b>substituting</b>
1178   * barrier.  The call to this barrier takes the place of a load.<p>
1179   *
1180   * @param slot The address of the slot being read.
1181   * @param metaDataA A value that assists the host VM in creating a load
1182   * @param metaDataB A value that assists the host VM in creating a load
1183   * @return The reference that was read.
1184   */
1185  @Inline
1186  public ObjectReference objectReferenceNonHeapRead(Address slot, Word metaDataA, Word metaDataB) {
1187    // Either: read barriers are used and this is overridden, or
1188    // read barriers are not used and this is never called
1189    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
1190    return ObjectReference.nullReference();
1191  }
1192
1193  /**
1194   * Attempt to atomically exchange the value in the given slot
1195   * with the passed replacement value. If a new reference is
1196   * created, we must then take appropriate write barrier actions.<p>
1197   *
1198   * <b>By default do nothing, override if appropriate.</b>
1199   *
1200   * @param src The object into which the new reference will be stored
1201   * @param slot The address into which the new reference will be
1202   * stored.
1203   * @param old The old reference to be swapped out
1204   * @param tgt The target of the new reference
1205   * @param metaDataA A value that assists the host VM in creating a store
1206   * @param metaDataB A value that assists the host VM in creating a store
1207   * @param mode The context in which the store occurred
1208   * @return True if the swap was successful.
1209   */
1210  public boolean objectReferenceTryCompareAndSwap(ObjectReference src, Address slot, ObjectReference old, ObjectReference tgt, Word metaDataA, Word metaDataB, int mode) {
1211    // Either: write barriers are used and this is overridden, or
1212    // write barriers are not used and this is never called
1213    if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(false);
1214    return false;
1215  }
1216
1217  /**
1218   * Flush mutator context, in response to a requestMutatorFlush.
1219   * Also called by the default implementation of deinitMutator.
1220   */
1221  public void flush() {
1222    flushRememberedSets();
1223    smcode.flush();
1224    nonmove.flush();
1225  }
1226
1227  /**
1228   * Flush per-mutator remembered sets into the global remset pool.
1229   */
1230  public void flushRememberedSets() {
1231    // Either: write barriers are used and this is overridden, or
1232    // write barriers are not used and this is a no-op
1233  }
1234
1235  /**
1236   * Assert that the remsets have been flushed.  This is critical to
1237   * correctness.  We need to maintain the invariant that remset entries
1238   * do not accrue during GC.  If the host JVM generates barrier entries
1239   * it is its own responsibility to ensure that they are flushed before
1240   * returning to MMTk.
1241   */
1242  public void assertRemsetsFlushed() {
1243    // Either: write barriers are used and this is overridden, or
1244    // write barriers are not used and this is a no-op
1245  }
1246
1247  /***********************************************************************
1248   *
1249   * Miscellaneous
1250   */
1251
1252  /** @return the <code>Log</code> instance for this mutator context. */
1253  public final Log getLog() {
1254    return log;
1255  }
1256
1257  /** @return the unique identifier for this mutator context. */
1258  @Inline
1259  public int getId() {
1260    return id;
1261  }
1262
1263}