Mercurial > hg > truffle
comparison src/share/vm/interpreter/interpreterRuntime.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 | 633a44a9fc45 |
children | b92c45f2bc75 |
comparison
equal
deleted
inserted
replaced
2176:27e4ea99855d | 2177:3582bf76420e |
---|---|
37 #include "oops/cpCacheOop.hpp" | 37 #include "oops/cpCacheOop.hpp" |
38 #include "oops/instanceKlass.hpp" | 38 #include "oops/instanceKlass.hpp" |
39 #include "oops/methodDataOop.hpp" | 39 #include "oops/methodDataOop.hpp" |
40 #include "oops/objArrayKlass.hpp" | 40 #include "oops/objArrayKlass.hpp" |
41 #include "oops/oop.inline.hpp" | 41 #include "oops/oop.inline.hpp" |
42 #include "oops/symbolOop.hpp" | 42 #include "oops/symbol.hpp" |
43 #include "prims/jvmtiExport.hpp" | 43 #include "prims/jvmtiExport.hpp" |
44 #include "prims/nativeLookup.hpp" | 44 #include "prims/nativeLookup.hpp" |
45 #include "runtime/biasedLocking.hpp" | 45 #include "runtime/biasedLocking.hpp" |
46 #include "runtime/compilationPolicy.hpp" | 46 #include "runtime/compilationPolicy.hpp" |
47 #include "runtime/deoptimization.hpp" | 47 #include "runtime/deoptimization.hpp" |
293 IRT_END | 293 IRT_END |
294 | 294 |
295 | 295 |
296 IRT_ENTRY(void, InterpreterRuntime::create_exception(JavaThread* thread, char* name, char* message)) | 296 IRT_ENTRY(void, InterpreterRuntime::create_exception(JavaThread* thread, char* name, char* message)) |
297 // lookup exception klass | 297 // lookup exception klass |
298 symbolHandle s = oopFactory::new_symbol_handle(name, CHECK); | 298 TempNewSymbol s = SymbolTable::new_symbol(name, CHECK); |
299 if (ProfileTraps) { | 299 if (ProfileTraps) { |
300 if (s == vmSymbols::java_lang_ArithmeticException()) { | 300 if (s == vmSymbols::java_lang_ArithmeticException()) { |
301 note_trap(thread, Deoptimization::Reason_div0_check, CHECK); | 301 note_trap(thread, Deoptimization::Reason_div0_check, CHECK); |
302 } else if (s == vmSymbols::java_lang_NullPointerException()) { | 302 } else if (s == vmSymbols::java_lang_NullPointerException()) { |
303 note_trap(thread, Deoptimization::Reason_null_check, CHECK); | 303 note_trap(thread, Deoptimization::Reason_null_check, CHECK); |
304 } | 304 } |
305 } | 305 } |
306 // create exception | 306 // create exception |
307 Handle exception = Exceptions::new_exception(thread, s(), message); | 307 Handle exception = Exceptions::new_exception(thread, s, message); |
308 thread->set_vm_result(exception()); | 308 thread->set_vm_result(exception()); |
309 IRT_END | 309 IRT_END |
310 | 310 |
311 | 311 |
312 IRT_ENTRY(void, InterpreterRuntime::create_klass_exception(JavaThread* thread, char* name, oopDesc* obj)) | 312 IRT_ENTRY(void, InterpreterRuntime::create_klass_exception(JavaThread* thread, char* name, oopDesc* obj)) |
313 ResourceMark rm(thread); | 313 ResourceMark rm(thread); |
314 const char* klass_name = Klass::cast(obj->klass())->external_name(); | 314 const char* klass_name = Klass::cast(obj->klass())->external_name(); |
315 // lookup exception klass | 315 // lookup exception klass |
316 symbolHandle s = oopFactory::new_symbol_handle(name, CHECK); | 316 TempNewSymbol s = SymbolTable::new_symbol(name, CHECK); |
317 if (ProfileTraps) { | 317 if (ProfileTraps) { |
318 note_trap(thread, Deoptimization::Reason_class_check, CHECK); | 318 note_trap(thread, Deoptimization::Reason_class_check, CHECK); |
319 } | 319 } |
320 // create exception, with klass name as detail message | 320 // create exception, with klass name as detail message |
321 Handle exception = Exceptions::new_exception(thread, s(), klass_name); | 321 Handle exception = Exceptions::new_exception(thread, s, klass_name); |
322 thread->set_vm_result(exception()); | 322 thread->set_vm_result(exception()); |
323 IRT_END | 323 IRT_END |
324 | 324 |
325 | 325 |
326 IRT_ENTRY(void, InterpreterRuntime::throw_ArrayIndexOutOfBoundsException(JavaThread* thread, char* name, jint index)) | 326 IRT_ENTRY(void, InterpreterRuntime::throw_ArrayIndexOutOfBoundsException(JavaThread* thread, char* name, jint index)) |
327 char message[jintAsStringSize]; | 327 char message[jintAsStringSize]; |
328 // lookup exception klass | 328 // lookup exception klass |
329 symbolHandle s = oopFactory::new_symbol_handle(name, CHECK); | 329 TempNewSymbol s = SymbolTable::new_symbol(name, CHECK); |
330 if (ProfileTraps) { | 330 if (ProfileTraps) { |
331 note_trap(thread, Deoptimization::Reason_range_check, CHECK); | 331 note_trap(thread, Deoptimization::Reason_range_check, CHECK); |
332 } | 332 } |
333 // create exception | 333 // create exception |
334 sprintf(message, "%d", index); | 334 sprintf(message, "%d", index); |
335 THROW_MSG(s(), message); | 335 THROW_MSG(s, message); |
336 IRT_END | 336 IRT_END |
337 | 337 |
338 IRT_ENTRY(void, InterpreterRuntime::throw_ClassCastException( | 338 IRT_ENTRY(void, InterpreterRuntime::throw_ClassCastException( |
339 JavaThread* thread, oopDesc* obj)) | 339 JavaThread* thread, oopDesc* obj)) |
340 | 340 |
671 Handle receiver(thread, NULL); | 671 Handle receiver(thread, NULL); |
672 if (bytecode == Bytecodes::_invokevirtual || bytecode == Bytecodes::_invokeinterface) { | 672 if (bytecode == Bytecodes::_invokevirtual || bytecode == Bytecodes::_invokeinterface) { |
673 ResourceMark rm(thread); | 673 ResourceMark rm(thread); |
674 methodHandle m (thread, method(thread)); | 674 methodHandle m (thread, method(thread)); |
675 Bytecode_invoke call(m, bci(thread)); | 675 Bytecode_invoke call(m, bci(thread)); |
676 symbolHandle signature (thread, call.signature()); | 676 Symbol* signature = call.signature(); |
677 receiver = Handle(thread, | 677 receiver = Handle(thread, |
678 thread->last_frame().interpreter_callee_receiver(signature)); | 678 thread->last_frame().interpreter_callee_receiver(signature)); |
679 assert(Universe::heap()->is_in_reserved_or_null(receiver()), | 679 assert(Universe::heap()->is_in_reserved_or_null(receiver()), |
680 "sanity check"); | 680 "sanity check"); |
681 assert(receiver.is_null() || | 681 assert(receiver.is_null() || |
795 | 795 |
796 // Short circuit if CallSite has been bound already: | 796 // Short circuit if CallSite has been bound already: |
797 if (!pool->cache()->secondary_entry_at(site_index)->is_f1_null()) | 797 if (!pool->cache()->secondary_entry_at(site_index)->is_f1_null()) |
798 return; | 798 return; |
799 | 799 |
800 symbolHandle call_site_name(THREAD, pool->name_ref_at(site_index)); | 800 Symbol* call_site_name = pool->name_ref_at(site_index); |
801 | 801 |
802 Handle call_site | 802 Handle call_site |
803 = SystemDictionary::make_dynamic_call_site(bootm, | 803 = SystemDictionary::make_dynamic_call_site(bootm, |
804 // Callee information: | 804 // Callee information: |
805 call_site_name, | 805 call_site_name, |