From: <mic...@us...> - 2007-08-06 15:23:41
|
Revision: 157 http://pearcolator.svn.sourceforge.net/pearcolator/?rev=157&view=rev Author: michael_baer Date: 2007-08-06 08:23:44 -0700 (Mon, 06 Aug 2007) Log Message: ----------- - changes to compile with latest RVM Modified Paths: -------------- ext/org/jikesrvm/classloader/VM_Member.java ext/org/jikesrvm/classloader/VM_Method.java ext/org/jikesrvm/compilers/common/VM_RuntimeCompiler.java ext/org/jikesrvm/compilers/opt/ia32/OPT_BURS_Helpers.java ext/org/jikesrvm/compilers/opt/ir/OPT_BC2IR.java Modified: ext/org/jikesrvm/classloader/VM_Member.java =================================================================== --- ext/org/jikesrvm/classloader/VM_Member.java 2007-08-06 14:18:07 UTC (rev 156) +++ ext/org/jikesrvm/classloader/VM_Member.java 2007-08-06 15:23:44 UTC (rev 157) @@ -1,29 +1,30 @@ /* - * This file is part of Jikes RVM (http://jikesrvm.sourceforge.net). - * The Jikes RVM project is distributed under the Common Public License (CPL). - * A copy of the license is included in the distribution, and is also - * available at http://www.opensource.org/licenses/cpl1.0.php + * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * (C) Copyright IBM Corp 2001,2002 + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. */ package org.jikesrvm.classloader; -import org.jikesrvm.*; -import org.vmmagic.pragma.*; +import org.jikesrvm.VM; +import org.jikesrvm.VM_Constants; +import org.vmmagic.pragma.Uninterruptible; import org.vmmagic.unboxed.Offset; /** * A field or method of a java class. - * - * @author Bowen Alpern - * @author Dave Grove - * @author Derek Lieber */ public abstract class VM_Member extends VM_AnnotatedElement implements VM_Constants, VM_ClassLoaderConstants { /** Initial value for a field offset - indicates field not laid out. */ - private static final int NO_OFFSET = Short.MIN_VALUE+1; - + private static final int NO_OFFSET = Short.MIN_VALUE + 1; + /** * The class that declared this member, avaliable by calling * getDeclaringClass once the class is loaded. @@ -54,15 +55,14 @@ /** * NOTE: Only {@link VM_Class} is allowed to create an instance of a VM_Member. - * + * * @param declaringClass the VM_TypeReference object of the class that declared this member * @param memRef the canonical memberReference for this member. * @param modifiers modifiers associated with this member. * @param signature generic type of this member * @param annotations array of runtime visible annotations */ - protected VM_Member(VM_TypeReference declaringClass, VM_MemberReference memRef, - short modifiers, VM_Atom signature, + protected VM_Member(VM_TypeReference declaringClass, VM_MemberReference memRef, short modifiers, VM_Atom signature, VM_Annotation[] annotations) { super(annotations); this.declaringClass = declaringClass; @@ -80,34 +80,34 @@ /** * Class that declared this field or method. Not available before * the class is loaded. - */ + */ @Uninterruptible public final VM_Class getDeclaringClass() { - return declaringClass.peekResolvedType().asClass(); + return declaringClass.peekType().asClass(); } /** * Canonical member reference for this member. - */ + */ @Uninterruptible - public final VM_MemberReference getMemberRef() { + public final VM_MemberReference getMemberRef() { return memRef; } /** * Name of this member. - */ + */ @Uninterruptible - public final VM_Atom getName() { + public final VM_Atom getName() { return memRef.getName(); } /** * Descriptor for this member. * something like "I" for a field or "(I)V" for a method. - */ + */ @Uninterruptible - public final VM_Atom getDescriptor() { + public final VM_Atom getDescriptor() { return memRef.getDescriptor(); } @@ -124,7 +124,7 @@ * and thus may be used to find the member by first finding the member reference. */ @Uninterruptible - public final int getId() { + public final int getId() { return memRef.getId(); } @@ -132,34 +132,34 @@ * Define hashcode in terms of VM_Atom.hashCode to enable * consistent hash codes during bootImage writing and run-time. */ - public int hashCode() { + public int hashCode() { return memRef.hashCode(); } public final String toString() { return declaringClass + "." + getName() + " " + getDescriptor(); } - + /** * Usable from classes outside its package? - */ + */ public final boolean isPublic() { - return (modifiers & ACC_PUBLIC) != 0; + return (modifiers & ACC_PUBLIC) != 0; } /** * Usable only from this class? - */ - public final boolean isPrivate() { - return (modifiers & ACC_PRIVATE) != 0; + */ + public final boolean isPrivate() { + return (modifiers & ACC_PRIVATE) != 0; } - + /** * Usable from subclasses? - */ - public final boolean isProtected() { - return (modifiers & ACC_PROTECTED) != 0; - } + */ + public final boolean isProtected() { + return (modifiers & ACC_PROTECTED) != 0; + } /** * Get the member's modifiers. @@ -167,10 +167,10 @@ public final int getModifiers() { return modifiers; } - + /** * Has the field been laid out in the object yet ? - * + * * @return */ public final boolean hasOffset() { @@ -179,7 +179,7 @@ //------------------------------------------------------------------// // Section 2. // - // The following are available after the declaring class has been // + // The following are available after the declaring class has been // // "resolved". // //------------------------------------------------------------------// @@ -191,10 +191,10 @@ * <li> For a non-static field: offset of field from start of object * <li> For a non-static method: offset of code object reference from start of tib * </ul> - */ + */ @Uninterruptible - public final Offset getOffset() { - if (VM.VerifyAssertions) VM._assert(declaringClass.isResolved()); + public final Offset getOffset() { + if (VM.VerifyAssertions) VM._assert(declaringClass.isLoaded()); if (VM.VerifyAssertions) VM._assert(offset != NO_OFFSET); return Offset.fromIntSignExtend(offset); } Modified: ext/org/jikesrvm/classloader/VM_Method.java =================================================================== --- ext/org/jikesrvm/classloader/VM_Method.java 2007-08-06 14:18:07 UTC (rev 156) +++ ext/org/jikesrvm/classloader/VM_Method.java 2007-08-06 15:23:44 UTC (rev 157) @@ -1,121 +1,96 @@ /* - * This file is part of Jikes RVM (http://jikesrvm.sourceforge.net). - * The Jikes RVM project is distributed under the Common Public License (CPL). - * A copy of the license is included in the distribution, and is also - * available at http://www.opensource.org/licenses/cpl1.0.php + * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * (C) Copyright IBM Corp 2001,2002 + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. */ package org.jikesrvm.classloader; -import org.jikesrvm.*; +import java.io.DataInputStream; +import java.io.IOException; import org.jikesrvm.ArchitectureSpecific.VM_CodeArray; import org.jikesrvm.ArchitectureSpecific.VM_LazyCompilationTrampolineGenerator; +import org.jikesrvm.VM; import org.jikesrvm.compilers.common.VM_CompiledMethod; import org.jikesrvm.compilers.common.VM_CompiledMethods; -import org.jikesrvm.runtime.VM_Statics; import org.jikesrvm.runtime.VM_Entrypoints; - -import java.io.DataInputStream; -import java.io.IOException; - +import org.jikesrvm.runtime.VM_Statics; +import org.vmmagic.pragma.Uninterruptible; +import org.vmmagic.pragma.Unpreemptible; import org.vmmagic.unboxed.Offset; -import org.vmmagic.pragma.*; /** - * A method of a java class corresponding to a method_info structure in the - * class file. A method is read from a class file using the {@link #readMethod} - * method. - * - * @author Bowen Alpern - * @author Dave Grove - * @author Derek Lieber - * @author Ian Rogers + * A method of a java class corresponding to a method_info structure + * in the class file. A method is read from a class file using the + * {@link #readMethod} method. */ -public abstract class VM_Method extends VM_Member implements - VM_BytecodeConstants { +public abstract class VM_Method extends VM_Member implements VM_BytecodeConstants { /** * current compiled method for this method */ protected VM_CompiledMethod currentCompiledMethod; - /** * exceptions this method might throw (null --> none) */ protected final VM_TypeReference[] exceptionTypes; - /** - * Method paramter annotations from the class file that are described as - * runtime visible. These annotations are available to the reflection API. + * Method paramter annotations from the class file that are + * described as runtime visible. These annotations are available to + * the reflection API. */ protected final VM_Annotation[] parameterAnnotations; - /** * A value present in the method info tables of annotation types. It * represents the default result from an annotation method. */ protected final Object annotationDefault; - /** - * The offset of this virtual method in the jtoc if it's been placed there by - * constant propagation, otherwise 0. + * The offset of this virtual method in the jtoc if it's been placed + * there by constant propagation, otherwise 0. */ private Offset jtocOffset; /** * Construct a read method - * - * @param declaringClass - * the VM_Class object of the class that declared this field - * @param memRef - * the canonical memberReference for this method. - * @param modifiers - * modifiers associated with this method. - * @param exceptionTypes - * exceptions thrown by this method. - * @param signature - * generic type of this method. - * @param annotations - * array of runtime visible annotations - * @param parameterAnnotations - * array of runtime visible parameter annotations - * @param annotationDefault - * value for this annotation that appears + * + * @param declaringClass the VM_Class object of the class that declared this field + * @param memRef the canonical memberReference for this method. + * @param modifiers modifiers associated with this method. + * @param exceptionTypes exceptions thrown by this method. + * @param signature generic type of this method. + * @param annotations array of runtime visible annotations + * @param parameterAnnotations array of runtime visible parameter annotations + * @param annotationDefault value for this annotation that appears */ - protected VM_Method(VM_TypeReference declaringClass, - VM_MemberReference memRef, short modifiers, - VM_TypeReference[] exceptionTypes, VM_Atom signature, - VM_Annotation[] annotations, VM_Annotation[] parameterAnnotations, - Object annotationDefault) { - super(declaringClass, memRef, (short) (modifiers & APPLICABLE_TO_METHODS), - signature, annotations); + protected VM_Method(VM_TypeReference declaringClass, VM_MemberReference memRef, short modifiers, + VM_TypeReference[] exceptionTypes, VM_Atom signature, VM_Annotation[] annotations, + VM_Annotation[] parameterAnnotations, Object annotationDefault) { + super(declaringClass, memRef, (short) (modifiers & APPLICABLE_TO_METHODS), signature, annotations); this.parameterAnnotations = parameterAnnotations; this.annotationDefault = annotationDefault; - memRef.asMethodReference().setResolvedMember(this); this.exceptionTypes = exceptionTypes; this.jtocOffset = Offset.fromIntSignExtend(-1); } /** - * Called from {@link VM_Class#readClass(VM_TypeReference, DataInputStream)} - * to create an instance of a VM_Method by reading the relevant data from the - * argument bytecode stream. - * - * @param declaringClass - * the VM_TypeReference of the class being loaded - * @param constantPool - * the constantPool of the VM_Class object that's being constructed - * @param memRef - * the canonical memberReference for this member. - * @param modifiers - * modifiers associated with this member. - * @param input - * the DataInputStream to read the method's attributes from + * Called from {@link VM_Class#readClass(VM_TypeReference,DataInputStream)} to create an + * instance of a VM_Method by reading the relevant data from the argument bytecode stream. + * + * @param declaringClass the VM_TypeReference of the class being loaded + * @param constantPool the constantPool of the VM_Class object that's being constructed + * @param memRef the canonical memberReference for this member. + * @param modifiers modifiers associated with this member. + * @param input the DataInputStream to read the method's attributes from */ - static VM_Method readMethod(VM_TypeReference declaringClass, - int[] constantPool, VM_MemberReference memRef, short modifiers, - DataInputStream input) throws IOException { + static VM_Method readMethod(VM_TypeReference declaringClass, int[] constantPool, VM_MemberReference memRef, + short modifiers, DataInputStream input) throws IOException { short tmp_localWords = 0; short tmp_operandWords = 0; byte[] tmp_bytecodes = null; @@ -129,8 +104,7 @@ // Read the attributes for (int i = 0, n = input.readUnsignedShort(); i < n; i++) { - VM_Atom attName = VM_Class - .getUtf(constantPool, input.readUnsignedShort()); + VM_Atom attName = VM_Class.getUtf(constantPool, input.readUnsignedShort()); int attLength = input.readInt(); // Only bother to interpret non-boring Method attributes @@ -139,8 +113,7 @@ tmp_localWords = input.readShort(); tmp_bytecodes = new byte[input.readInt()]; input.readFully(tmp_bytecodes); - tmp_exceptionHandlerMap = VM_ExceptionHandlerMap - .readExceptionHandlerMap(input, constantPool); + tmp_exceptionHandlerMap = VM_ExceptionHandlerMap.readExceptionHandlerMap(input, constantPool); // Read the attributes portion of the code attribute for (int j = 0, n2 = input.readUnsignedShort(); j < n2; j++) { @@ -158,8 +131,7 @@ } } } else { - // All other entries in the attribute portion of the code attribute - // are boring. + // All other entries in the attribute portion of the code attribute are boring. input.skipBytes(attLength); } } @@ -168,25 +140,21 @@ if (cnt != 0) { tmp_exceptionTypes = new VM_TypeReference[cnt]; for (int j = 0, m = tmp_exceptionTypes.length; j < m; ++j) { - tmp_exceptionTypes[j] = VM_Class.getTypeRef(constantPool, input - .readUnsignedShort()); + tmp_exceptionTypes[j] = VM_Class.getTypeRef(constantPool, input.readUnsignedShort()); } } } else if (attName == VM_ClassLoader.syntheticAttributeName) { modifiers |= ACC_SYNTHETIC; } else if (attName == VM_ClassLoader.signatureAttributeName) { - tmp_signature = VM_Class - .getUtf(constantPool, input.readUnsignedShort()); + tmp_signature = VM_Class.getUtf(constantPool, input.readUnsignedShort()); } else if (attName == VM_ClassLoader.runtimeVisibleAnnotationsAttributeName) { - annotations = VM_AnnotatedElement.readAnnotations(constantPool, input, - 2, declaringClass.getClassLoader()); + annotations = VM_AnnotatedElement.readAnnotations(constantPool, input, 2, declaringClass.getClassLoader()); } else if (attName == VM_ClassLoader.runtimeVisibleParameterAnnotationsAttributeName) { - parameterAnnotations = VM_AnnotatedElement.readAnnotations( - constantPool, input, 1, declaringClass.getClassLoader()); + parameterAnnotations = + VM_AnnotatedElement.readAnnotations(constantPool, input, 1, declaringClass.getClassLoader()); } else if (attName == VM_ClassLoader.annotationDefaultAttributeName) { try { - tmp_annotationDefault = VM_Annotation.readValue(constantPool, input, - declaringClass.getClassLoader()); + tmp_annotationDefault = VM_Annotation.readValue(constantPool, input, declaringClass.getClassLoader()); } catch (ClassNotFoundException e) { throw new Error(e); } @@ -197,73 +165,100 @@ } VM_Method method; if ((modifiers & ACC_NATIVE) != 0) { - method = new VM_NativeMethod(declaringClass, memRef, modifiers, - tmp_exceptionTypes, tmp_signature, annotations, parameterAnnotations, - tmp_annotationDefault); + method = + new VM_NativeMethod(declaringClass, + memRef, + modifiers, + tmp_exceptionTypes, + tmp_signature, + annotations, + parameterAnnotations, + tmp_annotationDefault); } else if ((modifiers & ACC_ABSTRACT) != 0) { - method = new VM_AbstractMethod(declaringClass, memRef, modifiers, - tmp_exceptionTypes, tmp_signature, annotations, parameterAnnotations, - tmp_annotationDefault); + method = + new VM_AbstractMethod(declaringClass, + memRef, + modifiers, + tmp_exceptionTypes, + tmp_signature, + annotations, + parameterAnnotations, + tmp_annotationDefault); } else { - method = new VM_NormalMethod(declaringClass, memRef, modifiers, - tmp_exceptionTypes, tmp_localWords, tmp_operandWords, tmp_bytecodes, - tmp_exceptionHandlerMap, tmp_lineNumberMap, constantPool, - tmp_signature, annotations, parameterAnnotations, - tmp_annotationDefault); + method = + new VM_NormalMethod(declaringClass, + memRef, + modifiers, + tmp_exceptionTypes, + tmp_localWords, + tmp_operandWords, + tmp_bytecodes, + tmp_exceptionHandlerMap, + tmp_lineNumberMap, + constantPool, + tmp_signature, + annotations, + parameterAnnotations, + tmp_annotationDefault); } return method; } /** - * Create a copy of the method that occurs in the annotation interface. The - * method body will contain a read of the field at the constant pool index - * specified. - * - * @param annotationClass - * the class this method belongs to - * @param constantPool - * for the class - * @param memRef - * the member reference corresponding to this method - * @param interfaceMethod - * the interface method that will copied to produce the annotation - * method - * @param constantPoolIndex - * the index of the field that will be returned by this method + * Create a copy of the method that occurs in the annotation + * interface. The method body will contain a read of the field at + * the constant pool index specified. + * + * @param annotationClass the class this method belongs to + * @param constantPool for the class + * @param memRef the member reference corresponding to this method + * @param interfaceMethod the interface method that will copied to + * produce the annotation method + * @param constantPoolIndex the index of the field that will be + * returned by this method * @return the created method */ - static VM_Method createAnnotationMethod(VM_TypeReference annotationClass, - int[] constantPool, VM_MemberReference memRef, VM_Method interfaceMethod, - int constantPoolIndex) { - byte[] bytecodes = new byte[] { (byte) JBC_aload_0, (byte) JBC_getfield, - (byte) (constantPoolIndex >>> 8), (byte) constantPoolIndex, + static VM_Method createAnnotationMethod(VM_TypeReference annotationClass, int[] constantPool, + VM_MemberReference memRef, VM_Method interfaceMethod, + int constantPoolIndex) { + byte[] bytecodes = + new byte[]{ + (byte) JBC_aload_0, + (byte) JBC_getfield, (byte) (constantPoolIndex >>> 8), (byte) constantPoolIndex, // Xreturn - (byte) typeRefToReturnBytecode(interfaceMethod.getReturnType()) }; - return new VM_NormalMethod(annotationClass, memRef, (short) (ACC_PUBLIC - | ACC_FINAL | ACC_SYNTHETIC), null, (short) 1, (short) 2, bytecodes, - null, null, constantPool, null, null, null, null); + (byte) typeRefToReturnBytecode(interfaceMethod.getReturnType())}; + return new VM_NormalMethod(annotationClass, + memRef, + (short) (ACC_PUBLIC | ACC_FINAL | ACC_SYNTHETIC), + null, + (short) 1, + (short) 2, + bytecodes, + null, + null, + constantPool, + null, + null, + null, + null); } /** * Create a method to initialise the annotation class - * - * @param aClass - * the class this method belongs to - * @param constantPool - * for the class - * @param memRef - * the member reference corresponding to this method - * @param objectInitIndex - * an index into the constant pool for a method reference to - * java.lang.Object.<init> + * + * @param aClass the class this method belongs to + * @param constantPool for the class + * @param memRef the member reference corresponding to this method + * @param objectInitIndex an index into the constant pool for a + * method reference to java.lang.Object.<init> * @param aFields * @param aMethods * @return the created method */ - static VM_Method createAnnotationInit(VM_TypeReference aClass, - int[] constantPool, VM_MemberReference memRef, int objectInitIndex, - VM_Field[] aFields, VM_Method[] aMethods, int[] defaultConstants) { + static VM_Method createAnnotationInit(VM_TypeReference aClass, int[] constantPool, VM_MemberReference memRef, + int objectInitIndex, VM_Field[] aFields, VM_Method[] aMethods, + int[] defaultConstants) { byte[] bytecode = new byte[6 + (defaultConstants.length * 7)]; bytecode[0] = (byte) JBC_aload_0; // stack[0] = this bytecode[1] = (byte) JBC_aload_1; // stack[1] = instanceof VM_Annotation @@ -272,7 +267,7 @@ bytecode[4] = (byte) objectInitIndex; for (int i = 0, j = 0; i < aMethods.length; i++) { if (aMethods[i].annotationDefault != null) { - bytecode[(j * 7) + 5 + 0] = (byte) JBC_aload_0; // stack[0] = this + bytecode[(j * 7) + 5 + 0] = (byte) JBC_aload_0; // stack[0] = this if (VM_Class.getLiteralSize(constantPool, defaultConstants[j]) == BYTES_IN_INT) { bytecode[(j * 7) + 5 + 1] = (byte) JBC_ldc_w; // stack[1] = value } else { @@ -287,22 +282,36 @@ } } bytecode[bytecode.length - 1] = (byte) JBC_return; - return new VM_NormalMethod(aClass, memRef, - (short) (ACC_PUBLIC | ACC_FINAL | ACC_SYNTHETIC), null, (short) 2, - (short) 3, bytecode, null, null, constantPool, null, null, null, null); + return new VM_NormalMethod(aClass, + memRef, + (short) (ACC_PUBLIC | ACC_FINAL | ACC_SYNTHETIC), + null, + (short) 2, + (short) 3, + bytecode, + null, + null, + constantPool, + null, + null, + null, + null); } /** - * What would be the appropriate return bytecode for the given type reference? + * What would be the appropriate return bytecode for the given type + * reference? */ private static int typeRefToReturnBytecode(VM_TypeReference tr) { if (!tr.isPrimitiveType()) { return JBC_areturn; } else { - VM_Primitive pt = (VM_Primitive) tr.peekResolvedType(); - if ((pt == VM_Type.BooleanType) || (pt == VM_Type.ByteType) - || (pt == VM_Type.ShortType) || (pt == VM_Type.CharType) - || (pt == VM_Type.IntType)) { + VM_Primitive pt = (VM_Primitive) tr.peekType(); + if ((pt == VM_Type.BooleanType) || + (pt == VM_Type.ByteType) || + (pt == VM_Type.ShortType) || + (pt == VM_Type.CharType) || + (pt == VM_Type.IntType)) { return JBC_ireturn; } else if (pt == VM_Type.LongType) { return JBC_lreturn; @@ -350,8 +359,8 @@ } /** - * Type of this method's parameters. Note: does *not* include implicit "this" - * parameter, if any. + * Type of this method's parameters. + * Note: does *not* include implicit "this" parameter, if any. */ @Uninterruptible public final VM_TypeReference[] getParameterTypes() { @@ -359,8 +368,8 @@ } /** - * Space required by this method for its parameters, in words. Note: does - * *not* include implicit "this" parameter, if any. + * Space required by this method for its parameters, in words. + * Note: does *not* include implicit "this" parameter, if any. */ @Uninterruptible public final int getParameterWords() { @@ -375,12 +384,11 @@ } /** - * Get the current compiled method for this method. Will return null if there - * is no current compiled method! - * - * We make this method Unpreemptible to avoid a race-condition in - * VM_Reflection.invoke. - * + * Get the current compiled method for this method. + * Will return null if there is no current compiled method! + * + * We make this method Unpreemptible to avoid a race-condition + * in VM_Reflection.invoke. * @return compiled method */ @Unpreemptible @@ -424,8 +432,7 @@ * Not implemented in Java and use C not JNI calling convention */ public final boolean isSysCall() { - return isNative() && isStatic() - && isAnnotationDeclared(VM_TypeReference.SysCall); + return isNative() && isStatic() && isAnnotationDeclared(VM_TypeReference.SysCall); } /** @@ -444,9 +451,8 @@ } /** - * Exceptions thrown by this method - something like { - * "java/lang/IOException", "java/lang/EOFException" } - * + * Exceptions thrown by this method - + * something like { "java/lang/IOException", "java/lang/EOFException" } * @return info (null --> method doesn't throw any exceptions) */ @Uninterruptible @@ -455,47 +461,36 @@ } /** - * Is this method interruptible? In other words, should the compiler insert - * yieldpoints in method prologue, epilogue, and backwards branches. Also, - * only methods that are Interruptible have stackoverflow checks in the method - * prologue (since there is no mechanism for handling a stackoverflow that - * doesn't violate the uninterruptiblity of the method). To determine if a - * method is interruptible, the following conditions are checked (<em>in order</em>): + * Is this method interruptible? + * In other words, should the compiler insert yieldpoints + * in method prologue, epilogue, and backwards branches. + * Also, only methods that are Interruptible have stackoverflow checks + * in the method prologue (since there is no mechanism for handling a stackoverflow + * that doesn't violate the uninterruptiblity of the method). + * To determine if a method is interruptible, the following conditions + * are checked (<em>in order</em>): * <ul> * <li> If it is a <clinit> or <init> method then it is interruptible. - * <li> If is the synthetic 'this' method used by jikes to factor out default - * initializers for <init> methods then it is interruptible. - * <li> If it is annotated with <CODE>Interruptible</CODE> it is - * interruptible. - * <li> If it is annotated with <CODE>Preemptible</CODE> it is - * interruptible. - * <li> If it is annotated with <CODE>Uninterruptible</CODE> it is not - * interruptible. - * <li> If it is annotated with <CODE>UninterruptibleNoWarn</CODE> it is not - * interruptible. - * <li> If it is annotated with <CODE>Unpreemptible</CODE> it is not - * interruptible. + * <li> If is the synthetic 'this' method used by jikes to + * factor out default initializers for <init> methods then it is interruptible. + * <li> If it is annotated with <CODE>Interruptible</CODE> it is interruptible. + * <li> If it is annotated with <CODE>Preemptible</CODE> it is interruptible. + * <li> If it is annotated with <CODE>Uninterruptible</CODE> it is not interruptible. + * <li> If it is annotated with <CODE>UninterruptibleNoWarn</CODE> it is not interruptible. + * <li> If it is annotated with <CODE>Unpreemptible</CODE> it is not interruptible. * <li> If its declaring class is annotated with <CODE>Uninterruptible</CODE> - * or <CODE>Unpreemptible</CODE> it is not interruptible. + * or <CODE>Unpreemptible</CODE> it is not interruptible. * </ul> */ public final boolean isInterruptible() { - if (isClassInitializer() || isObjectInitializer()) - return true; - if (isObjectInitializerHelper()) - return true; - if (hasInterruptibleAnnotation()) - return true; - if (hasPreemptibleAnnotation()) - return true; - if (hasUninterruptibleNoWarnAnnotation()) - return false; - if (hasUninterruptibleAnnotation()) - return false; - if (hasUnpreemptibleAnnotation()) - return false; - if (getDeclaringClass().hasUnpreemptibleAnnotation()) - return false; + if (isClassInitializer() || isObjectInitializer()) return true; + if (isObjectInitializerHelper()) return true; + if (hasInterruptibleAnnotation()) return true; + if (hasPreemptibleAnnotation()) return true; + if (hasUninterruptibleNoWarnAnnotation()) return false; + if (hasUninterruptibleAnnotation()) return false; + if (hasUnpreemptibleAnnotation()) return false; + if (getDeclaringClass().hasUnpreemptibleAnnotation()) return false; return !getDeclaringClass().hasUninterruptibleAnnotation(); } @@ -503,20 +498,13 @@ * Is the method Unpreemptible? See the comment in {@link #isInterruptible} */ public final boolean isUnpreemptible() { - if (isClassInitializer() || isObjectInitializer()) - return false; - if (isObjectInitializerHelper()) - return false; - if (hasInterruptibleAnnotation()) - return false; - if (hasPreemptibleAnnotation()) - return false; - if (hasUninterruptibleAnnotation()) - return false; - if (hasUninterruptibleNoWarnAnnotation()) - return false; - if (hasUnpreemptibleAnnotation()) - return true; + if (isClassInitializer() || isObjectInitializer()) return false; + if (isObjectInitializerHelper()) return false; + if (hasInterruptibleAnnotation()) return false; + if (hasPreemptibleAnnotation()) return false; + if (hasUninterruptibleAnnotation()) return false; + if (hasUninterruptibleNoWarnAnnotation()) return false; + if (hasUnpreemptibleAnnotation()) return true; return getDeclaringClass().hasUnpreemptibleAnnotation(); } @@ -524,28 +512,30 @@ * Is the method Uninterruptible? See the comment in {@link #isInterruptible} */ public final boolean isUninterruptible() { - if (isClassInitializer() || isObjectInitializer()) - return false; - if (isObjectInitializerHelper()) - return false; - if (hasInterruptibleAnnotation()) - return false; - if (hasPreemptibleAnnotation()) - return false; - if (hasUnpreemptibleAnnotation()) - return false; - if (hasUninterruptibleAnnotation()) - return true; - if (hasUninterruptibleNoWarnAnnotation()) - return true; + if (isClassInitializer() || isObjectInitializer()) return false; + if (isObjectInitializerHelper()) return false; + if (hasInterruptibleAnnotation()) return false; + if (hasPreemptibleAnnotation()) return false; + if (hasUnpreemptibleAnnotation()) return false; + if (hasUninterruptibleAnnotation()) return true; + if (hasUninterruptibleNoWarnAnnotation()) return true; return getDeclaringClass().hasUninterruptibleAnnotation(); } /** - * Has this method been marked as forbidden to inline? ie., it is marked with - * the <CODE>NoInline</CODE> annotation or the <CODE>NoOptCompile</CODE> - * annotation? + * Is the method Pure? That is would it, without any side effects, return the + * same value given the same arguments? + * + * @return whether the method has a pure annotation */ + public final boolean isPure() { + return hasPureAnnotation(); + } + /** + * Has this method been marked as forbidden to inline? + * ie., it is marked with the <CODE>NoInline</CODE> annotation or + * the <CODE>NoOptCompile</CODE> annotation? + */ public final boolean hasNoInlinePragma() { return (hasNoInlineAnnotation() || hasNoOptCompileAnnotation()); } @@ -554,57 +544,48 @@ * @return true if the method may write to a given field */ public boolean mayWrite(VM_Field field) { - return true; // be conservative. native methods can write to anything + return true; // be conservative. native methods can write to anything } /** - * @return true if the method is the implementation of a runtime service that - * is called "under the covers" from the generated code and thus is - * not subject to inlining via the normal mechanisms. + * @return true if the method is the implementation of a runtime service + * that is called "under the covers" from the generated code and thus is not subject to + * inlining via the normal mechanisms. */ public boolean isRuntimeServiceMethod() { - return false; // only VM_NormalMethods can be runtime service impls in Jikes - // RVM and they override this method + return false; // only VM_NormalMethods can be runtime service impls in Jikes RVM and they override this method } - // ------------------------------------------------------------------// - // Section 2. // - // The following are available after the declaring class has been // - // "resolved". // - // ------------------------------------------------------------------// + //------------------------------------------------------------------// + // Section 2. // + // The following are available after the declaring class has been // + // "resolved". // + //------------------------------------------------------------------// /** - * Get the code array that corresponds to the entry point (prologue) for the - * method. + * Get the code array that corresponds to the entry point (prologue) for the method. */ public final synchronized VM_CodeArray getCurrentEntryCodeArray() { VM_Class declaringClass = getDeclaringClass(); - if (VM.VerifyAssertions) - VM._assert(declaringClass.isResolved()); + if (VM.VerifyAssertions) VM._assert(declaringClass.isResolved()); if (isCompiled()) { return currentCompiledMethod.getEntryCodeArray(); } else if (!VM.writingBootImage || isNative()) { if (!isStatic() && !isObjectInitializer() && !isPrivate()) { // A non-private virtual method. - if (declaringClass.isJavaLangObjectType() - || declaringClass.getSuperClass().findVirtualMethod(getName(), - getDescriptor()) == null) { - // The root method of a virtual method family can use the lazy method - // invoker directly. - return VM_Entrypoints.lazyMethodInvokerMethod - .getCurrentEntryCodeArray(); + if (declaringClass.isJavaLangObjectType() || + declaringClass.getSuperClass().findVirtualMethod(getName(), getDescriptor()) == null) { + // The root method of a virtual method family can use the lazy method invoker directly. + return VM_Entrypoints.lazyMethodInvokerMethod.getCurrentEntryCodeArray(); } else { - // All other virtual methods in the family must generate unique stubs - // to - // ensure correct operation of the method test (guarded inlining of - // virtual calls). + // All other virtual methods in the family must generate unique stubs to + // ensure correct operation of the method test (guarded inlining of virtual calls). return VM_LazyCompilationTrampolineGenerator.getTrampoline(); } } else { // We'll never do a method test against this method. // Therefore we can use the lazy method invoker directly. - return VM_Entrypoints.lazyMethodInvokerMethod - .getCurrentEntryCodeArray(); + return VM_Entrypoints.lazyMethodInvokerMethod.getCurrentEntryCodeArray(); } } else { compile(); @@ -613,17 +594,15 @@ } /** - * Generate machine code for this method if valid machine code doesn't already - * exist. Return the resulting VM_CompiledMethod object. + * Generate machine code for this method if valid + * machine code doesn't already exist. + * Return the resulting VM_CompiledMethod object. */ public final synchronized void compile() { - if (VM.VerifyAssertions) - VM._assert(getDeclaringClass().isResolved()); - if (isCompiled()) - return; + if (VM.VerifyAssertions) VM._assert(getDeclaringClass().isResolved()); + if (isCompiled()) return; - if (VM.TraceClassLoading && VM.runningVM) - VM.sysWrite("VM_Method: (begin) compiling " + this + "\n"); + if (VM.TraceClassLoading && VM.runningVM) VM.sysWrite("VM_Method: (begin) compiling " + this + "\n"); VM_CompiledMethod cm = genCode(); @@ -636,37 +615,31 @@ } } - if (VM.TraceClassLoading && VM.runningVM) - VM.sysWrite("VM_Method: (end) compiling " + this + "\n"); + if (VM.TraceClassLoading && VM.runningVM) VM.sysWrite("VM_Method: (end) compiling " + this + "\n"); } protected abstract VM_CompiledMethod genCode(); - // ----------------------------------------------------------------// - // Section 3. // + //----------------------------------------------------------------// + // Section 3. // // The following are available after the declaring class has been // - // "instantiated". // - // ----------------------------------------------------------------// + // "instantiated". // + //----------------------------------------------------------------// /** * Change machine code that will be used by future executions of this method * (ie. optimized <-> non-optimized) - * - * @param compiledMethod - * new machine code Side effect: updates jtoc or method dispatch - * tables ("type information blocks") for this class and its - * subclasses + * @param compiledMethod new machine code + * Side effect: updates jtoc or method dispatch tables + * ("type information blocks") + * for this class and its subclasses */ - public synchronized void replaceCompiledMethod( - VM_CompiledMethod compiledMethod) { - if (VM.VerifyAssertions) - VM._assert(getDeclaringClass().isInstantiated()); - // If we're replacing with a non-null compiledMethod, ensure that is still - // valid! + public synchronized void replaceCompiledMethod(VM_CompiledMethod compiledMethod) { + if (VM.VerifyAssertions) VM._assert(getDeclaringClass().isInstantiated()); + // If we're replacing with a non-null compiledMethod, ensure that is still valid! if (compiledMethod != null) { synchronized (compiledMethod) { - if (compiledMethod.isInvalid()) - return; + if (compiledMethod.isInvalid()) return; } } @@ -693,8 +666,7 @@ * If CM is the current compiled code for this, then invaldiate it. */ public final synchronized void invalidateCompiledMethod(VM_CompiledMethod cm) { - if (VM.VerifyAssertions) - VM._assert(getDeclaringClass().isInstantiated()); + if (VM.VerifyAssertions) VM._assert(getDeclaringClass().isInstantiated()); if (currentCompiledMethod == cm) { replaceCompiledMethod(null); } @@ -704,8 +676,7 @@ * Find or create a jtoc offset for this method */ public final synchronized Offset findOrCreateJtocOffset() { - if (VM.VerifyAssertions) - VM._assert(!isStatic() && !isObjectInitializer()); + if (VM.VerifyAssertions) VM._assert(!isStatic() && !isObjectInitializer()); if (jtocOffset.EQ(Offset.zero())) { jtocOffset = VM_Statics.allocateReferenceSlot(); VM_Statics.setSlotContents(jtocOffset, getCurrentEntryCodeArray()); Modified: ext/org/jikesrvm/compilers/common/VM_RuntimeCompiler.java =================================================================== --- ext/org/jikesrvm/compilers/common/VM_RuntimeCompiler.java 2007-08-06 14:18:07 UTC (rev 156) +++ ext/org/jikesrvm/compilers/common/VM_RuntimeCompiler.java 2007-08-06 15:23:44 UTC (rev 157) @@ -1,85 +1,97 @@ /* - * This file is part of Jikes RVM (http://jikesrvm.sourceforge.net). - * The Jikes RVM project is distributed under the Common Public License (CPL). - * A copy of the license is included in the distribution, and is also - * available at http://www.opensource.org/licenses/cpl1.0.php + * This file is part of the Jikes RVM project (http://jikesrvm.org). * - * (C) Copyright IBM Corp. 2001, 2005 + * This file is licensed to You under the Common Public License (CPL); + * You may not use this file except in compliance with the License. You + * may obtain a copy of the License at + * + * http://www.opensource.org/licenses/cpl1.0.php + * + * See the COPYRIGHT.txt file distributed with this work for information + * regarding copyright ownership. */ package org.jikesrvm.compilers.common; -import org.jikesrvm.*; -import org.jikesrvm.classloader.*; -import org.jikesrvm.compilers.baseline.*; -import org.jikesrvm.compilers.opt.*; +import org.jikesrvm.ArchitectureSpecific; +import org.jikesrvm.ArchitectureSpecific.VM_JNICompiler; +import org.jikesrvm.VM; +import org.jikesrvm.VM_Callbacks; +import org.jikesrvm.VM_Constants; import org.jikesrvm.adaptive.controller.VM_Controller; import org.jikesrvm.adaptive.controller.VM_ControllerMemory; import org.jikesrvm.adaptive.controller.VM_ControllerPlan; import org.jikesrvm.adaptive.recompilation.VM_InvocationCounts; import org.jikesrvm.adaptive.recompilation.VM_PreCompile; import org.jikesrvm.adaptive.recompilation.instrumentation.VM_AOSInstrumentationPlan; -import org.jikesrvm.adaptive.util.*; -import org.jikesrvm.ArchitectureSpecific.VM_JNICompiler; +import org.jikesrvm.adaptive.util.VM_AOSGenerator; +import org.jikesrvm.adaptive.util.VM_AOSLogging; +import org.jikesrvm.adaptive.util.VM_CompilerAdviceAttribute; +import org.jikesrvm.classloader.VM_NativeMethod; +import org.jikesrvm.classloader.VM_NormalMethod; +import org.jikesrvm.classloader.VM_Type; +import org.jikesrvm.classloader.VM_TypeReference; +import org.jikesrvm.compilers.baseline.VM_BaselineCompiler; +import org.jikesrvm.compilers.opt.OPT_CompilationPlan; +import org.jikesrvm.compilers.opt.OPT_Compiler; +import org.jikesrvm.compilers.opt.OPT_MagicNotImplementedException; +import org.jikesrvm.compilers.opt.OPT_OptimizationPlanElement; +import org.jikesrvm.compilers.opt.OPT_OptimizationPlanner; +import org.jikesrvm.compilers.opt.OPT_OptimizingCompilerException; +import org.jikesrvm.compilers.opt.OPT_Options; import org.jikesrvm.runtime.VM_Time; -import org.jikesrvm.scheduler.VM_Thread; +import org.jikesrvm.scheduler.VM_Scheduler; /** - * Harness to select which compiler to dynamically compile a method in first - * invocation. - * - * A place to put code common to all runtime compilers. This includes - * instrumentation code to get equivalent data for each of the runtime - * compilers. + * Harness to select which compiler to dynamically + * compile a method in first invocation. + * + * A place to put code common to all runtime compilers. + * This includes instrumentation code to get equivalent data for + * each of the runtime compilers. * <p> * We collect the following data for each compiler * <ol> - * <li> total number of methods complied by the compiler - * <li> total compilation time in milliseconds. - * <li> total number of bytes of bytecodes compiled by the compiler (under the - * assumption that there is no padding in the bytecode array and thus - * VM_Method.getBytecodes().length is the number bytes of bytecode for a method) - * <li> total number of machine code insructions generated by the compiler - * (under the assumption that there is no (excessive) padding in the machine - * code array and thus VM_CompiledMethod.numberOfInsturctions() is a close - * enough approximation of the number of machinecodes generated) + * <li> + * total number of methods complied by the compiler + * <li> + * total compilation time in milliseconds. + * <li> + * total number of bytes of bytecodes compiled by the compiler + * (under the assumption that there is no padding in the bytecode + * array and thus VM_Method.getBytecodes().length is the number bytes + * of bytecode for a method) + * <li> + * total number of machine code insructions generated by the compiler + * (under the assumption that there is no (excessive) padding in the + * machine code array and thus VM_CompiledMethod.numberOfInsturctions() + * is a close enough approximation of the number of machinecodes generated) * </ol> - * Note that even if 3. & 4. are inflated due to padding, the numbers will still - * be an accurate measure of the space costs of the compile-only approach. - * - * @author Matthew Arnold - * @author Dave Grove - * @author Michael Hind + * Note that even if 3. & 4. are inflated due to padding, the numbers will + * still be an accurate measure of the space costs of the compile-only + * approach. */ -public class VM_RuntimeCompiler implements VM_Constants, - VM_Callbacks.ExitMonitor { +public class VM_RuntimeCompiler implements VM_Constants, VM_Callbacks.ExitMonitor { // Use these to encode the compiler for record() public static final byte JNI_COMPILER = 0; - public static final byte BASELINE_COMPILER = 1; - public static final byte OPT_COMPILER = 2; // Data accumulators - private static final String[] name = { "JNI\t", "Base\t", "Opt\t" }; // Output - // names + private static final String[] name = {"JNI\t", "Base\t", "Opt\t"}; // Output names + private static int[] totalMethods = {0, 0, 0}; + private static double[] totalCompTime = {0, 0, 0}; + private static int[] totalBCLength = {0, 0, 0}; + private static int[] totalMCLength = {0, 0, 0}; - private static int[] totalMethods = { 0, 0, 0 }; - - private static double[] totalCompTime = { 0, 0, 0 }; - - private static int[] totalBCLength = { 0, 0, 0 }; - - private static int[] totalMCLength = { 0, 0, 0 }; - // running sum of the natural logs of the rates, - // used for geometric mean, the product of rates is too big for doubles - // so we use the principle of logs to help us - // We compute e ** ((log a + log b + ... + log n) / n ) - private static double[] totalLogOfRates = { 0, 0, 0 }; + // used for geometric mean, the product of rates is too big for doubles + // so we use the principle of logs to help us + // We compute e ** ((log a + log b + ... + log n) / n ) + private static double[] totalLogOfRates = {0, 0, 0}; // We can't record values until Math.log is loaded, so we miss the first few - private static int[] totalLogValueMethods = { 0, 0, 0 }; + private static int[] totalLogValueMethods = {0, 0, 0}; private static String[] earlyOptArgs = new String[0]; @@ -93,8 +105,7 @@ // because the opt compiler is not reentrant. // When we actually fix defect 2912, we'll have to implement a different // scheme that can distinguish between recursive opt compilation by the same - // thread (always bad) and parallel opt compilation (currently bad, future - // ok). + // thread (always bad) and parallel opt compilation (currently bad, future ok). // NOTE: This code can be quite subtle, so please be absolutely sure // you know what you're doing before modifying it!!! protected static boolean compilationInProgress; @@ -104,82 +115,69 @@ // Cache objects needed to cons up compilation plans // TODO: cutting link to opt compiler by declaring type as object. - public static Object /* OPT_Options */options; + public static final Object /* OPT_Options */ options = VM.BuildForAdaptiveSystem ? new OPT_Options() : null; + public static Object /* OPT_OptimizationPlanElement[] */ optimizationPlan; - public static Object /* OPT_OptimizationPlanElement[] */optimizationPlan; - /** * To be called when the VM is about to exit. - * - * @param value - * the exit value + * @param value the exit value */ public void notifyExit(int value) { report(false); } /** - * This method records the time and sizes (bytecode and machine code) for a - * compilation. - * - * @param compiler - * the compiler used - * @param method - * the resulting VM_Method - * @param compiledMethod - * the resulting compiled method + * This method records the time and sizes (bytecode and machine code) for + * a compilation. + * @param compiler the compiler used + * @param method the resulting VM_Method + * @param compiledMethod the resulting compiled method */ - public static void record(byte compiler, VM_NormalMethod method, - VM_CompiledMethod compiledMethod) { + public static void record(byte compiler, VM_NormalMethod method, VM_CompiledMethod compiledMethod) { - recordCompilation(compiler, method.getBytecodeLength(), compiledMethod - .numberOfInstructions(), compiledMethod.getCompilationTime()); + recordCompilation(compiler, + method.getBytecodeLength(), + compiledMethod.numberOfInstructions(), + compiledMethod.getCompilationTime()); if (VM.BuildForAdaptiveSystem) { if (VM_AOSLogging.booted()) { - VM_AOSLogging.recordUpdatedCompilationRates(compiler, method, method - .getBytecodeLength(), totalBCLength[compiler], compiledMethod - .numberOfInstructions(), totalMCLength[compiler], compiledMethod - .getCompilationTime(), totalCompTime[compiler], - totalLogOfRates[compiler], totalLogValueMethods[compiler], - totalMethods[compiler]); + VM_AOSLogging.recordUpdatedCompilationRates(compiler, + method, + method.getBytecodeLength(), + totalBCLength[compiler], + compiledMethod.numberOfInstructions(), + totalMCLength[compiler], + compiledMethod.getCompilationTime(), + totalCompTime[compiler], + totalLogOfRates[compiler], + totalLogValueMethods[compiler], + totalMethods[compiler]); } } } /** - * This method records the time and sizes (bytecode and machine code) for a - * compilation - * - * @param compiler - * the compiler used - * @param method - * the resulting VM_Method - * @param compiledMethod - * the resulting compiled method + * This method records the time and sizes (bytecode and machine code) for + * a compilation + * @param compiler the compiler used + * @param method the resulting VM_Method + * @param compiledMethod the resulting compiled method */ - public static void record(byte compiler, VM_NativeMethod method, - VM_CompiledMethod compiledMethod) { + public static void record(byte compiler, VM_NativeMethod method, VM_CompiledMethod compiledMethod) { recordCompilation(compiler, 0, // don't have any bytecode info, its native - compiledMethod.numberOfInstructions(), compiledMethod - .getCompilationTime()); + compiledMethod.numberOfInstructions(), compiledMethod.getCompilationTime()); } /** * This method does the actual recording - * - * @param compiler - * the compiler used - * @param BCLength - * the number of bytecodes in method source - * @param MCLength - * the length of the generated machine code - * @param compTime - * the compilation time in ms + * @param compiler the compiler used + * @param BCLength the number of bytecodes in method source + * @param MCLength the length of the generated machine code + * @param compTime the compilation time in ms */ - private static void recordCompilation(byte compiler, int BCLength, - int MCLength, double compTime) { + private static void recordCompilation(byte compiler, int BCLength, int MCLength, double compTime) { totalMethods[compiler]++; totalMCLength[compiler] += MCLength; @@ -193,8 +191,8 @@ // need to be fully booted before calling log if (VM.fullyBooted) { // we want the geometric mean, but the product of rates is too big - // for doubles, so we use the principle of logs to help us - // We compute e ** ((log a + log b + ... + log n) / n ) + // for doubles, so we use the principle of logs to help us + // We compute e ** ((log a + log b + ... + log n) / n ) totalLogOfRates[compiler] += Math.log(rate); totalLogValueMethods[compiler]++; } @@ -203,9 +201,7 @@ /** * This method produces a summary report of compilation activities - * - * @param explain - * Explains the metrics used in the report + * @param explain Explains the metrics used in the report */ public static void report(boolean explain) { VM.sysWrite("\n\t\tCompilation Subsystem Report\n"); @@ -224,27 +220,21 @@ VM.sysWrite("NA"); } else { // Bytecode bytes per millisecond, - // use unweighted geomean - VM - .sysWrite(Math.exp(totalLogOfRates[i] / totalLogValueMethods[i]), - 2); + // use unweighted geomean + VM.sysWrite(Math.exp(totalLogOfRates[i] / totalLogValueMethods[i]), 2); } VM.sysWrite("\t"); // Ratio of machine code bytes to bytecode bytes if (i != JNI_COMPILER) { - VM - .sysWrite( - (double) (totalMCLength[i] << ArchitectureSpecific.VM_RegisterConstants.LG_INSTRUCTION_WIDTH) - / (double) totalBCLength[i], 2); + VM.sysWrite((double) (totalMCLength[i] << ArchitectureSpecific.VM_RegisterConstants.LG_INSTRUCTION_WIDTH) / + (double) totalBCLength[i], 2); } else { VM.sysWrite("NA"); } VM.sysWrite("\t"); // Generated machine code Kbytes - VM - .sysWrite( - (double) (totalMCLength[i] << ArchitectureSpecific.VM_RegisterConstants.LG_INSTRUCTION_WIDTH) / 1024, - 1); + VM.sysWrite((double) (totalMCLength[i] << ArchitectureSpecific.VM_RegisterConstants.LG_INSTRUCTION_WIDTH) / + 1024, 1); VM.sysWrite("\t"); // Compiled bytecode Kbytes if (i != JNI_COMPILER) { @@ -258,34 +248,23 @@ if (explain) { // Generate an explanation of the metrics reported VM.sysWrite("\t\t\tExplanation of Metrics\n"); - VM - .sysWrite("#Meths:\t\tTotal number of methods compiled by the compiler\n"); + VM.sysWrite("#Meths:\t\tTotal number of methods compiled by the compiler\n"); VM.sysWrite("Time:\t\tTotal compilation time in milliseconds\n"); - VM - .sysWrite("bcb/ms:\t\tNumber of bytecode bytes complied per millisecond\n"); + VM.sysWrite("bcb/ms:\t\tNumber of bytecode bytes complied per millisecond\n"); VM.sysWrite("mcb/bcb:\tRatio of machine code bytes to bytecode bytes\n"); - VM - .sysWrite("MCKB:\t\tTotal number of machine code bytes generated in kilobytes\n"); - VM - .sysWrite("BCKB:\t\tTotal number of bytecode bytes compiled in kilobytes\n"); + VM.sysWrite("MCKB:\t\tTotal number of machine code bytes generated in kilobytes\n"); + VM.sysWrite("BCKB:\t\tTotal number of bytecode bytes compiled in kilobytes\n"); } VM_BaselineCompiler.generateBaselineCompilerSubsystemReport(explain); if (VM.BuildForAdaptiveSystem) { // Get the opt's report - VM_TypeReference theTypeRef = VM_TypeReference - .findOrCreate( - VM_BootstrapClassLoader.getBootstrapClassLoader(), - VM_Atom - .findOrCreateAsciiAtom("Lorg/jikesrvm/opt/OPT_OptimizationPlanner;")); - VM_Type theType = theTypeRef.peekResolvedType(); + VM_Type theType = VM_TypeReference.OPT_OptimizationPlanner.peekType(); if (theType != null && theType.asClass().isInitialized()) { - OPT_OptimizationPlanner - .generateOptimizingCompilerSubsystemReport(explain); + OPT_OptimizationPlanner.generateOptimizingCompilerSubsystemReport(explain); } else { - VM - .sysWrite("\n\tNot generating Optimizing Compiler SubSystem Report because \n"); + VM.sysWrite("\n\tNot generating Optimizing Compiler SubSystem Report because \n"); VM.sysWrite("\tthe opt compiler was never invoked.\n\n"); } } @@ -295,32 +274,35 @@ * Return the current estimate of basline-compiler rate, in bcb/msec */ public static double getBaselineRate() { - return Math.exp(totalLogOfRates[BASELINE_COMPILER] - / totalLogValueMethods[BASELINE_COMPILER]); + return Math.exp(totalLogOfRates[BASELINE_COMPILER] / tota... [truncated message content] |