Mercurial > hg > truffle
comparison src/share/vm/runtime/javaCalls.cpp @ 2177:3582bf76420e
6990754: Use native memory and reference counting to implement SymbolTable
Summary: move symbols from permgen into C heap and reference count them
Reviewed-by: never, acorn, jmasa, stefank
author | coleenp |
---|---|
date | Thu, 27 Jan 2011 16:11:27 -0800 |
parents | f95d63e2154a |
children | d25d4ca69222 1d1603768966 |
comparison
equal
deleted
inserted
replaced
2176:27e4ea99855d | 2177:3582bf76420e |
---|---|
198 } | 198 } |
199 } | 199 } |
200 | 200 |
201 // ============ Virtual calls ============ | 201 // ============ Virtual calls ============ |
202 | 202 |
203 void JavaCalls::call_virtual(JavaValue* result, KlassHandle spec_klass, symbolHandle name, symbolHandle signature, JavaCallArguments* args, TRAPS) { | 203 void JavaCalls::call_virtual(JavaValue* result, KlassHandle spec_klass, Symbol* name, Symbol* signature, JavaCallArguments* args, TRAPS) { |
204 CallInfo callinfo; | 204 CallInfo callinfo; |
205 Handle receiver = args->receiver(); | 205 Handle receiver = args->receiver(); |
206 KlassHandle recvrKlass(THREAD, receiver.is_null() ? (klassOop)NULL : receiver->klass()); | 206 KlassHandle recvrKlass(THREAD, receiver.is_null() ? (klassOop)NULL : receiver->klass()); |
207 LinkResolver::resolve_virtual_call( | 207 LinkResolver::resolve_virtual_call( |
208 callinfo, receiver, recvrKlass, spec_klass, name, signature, | 208 callinfo, receiver, recvrKlass, spec_klass, name, signature, |
213 // Invoke the method | 213 // Invoke the method |
214 JavaCalls::call(result, method, args, CHECK); | 214 JavaCalls::call(result, method, args, CHECK); |
215 } | 215 } |
216 | 216 |
217 | 217 |
218 void JavaCalls::call_virtual(JavaValue* result, Handle receiver, KlassHandle spec_klass, symbolHandle name, symbolHandle signature, TRAPS) { | 218 void JavaCalls::call_virtual(JavaValue* result, Handle receiver, KlassHandle spec_klass, Symbol* name, Symbol* signature, TRAPS) { |
219 JavaCallArguments args(receiver); // One oop argument | 219 JavaCallArguments args(receiver); // One oop argument |
220 call_virtual(result, spec_klass, name, signature, &args, CHECK); | 220 call_virtual(result, spec_klass, name, signature, &args, CHECK); |
221 } | 221 } |
222 | 222 |
223 | 223 |
224 void JavaCalls::call_virtual(JavaValue* result, Handle receiver, KlassHandle spec_klass, symbolHandle name, symbolHandle signature, Handle arg1, TRAPS) { | 224 void JavaCalls::call_virtual(JavaValue* result, Handle receiver, KlassHandle spec_klass, Symbol* name, Symbol* signature, Handle arg1, TRAPS) { |
225 JavaCallArguments args(receiver); // One oop argument | 225 JavaCallArguments args(receiver); // One oop argument |
226 args.push_oop(arg1); | 226 args.push_oop(arg1); |
227 call_virtual(result, spec_klass, name, signature, &args, CHECK); | 227 call_virtual(result, spec_klass, name, signature, &args, CHECK); |
228 } | 228 } |
229 | 229 |
230 | 230 |
231 | 231 |
232 void JavaCalls::call_virtual(JavaValue* result, Handle receiver, KlassHandle spec_klass, symbolHandle name, symbolHandle signature, Handle arg1, Handle arg2, TRAPS) { | 232 void JavaCalls::call_virtual(JavaValue* result, Handle receiver, KlassHandle spec_klass, Symbol* name, Symbol* signature, Handle arg1, Handle arg2, TRAPS) { |
233 JavaCallArguments args(receiver); // One oop argument | 233 JavaCallArguments args(receiver); // One oop argument |
234 args.push_oop(arg1); | 234 args.push_oop(arg1); |
235 args.push_oop(arg2); | 235 args.push_oop(arg2); |
236 call_virtual(result, spec_klass, name, signature, &args, CHECK); | 236 call_virtual(result, spec_klass, name, signature, &args, CHECK); |
237 } | 237 } |
238 | 238 |
239 | 239 |
240 // ============ Special calls ============ | 240 // ============ Special calls ============ |
241 | 241 |
242 void JavaCalls::call_special(JavaValue* result, KlassHandle klass, symbolHandle name, symbolHandle signature, JavaCallArguments* args, TRAPS) { | 242 void JavaCalls::call_special(JavaValue* result, KlassHandle klass, Symbol* name, Symbol* signature, JavaCallArguments* args, TRAPS) { |
243 CallInfo callinfo; | 243 CallInfo callinfo; |
244 LinkResolver::resolve_special_call(callinfo, klass, name, signature, KlassHandle(), false, CHECK); | 244 LinkResolver::resolve_special_call(callinfo, klass, name, signature, KlassHandle(), false, CHECK); |
245 methodHandle method = callinfo.selected_method(); | 245 methodHandle method = callinfo.selected_method(); |
246 assert(method.not_null(), "should have thrown exception"); | 246 assert(method.not_null(), "should have thrown exception"); |
247 | 247 |
248 // Invoke the method | 248 // Invoke the method |
249 JavaCalls::call(result, method, args, CHECK); | 249 JavaCalls::call(result, method, args, CHECK); |
250 } | 250 } |
251 | 251 |
252 | 252 |
253 void JavaCalls::call_special(JavaValue* result, Handle receiver, KlassHandle klass, symbolHandle name, symbolHandle signature, TRAPS) { | 253 void JavaCalls::call_special(JavaValue* result, Handle receiver, KlassHandle klass, Symbol* name, Symbol* signature, TRAPS) { |
254 JavaCallArguments args(receiver); // One oop argument | 254 JavaCallArguments args(receiver); // One oop argument |
255 call_special(result, klass, name, signature, &args, CHECK); | 255 call_special(result, klass, name, signature, &args, CHECK); |
256 } | 256 } |
257 | 257 |
258 | 258 |
259 void JavaCalls::call_special(JavaValue* result, Handle receiver, KlassHandle klass, symbolHandle name, symbolHandle signature, Handle arg1, TRAPS) { | 259 void JavaCalls::call_special(JavaValue* result, Handle receiver, KlassHandle klass, Symbol* name, Symbol* signature, Handle arg1, TRAPS) { |
260 JavaCallArguments args(receiver); // One oop argument | 260 JavaCallArguments args(receiver); // One oop argument |
261 args.push_oop(arg1); | 261 args.push_oop(arg1); |
262 call_special(result, klass, name, signature, &args, CHECK); | 262 call_special(result, klass, name, signature, &args, CHECK); |
263 } | 263 } |
264 | 264 |
265 | 265 |
266 void JavaCalls::call_special(JavaValue* result, Handle receiver, KlassHandle klass, symbolHandle name, symbolHandle signature, Handle arg1, Handle arg2, TRAPS) { | 266 void JavaCalls::call_special(JavaValue* result, Handle receiver, KlassHandle klass, Symbol* name, Symbol* signature, Handle arg1, Handle arg2, TRAPS) { |
267 JavaCallArguments args(receiver); // One oop argument | 267 JavaCallArguments args(receiver); // One oop argument |
268 args.push_oop(arg1); | 268 args.push_oop(arg1); |
269 args.push_oop(arg2); | 269 args.push_oop(arg2); |
270 call_special(result, klass, name, signature, &args, CHECK); | 270 call_special(result, klass, name, signature, &args, CHECK); |
271 } | 271 } |
272 | 272 |
273 | 273 |
274 // ============ Static calls ============ | 274 // ============ Static calls ============ |
275 | 275 |
276 void JavaCalls::call_static(JavaValue* result, KlassHandle klass, symbolHandle name, symbolHandle signature, JavaCallArguments* args, TRAPS) { | 276 void JavaCalls::call_static(JavaValue* result, KlassHandle klass, Symbol* name, Symbol* signature, JavaCallArguments* args, TRAPS) { |
277 CallInfo callinfo; | 277 CallInfo callinfo; |
278 LinkResolver::resolve_static_call(callinfo, klass, name, signature, KlassHandle(), false, true, CHECK); | 278 LinkResolver::resolve_static_call(callinfo, klass, name, signature, KlassHandle(), false, true, CHECK); |
279 methodHandle method = callinfo.selected_method(); | 279 methodHandle method = callinfo.selected_method(); |
280 assert(method.not_null(), "should have thrown exception"); | 280 assert(method.not_null(), "should have thrown exception"); |
281 | 281 |
282 // Invoke the method | 282 // Invoke the method |
283 JavaCalls::call(result, method, args, CHECK); | 283 JavaCalls::call(result, method, args, CHECK); |
284 } | 284 } |
285 | 285 |
286 | 286 |
287 void JavaCalls::call_static(JavaValue* result, KlassHandle klass, symbolHandle name, symbolHandle signature, TRAPS) { | 287 void JavaCalls::call_static(JavaValue* result, KlassHandle klass, Symbol* name, Symbol* signature, TRAPS) { |
288 JavaCallArguments args; // No argument | 288 JavaCallArguments args; // No argument |
289 call_static(result, klass, name, signature, &args, CHECK); | 289 call_static(result, klass, name, signature, &args, CHECK); |
290 } | 290 } |
291 | 291 |
292 | 292 |
293 void JavaCalls::call_static(JavaValue* result, KlassHandle klass, symbolHandle name, symbolHandle signature, Handle arg1, TRAPS) { | 293 void JavaCalls::call_static(JavaValue* result, KlassHandle klass, Symbol* name, Symbol* signature, Handle arg1, TRAPS) { |
294 JavaCallArguments args(arg1); // One oop argument | 294 JavaCallArguments args(arg1); // One oop argument |
295 call_static(result, klass, name, signature, &args, CHECK); | 295 call_static(result, klass, name, signature, &args, CHECK); |
296 } | 296 } |
297 | 297 |
298 | 298 |
299 void JavaCalls::call_static(JavaValue* result, KlassHandle klass, symbolHandle name, symbolHandle signature, Handle arg1, Handle arg2, TRAPS) { | 299 void JavaCalls::call_static(JavaValue* result, KlassHandle klass, Symbol* name, Symbol* signature, Handle arg1, Handle arg2, TRAPS) { |
300 JavaCallArguments args; // One oop argument | 300 JavaCallArguments args; // One oop argument |
301 args.push_oop(arg1); | 301 args.push_oop(arg1); |
302 args.push_oop(arg2); | 302 args.push_oop(arg2); |
303 call_static(result, klass, name, signature, &args, CHECK); | 303 call_static(result, klass, name, signature, &args, CHECK); |
304 } | 304 } |
457 Thread* _thread; | 457 Thread* _thread; |
458 | 458 |
459 public: | 459 public: |
460 bool _is_return; | 460 bool _is_return; |
461 | 461 |
462 SignatureChekker(symbolHandle signature, BasicType return_type, bool is_static, bool* is_oop, intptr_t* value, Thread* thread) : SignatureIterator(signature) { | 462 SignatureChekker(Symbol* signature, BasicType return_type, bool is_static, bool* is_oop, intptr_t* value, Thread* thread) : SignatureIterator(signature) { |
463 _is_oop = is_oop; | 463 _is_oop = is_oop; |
464 _is_return = false; | 464 _is_return = false; |
465 _return_type = return_type; | 465 _return_type = return_type; |
466 _pos = 0; | 466 _pos = 0; |
467 _value = value; | 467 _value = value; |
548 | 548 |
549 // Treat T_OBJECT and T_ARRAY as the same | 549 // Treat T_OBJECT and T_ARRAY as the same |
550 if (return_type == T_ARRAY) return_type = T_OBJECT; | 550 if (return_type == T_ARRAY) return_type = T_OBJECT; |
551 | 551 |
552 // Check that oop information is correct | 552 // Check that oop information is correct |
553 symbolHandle signature (thread, method->signature()); | 553 Symbol* signature = method->signature(); |
554 | 554 |
555 SignatureChekker sc(signature, return_type, method->is_static(),_is_oop, _value, thread); | 555 SignatureChekker sc(signature, return_type, method->is_static(),_is_oop, _value, thread); |
556 sc.iterate_parameters(); | 556 sc.iterate_parameters(); |
557 sc.check_doing_return(true); | 557 sc.check_doing_return(true); |
558 sc.iterate_returntype(); | 558 sc.iterate_returntype(); |