/*
 * (C) Copyright IBM Corp. 2001
 */

package s3.core.services.memory.JMTk;

import ovm.core.services.memory.VM_Address;
import ovm.core.services.memory.VM_Word;
import s3.core.services.memory.vmInterface.Constants;
import s3.core.services.memory.vmInterface.VM_Interface;

/**
 * This class restricts MonotoneVMResource by preventing release of immortal memory.
 * There is functionality for boot-image support.
 *
 * 
 * @author Perry Cheng
 * @version $Revision: 1.2 $
 * @date $Date: 2003/12/04 16:44:08 $
 */
public class ImmortalVMResource extends MonotoneVMResource implements Constants, VM_Uninterruptible {
  public final static String Id = "$Id: ImmortalVMResource.java,v 1.2 2003/12/04 16:44:08 flack Exp $"; 

  /****************************************************************************
   *
   * Public instance methods
   */
  /**
   * Constructor
   */
  ImmortalVMResource(byte space_, String vmName, MemoryResource mr, VM_Address vmStart, VM_Word bytes) {
    super(space_, vmName, mr, vmStart, bytes, (byte) (VMResource.IN_VM | VMResource.IMMORTAL));
    if (VM_Interface.VerifyAssertions) VM_Interface._assert(cursor.uGE(vmStart) && cursor.uLE(sentinel));
    sentinel = start.add(bytes);
  }

  public final VM_Address acquire(int pageRequest) {
    VM_Address result = super.acquire(pageRequest);
    acquireHelp(start, pageRequest);
    return result;
  }

  public final void release() {
    if (VM_Interface.VerifyAssertions) VM_Interface._assert(false);
  }
  
}
