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.generational.immix; 014 015import static org.mmtk.policy.immix.ImmixConstants.MARK_LINE_AT_SCAN_TIME; 016 017import org.mmtk.plan.generational.GenCollector; 018import org.mmtk.plan.generational.GenMatureTraceLocal; 019import org.mmtk.plan.Trace; 020import org.mmtk.policy.Space; 021import org.mmtk.utility.Log; 022import org.mmtk.utility.options.Options; 023import org.mmtk.vm.VM; 024 025import org.vmmagic.unboxed.*; 026import org.vmmagic.pragma.*; 027 028/** 029 * This class implements the core functionality for a transitive 030 * closure over the heap graph, specifically in a defragmenting pass over 031 * a generational immix collector. 032 */ 033@Uninterruptible 034public final class GenImmixMatureDefragTraceLocal extends GenMatureTraceLocal{ 035 036 /** 037 * @param global the global trace class to use 038 * @param plan the state of the generational collector 039 */ 040 public GenImmixMatureDefragTraceLocal(Trace global, GenCollector plan) { 041 super(-1, global, plan); 042 } 043 044 @Override 045 public boolean isLive(ObjectReference object) { 046 if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(GenImmix.immixSpace.inImmixDefragCollection()); 047 if (object.isNull()) return false; 048 if (Space.isInSpace(GenImmix.IMMIX, object)) { 049 return GenImmix.immixSpace.isLive(object); 050 } 051 return super.isLive(object); 052 } 053 054 @Override 055 @Inline 056 public ObjectReference traceObject(ObjectReference object) { 057 if (VM.VERIFY_ASSERTIONS) VM.assertions._assert(GenImmix.immixSpace.inImmixDefragCollection()); 058 if (object.isNull()) return object; 059 if (Space.isInSpace(GenImmix.IMMIX, object)) 060 return GenImmix.immixSpace.traceObject(this, object, GenImmix.ALLOC_MATURE_MAJORGC); 061 return super.traceObject(object); 062 } 063 064 @Override 065 public boolean willNotMoveInCurrentCollection(ObjectReference object) { 066 if (Space.isInSpace(GenImmix.IMMIX, object)) { 067 return GenImmix.immixSpace.willNotMoveThisGC(object); 068 } 069 return super.willNotMoveInCurrentCollection(object); 070 } 071 072 @Inline 073 @Override 074 protected void scanObject(ObjectReference object) { 075 if (VM.VERIFY_ASSERTIONS && Options.verbose.getValue() >= 9) { 076 Log.write("SO["); Log.write(object); Log.writeln("]"); 077 } 078 super.scanObject(object); 079 if (MARK_LINE_AT_SCAN_TIME && Space.isInSpace(GenImmix.IMMIX, object)) 080 GenImmix.immixSpace.markLines(object); 081 } 082}