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.utility.options;
014
015import org.mmtk.policy.MarkSweepSpace;
016
017/**
018 * Number of bits to use for the header cycle of mark sweep spaces.
019 */
020public final class MarkSweepMarkBits extends org.vmutil.options.IntOption {
021  /**
022   * Create the option.
023   */
024  public MarkSweepMarkBits() {
025    super(Options.set, "Mark Sweep Mark Bits",
026          "Number of bits to use for the header cycle of mark sweep spaces",
027          MarkSweepSpace.DEFAULT_MARKCOUNT_BITS);
028  }
029
030  /**
031   * Ensure the value is valid.
032   */
033  @Override
034  protected void validate() {
035    failIf(this.value <= 0, "Must provide at least one bit");
036    failIf(this.value > MarkSweepSpace.MAX_MARKCOUNT_BITS , "Only " +
037        MarkSweepSpace.MAX_MARKCOUNT_BITS + " bits are reserved in MarkSweepSpace");
038  }
039}