< prev index next >

src/hotspot/share/interpreter/interpreter.cpp

Print this page

 33 #include "memory/allocation.inline.hpp"
 34 #include "memory/resourceArea.hpp"
 35 #include "oops/arrayOop.hpp"
 36 #include "oops/methodData.hpp"
 37 #include "oops/method.hpp"
 38 #include "oops/oop.inline.hpp"
 39 #include "prims/forte.hpp"
 40 #include "prims/jvmtiExport.hpp"
 41 #include "prims/methodHandles.hpp"
 42 #include "runtime/handles.inline.hpp"
 43 #include "runtime/sharedRuntime.hpp"
 44 #include "runtime/stubRoutines.hpp"
 45 #include "runtime/timer.hpp"
 46 
 47 # define __ _masm->
 48 
 49 
 50 //------------------------------------------------------------------------------
 51 // Implementation of InterpreterCodelet
 52 
 53 void InterpreterCodelet::initialize(const char* description, Bytecodes::Code bytecode) {
 54   _description = description;

 55   _bytecode    = bytecode;
 56 #ifndef PRODUCT
 57   AsmRemarks* arp = new(&_asm_remarks) AsmRemarks();
 58   DbgStrings* dsp = new(&_dbg_strings) DbgStrings();
 59   postcond(arp == &_asm_remarks);
 60   postcond(dsp == &_dbg_strings);
 61 #endif
 62 }
 63 
 64 void InterpreterCodelet::verify() {}
 65 
 66 void InterpreterCodelet::print_on(outputStream* st) const {
 67   ttyLocker ttyl;
 68 
 69   if (PrintInterpreter) {
 70     st->cr();
 71     st->print_cr("----------------------------------------------------------------------");
 72   }
 73 
 74   if (description() != NULL) st->print("%s  ", description());
 75   if (bytecode()    >= 0   ) st->print("%d %s  ", bytecode(), Bytecodes::name(bytecode()));
 76   st->print_cr("[" INTPTR_FORMAT ", " INTPTR_FORMAT "]  %d bytes",
 77                 p2i(code_begin()), p2i(code_end()), code_size());
 78 
 79   if (PrintInterpreter) {
 80     st->cr();
 81     Disassembler::decode(code_begin(), code_end(), st NOT_PRODUCT(COMMA &_asm_remarks));
 82   }
 83 }
 84 
 85 void InterpreterCodelet::print() const { print_on(tty); }
 86 
 87 CodeletMark::CodeletMark(InterpreterMacroAssembler*& masm,
 88                          const char* description,

 89                          Bytecodes::Code bytecode) :
 90   _clet((InterpreterCodelet*)AbstractInterpreter::code()->request(codelet_size())),
 91   _cb(_clet->code_begin(), _clet->code_size()) {
 92   // Request all space (add some slack for Codelet data).
 93   assert(_clet != NULL, "we checked not enough space already");
 94 
 95   // Initialize Codelet attributes.
 96   _clet->initialize(description, bytecode);
 97   // Create assembler for code generation.
 98   masm = new InterpreterMacroAssembler(&_cb);
 99   _masm = &masm;
100 }
101 
102 CodeletMark::~CodeletMark() {
103   // Align so printing shows nop's instead of random code at the end (Codelets are aligned).
104   (*_masm)->align(wordSize);
105   // Make sure all code is in code buffer.
106   (*_masm)->flush();
107 
108   // Commit Codelet.
109   int committed_code_size = (*_masm)->code()->pure_insts_size();
110   if (committed_code_size > 0) {
111     // This is  the ONE place where  we pickup any assembly  remarks and debug
112     // strings, and propagate these to the codelet.
113     NOT_PRODUCT(_clet->use_remarks((*_masm)->code()->asm_remarks()));
114     NOT_PRODUCT(_clet->use_strings((*_masm)->code()->dbg_strings()));
115 
116     AbstractInterpreter::code()->commit(committed_code_size);

 33 #include "memory/allocation.inline.hpp"
 34 #include "memory/resourceArea.hpp"
 35 #include "oops/arrayOop.hpp"
 36 #include "oops/methodData.hpp"
 37 #include "oops/method.hpp"
 38 #include "oops/oop.inline.hpp"
 39 #include "prims/forte.hpp"
 40 #include "prims/jvmtiExport.hpp"
 41 #include "prims/methodHandles.hpp"
 42 #include "runtime/handles.inline.hpp"
 43 #include "runtime/sharedRuntime.hpp"
 44 #include "runtime/stubRoutines.hpp"
 45 #include "runtime/timer.hpp"
 46 
 47 # define __ _masm->
 48 
 49 
 50 //------------------------------------------------------------------------------
 51 // Implementation of InterpreterCodelet
 52 
 53 void InterpreterCodelet::initialize(const char* description, Kind kind, Bytecodes::Code bytecode) {
 54   _description = description;
 55   _kind        = kind;
 56   _bytecode    = bytecode;
 57 #ifndef PRODUCT
 58   AsmRemarks* arp = new(&_asm_remarks) AsmRemarks();
 59   DbgStrings* dsp = new(&_dbg_strings) DbgStrings();
 60   postcond(arp == &_asm_remarks);
 61   postcond(dsp == &_dbg_strings);
 62 #endif
 63 }
 64 
 65 void InterpreterCodelet::verify() {}
 66 
 67 void InterpreterCodelet::print_on(outputStream* st) const {
 68   ttyLocker ttyl;
 69 
 70   if (PrintInterpreter) {
 71     st->cr();
 72     st->print_cr("----------------------------------------------------------------------");
 73   }
 74 
 75   if (description() != NULL) st->print("%s  ", description());
 76   if (bytecode()    >= 0   ) st->print("%d %s  ", bytecode(), Bytecodes::name(bytecode()));
 77   st->print_cr("[" INTPTR_FORMAT ", " INTPTR_FORMAT "]  %d bytes",
 78                 p2i(code_begin()), p2i(code_end()), code_size());
 79 
 80   if (PrintInterpreter) {
 81     st->cr();
 82     Disassembler::decode(code_begin(), code_end(), st NOT_PRODUCT(COMMA &_asm_remarks));
 83   }
 84 }
 85 
 86 void InterpreterCodelet::print() const { print_on(tty); }
 87 
 88 CodeletMark::CodeletMark(InterpreterMacroAssembler*& masm,
 89                          const char* description,
 90                          InterpreterCodelet::Kind kind,
 91                          Bytecodes::Code bytecode) :
 92   _clet((InterpreterCodelet*)AbstractInterpreter::code()->request(codelet_size())),
 93   _cb(_clet->code_begin(), _clet->code_size()) {
 94   // Request all space (add some slack for Codelet data).
 95   assert(_clet != NULL, "we checked not enough space already");
 96 
 97   // Initialize Codelet attributes.
 98   _clet->initialize(description, kind, bytecode);
 99   // Create assembler for code generation.
100   masm = new InterpreterMacroAssembler(&_cb);
101   _masm = &masm;
102 }
103 
104 CodeletMark::~CodeletMark() {
105   // Align so printing shows nop's instead of random code at the end (Codelets are aligned).
106   (*_masm)->align(wordSize);
107   // Make sure all code is in code buffer.
108   (*_masm)->flush();
109 
110   // Commit Codelet.
111   int committed_code_size = (*_masm)->code()->pure_insts_size();
112   if (committed_code_size > 0) {
113     // This is  the ONE place where  we pickup any assembly  remarks and debug
114     // strings, and propagate these to the codelet.
115     NOT_PRODUCT(_clet->use_remarks((*_masm)->code()->asm_remarks()));
116     NOT_PRODUCT(_clet->use_strings((*_masm)->code()->dbg_strings()));
117 
118     AbstractInterpreter::code()->commit(committed_code_size);
< prev index next >