ParametersTypeData.java revision 9883:903a2e023ffb
1353940Sdim/* 2353940Sdim * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 3353940Sdim * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4353940Sdim * 5353940Sdim * This code is free software; you can redistribute it and/or modify it 6353940Sdim * under the terms of the GNU General Public License version 2 only, as 7353940Sdim * published by the Free Software Foundation. 8353940Sdim * 9353940Sdim * This code is distributed in the hope that it will be useful, but WITHOUT 10353940Sdim * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11353940Sdim * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12353940Sdim * version 2 for more details (a copy is included in the LICENSE file that 13353940Sdim * accompanied this code). 14353940Sdim * 15353940Sdim * You should have received a copy of the GNU General Public License version 16357095Sdim * 2 along with this work; if not, write to the Free Software Foundation, 17353940Sdim * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18357095Sdim * 19357095Sdim * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20353940Sdim * or visit www.oracle.com if you need additional information or have any 21357095Sdim * questions. 22357095Sdim * 23357095Sdim */ 24353940Sdim 25353940Sdimpackage sun.jvm.hotspot.oops; 26357095Sdim 27357095Sdimimport java.io.*; 28353940Sdimimport java.util.*; 29357095Sdimimport sun.jvm.hotspot.debugger.*; 30357095Sdimimport sun.jvm.hotspot.runtime.*; 31353940Sdimimport sun.jvm.hotspot.types.*; 32357095Sdimimport sun.jvm.hotspot.utilities.*; 33353940Sdim 34357095Sdim// ParametersTypeData 35357095Sdim// 36357095Sdim// A ParametersTypeData is used to access profiling information about 37357095Sdim// types of parameters to a method 38357095Sdimpublic class ParametersTypeData<K,M> extends ArrayData { 39357095Sdim final TypeStackSlotEntries<K,M> parameters; 40353940Sdim 41357095Sdim static int stackSlotLocalOffset(int i) { 42357095Sdim return arrayStartOffSet + TypeStackSlotEntries.stackSlotLocalOffset(i); 43357095Sdim } 44357095Sdim 45353940Sdim static int typeLocalOffset(int i) { 46357095Sdim return arrayStartOffSet + TypeStackSlotEntries.typeLocalOffset(i); 47353940Sdim } 48353940Sdim 49357095Sdim public ParametersTypeData(MethodDataInterface<K,M> methodData, DataLayout layout) { 50357095Sdim super(layout); 51357095Sdim parameters = new TypeStackSlotEntries<K,M>(methodData, this, 1, numberOfParameters()); 52353940Sdim } 53357095Sdim 54357095Sdim public int numberOfParameters() { 55357095Sdim return arrayLen() / TypeStackSlotEntries.perArgCount(); 56357095Sdim } 57357095Sdim 58357095Sdim int stackSlot(int i) { 59357095Sdim return parameters.stackSlot(i); 60357095Sdim } 61357095Sdim 62357095Sdim public K type(int i) { 63357095Sdim return parameters.type(i); 64357095Sdim } 65357095Sdim 66357095Sdim static public int typeIndex(int i) { 67357095Sdim return typeLocalOffset(i); 68357095Sdim } 69357095Sdim 70357095Sdim public void printDataOn(PrintStream st) { 71357095Sdim st.print("parameter types"); 72357095Sdim parameters.printDataOn(st); 73353940Sdim } 74357095Sdim} 75357095Sdim