comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/HotSpotMethodResolved.java @ 1429:abc670a709dc

* -XX:TraceC1X=0...5 controls the native c1x tracing * -Dc1x.debug=true turns on the logging proxies and lots of log output on the java side * provide more information about types to the compiler (type hierarchy, etc) * provide exception handler tables to the compiler * add exception handlers to the nmethod * correct implementation of ExceptionObject * exception handling/unwinding entry points * modified versions of handle/unwind exception stubs using standard calling conventions * exception throwing * implicit null pointer exception, implicit div by 0 exception * arraystore/classcast/arrayindex exceptions * checkcast implementation * newarray, anewarray, multinewarray implementation * correct new instance initialization * access to java class mirrors (for ldc) * unresolved methods * class resolving - class patching (asssembly prototype copying)
author Lukas Stadler <lukas.stadler@oracle.com>
date Tue, 31 Aug 2010 22:13:30 -0700
parents
children efba53f86c4f
comparison
equal deleted inserted replaced
1428:695451afc619 1429:abc670a709dc
1 /*
2 * Copyright (c) 2010 Sun Microsystems, Inc. All rights reserved.
3 *
4 * Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is
5 * described in this document. In particular, and without limitation, these intellectual property rights may include one
6 * or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent
7 * applications in the U.S. and in other countries.
8 *
9 * U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard
10 * license agreement and applicable provisions of the FAR and its supplements.
11 *
12 * Use is subject to license terms. Sun, Sun Microsystems, the Sun logo, Java and Solaris are trademarks or registered
13 * trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All SPARC trademarks are used under license and
14 * are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries.
15 *
16 * UNIX is a registered trademark in the U.S. and other countries, exclusively licensed through X/Open Company, Ltd.
17 */
18 package com.sun.hotspot.c1x;
19
20 import com.sun.cri.ri.*;
21
22 /**
23 * Implementation of RiMethod for resolved HotSpot methods.
24 *
25 * @author Thomas Wuerthinger, Lukas Stadler
26 */
27 public class HotSpotMethodResolved implements HotSpotMethod {
28
29 private final long vmId;
30 private final String name;
31
32 // cached values
33 private byte[] code;
34 private int accessFlags = -1;
35 private int maxLocals = -1;
36 private int maxStackSize = -1;
37 private RiExceptionHandler[] exceptionHandlers;
38 private RiSignature signature;
39 private RiType holder;
40
41 public HotSpotMethodResolved(long vmId, String name) {
42 this.vmId = vmId;
43 this.name = name;
44 }
45
46 @Override
47 public int accessFlags() {
48 if (accessFlags == -1) {
49 accessFlags = Compiler.getVMEntries().RiMethod_accessFlags(vmId);
50 }
51 return accessFlags;
52 }
53
54 @Override
55 public boolean canBeStaticallyBound() {
56 // TODO Auto-generated method stub
57 return false;
58 }
59
60 @Override
61 public byte[] code() {
62 if (code == null) {
63 code = Compiler.getVMEntries().RiMethod_code(vmId);
64 }
65 return code;
66 }
67
68 @Override
69 public RiExceptionHandler[] exceptionHandlers() {
70 if (exceptionHandlers == null) {
71 exceptionHandlers = Compiler.getVMEntries().RiMethod_exceptionHandlers(vmId);
72 }
73 return exceptionHandlers;
74 }
75
76 @Override
77 public boolean hasBalancedMonitors() {
78 // TODO Auto-generated method stub
79 return false;
80 }
81
82 @Override
83 public RiType holder() {
84 if (holder == null ) {
85 holder = Compiler.getVMEntries().RiMethod_holder(vmId);
86 }
87 return holder;
88 }
89
90 @Override
91 public boolean isClassInitializer() {
92 return "<clinit>".equals(name);
93 }
94
95 @Override
96 public boolean isConstructor() {
97 return "<init>".equals(name);
98 }
99
100 @Override
101 public boolean isLeafMethod() {
102 // TODO Auto-generated method stub
103 return false;
104 }
105
106 @Override
107 public boolean isOverridden() {
108 // TODO Auto-generated method stub
109 return false;
110 }
111
112 @Override
113 public boolean isResolved() {
114 return true;
115 }
116
117 @Override
118 public String jniSymbol() {
119 // TODO Auto-generated method stub
120 return null;
121 }
122
123 @Override
124 public Object liveness(int bci) {
125 // TODO Auto-generated method stub
126 return null;
127 }
128
129 @Override
130 public int maxLocals() {
131 if (maxLocals == -1) {
132 maxLocals = Compiler.getVMEntries().RiMethod_maxLocals(vmId);
133 }
134 return maxLocals;
135 }
136
137 @Override
138 public int maxStackSize() {
139 if (maxStackSize == -1) {
140 maxStackSize = Compiler.getVMEntries().RiMethod_maxStackSize(vmId);
141 }
142 return maxStackSize;
143 }
144
145 @Override
146 public RiMethodProfile methodData() {
147 // TODO Auto-generated method stub
148 return null;
149 }
150
151 @Override
152 public String name() {
153 return name;
154 }
155
156 @Override
157 public RiSignature signature() {
158 if (signature == null) {
159 signature = new HotSpotSignature(Compiler.getVMEntries().RiMethod_signature(vmId));
160 }
161 return signature;
162 }
163
164 @Override
165 public String toString() {
166 return "HotSpotMethod<" + name + ">";
167 }
168
169 }