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