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