1 /* 2 * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 package sun.jvm.hotspot.debugger.cdbg.basic; 26 27 import java.util.*; 28 import sun.jvm.hotspot.debugger.*; 29 import sun.jvm.hotspot.debugger.cdbg.*; 30 31 public class BasicMemberFunctionType extends BasicFunctionType implements MemberFunctionType { 32 private Type containingClass; 33 private Type thisType; 34 private long thisAdjust; 35 BasicMemberFunctionType(String name, int size, Type returnType, Type containingClass, Type thisType, long thisAdjust)36 public BasicMemberFunctionType(String name, 37 int size, 38 Type returnType, 39 Type containingClass, 40 Type thisType, 41 long thisAdjust) { 42 this(name, size, returnType, containingClass, thisType, thisAdjust, 0); 43 } 44 BasicMemberFunctionType(String name, int size, Type returnType, Type containingClass, Type thisType, long thisAdjust, int cvAttributes)45 private BasicMemberFunctionType(String name, 46 int size, 47 Type returnType, 48 Type containingClass, 49 Type thisType, 50 long thisAdjust, 51 int cvAttributes) { 52 super(name, size, returnType, cvAttributes); 53 this.containingClass = containingClass; 54 this.thisType = thisType; 55 this.thisAdjust = thisAdjust; 56 } 57 asMemberFunction()58 public MemberFunctionType asMemberFunction() { return this; } 59 getContainingClass()60 public Type getContainingClass() { return containingClass; } getThisType()61 public Type getThisType() { return thisType; } getThisAdjust()62 public long getThisAdjust() { return thisAdjust; } 63 resolveTypes(BasicCDebugInfoDataBase db, ResolveListener listener)64 Type resolveTypes(BasicCDebugInfoDataBase db, ResolveListener listener) { 65 super.resolveTypes(db, listener); 66 containingClass = db.resolveType(this, containingClass, listener, "resolving member function class"); 67 thisType = db.resolveType(this, thisType, listener, "resolving member function \"this\" type"); 68 return this; 69 } 70 iterateObject(Address a, ObjectVisitor v, FieldIdentifier f)71 public void iterateObject(Address a, ObjectVisitor v, FieldIdentifier f) { 72 // FIXME: nothing to do here? Are we going to provide iteration 73 // mechanisms through member functions, and if so what are the 74 // types of those functions going to be? 75 } 76 createCVVariant(int cvAttributes)77 protected Type createCVVariant(int cvAttributes) { 78 return new BasicMemberFunctionType(getName(), 79 getSize(), 80 getReturnType(), 81 getContainingClass(), 82 getThisType(), 83 getThisAdjust(), 84 cvAttributes); 85 } 86 visit(TypeVisitor v)87 public void visit(TypeVisitor v) { 88 v.doMemberFunctionType(this); 89 } 90 } 91