/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_RUNTIME_RELOCATOR_HPP
#define SHARE_VM_RUNTIME_RELOCATOR_HPP
#include "interpreter/bytecodes.hpp"
#include "oops/methodOop.hpp"
#ifdef TARGET_ARCH_x86
# include "bytes_x86.hpp"
#endif
#ifdef TARGET_ARCH_sparc
# include "bytes_sparc.hpp"
#endif
#ifdef TARGET_ARCH_zero
# include "bytes_zero.hpp"
#endif
#ifdef TARGET_ARCH_arm
# include "bytes_arm.hpp"
#endif
#ifdef TARGET_ARCH_ppc
# include "bytes_ppc.hpp"
#endif
// This code has been converted from the 1.1E java virtual machine
// Thanks to the JavaTopics group for using the code
class ChangeItem;
// Callback object for code relocations
public:
RelocatorListener() {};
};
public:
// Callbacks from ChangeItem's
bool handle_code_changes();
bool handle_switch_pad (int bci, int old_pad, bool is_lookup_switch); // handles table and lookup switches
private:
unsigned char* _code_array;
int _code_array_length;
int _code_length;
unsigned char* _compressed_line_number_table;
void set_compressed_line_number_table(unsigned char* table) { _compressed_line_number_table = table; }
// This will return a raw bytecode, which is possibly rewritten.
// get and set signed integers in the code_array
// get and set signed shorts in the code_array
inline void short_at_put(int bci, short value) { Bytes::put_Java_u2((address) &code_array()[bci], value); }
// get the address of in the code_array
// Helper methods
// basic relocation methods
int rc_instr_len (int bci);
bool expand_code_array (int delta);
// Callback support
}
};
#endif // SHARE_VM_RUNTIME_RELOCATOR_HPP