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 artificial 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      @Override
036      @Uninterruptible
037      public int getCompilerType() {
038        return TRAP;
039      }
040    
041      @Override
042      public String getCompilerName() {
043        return "<hardware trap>";
044      }
045    
046      @Override
047      @Uninterruptible
048      public ExceptionDeliverer getExceptionDeliverer() {
049        // this method should never get called, because exception delivery begins
050        // at site of exception, which is one frame above artificial "trap" frame
051        // corresponding to this compiler-info object
052        //
053        if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED);
054        return null;
055      }
056    
057      @Override
058      @Unpreemptible
059      public int findCatchBlockForInstruction(Offset instructionOffset, RVMType exceptionType) {
060        return -1;
061      }
062    
063      @Override
064      @Uninterruptible
065      public void getDynamicLink(DynamicLink dynamicLink, Offset instructionOffset) {
066        // this method should never get called, because exception delivery begins
067        // at site of exception, which is one frame above artificial "trap" frame
068        // corresponding to this compiler-info object
069        //
070        if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED);
071      }
072    
073      @Override
074      public boolean isWithinUninterruptibleCode(Offset instructionOffset) {
075        return false;
076      }
077    
078      @Override
079      public void printStackTrace(Offset instructionOffset, org.jikesrvm.PrintLN out) {
080        out.println("\tat <hardware trap>");
081      }
082    
083      @Override
084      public void set(StackBrowser browser, Offset instr) {
085        if (VM.VerifyAssertions) VM._assert(VM.NOT_REACHED);
086      }
087    
088      @Override
089      public boolean up(StackBrowser browser) {
090        return false;
091      }
092    
093    }