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.jikesrvm.mm.mmtk; 014 015 import org.mmtk.policy.Space; 016 017 import org.jikesrvm.VM; 018 import org.jikesrvm.scheduler.RVMThread; 019 020 import org.vmmagic.pragma.*; 021 022 @Uninterruptible public class Assert extends org.mmtk.vm.Assert { 023 @Override 024 protected final boolean getVerifyAssertionsConstant() { return VM.VerifyAssertions;} 025 026 /** 027 * This method should be called whenever an error is encountered. 028 * 029 * @param str A string describing the error condition. 030 */ 031 public final void error(String str) { 032 Space.printUsagePages(); 033 Space.printUsageMB(); 034 fail(str); 035 } 036 037 @Override 038 public final void fail(String message) { 039 Space.printUsagePages(); 040 Space.printUsageMB(); 041 VM.sysFail(message); 042 } 043 044 @Uninterruptible 045 public final void exit(int rc) { 046 VM.sysExit(rc); 047 } 048 049 @Override 050 @Inline(value=Inline.When.AllArgumentsAreConstant) 051 public final void _assert(boolean cond) { 052 if (!org.mmtk.vm.VM.VERIFY_ASSERTIONS) 053 VM.sysFail("All assertions must be guarded by VM.VERIFY_ASSERTIONS: please check the failing assertion"); 054 VM._assert(cond); 055 } 056 057 @Override 058 @Inline(value=Inline.When.ArgumentsAreConstant, arguments={1}) 059 public final void _assert(boolean cond, String message) { 060 if (!org.mmtk.vm.VM.VERIFY_ASSERTIONS) 061 VM.sysFail("All assertions must be guarded by VM.VERIFY_ASSERTIONS: please check the failing assertion"); 062 if (!cond) VM.sysWriteln(message); 063 VM._assert(cond); 064 } 065 066 @Override 067 public final void dumpStack() { 068 RVMThread.dumpStack(); 069 } 070 }