< prev index next >
src/hotspot/share/interpreter/rewriter.cpp
Print this page
@@ -78,17 +78,17 @@
_method_handle_invokers.at_grow(length, 0);
}
}
// Unrewrite the bytecodes if an error occurs.
-void Rewriter::restore_bytecodes() {
+void Rewriter::restore_bytecodes(Thread* thread) {
int len = _methods->length();
bool invokespecial_error = false;
for (int i = len-1; i >= 0; i--) {
Method* method = _methods->at(i);
- scan_method(method, true, &invokespecial_error);
+ scan_method(thread, method, true, &invokespecial_error);
assert(!invokespecial_error, "reversing should not get an invokespecial error");
}
}
// Creates a constant pool cache given a CPC map
@@ -363,11 +363,11 @@
}
}
// Rewrites a method given the index_map information
-void Rewriter::scan_method(Method* method, bool reverse, bool* invokespecial_error) {
+void Rewriter::scan_method(Thread* thread, Method* method, bool reverse, bool* invokespecial_error) {
int nof_jsrs = 0;
bool has_monitor_bytecodes = false;
Bytecodes::Code c;
@@ -437,11 +437,11 @@
//
// The check is performed after verification and only if verification has
// succeeded. Therefore, the class is guaranteed to be well-formed.
InstanceKlass* klass = method->method_holder();
u2 bc_index = Bytes::get_Java_u2(bcp + prefix_length + 1);
- constantPoolHandle cp(method->constants());
+ constantPoolHandle cp(thread, method->constants());
Symbol* ref_class_name = cp->klass_name_at(cp->klass_ref_index_at(bc_index));
if (klass->name() == ref_class_name) {
Symbol* field_name = cp->name_ref_at(bc_index);
Symbol* field_sig = cp->signature_ref_at(bc_index);
@@ -546,11 +546,11 @@
int len = _methods->length();
bool invokespecial_error = false;
for (int i = len-1; i >= 0; i--) {
Method* method = _methods->at(i);
- scan_method(method, false, &invokespecial_error);
+ scan_method(THREAD, method, false, &invokespecial_error);
if (invokespecial_error) {
// If you get an error here, there is no reversing bytecodes
// This exception is stored for this class and no further attempt is
// made at verifying or rewriting.
THROW_MSG(vmSymbols::java_lang_InternalError(),
@@ -568,11 +568,12 @@
void Rewriter::rewrite(InstanceKlass* klass, TRAPS) {
if (!DumpSharedSpaces) {
assert(!klass->is_shared(), "archive methods must not be rewritten at run time");
}
ResourceMark rm(THREAD);
- Rewriter rw(klass, klass->constants(), klass->methods(), CHECK);
+ constantPoolHandle cpool(THREAD, klass->constants());
+ Rewriter rw(klass, cpool, klass->methods(), CHECK);
// (That's all, folks.)
}
Rewriter::Rewriter(InstanceKlass* klass, const constantPoolHandle& cpool, Array<Method*>* methods, TRAPS)
: _klass(klass),
@@ -590,21 +591,21 @@
// Rewrite bytecodes - exception here exits.
rewrite_bytecodes(CHECK);
// Stress restoring bytecodes
if (StressRewriter) {
- restore_bytecodes();
+ restore_bytecodes(THREAD);
rewrite_bytecodes(CHECK);
}
// allocate constant pool cache, now that we've seen all the bytecodes
make_constant_pool_cache(THREAD);
// Restore bytecodes to their unrewritten state if there are exceptions
// rewriting bytecodes or allocating the cpCache
if (HAS_PENDING_EXCEPTION) {
- restore_bytecodes();
+ restore_bytecodes(THREAD);
return;
}
// Relocate after everything, but still do this under the is_rewritten flag,
// so methods with jsrs in custom class lists in aren't attempted to be
@@ -618,11 +619,11 @@
m = rewrite_jsrs(m, THREAD);
// Restore bytecodes to their unrewritten state if there are exceptions
// relocating bytecodes. If some are relocated, that is ok because that
// doesn't affect constant pool to cpCache rewriting.
if (HAS_PENDING_EXCEPTION) {
- restore_bytecodes();
+ restore_bytecodes(THREAD);
return;
}
// Method might have gotten rewritten.
methods->at_put(i, m());
}
< prev index next >