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.vm;
014
015 import org.mmtk.plan.TraceLocal;
016 import org.vmmagic.pragma.Uninterruptible;
017 import org.vmmagic.unboxed.Address;
018 import org.vmmagic.unboxed.ObjectReference;
019
020 /**
021 *
022 */
023 @Uninterruptible
024 public abstract class Debug {
025 /**
026 * Global switch for debugging - if {@code false} the other methods of this
027 * class are never called.
028 * @return Whether debugging is enabled
029 */
030 public abstract boolean isEnabled();
031
032 /**
033 * A modbuf (object remembering barrier) entry has been
034 * traced during collection.
035 * @param object The modbuf entry
036 */
037 public void modbufEntry(ObjectReference object) { }
038
039 /**
040 * A remset (slot remembering barrier) entry has been
041 * traced during collection.
042 * @param slot The remset entry
043 */
044 public void remsetEntry(Address slot) { }
045
046 /**
047 * An array remset entry has been traced during collection. Implicitly
048 * the slots from start (inclusive) through to guard (non-inclusive)
049 * are traced as remset entries
050 * @param start The entry start address
051 * @param guard The guard
052 */
053 public void arrayRemsetEntry(Address start, Address guard) { }
054
055 /**
056 * A global GC collection phase
057 * @param phaseId The phase ID
058 * @param before true at the start of the phase, false at the end
059 */
060 public void globalPhase(short phaseId, boolean before) { }
061
062 /**
063 * A per-collector GC collection phase
064 * @param phaseId The phase ID
065 * @param ordinal The collector ID (within this collection)
066 * @param before true at the start of the phase, false at the end
067 */
068 public void collectorPhase(short phaseId, int ordinal, boolean before) { }
069
070 /**
071 * A per-mutator GC collection phase
072 * @param phaseId The phase ID
073 * @param ordinal The mutator ID
074 * @param before true at the start of the phase, false at the end
075 */
076 public void mutatorPhase(short phaseId, int ordinal, boolean before) { }
077
078 /**
079 * Trace an object during GC
080 *
081 * *** Non-standard, requires plumbing into a collector during debugging ***
082 *
083 * @param trace The trace being performed
084 * @param object The object
085 */
086 public void traceObject(TraceLocal trace, ObjectReference object) { }
087
088 /**
089 * An entry has been inserted at the head of a queue
090 *
091 * *** Non-standard, requires plumbing into a collector during debugging ***
092 *
093 * @param queueName The name of the queue
094 * @param value The value
095 */
096 public void queueHeadInsert(String queueName, Address value) {
097 }
098
099 /**
100 * An entry has been inserted at the head of a queue
101 *
102 * *** Non-standard, requires plumbing into a collector during debugging ***
103 *
104 * @param queueName The name of the queue
105 * @param value The value
106 */
107 public void queueTailInsert(String queueName, Address value) {
108 }
109
110 /**
111 * An entry has been inserted at the head of a queue
112 *
113 * *** Non-standard, requires plumbing into a collector during debugging ***
114 *
115 * @param queueName The name of the queue
116 * @param value The value
117 */
118 public void queueHeadRemove(String queueName, Address value) { }
119
120 /**
121 * An entry has been inserted at the head of a queue
122 *
123 * *** Non-standard, requires plumbing into a collector during debugging ***
124 *
125 * @param queueName The name of the queue
126 * @param value The value
127 */
128 public void queueTailRemove(String queueName, Address value) { }
129
130 /*
131 * NOTE: These methods should not be called by anything other than the
132 * reflective mechanisms in org.mmtk.vm.VM, and are not implemented by
133 * subclasses.
134 *
135 * This hack exists only to allow us to declare the respective
136 * methods as protected.
137 */
138 static final boolean isEnabledTrapdoor(Debug d) {
139 return d.isEnabled();
140 }
141
142 }