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.runtime;
014    
015    import org.jikesrvm.classloader.BytecodeConstants;
016    import org.jikesrvm.classloader.MethodReference;
017    import org.vmmagic.pragma.Uninterruptible;
018    
019    /**
020     * Place for CompiledMethod.getDynamicLink() to deposit return
021     * information.  NB this method is called from within GCMapIterator
022     * and has to be uninterruptible (ie contain no new bytecodes),
023     * therefore the fields of this class are non-final).
024     */
025    @Uninterruptible
026    public final class DynamicLink implements BytecodeConstants {
027      /** method referenced at a call site */
028      private MethodReference methodRef;
029      /** how method was called at that site */
030      private int bytecode;
031    
032      /** set the dynamic link information. */
033      public void set(MethodReference methodRef, int bytecode) {
034        this.methodRef = methodRef;
035        this.bytecode = bytecode;
036      }
037    
038      public MethodReference methodRef() {
039        return methodRef;
040      }
041    
042      public boolean isInvokedWithImplicitThisParameter() {
043        return bytecode != JBC_invokestatic;
044      }
045    
046      boolean isInvokeVirtual() {
047        return bytecode == JBC_invokevirtual;
048      }
049    
050      boolean isInvokeSpecial() {
051        return bytecode == JBC_invokespecial;
052      }
053    
054      boolean isInvokeStatic() {
055        return bytecode == JBC_invokestatic;
056      }
057    
058      boolean isInvokeInterface() {
059        return bytecode == JBC_invokeinterface;
060      }
061    }