Mercurial > hg > truffle
diff src/share/vm/runtime/frame.cpp @ 6725:da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author | coleenp |
---|---|
date | Sat, 01 Sep 2012 13:25:18 -0400 |
parents | 1d7922586cf6 |
children | e522a00b91aa d0aa87f04bd5 cd3d6a6b95d9 |
line wrap: on
line diff
--- a/src/share/vm/runtime/frame.cpp Fri Aug 31 16:39:35 2012 -0700 +++ b/src/share/vm/runtime/frame.cpp Sat Sep 01 13:25:18 2012 -0400 @@ -29,8 +29,8 @@ #include "memory/resourceArea.hpp" #include "memory/universe.inline.hpp" #include "oops/markOop.hpp" -#include "oops/methodDataOop.hpp" -#include "oops/methodOop.hpp" +#include "oops/methodData.hpp" +#include "oops/method.hpp" #include "oops/oop.inline.hpp" #include "oops/oop.inline2.hpp" #include "prims/methodHandles.hpp" @@ -383,15 +383,15 @@ *interpreter_frame_locals_addr() = locs; } -methodOop frame::interpreter_frame_method() const { +Method* frame::interpreter_frame_method() const { assert(is_interpreted_frame(), "interpreted frame expected"); - methodOop m = *interpreter_frame_method_addr(); - assert(m->is_perm(), "bad methodOop in interpreter frame"); - assert(m->is_method(), "not a methodOop"); + Method* m = *interpreter_frame_method_addr(); + assert(m->is_metadata(), "bad Method* in interpreter frame"); + assert(m->is_method(), "not a Method*"); return m; } -void frame::interpreter_frame_set_method(methodOop method) { +void frame::interpreter_frame_set_method(Method* method) { assert(is_interpreted_frame(), "interpreted frame expected"); *interpreter_frame_method_addr() = method; } @@ -410,7 +410,7 @@ if (!is_now_bci) { // The bcx was just converted from bci to bcp. // Convert the mdx in parallel. - methodDataOop mdo = interpreter_frame_method()->method_data(); + MethodData* mdo = interpreter_frame_method()->method_data(); assert(mdo != NULL, ""); int mdi = mdx - 1; // We distinguish valid mdi from zero by adding one. address mdp = mdo->di_to_dp(mdi); @@ -420,7 +420,7 @@ if (is_now_bci) { // The bcx was just converted from bcp to bci. // Convert the mdx in parallel. - methodDataOop mdo = interpreter_frame_method()->method_data(); + MethodData* mdo = interpreter_frame_method()->method_data(); assert(mdo != NULL, ""); int mdi = mdo->dp_to_di((address)mdx); interpreter_frame_set_mdx((intptr_t)mdi + 1); // distinguish valid from 0. @@ -691,7 +691,7 @@ void frame::print_on_error(outputStream* st, char* buf, int buflen, bool verbose) const { if (_cb != NULL) { if (Interpreter::contains(pc())) { - methodOop m = this->interpreter_frame_method(); + Method* m = this->interpreter_frame_method(); if (m != NULL) { m->name_and_sig_as_C_string(buf, buflen); st->print("j %s", buf); @@ -709,7 +709,7 @@ } else if (_cb->is_buffer_blob()) { st->print("v ~BufferBlob::%s", ((BufferBlob *)_cb)->name()); } else if (_cb->is_nmethod()) { - methodOop m = ((nmethod *)_cb)->method(); + Method* m = ((nmethod *)_cb)->method(); if (m != NULL) { m->name_and_sig_as_C_string(buf, buflen); st->print("J %s", buf); @@ -736,8 +736,8 @@ /* The interpreter_frame_expression_stack_at method in the case of SPARC needs the max_stack value of the method in order to compute the expression stack address. - It uses the methodOop in order to get the max_stack value but during GC this - methodOop value saved on the frame is changed by reverse_and_push and hence cannot + It uses the Method* in order to get the max_stack value but during GC this + Method* value saved on the frame is changed by reverse_and_push and hence cannot be used. So we save the max_stack value in the FrameClosure object and pass it down to the interpreter_frame_expression_stack_at method */ @@ -886,9 +886,12 @@ methodHandle m (thread, interpreter_frame_method()); jint bci = interpreter_frame_bci(); - assert(Universe::heap()->is_in(m()), "must be valid oop"); + assert(!Universe::heap()->is_in(m()), + "must be valid oop"); assert(m->is_method(), "checking frame value"); - assert((m->is_native() && bci == 0) || (!m->is_native() && bci >= 0 && bci < m->code_size()), "invalid bci value"); + assert((m->is_native() && bci == 0) || + (!m->is_native() && bci >= 0 && bci < m->code_size()), + "invalid bci value"); // Handle the monitor elements in the activation for ( @@ -903,23 +906,10 @@ } // process fixed part - f->do_oop((oop*)interpreter_frame_method_addr()); - f->do_oop((oop*)interpreter_frame_cache_addr()); - - // Hmm what about the mdp? -#ifdef CC_INTERP - // Interpreter frame in the midst of a call have a methodOop within the - // object. - interpreterState istate = get_interpreterState(); - if (istate->msg() == BytecodeInterpreter::call_method) { - f->do_oop((oop*)&istate->_result._to_call._callee); - } - -#endif /* CC_INTERP */ - #if !defined(PPC) || defined(ZERO) if (m->is_native()) { #ifdef CC_INTERP + interpreterState istate = get_interpreterState(); f->do_oop((oop*)&istate->_oop_temp); #else f->do_oop((oop*)( fp() + interpreter_frame_oop_temp_offset )); @@ -1148,9 +1138,19 @@ } +// call f() on the interpreted Method*s in the stack. +// Have to walk the entire code cache for the compiled frames Yuck. +void frame::metadata_do(void f(Metadata*)) { + if (_cb != NULL && Interpreter::contains(pc())) { + Method* m = this->interpreter_frame_method(); + assert(m != NULL, "huh?"); + f(m); + } +} + void frame::gc_prologue() { if (is_interpreted_frame()) { - // set bcx to bci to become methodOop position independent during GC + // set bcx to bci to become Method* position independent during GC interpreter_frame_set_bcx(interpreter_frame_bci()); } } @@ -1225,7 +1225,7 @@ void frame::zap_dead_interpreted_locals(JavaThread *thread, const RegisterMap* map) { // get current interpreter 'pc' assert(is_interpreted_frame(), "Not an interpreted frame"); - methodOop m = interpreter_frame_method(); + Method* m = interpreter_frame_method(); int bci = interpreter_frame_bci(); int max_locals = m->is_native() ? m->size_of_parameters() : m->max_locals(); @@ -1269,7 +1269,7 @@ void frame::verify(const RegisterMap* map) { // for now make sure receiver type is correct if (is_interpreted_frame()) { - methodOop method = interpreter_frame_method(); + Method* method = interpreter_frame_method(); guarantee(method->is_method(), "method is wrong in frame::verify"); if (!method->is_static()) { // fetch the receiver @@ -1334,7 +1334,7 @@ } if (is_interpreted_frame()) { - methodOop m = interpreter_frame_method(); + Method* m = interpreter_frame_method(); int bci = interpreter_frame_bci(); // Label the method and current bci