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;
014
015import org.mmtk.policy.SegregatedFreeListSpace;
016import org.vmmagic.pragma.*;
017
018/**
019 * This class and its subclasses communicate to the host VM/Runtime
020 * any features of the selected plan that it needs to know.  This is
021 * separate from the main Plan/PlanLocal class in order to bypass any
022 * issues with ordering of static initialization.
023 */
024@Uninterruptible public abstract class PlanConstraints {
025  /** @return {@code true} if this Plan requires read barriers on java.lang.reference types. */
026  public boolean needsJavaLangReferenceReadBarrier() {
027    return false;
028  }
029
030  /** @return {@code true} if this Plan requires write barriers on booleans. */
031  public boolean needsBooleanWriteBarrier() {
032    return false;
033  }
034
035  /** @return {@code true} if this Plan requires read barriers on booleans. */
036  public boolean needsBooleanReadBarrier() {
037    return false;
038  }
039
040  /** @return {@code true} if this Plan can perform bulk boolean arraycopy barriers. */
041  public boolean booleanBulkCopySupported() {
042    return false;
043  }
044
045  /** @return {@code true} if this Plan requires write barriers on bytes. */
046  public boolean needsByteWriteBarrier() {
047    return false;
048  }
049
050  /** @return {@code true} if this Plan requires read barriers on bytes. */
051  public boolean needsByteReadBarrier() {
052    return false;
053  }
054
055  /** @return {@code true} if this Plan can perform bulk byte arraycopy barriers. */
056  public boolean byteBulkCopySupported() {
057    return false;
058  }
059
060  /** @return {@code true} if this Plan requires write barriers on chars. */
061  public boolean needsCharWriteBarrier() {
062    return false;
063  }
064
065  /** @return {@code true} if this Plan requires read barriers on chars. */
066  public boolean needsCharReadBarrier() {
067    return false;
068  }
069
070  /** @return {@code true} if this Plan can perform bulk char arraycopy barriers. */
071  public boolean charBulkCopySupported() {
072    return false;
073  }
074
075  /** @return {@code true} if this Plan requires write barriers on shorts. */
076  public boolean needsShortWriteBarrier() {
077    return false;
078  }
079
080  /** @return {@code true} if this Plan requires read barriers on shorts. */
081  public boolean needsShortReadBarrier() {
082    return false;
083  }
084
085  /** @return {@code true} if this Plan can perform bulk short arraycopy barriers. */
086  public boolean shortBulkCopySupported() {
087    return false;
088  }
089
090  /** @return {@code true} if this Plan requires write barriers on ints. */
091  public boolean needsIntWriteBarrier() {
092    return false;
093  }
094
095  /** @return {@code true} if this Plan requires read barriers on ints. */
096  public boolean needsIntReadBarrier() {
097    return false;
098  }
099
100  /** @return {@code true} if this Plan can perform bulk int arraycopy barriers. */
101  public boolean intBulkCopySupported() {
102    return false;
103  }
104
105  /** @return {@code true} if this Plan requires write barriers on longs. */
106  public boolean needsLongWriteBarrier() {
107    return false;
108  }
109
110  /** @return {@code true} if this Plan requires read barriers on longs. */
111  public boolean needsLongReadBarrier() {
112    return false;
113  }
114
115  /** @return {@code true} if this Plan can perform bulk long arraycopy barriers. */
116  public boolean longBulkCopySupported() {
117    return false;
118  }
119
120  /** @return {@code true} if this Plan requires write barriers on floats. */
121  public boolean needsFloatWriteBarrier() {
122    return false;
123  }
124
125  /** @return {@code true} if this Plan requires read barriers on floats. */
126  public boolean needsFloatReadBarrier() {
127    return false;
128  }
129
130  /** @return {@code true} if this Plan can perform bulk float arraycopy barriers. */
131  public boolean floatBulkCopySupported() {
132    return false;
133  }
134
135  /** @return {@code true} if this Plan requires write barriers on doubles. */
136  public boolean needsDoubleWriteBarrier() {
137    return false;
138  }
139
140  /** @return {@code true} if this Plan requires read barriers on doubles. */
141  public boolean needsDoubleReadBarrier() {
142    return false;
143  }
144
145  /** @return {@code true} if this Plan can perform bulk double arraycopy barriers. */
146  public boolean doubleBulkCopySupported() {
147    return false;
148  }
149
150  /** @return {@code true} if this Plan requires write barriers on Words. */
151  public boolean needsWordWriteBarrier() {
152    return false;
153  }
154
155  /** @return {@code true} if this Plan requires read barriers on Words. */
156  public boolean needsWordReadBarrier() {
157    return false;
158  }
159
160  /** @return {@code true} if this Plan can perform bulk Word arraycopy barriers. */
161  public boolean wordBulkCopySupported() {
162    return false;
163  }
164
165  /** @return {@code true} if this Plan requires write barriers on Address's. */
166  public boolean needsAddressWriteBarrier() {
167    return false;
168  }
169
170  /** @return {@code true} if this Plan requires read barriers on Address's. */
171  public boolean needsAddressReadBarrier() {
172    return false;
173  }
174
175  /** @return {@code true} if this Plan can perform bulk Address arraycopy barriers. */
176  public boolean addressBulkCopySupported() {
177    return false;
178  }
179
180  /** @return {@code true} if this Plan requires write barriers on Extents. */
181  public boolean needsExtentWriteBarrier() {
182    return false;
183  }
184
185  /** @return {@code true} if this Plan requires read barriers on Extents. */
186  public boolean needsExtentReadBarrier() {
187    return false;
188  }
189
190  /** @return {@code true} if this Plan can perform bulk Extent arraycopy barriers. */
191  public boolean extentBulkCopySupported() {
192    return false;
193  }
194
195  /** @return {@code true} if this Plan requires write barriers on Offsets. */
196  public boolean needsOffsetWriteBarrier() {
197    return false;
198  }
199
200  /** @return {@code true} if this Plan requires read barriers on Offsets. */
201  public boolean needsOffsetReadBarrier() {
202    return false;
203  }
204
205  /** @return {@code true} if this Plan can perform bulk Offset arraycopy barriers. */
206  public boolean offsetBulkCopySupported() {
207    return false;
208  }
209
210  /** @return {@code true} if this Plan requires write barriers on object references. */
211  public boolean needsObjectReferenceWriteBarrier() {
212    return false;
213  }
214
215  /** @return {@code true} if this Plan requires read barriers on object references. */
216  public boolean needsObjectReferenceReadBarrier() {
217    return false;
218  }
219
220  /** @return {@code true} if this Plan requires non-heap write barriers on object references. */
221  public boolean needsObjectReferenceNonHeapWriteBarrier() {
222    return false;
223  }
224
225  /** @return {@code true} if this Plan requires non-heap read barriers on object references. */
226  public boolean needsObjectReferenceNonHeapReadBarrier() {
227    return false;
228  }
229
230  /** @return {@code true} if this Plan can perform bulk object arraycopy barriers. */
231  public boolean objectReferenceBulkCopySupported() {
232    return false;
233  }
234
235  /** @return {@code true} if this Plan requires linear scanning. */
236  public boolean needsLinearScan() {
237    return org.mmtk.utility.Constants.SUPPORT_CARD_SCANNING;
238  }
239
240  /** @return {@code true} if this Plan moves objects. */
241  public boolean movesObjects() {
242    return false;
243  }
244
245  /** @return Size (in bytes) beyond which new regular objects must be allocated to the LOS */
246  public int maxNonLOSDefaultAllocBytes() {
247    return org.mmtk.utility.Constants.MAX_INT;
248  }
249
250  /** @return Size (in bytes) beyond which new non-moving objects must be allocated to the LOS */
251  public int maxNonLOSNonMovingAllocBytes() {
252    return SegregatedFreeListSpace.MAX_FREELIST_OBJECT_BYTES;
253  }
254
255  /** @return Size (in bytes) beyond which copied objects must be copied to the LOS */
256  public int maxNonLOSCopyBytes() {
257    return org.mmtk.utility.Constants.MAX_INT;
258  }
259
260  /** @return {@code true} if this object forwards objects <i>after</i>
261   * determining global object liveness (e.g. many compacting collectors). */
262  public boolean needsForwardAfterLiveness() {
263    return false;
264  }
265
266  /** @return Is this plan generational in nature. */
267  public boolean generational() {
268    return false;
269  }
270
271  /** @return The number of header bits that are required. */
272  public abstract int gcHeaderBits();
273
274  /** @return The number of header words that are required. */
275  public abstract int gcHeaderWords();
276
277  /** @return {@code true} if this plan contains GCspy. */
278  public boolean withGCspy() {
279    return false;
280  }
281
282  /** @return {@code true} if this plan contains GCTrace. */
283  public boolean generateGCTrace() {
284    return false;
285  }
286
287  /** @return The specialized scan methods required */
288  public int numSpecializedScans() {
289    return 0;
290  }
291
292  /** @return {@code true} if this plan requires concurrent worker threads */
293  public boolean needsConcurrentWorkers() {
294    return false;
295  }
296
297  /** @return {@code true} if this Plan requires a header bit for object logging */
298  public boolean needsLogBitInHeader() {
299    return false;
300  }
301
302  /** @return the maximum number of GC threads supported by this plan.
303   * The return value must be a positive number. */
304  public int maxNumGCThreads() {
305    return Integer.MAX_VALUE;
306  }
307}