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.vmmagic.pragma.Uninterruptible;
016
017/**
018 * The zeroing approach to use for new object allocations.
019 * Affects each plan differently.
020 */
021@Uninterruptible
022public final class NurseryZeroing extends org.vmutil.options.EnumOption {
023
024  public final int TEMPORAL = 0;
025  public final int NON_TEMPORAL = 1;
026  public final int CONCURRENT = 2;
027  public final int ADAPTIVE = 3;
028
029  /**
030   * Create the option.
031   */
032  public NurseryZeroing() {
033    super(Options.set, "Nursery Zeroing",
034          "The default approach used for zero initializing nursery objects",
035          new String[] {"temporal", "nontemporal", "concurrent", "adaptive"},
036          "temporal");
037  }
038
039  /**
040   * @return {@code true} if a non temporal zeroing approach is to be used.
041   */
042  public boolean getNonTemporal() {
043    return getValue() != TEMPORAL;
044  }
045
046  /**
047   * @return {@code true} if a concurrent zeroing approach is to be used.
048   */
049  public boolean getConcurrent() {
050    return getValue() == CONCURRENT || getValue() == ADAPTIVE;
051  }
052
053  /**
054   * @return {@code true} if a concurrent zeroing approach is to be used.
055   */
056  public boolean getAdaptive() {
057    return getValue() == ADAPTIVE;
058  }
059}