1 /* 2 * Copyright (c) 2009, 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 com.sun.hotspot.tools.compiler; 26 27 import java.util.Arrays; 28 29 public class Method implements Constants { 30 31 private String holder; 32 private String name; 33 private String returnType; 34 private String arguments; 35 private String bytes; 36 private String iicount; 37 private String flags; 38 39 String decodeFlags(int osr_bci) { 40 int f = Integer.parseInt(getFlags()); 41 char[] c = new char[4]; 42 Arrays.fill(c, ' '); 43 if (osr_bci >= 0) { 44 c[0] = '%'; 45 } 46 if ((f & JVM_ACC_SYNCHRONIZED) != 0) { 47 c[1] = 's'; 48 } 49 return new String(c); 50 } 51 52 String format(int osr_bci) { 53 if (osr_bci >= 0) { 54 return getHolder() + "::" + getName() + " @ " + osr_bci + " (" + getBytes() + " bytes)"; 55 } else { 56 return getHolder() + "::" + getName() + " (" + getBytes() + " bytes)"; 57 } 58 } 59 60 @Override 61 public String toString() { 62 return getHolder() + "::" + getName() + " (" + getBytes() + " bytes)"; 63 } 64 65 public String getHolder() { 66 return holder; 67 } 68 69 public void setHolder(String holder) { 70 this.holder = holder; 71 } 72 73 public String getName() { 74 return name; 75 } 76 77 public void setName(String name) { 78 this.name = name; 79 } 80 81 public String getReturnType() { 82 return returnType; 83 } 84 85 public void setReturnType(String returnType) { 86 this.returnType = returnType; 87 } 88 89 public String getArguments() { 90 return arguments; 91 } 92 93 public void setArguments(String arguments) { 94 this.arguments = arguments; 95 } 96 97 public String getBytes() { 98 return bytes; 99 } 100 101 public void setBytes(String bytes) { 102 this.bytes = bytes; 103 } 104 105 public String getIICount() { 106 return iicount; 107 } 108 109 public void setIICount(String iicount) { 110 this.iicount = iicount; 111 } 112 113 public String getFlags() { 114 return flags; 115 } 116 117 public void setFlags(String flags) { 118 this.flags = flags; 119 } 120 121 @Override 122 public boolean equals(Object o) { 123 if (o instanceof Method) { 124 Method other = (Method)o; 125 return holder.equals(other.holder) && name.equals(other.name) && 126 arguments.equals(other.arguments) && returnType.equals(other.returnType); 127 } 128 return false; 129 } 130 }