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