28 #include "compiler/disassembler.hpp" |
28 #include "compiler/disassembler.hpp" |
29 #include "interpreter/bytecodeHistogram.hpp" |
29 #include "interpreter/bytecodeHistogram.hpp" |
30 #include "interpreter/bytecodeInterpreter.hpp" |
30 #include "interpreter/bytecodeInterpreter.hpp" |
31 #include "interpreter/interpreter.hpp" |
31 #include "interpreter/interpreter.hpp" |
32 #include "interpreter/interpreterRuntime.hpp" |
32 #include "interpreter/interpreterRuntime.hpp" |
|
33 #include "interpreter/interp_masm.hpp" |
33 #include "interpreter/templateTable.hpp" |
34 #include "interpreter/templateTable.hpp" |
34 #include "memory/allocation.inline.hpp" |
35 #include "memory/allocation.inline.hpp" |
35 #include "memory/resourceArea.hpp" |
36 #include "memory/resourceArea.hpp" |
36 #include "oops/arrayOop.hpp" |
37 #include "oops/arrayOop.hpp" |
37 #include "oops/methodData.hpp" |
38 #include "oops/methodData.hpp" |
78 st->cr(); |
79 st->cr(); |
79 Disassembler::decode(code_begin(), code_end(), st, DEBUG_ONLY(_strings) NOT_DEBUG(CodeStrings())); |
80 Disassembler::decode(code_begin(), code_end(), st, DEBUG_ONLY(_strings) NOT_DEBUG(CodeStrings())); |
80 } |
81 } |
81 } |
82 } |
82 |
83 |
|
84 CodeletMark::CodeletMark(InterpreterMacroAssembler*& masm, |
|
85 const char* description, |
|
86 Bytecodes::Code bytecode) : |
|
87 _clet((InterpreterCodelet*)AbstractInterpreter::code()->request(codelet_size())), |
|
88 _cb(_clet->code_begin(), _clet->code_size()) { |
|
89 // Request all space (add some slack for Codelet data). |
|
90 assert(_clet != NULL, "we checked not enough space already"); |
|
91 |
|
92 // Initialize Codelet attributes. |
|
93 _clet->initialize(description, bytecode); |
|
94 // Create assembler for code generation. |
|
95 masm = new InterpreterMacroAssembler(&_cb); |
|
96 _masm = &masm; |
|
97 } |
|
98 |
|
99 CodeletMark::~CodeletMark() { |
|
100 // Align so printing shows nop's instead of random code at the end (Codelets are aligned). |
|
101 (*_masm)->align(wordSize); |
|
102 // Make sure all code is in code buffer. |
|
103 (*_masm)->flush(); |
|
104 |
|
105 // Commit Codelet. |
|
106 AbstractInterpreter::code()->commit((*_masm)->code()->pure_insts_size(), (*_masm)->code()->strings()); |
|
107 // Make sure nobody can use _masm outside a CodeletMark lifespan. |
|
108 *_masm = NULL; |
|
109 } |
83 |
110 |
84 //------------------------------------------------------------------------------------------------------------------------ |
111 //------------------------------------------------------------------------------------------------------------------------ |
85 // Implementation of platform independent aspects of Interpreter |
112 // Implementation of platform independent aspects of Interpreter |
86 |
113 |
87 void AbstractInterpreter::initialize() { |
114 void AbstractInterpreter::initialize() { |
88 if (_code != NULL) return; |
115 if (_code != NULL) return; |
89 |
116 |
90 // make sure 'imported' classes are initialized |
117 // make sure 'imported' classes are initialized |