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.policy.immix;
014
015 import static org.mmtk.policy.Space.BYTES_IN_CHUNK;
016 import static org.mmtk.policy.Space.LOG_BYTES_IN_CHUNK;
017 import static org.mmtk.utility.Constants.LOG_BYTES_IN_PAGE;
018
019 import org.mmtk.plan.Plan;
020 import org.mmtk.vm.VM;
021 import org.vmmagic.unboxed.Word;
022
023 public class ImmixConstants {
024 public static final boolean BUILD_FOR_STICKYIMMIX = Plan.NEEDS_LOG_BIT_IN_HEADER;
025
026 /* start temporary experimental constants --- should not be allowed to lurk longer than necessary */
027 public static final int TMP_MIN_SPILL_THRESHOLD = 2;
028 public static final boolean PREFER_COPY_ON_NURSERY_GC = true;
029 /* end temporary experimental constants */
030
031 static final byte MAX_LINE_MARK_STATE = 127;
032 static final byte RESET_LINE_MARK_STATE = 1;
033
034 public static final boolean MARK_LINE_AT_SCAN_TIME = true; // else do it at mark time
035
036 public static final boolean SANITY_CHECK_LINE_MARKS = false && VM.VERIFY_ASSERTIONS;
037
038 public static final float DEFAULT_LINE_REUSE_RATIO = (float) 0.99;
039 public static final float DEFAULT_DEFRAG_LINE_REUSE_RATIO = (float) 0.99;
040 public static final float DEFAULT_SIMPLE_SPILL_THRESHOLD = (float) 0.25;
041 public static final int DEFAULT_DEFRAG_HEADROOM = 0; // number of pages.
042 public static final float DEFAULT_DEFRAG_HEADROOM_FRACTION = (float) 0.020;
043 public static final int DEFAULT_DEFRAG_FREE_HEADROOM = 0; // number of pages. This should only deviate from zero for analytical purposes. Otherwise the defragmenter is cheating!
044 public static final float DEFAULT_DEFRAG_FREE_HEADROOM_FRACTION = (float) 0.0;
045 /* sizes etc */
046 static final int LOG_BYTES_IN_BLOCK = (LOG_BYTES_IN_PAGE > 15 ? LOG_BYTES_IN_PAGE : 15);
047 public static final int BYTES_IN_BLOCK = 1<<LOG_BYTES_IN_BLOCK;
048 static final int LOG_PAGES_IN_BLOCK = LOG_BYTES_IN_BLOCK - LOG_BYTES_IN_PAGE;
049 static final int PAGES_IN_BLOCK = 1<<LOG_PAGES_IN_BLOCK;
050 static final int LOG_BLOCKS_IN_CHUNK = LOG_BYTES_IN_CHUNK-LOG_BYTES_IN_BLOCK;
051 static final int BLOCKS_IN_CHUNK = 1<<LOG_BLOCKS_IN_CHUNK;
052
053 public static final int LOG_BYTES_IN_LINE = 8;
054 static final int LOG_LINES_IN_BLOCK = LOG_BYTES_IN_BLOCK - LOG_BYTES_IN_LINE;
055 public static final short LINES_IN_BLOCK = (short) (1<<LOG_LINES_IN_BLOCK);
056 static final int LOG_LINES_IN_CHUNK = LOG_BYTES_IN_CHUNK - LOG_BYTES_IN_LINE;
057 static final int LINES_IN_CHUNK = 1<<LOG_LINES_IN_CHUNK;
058
059 public static final int BYTES_IN_LINE = 1<<LOG_BYTES_IN_LINE;
060
061 public static final int MAX_IMMIX_OBJECT_BYTES = BYTES_IN_BLOCK>>1;
062
063 private static final int LOG_BLOCKS_IN_RECYCLE_ALLOC_CHUNK = 4; // 3 + 15 -> 19 (512KB)
064 private static final int LOG_BYTES_IN_RECYCLE_ALLOC_CHUNK = LOG_BLOCKS_IN_RECYCLE_ALLOC_CHUNK + LOG_BYTES_IN_BLOCK;
065 static final int BYTES_IN_RECYCLE_ALLOC_CHUNK = 1<<LOG_BYTES_IN_RECYCLE_ALLOC_CHUNK;
066
067 public static final short MAX_BLOCK_MARK_STATE = LINES_IN_BLOCK;
068 static final short MAX_CONSV_SPILL_COUNT = (short) (LINES_IN_BLOCK/2);
069 public static final short SPILL_HISTOGRAM_BUCKETS = (short) (MAX_CONSV_SPILL_COUNT + 1);
070 public static final short MARK_HISTOGRAM_BUCKETS = (short) (LINES_IN_BLOCK + 1);
071 static final short MAX_COLLECTORS = 16; // nothing special here---we can increase this at the cost of a few hundred bites at build time.
072
073 public static final Word RECYCLE_ALLOC_CHUNK_MASK = Word.fromIntZeroExtend(BYTES_IN_RECYCLE_ALLOC_CHUNK - 1);
074 protected static final Word CHUNK_MASK = Word.fromIntZeroExtend(BYTES_IN_CHUNK - 1);
075 public static final Word BLOCK_MASK = Word.fromIntZeroExtend(BYTES_IN_BLOCK - 1);
076 protected static final Word LINE_MASK = Word.fromIntZeroExtend(BYTES_IN_LINE - 1);
077
078 }