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.copyms; 014 015import org.mmtk.plan.TraceLocal; 016import org.mmtk.plan.Trace; 017import org.mmtk.policy.Space; 018 019import org.vmmagic.pragma.*; 020import org.vmmagic.unboxed.*; 021 022/** 023 * This class implements the thread-local functionality for a 024 * transitive closure over a coping/mark-sweep hybrid collector. 025 */ 026@Uninterruptible 027public final class CopyMSTraceLocal extends TraceLocal { 028 029 /** 030 * @param trace the global trace class to use 031 */ 032 public CopyMSTraceLocal(Trace trace) { 033 super(CopyMS.SCAN_COPYMS, trace); 034 } 035 036 /**************************************************************************** 037 * 038 * Externally visible Object processing and tracing 039 */ 040 041 /** 042 * Is the specified object reachable? 043 */ 044 @Override 045 public boolean isLive(ObjectReference object) { 046 if (object.isNull()) return false; 047 if (Space.isInSpace(CopyMS.NURSERY, object)) { 048 return CopyMS.nurserySpace.isLive(object); 049 } 050 if (Space.isInSpace(CopyMS.MARK_SWEEP, object)) { 051 return CopyMS.msSpace.isLive(object); 052 } 053 return super.isLive(object); 054 } 055 056 /** 057 * {@inheritDoc}<p> 058 * 059 * In this instance, we refer objects in the mark-sweep space to the 060 * msSpace for tracing, and defer to the superclass for all others. 061 */ 062 @Inline 063 @Override 064 public ObjectReference traceObject(ObjectReference object) { 065 if (object.isNull()) return object; 066 if (Space.isInSpace(CopyMS.NURSERY, object)) 067 return CopyMS.nurserySpace.traceObject(this, object, CopyMS.ALLOC_MS); 068 if (Space.isInSpace(CopyMS.MARK_SWEEP, object)) 069 return CopyMS.msSpace.traceObject(this, object); 070 return super.traceObject(object); 071 } 072 073 /** 074 * Will this object move from this point on, during the current collection ? 075 * 076 * @param object The object to query. 077 */ 078 @Override 079 public boolean willNotMoveInCurrentCollection(ObjectReference object) { 080 return !Space.isInSpace(CopyMS.NURSERY, object); 081 } 082}