< prev index next >

src/share/vm/oops/constantPool.cpp

Print this page
rev 8978 : imported patch remove_err_msg


1809 void ConstantPool::patch_resolved_references(GrowableArray<Handle>* cp_patches) {
1810   for (int index = 1; index < cp_patches->length(); index++) { // Index 0 is unused
1811     Handle patch = cp_patches->at(index);
1812     if (patch.not_null()) {
1813       assert (tag_at(index).is_string(), "should only be string left");
1814       // Patching a string means pre-resolving it.
1815       // The spelling in the constant pool is ignored.
1816       // The constant reference may be any object whatever.
1817       // If it is not a real interned string, the constant is referred
1818       // to as a "pseudo-string", and must be presented to the CP
1819       // explicitly, because it may require scavenging.
1820       int obj_index = cp_to_object_index(index);
1821       pseudo_string_at_put(index, obj_index, patch());
1822      DEBUG_ONLY(cp_patches->at_put(index, Handle());)
1823     }
1824   }
1825 #ifdef ASSERT
1826   // Ensure that all the patches have been used.
1827   for (int index = 0; index < cp_patches->length(); index++) {
1828     assert(cp_patches->at(index).is_null(),
1829            err_msg("Unused constant pool patch at %d in class file %s",
1830                    index,
1831                    pool_holder()->external_name()));
1832   }
1833 #endif // ASSERT
1834 }
1835 
1836 #ifndef PRODUCT
1837 
1838 // CompileTheWorld support. Preload all classes loaded references in the passed in constantpool
1839 void ConstantPool::preload_and_initialize_all_classes(ConstantPool* obj, TRAPS) {
1840   guarantee(obj->is_constantPool(), "object must be constant pool");
1841   constantPoolHandle cp(THREAD, (ConstantPool*)obj);
1842   guarantee(cp->pool_holder() != NULL, "must be fully loaded");
1843 
1844   for (int i = 0; i< cp->length();  i++) {
1845     if (cp->tag_at(i).is_unresolved_klass()) {
1846       // This will force loading of the class
1847       Klass* klass = cp->klass_at(i, CHECK);
1848       if (klass->oop_is_instance()) {
1849         // Force initialization of class
1850         InstanceKlass::cast(klass)->initialize(CHECK);
1851       }




1809 void ConstantPool::patch_resolved_references(GrowableArray<Handle>* cp_patches) {
1810   for (int index = 1; index < cp_patches->length(); index++) { // Index 0 is unused
1811     Handle patch = cp_patches->at(index);
1812     if (patch.not_null()) {
1813       assert (tag_at(index).is_string(), "should only be string left");
1814       // Patching a string means pre-resolving it.
1815       // The spelling in the constant pool is ignored.
1816       // The constant reference may be any object whatever.
1817       // If it is not a real interned string, the constant is referred
1818       // to as a "pseudo-string", and must be presented to the CP
1819       // explicitly, because it may require scavenging.
1820       int obj_index = cp_to_object_index(index);
1821       pseudo_string_at_put(index, obj_index, patch());
1822      DEBUG_ONLY(cp_patches->at_put(index, Handle());)
1823     }
1824   }
1825 #ifdef ASSERT
1826   // Ensure that all the patches have been used.
1827   for (int index = 0; index < cp_patches->length(); index++) {
1828     assert(cp_patches->at(index).is_null(),
1829            "Unused constant pool patch at %d in class file %s",
1830            index,
1831            pool_holder()->external_name());
1832   }
1833 #endif // ASSERT
1834 }
1835 
1836 #ifndef PRODUCT
1837 
1838 // CompileTheWorld support. Preload all classes loaded references in the passed in constantpool
1839 void ConstantPool::preload_and_initialize_all_classes(ConstantPool* obj, TRAPS) {
1840   guarantee(obj->is_constantPool(), "object must be constant pool");
1841   constantPoolHandle cp(THREAD, (ConstantPool*)obj);
1842   guarantee(cp->pool_holder() != NULL, "must be fully loaded");
1843 
1844   for (int i = 0; i< cp->length();  i++) {
1845     if (cp->tag_at(i).is_unresolved_klass()) {
1846       // This will force loading of the class
1847       Klass* klass = cp->klass_at(i, CHECK);
1848       if (klass->oop_is_instance()) {
1849         // Force initialization of class
1850         InstanceKlass::cast(klass)->initialize(CHECK);
1851       }


< prev index next >