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