8253162: Make frame::oops_do const
Reviewed-by: kbarrett, coleenp, pliden
This commit is contained in:
parent
300b8517c3
commit
e2196f8882
@ -672,13 +672,13 @@ void frame::print_on_error(outputStream* st, char* buf, int buflen, bool verbose
|
||||
*/
|
||||
class InterpreterFrameClosure : public OffsetClosure {
|
||||
private:
|
||||
frame* _fr;
|
||||
OopClosure* _f;
|
||||
int _max_locals;
|
||||
int _max_stack;
|
||||
const frame* _fr;
|
||||
OopClosure* _f;
|
||||
int _max_locals;
|
||||
int _max_stack;
|
||||
|
||||
public:
|
||||
InterpreterFrameClosure(frame* fr, int max_locals, int max_stack,
|
||||
InterpreterFrameClosure(const frame* fr, int max_locals, int max_stack,
|
||||
OopClosure* f) {
|
||||
_fr = fr;
|
||||
_max_locals = max_locals;
|
||||
@ -709,16 +709,15 @@ class InterpreterFrameClosure : public OffsetClosure {
|
||||
}
|
||||
|
||||
int max_locals() { return _max_locals; }
|
||||
frame* fr() { return _fr; }
|
||||
};
|
||||
|
||||
|
||||
class InterpretedArgumentOopFinder: public SignatureIterator {
|
||||
private:
|
||||
OopClosure* _f; // Closure to invoke
|
||||
int _offset; // TOS-relative offset, decremented with each argument
|
||||
bool _has_receiver; // true if the callee has a receiver
|
||||
frame* _fr;
|
||||
OopClosure* _f; // Closure to invoke
|
||||
int _offset; // TOS-relative offset, decremented with each argument
|
||||
bool _has_receiver; // true if the callee has a receiver
|
||||
const frame* _fr;
|
||||
|
||||
friend class SignatureIterator; // so do_parameters_on can call do_type
|
||||
void do_type(BasicType type) {
|
||||
@ -733,7 +732,7 @@ class InterpretedArgumentOopFinder: public SignatureIterator {
|
||||
}
|
||||
|
||||
public:
|
||||
InterpretedArgumentOopFinder(Symbol* signature, bool has_receiver, frame* fr, OopClosure* f) : SignatureIterator(signature), _has_receiver(has_receiver) {
|
||||
InterpretedArgumentOopFinder(Symbol* signature, bool has_receiver, const frame* fr, OopClosure* f) : SignatureIterator(signature), _has_receiver(has_receiver) {
|
||||
// compute size of arguments
|
||||
int args_size = ArgumentSizeComputer(signature).size() + (has_receiver ? 1 : 0);
|
||||
assert(!fr->is_interpreted_frame() ||
|
||||
@ -769,10 +768,10 @@ class InterpretedArgumentOopFinder: public SignatureIterator {
|
||||
// visits and GC's all the arguments in entry frame
|
||||
class EntryFrameOopFinder: public SignatureIterator {
|
||||
private:
|
||||
bool _is_static;
|
||||
int _offset;
|
||||
frame* _fr;
|
||||
OopClosure* _f;
|
||||
bool _is_static;
|
||||
int _offset;
|
||||
const frame* _fr;
|
||||
OopClosure* _f;
|
||||
|
||||
friend class SignatureIterator; // so do_parameters_on can call do_type
|
||||
void do_type(BasicType type) {
|
||||
@ -789,7 +788,7 @@ class EntryFrameOopFinder: public SignatureIterator {
|
||||
}
|
||||
|
||||
public:
|
||||
EntryFrameOopFinder(frame* frame, Symbol* signature, bool is_static) : SignatureIterator(signature) {
|
||||
EntryFrameOopFinder(const frame* frame, Symbol* signature, bool is_static) : SignatureIterator(signature) {
|
||||
_f = NULL; // will be set later
|
||||
_fr = frame;
|
||||
_is_static = is_static;
|
||||
@ -811,7 +810,7 @@ oop* frame::interpreter_callee_receiver_addr(Symbol* signature) {
|
||||
}
|
||||
|
||||
|
||||
void frame::oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache) {
|
||||
void frame::oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache) const {
|
||||
assert(is_interpreted_frame(), "Not an interpreted frame");
|
||||
assert(map != NULL, "map must be set");
|
||||
Thread *thread = Thread::current();
|
||||
@ -892,12 +891,12 @@ void frame::oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool quer
|
||||
}
|
||||
|
||||
|
||||
void frame::oops_interpreted_arguments_do(Symbol* signature, bool has_receiver, OopClosure* f) {
|
||||
void frame::oops_interpreted_arguments_do(Symbol* signature, bool has_receiver, OopClosure* f) const {
|
||||
InterpretedArgumentOopFinder finder(signature, has_receiver, this, f);
|
||||
finder.oops_do();
|
||||
}
|
||||
|
||||
void frame::oops_code_blob_do(OopClosure* f, CodeBlobClosure* cf, const RegisterMap* reg_map) {
|
||||
void frame::oops_code_blob_do(OopClosure* f, CodeBlobClosure* cf, const RegisterMap* reg_map) const {
|
||||
assert(_cb != NULL, "sanity check");
|
||||
if (_cb->oop_maps() != NULL) {
|
||||
OopMapSet::oops_do(this, reg_map, f);
|
||||
@ -974,7 +973,7 @@ class CompiledArgumentOopFinder: public SignatureIterator {
|
||||
};
|
||||
|
||||
void frame::oops_compiled_arguments_do(Symbol* signature, bool has_receiver, bool has_appendix,
|
||||
const RegisterMap* reg_map, OopClosure* f) {
|
||||
const RegisterMap* reg_map, OopClosure* f) const {
|
||||
ResourceMark rm;
|
||||
CompiledArgumentOopFinder finder(signature, has_receiver, has_appendix, f, *this, reg_map);
|
||||
finder.oops_do();
|
||||
@ -1023,7 +1022,7 @@ oop frame::get_native_receiver() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
void frame::oops_entry_do(OopClosure* f, const RegisterMap* map) {
|
||||
void frame::oops_entry_do(OopClosure* f, const RegisterMap* map) const {
|
||||
assert(map != NULL, "map must be set");
|
||||
if (map->include_argument_oops()) {
|
||||
// must collect argument oops, as nobody else is doing it
|
||||
@ -1037,7 +1036,7 @@ void frame::oops_entry_do(OopClosure* f, const RegisterMap* map) {
|
||||
}
|
||||
|
||||
|
||||
void frame::oops_do_internal(OopClosure* f, CodeBlobClosure* cf, RegisterMap* map, bool use_interpreter_oop_map_cache) {
|
||||
void frame::oops_do_internal(OopClosure* f, CodeBlobClosure* cf, const RegisterMap* map, bool use_interpreter_oop_map_cache) const {
|
||||
#ifndef PRODUCT
|
||||
// simulate GC crash here to dump java thread in error report
|
||||
if (CrashGCForDumpingJavaThread) {
|
||||
@ -1056,7 +1055,7 @@ void frame::oops_do_internal(OopClosure* f, CodeBlobClosure* cf, RegisterMap* ma
|
||||
}
|
||||
}
|
||||
|
||||
void frame::nmethods_do(CodeBlobClosure* cf) {
|
||||
void frame::nmethods_do(CodeBlobClosure* cf) const {
|
||||
if (_cb != NULL && _cb->is_nmethod()) {
|
||||
cf->do_code_blob(_cb);
|
||||
}
|
||||
@ -1064,7 +1063,7 @@ void frame::nmethods_do(CodeBlobClosure* cf) {
|
||||
|
||||
|
||||
// Call f closure on the interpreted Method*s in the stack.
|
||||
void frame::metadata_do(MetadataClosure* f) {
|
||||
void frame::metadata_do(MetadataClosure* f) const {
|
||||
ResourceMark rm;
|
||||
if (is_interpreted_frame()) {
|
||||
Method* m = this->interpreter_frame_method();
|
||||
@ -1073,7 +1072,7 @@ void frame::metadata_do(MetadataClosure* f) {
|
||||
}
|
||||
}
|
||||
|
||||
void frame::verify(const RegisterMap* map) {
|
||||
void frame::verify(const RegisterMap* map) const {
|
||||
// for now make sure receiver type is correct
|
||||
if (is_interpreted_frame()) {
|
||||
Method* method = interpreter_frame_method();
|
||||
@ -1087,7 +1086,7 @@ void frame::verify(const RegisterMap* map) {
|
||||
#if COMPILER2_OR_JVMCI
|
||||
assert(DerivedPointerTable::is_empty(), "must be empty before verify");
|
||||
#endif
|
||||
oops_do_internal(&VerifyOopClosure::verify_oop, NULL, (RegisterMap*)map, false);
|
||||
oops_do_internal(&VerifyOopClosure::verify_oop, NULL, map, false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -359,27 +359,27 @@ class frame {
|
||||
oop* oopmapreg_to_location(VMReg reg, const RegisterMap* reg_map) const;
|
||||
|
||||
// Oops-do's
|
||||
void oops_compiled_arguments_do(Symbol* signature, bool has_receiver, bool has_appendix, const RegisterMap* reg_map, OopClosure* f);
|
||||
void oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache = true);
|
||||
void oops_compiled_arguments_do(Symbol* signature, bool has_receiver, bool has_appendix, const RegisterMap* reg_map, OopClosure* f) const;
|
||||
void oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache = true) const;
|
||||
|
||||
private:
|
||||
void oops_interpreted_arguments_do(Symbol* signature, bool has_receiver, OopClosure* f);
|
||||
void oops_interpreted_arguments_do(Symbol* signature, bool has_receiver, OopClosure* f) const;
|
||||
|
||||
// Iteration of oops
|
||||
void oops_do_internal(OopClosure* f, CodeBlobClosure* cf, RegisterMap* map, bool use_interpreter_oop_map_cache);
|
||||
void oops_entry_do(OopClosure* f, const RegisterMap* map);
|
||||
void oops_code_blob_do(OopClosure* f, CodeBlobClosure* cf, const RegisterMap* map);
|
||||
void oops_do_internal(OopClosure* f, CodeBlobClosure* cf, const RegisterMap* map, bool use_interpreter_oop_map_cache) const;
|
||||
void oops_entry_do(OopClosure* f, const RegisterMap* map) const;
|
||||
void oops_code_blob_do(OopClosure* f, CodeBlobClosure* cf, const RegisterMap* map) const;
|
||||
int adjust_offset(Method* method, int index); // helper for above fn
|
||||
public:
|
||||
// Memory management
|
||||
void oops_do(OopClosure* f, CodeBlobClosure* cf, RegisterMap* map) { oops_do_internal(f, cf, map, true); }
|
||||
void nmethods_do(CodeBlobClosure* cf);
|
||||
void oops_do(OopClosure* f, CodeBlobClosure* cf, const RegisterMap* map) const { oops_do_internal(f, cf, map, true); }
|
||||
void nmethods_do(CodeBlobClosure* cf) const;
|
||||
|
||||
// RedefineClasses support for finding live interpreted methods on the stack
|
||||
void metadata_do(MetadataClosure* f);
|
||||
void metadata_do(MetadataClosure* f) const;
|
||||
|
||||
// Verification
|
||||
void verify(const RegisterMap* map);
|
||||
void verify(const RegisterMap* map) const;
|
||||
static bool verify_return_pc(address x);
|
||||
// Usage:
|
||||
// assert(frame::verify_return_pc(return_address), "must be a return pc");
|
||||
|
Loading…
x
Reference in New Issue
Block a user