@@ -100,10 +100,6 @@ ciSymbol* ciEnv::_unloaded_cisymbol = nullptr;
100100ciInstanceKlass* ciEnv::_unloaded_ciinstance_klass = nullptr ;
101101ciObjArrayKlass* ciEnv::_unloaded_ciobjarrayklass = nullptr ;
102102
103- jobject ciEnv::_ArrayIndexOutOfBoundsException_handle = nullptr ;
104- jobject ciEnv::_ArrayStoreException_handle = nullptr ;
105- jobject ciEnv::_ClassCastException_handle = nullptr ;
106-
107103#ifndef PRODUCT
108104static bool firstEnv = true ;
109105#endif /* PRODUCT */
@@ -158,10 +154,16 @@ ciEnv::ciEnv(CompileTask* task)
158154 o = Universe::arithmetic_exception_instance ();
159155 assert (o != nullptr , " should have been initialized" );
160156 _ArithmeticException_instance = get_object (o)->as_instance ();
157+ o = Universe::array_index_out_of_bounds_exception_instance ();
158+ assert (o != nullptr , " should have been initialized" );
159+ _ArrayIndexOutOfBoundsException_instance = get_object (o)->as_instance ();
160+ o = Universe::array_store_exception_instance ();
161+ assert (o != nullptr , " should have been initialized" );
162+ _ArrayStoreException_instance = get_object (o)->as_instance ();
163+ o = Universe::class_cast_exception_instance ();
164+ assert (o != nullptr , " should have been initialized" );
165+ _ClassCastException_instance = get_object (o)->as_instance ();
161166
162- _ArrayIndexOutOfBoundsException_instance = nullptr ;
163- _ArrayStoreException_instance = nullptr ;
164- _ClassCastException_instance = nullptr ;
165167 _the_null_string = nullptr ;
166168 _the_min_jint_string = nullptr ;
167169
@@ -363,29 +365,6 @@ void ciEnv::cache_dtrace_flags() {
363365 _dtrace_alloc_probes = DTraceAllocProbes;
364366}
365367
366- // ------------------------------------------------------------------
367- // helper for lazy exception creation
368- ciInstance* ciEnv::get_or_create_exception (jobject& handle, Symbol* name) {
369- VM_ENTRY_MARK;
370- if (handle == nullptr ) {
371- // Cf. universe.cpp, creation of Universe::_null_ptr_exception_instance.
372- InstanceKlass* ik = SystemDictionary::find_instance_klass (THREAD, name, Handle (), Handle ());
373- jobject objh = nullptr ;
374- if (ik != nullptr ) {
375- oop obj = ik->allocate_instance (THREAD);
376- if (!HAS_PENDING_EXCEPTION)
377- objh = JNIHandles::make_global (Handle (THREAD, obj));
378- }
379- if (HAS_PENDING_EXCEPTION) {
380- CLEAR_PENDING_EXCEPTION;
381- } else {
382- handle = objh;
383- }
384- }
385- oop obj = JNIHandles::resolve (handle);
386- return obj == nullptr ? nullptr : get_object (obj)->as_instance ();
387- }
388-
389368ciInstanceKlass* ciEnv::get_box_klass_for_primitive_type (BasicType type) {
390369 switch (type) {
391370 case T_BOOLEAN: return Boolean_klass ();
@@ -403,31 +382,6 @@ ciInstanceKlass* ciEnv::get_box_klass_for_primitive_type(BasicType type) {
403382 }
404383}
405384
406- ciInstance* ciEnv::ArrayIndexOutOfBoundsException_instance () {
407- if (_ArrayIndexOutOfBoundsException_instance == nullptr ) {
408- _ArrayIndexOutOfBoundsException_instance
409- = get_or_create_exception (_ArrayIndexOutOfBoundsException_handle,
410- vmSymbols::java_lang_ArrayIndexOutOfBoundsException ());
411- }
412- return _ArrayIndexOutOfBoundsException_instance;
413- }
414- ciInstance* ciEnv::ArrayStoreException_instance () {
415- if (_ArrayStoreException_instance == nullptr ) {
416- _ArrayStoreException_instance
417- = get_or_create_exception (_ArrayStoreException_handle,
418- vmSymbols::java_lang_ArrayStoreException ());
419- }
420- return _ArrayStoreException_instance;
421- }
422- ciInstance* ciEnv::ClassCastException_instance () {
423- if (_ClassCastException_instance == nullptr ) {
424- _ClassCastException_instance
425- = get_or_create_exception (_ClassCastException_handle,
426- vmSymbols::java_lang_ClassCastException ());
427- }
428- return _ClassCastException_instance;
429- }
430-
431385ciInstance* ciEnv::the_null_string () {
432386 if (_the_null_string == nullptr ) {
433387 VM_ENTRY_MARK;
0 commit comments