Skip to content

Commit a7546b3

Browse files
author
David Holmes
committed
8304996: Add missing HandleMarks
Reviewed-by: coleenp, shade, iklam
1 parent ac898e9 commit a7546b3

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

src/hotspot/share/cds/classPrelinker.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ void ClassPrelinker::dumptime_resolve_constants(InstanceKlass* ik, TRAPS) {
142142
}
143143

144144
Klass* ClassPrelinker::find_loaded_class(JavaThread* THREAD, oop class_loader, Symbol* name) {
145+
HandleMark hm(THREAD);
145146
Handle h_loader(THREAD, class_loader);
146147
Klass* k = SystemDictionary::find_instance_or_array_klass(THREAD, name,
147148
h_loader,

src/hotspot/share/cds/dynamicArchive.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,6 @@ void DynamicArchive::check_for_dynamic_dump() {
380380
void DynamicArchive::dump_at_exit(JavaThread* current, const char* archive_name) {
381381
ExceptionMark em(current);
382382
ResourceMark rm(current);
383-
HandleMark hm(current);
384383

385384
if (!DynamicDumpSharedSpaces || archive_name == nullptr) {
386385
return;

src/hotspot/share/oops/constantPool.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ void ConstantPool::initialize_resolved_references(ClassLoaderData* loader_data,
213213
// Create Java array for holding resolved strings, methodHandles,
214214
// methodTypes, invokedynamic and invokehandle appendix objects, etc.
215215
objArrayOop stom = oopFactory::new_objArray(vmClasses::Object_klass(), map_length, CHECK);
216+
HandleMark hm(THREAD);
216217
Handle refs_handle (THREAD, stom); // must handleize.
217218
set_resolved_references(loader_data->add_handle(refs_handle));
218219
}
@@ -341,6 +342,7 @@ void ConstantPool::restore_unshareable_info(TRAPS) {
341342
_cache->archived_references() != nullptr) {
342343
oop archived = _cache->archived_references();
343344
// Create handle for the archived resolved reference array object
345+
HandleMark hm(THREAD);
344346
Handle refs_handle(THREAD, archived);
345347
set_resolved_references(loader_data->add_handle(refs_handle));
346348
_cache->clear_archived_references();
@@ -352,6 +354,7 @@ void ConstantPool::restore_unshareable_info(TRAPS) {
352354
int map_length = resolved_reference_length();
353355
if (map_length > 0) {
354356
objArrayOop stom = oopFactory::new_objArray(vmClasses::Object_klass(), map_length, CHECK);
357+
HandleMark hm(THREAD);
355358
Handle refs_handle(THREAD, stom); // must handleize.
356359
set_resolved_references(loader_data->add_handle(refs_handle));
357360
}
@@ -519,6 +522,7 @@ Klass* ConstantPool::klass_at_impl(const constantPoolHandle& this_cp, int which,
519522
ShouldNotReachHere();
520523
}
521524

525+
HandleMark hm(THREAD);
522526
Handle mirror_handle;
523527
Symbol* name = this_cp->symbol_at(name_index);
524528
Handle loader (THREAD, this_cp->pool_holder()->class_loader());
@@ -595,6 +599,7 @@ Klass* ConstantPool::klass_at_if_loaded(const constantPoolHandle& this_cp, int w
595599
return nullptr;
596600
} else {
597601
Thread* current = Thread::current();
602+
HandleMark hm(current);
598603
Symbol* name = this_cp->symbol_at(name_index);
599604
oop loader = this_cp->pool_holder()->class_loader();
600605
oop protection_domain = this_cp->pool_holder()->protection_domain();
@@ -942,7 +947,6 @@ oop ConstantPool::resolve_constant_at_impl(const constantPoolHandle& this_cp,
942947
int index, int cache_index,
943948
bool* status_return, TRAPS) {
944949
oop result_oop = nullptr;
945-
Handle throw_exception;
946950

947951
if (cache_index == _possible_index_sentinel) {
948952
// It is possible that this constant is one which is cached in the objects.
@@ -1110,6 +1114,7 @@ oop ConstantPool::resolve_constant_at_impl(const constantPoolHandle& this_cp,
11101114
}
11111115

11121116
Klass* klass = this_cp->pool_holder();
1117+
HandleMark hm(THREAD);
11131118
Handle value = SystemDictionary::link_method_handle_constant(klass, ref_kind,
11141119
callee, name, signature,
11151120
THREAD);
@@ -1129,6 +1134,7 @@ oop ConstantPool::resolve_constant_at_impl(const constantPoolHandle& this_cp,
11291134
signature->as_C_string());
11301135
}
11311136
Klass* klass = this_cp->pool_holder();
1137+
HandleMark hm(THREAD);
11321138
Handle value = SystemDictionary::find_method_handle_type(signature, klass, THREAD);
11331139
result_oop = value();
11341140
if (HAS_PENDING_EXCEPTION) {

src/hotspot/share/oops/klassVtable.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,7 @@ void klassVtable::check_constraints(GrowableArray<InstanceKlass*>* supers, TRAPS
572572
// Do not check loader constraints for overpass methods because overpass
573573
// methods are created by the jvm to throw exceptions.
574574
if (!target_method->is_overpass()) {
575+
HandleMark hm(THREAD);
575576
// Override vtable entry if passes loader constraint check
576577
// if loader constraint checking requested
577578
// No need to visit his super, since he and his super

0 commit comments

Comments
 (0)