Thu, 24 Mar 2011 02:11:50 -0700
7030207: Zero tweak to remove accidentally incorporated code
Summary: IcedTea contains a now-unmaintained ARM-specific interpreter and part of that interpreter was accidentally incorporated in one of the webrevs when Zero was initially imported.
Reviewed-by: twisti
Contributed-by: Gary Benson <gbenson@redhat.com>
duke@435 | 1 | /* |
twisti@2103 | 2 | * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
stefank@2314 | 25 | #ifndef SHARE_VM_INTERPRETER_INTERPRETER_HPP |
stefank@2314 | 26 | #define SHARE_VM_INTERPRETER_INTERPRETER_HPP |
stefank@2314 | 27 | |
stefank@2314 | 28 | #include "code/stubs.hpp" |
stefank@2314 | 29 | #include "interpreter/cppInterpreter.hpp" |
stefank@2314 | 30 | #include "interpreter/templateInterpreter.hpp" |
stefank@2314 | 31 | #ifdef ZERO |
stefank@2314 | 32 | #ifdef TARGET_ARCH_zero |
stefank@2314 | 33 | # include "entry_zero.hpp" |
stefank@2314 | 34 | #endif |
stefank@2314 | 35 | #endif |
stefank@2314 | 36 | |
twisti@1040 | 37 | // This file contains the platform-independent parts |
duke@435 | 38 | // of the interpreter and the interpreter generator. |
duke@435 | 39 | |
duke@435 | 40 | //------------------------------------------------------------------------------------------------------------------------ |
duke@435 | 41 | // An InterpreterCodelet is a piece of interpreter code. All |
duke@435 | 42 | // interpreter code is generated into little codelets which |
duke@435 | 43 | // contain extra information for debugging and printing purposes. |
duke@435 | 44 | |
duke@435 | 45 | class InterpreterCodelet: public Stub { |
duke@435 | 46 | friend class VMStructs; |
duke@435 | 47 | private: |
duke@435 | 48 | int _size; // the size in bytes |
duke@435 | 49 | const char* _description; // a description of the codelet, for debugging & printing |
duke@435 | 50 | Bytecodes::Code _bytecode; // associated bytecode if any |
duke@435 | 51 | |
duke@435 | 52 | public: |
duke@435 | 53 | // Initialization/finalization |
duke@435 | 54 | void initialize(int size) { _size = size; } |
duke@435 | 55 | void finalize() { ShouldNotCallThis(); } |
duke@435 | 56 | |
duke@435 | 57 | // General info/converters |
duke@435 | 58 | int size() const { return _size; } |
duke@435 | 59 | static int code_size_to_size(int code_size) { return round_to(sizeof(InterpreterCodelet), CodeEntryAlignment) + code_size; } |
duke@435 | 60 | |
duke@435 | 61 | // Code info |
duke@435 | 62 | address code_begin() const { return (address)this + round_to(sizeof(InterpreterCodelet), CodeEntryAlignment); } |
duke@435 | 63 | address code_end() const { return (address)this + size(); } |
duke@435 | 64 | |
duke@435 | 65 | // Debugging |
duke@435 | 66 | void verify(); |
bobv@2036 | 67 | void print_on(outputStream* st) const; |
bobv@2036 | 68 | void print() const { print_on(tty); } |
duke@435 | 69 | |
duke@435 | 70 | // Interpreter-specific initialization |
duke@435 | 71 | void initialize(const char* description, Bytecodes::Code bytecode); |
duke@435 | 72 | |
duke@435 | 73 | // Interpreter-specific attributes |
duke@435 | 74 | int code_size() const { return code_end() - code_begin(); } |
duke@435 | 75 | const char* description() const { return _description; } |
duke@435 | 76 | Bytecodes::Code bytecode() const { return _bytecode; } |
duke@435 | 77 | }; |
duke@435 | 78 | |
duke@435 | 79 | // Define a prototype interface |
duke@435 | 80 | DEF_STUB_INTERFACE(InterpreterCodelet); |
duke@435 | 81 | |
duke@435 | 82 | |
duke@435 | 83 | //------------------------------------------------------------------------------------------------------------------------ |
duke@435 | 84 | // A CodeletMark serves as an automatic creator/initializer for Codelets |
duke@435 | 85 | // (As a subclass of ResourceMark it automatically GC's the allocated |
duke@435 | 86 | // code buffer and assemblers). |
duke@435 | 87 | |
duke@435 | 88 | class CodeletMark: ResourceMark { |
duke@435 | 89 | private: |
duke@435 | 90 | InterpreterCodelet* _clet; |
duke@435 | 91 | InterpreterMacroAssembler** _masm; |
duke@435 | 92 | CodeBuffer _cb; |
duke@435 | 93 | |
duke@435 | 94 | int codelet_size() { |
duke@435 | 95 | // Request the whole code buffer (minus a little for alignment). |
duke@435 | 96 | // The commit call below trims it back for each codelet. |
duke@435 | 97 | int codelet_size = AbstractInterpreter::code()->available_space() - 2*K; |
duke@435 | 98 | |
duke@435 | 99 | // Guarantee there's a little bit of code space left. |
duke@435 | 100 | guarantee (codelet_size > 0 && (size_t)codelet_size > 2*K, |
duke@435 | 101 | "not enough space for interpreter generation"); |
duke@435 | 102 | |
duke@435 | 103 | return codelet_size; |
duke@435 | 104 | } |
duke@435 | 105 | |
duke@435 | 106 | public: |
duke@435 | 107 | CodeletMark( |
duke@435 | 108 | InterpreterMacroAssembler*& masm, |
duke@435 | 109 | const char* description, |
duke@435 | 110 | Bytecodes::Code bytecode = Bytecodes::_illegal): |
duke@435 | 111 | _clet((InterpreterCodelet*)AbstractInterpreter::code()->request(codelet_size())), |
duke@435 | 112 | _cb(_clet->code_begin(), _clet->code_size()) |
duke@435 | 113 | |
duke@435 | 114 | { // request all space (add some slack for Codelet data) |
duke@435 | 115 | assert (_clet != NULL, "we checked not enough space already"); |
duke@435 | 116 | |
duke@435 | 117 | // initialize Codelet attributes |
duke@435 | 118 | _clet->initialize(description, bytecode); |
duke@435 | 119 | // create assembler for code generation |
duke@435 | 120 | masm = new InterpreterMacroAssembler(&_cb); |
duke@435 | 121 | _masm = &masm; |
duke@435 | 122 | } |
duke@435 | 123 | |
duke@435 | 124 | ~CodeletMark() { |
duke@435 | 125 | // align so printing shows nop's instead of random code at the end (Codelets are aligned) |
duke@435 | 126 | (*_masm)->align(wordSize); |
duke@435 | 127 | // make sure all code is in code buffer |
duke@435 | 128 | (*_masm)->flush(); |
duke@435 | 129 | |
duke@435 | 130 | |
duke@435 | 131 | // commit Codelet |
twisti@2103 | 132 | AbstractInterpreter::code()->commit((*_masm)->code()->pure_insts_size()); |
duke@435 | 133 | // make sure nobody can use _masm outside a CodeletMark lifespan |
duke@435 | 134 | *_masm = NULL; |
duke@435 | 135 | } |
duke@435 | 136 | }; |
duke@435 | 137 | |
duke@435 | 138 | // Wrapper classes to produce Interpreter/InterpreterGenerator from either |
duke@435 | 139 | // the c++ interpreter or the template interpreter. |
duke@435 | 140 | |
duke@435 | 141 | class Interpreter: public CC_INTERP_ONLY(CppInterpreter) NOT_CC_INTERP(TemplateInterpreter) { |
duke@435 | 142 | |
duke@435 | 143 | public: |
duke@435 | 144 | // Debugging/printing |
duke@435 | 145 | static InterpreterCodelet* codelet_containing(address pc) { return (InterpreterCodelet*)_code->stub_containing(pc); } |
stefank@2314 | 146 | #ifdef TARGET_ARCH_x86 |
stefank@2314 | 147 | # include "interpreter_x86.hpp" |
stefank@2314 | 148 | #endif |
stefank@2314 | 149 | #ifdef TARGET_ARCH_sparc |
stefank@2314 | 150 | # include "interpreter_sparc.hpp" |
stefank@2314 | 151 | #endif |
stefank@2314 | 152 | #ifdef TARGET_ARCH_zero |
stefank@2314 | 153 | # include "interpreter_zero.hpp" |
stefank@2314 | 154 | #endif |
bobv@2508 | 155 | #ifdef TARGET_ARCH_arm |
bobv@2508 | 156 | # include "interpreter_arm.hpp" |
bobv@2508 | 157 | #endif |
bobv@2508 | 158 | #ifdef TARGET_ARCH_ppc |
bobv@2508 | 159 | # include "interpreter_ppc.hpp" |
bobv@2508 | 160 | #endif |
stefank@2314 | 161 | |
duke@435 | 162 | }; |
stefank@2314 | 163 | |
stefank@2314 | 164 | #endif // SHARE_VM_INTERPRETER_INTERPRETER_HPP |