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.compilers.common;
014    
015    import org.jikesrvm.VM;
016    import org.jikesrvm.classloader.RVMMethod;
017    import org.jikesrvm.classloader.RVMType;
018    import org.jikesrvm.runtime.DynamicLink;
019    import org.jikesrvm.runtime.ExceptionDeliverer;
020    import org.jikesrvm.runtime.StackBrowser;
021    import org.vmmagic.pragma.Uninterruptible;
022    import org.vmmagic.pragma.Unpreemptible;
023    import org.vmmagic.unboxed.Offset;
024    
025    /**
026     * Information associated with artifical stackframe inserted by hardware
027     * trap handler.
028     */
029    final class HardwareTrapCompiledMethod extends CompiledMethod {
030    
031      public HardwareTrapCompiledMethod(int id, RVMMethod m) {
032        super(id, m);
033      }
034    
035      @Uninterruptible
036      public int getCompilerType() {
037        return TRAP;
038      }
039    
040      public String getCompilerName() {
041        return "<hardware trap>";
042      }
043    
044      @Uninterruptible
045      public ExceptionDeliverer getExceptionDeliverer() {
046        // this method should never get called, because exception delivery begins
047        // at site of exception, which is one frame above artificial "trap" frame
048        // corresponding to this compiler-info object
049        //
050        if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED);
051        return null;
052      }
053    
054      @Unpreemptible
055      public int findCatchBlockForInstruction(Offset instructionOffset, RVMType exceptionType) {
056        return -1;
057      }
058    
059      @Uninterruptible
060      public void getDynamicLink(DynamicLink dynamicLink, Offset instructionOffset) {
061        // this method should never get called, because exception delivery begins
062        // at site of exception, which is one frame above artificial "trap" frame
063        // corresponding to this compiler-info object
064        //
065        if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED);
066      }
067    
068      public boolean isWithinUninterruptibleCode(Offset instructionOffset) {
069        return false;
070      }
071    
072      public void printStackTrace(Offset instructionOffset, org.jikesrvm.PrintLN out) {
073        out.println("\tat <hardware trap>");
074      }
075    
076      /**
077       * Set the stack browser to the innermost logical stack frame of this method
078       */
079      public void set(StackBrowser browser, Offset instr) {
080        if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED);
081      }
082    
083      /**
084       * Advance the StackBrowser up one internal stack frame, if possible
085       */
086      public boolean up(StackBrowser browser) {
087        return false;
088      }
089    
090    }