changeset in /hg/icedtea: 2007-12-13 Gary Benson <gbenson at redh...
Gary Benson
gbenson at redhat.com
Thu Dec 13 07:57:57 PST 2007
changeset 055d32cf277f in /hg/icedtea
details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=055d32cf277f
description:
2007-12-13 Gary Benson <gbenson at redhat.com>
* contrib/templater/*: Imported changes from PPC port.
* ports/hotspot/src/cpu/ppc/vm/assembler_ppc.hpp:
Regenerated from templater (whitespace changes only).
* ports/hotspot/src/cpu/ppc/vm/assembler_ppc.cpp: Likewise.
* ports/hotspot/src/cpu/ppc/vm/cppInterpreter_ppc.cpp: Likewise.
* ports/hotspot/src/cpu/ppc/vm/disassembler_ppc.cpp: Likewise.
* ports/hotspot/src/cpu/ppc/vm/vmreg_ppc.cpp: Likewise.
diffstat:
31 files changed, 1494 insertions(+), 301 deletions(-)
ChangeLog | 11
contrib/templater/hotspot/src/cpu/CPU/vm/assembler_CPU.cpp | 215 ++-
contrib/templater/hotspot/src/cpu/CPU/vm/assembler_CPU.hpp | 97 +
contrib/templater/hotspot/src/cpu/CPU/vm/cppInterpreter_CPU.cpp | 79 -
contrib/templater/hotspot/src/cpu/CPU/vm/disassembler_CPU.cpp | 686 ++++++++++
contrib/templater/hotspot/src/cpu/CPU/vm/disassembler_CPU.hpp | 20
contrib/templater/hotspot/src/cpu/CPU/vm/globalDefinitions_CPU.hpp | 26
contrib/templater/hotspot/src/cpu/CPU/vm/icache_CPU.cpp | 4
contrib/templater/hotspot/src/cpu/CPU/vm/icache_CPU.hpp | 4
contrib/templater/hotspot/src/cpu/CPU/vm/interp_masm_CPU.cpp | 72 +
contrib/templater/hotspot/src/cpu/CPU/vm/interp_masm_CPU.hpp | 22
contrib/templater/hotspot/src/cpu/CPU/vm/interpreterRT_CPU.cpp | 29
contrib/templater/hotspot/src/cpu/CPU/vm/interpreter_CPU.cpp | 15
contrib/templater/hotspot/src/cpu/CPU/vm/nativeInst_CPU.hpp | 70 -
contrib/templater/hotspot/src/cpu/CPU/vm/register_CPU.hpp | 2
contrib/templater/hotspot/src/cpu/CPU/vm/register_definitions_CPU.cpp | 6
contrib/templater/hotspot/src/cpu/CPU/vm/sharedRuntime_CPU.cpp | 17
contrib/templater/hotspot/src/cpu/CPU/vm/stubGenerator_CPU.cpp | 6
contrib/templater/hotspot/src/cpu/CPU/vm/vmreg_CPU.cpp | 28
contrib/templater/hotspot/src/cpu/CPU/vm/vmreg_CPU.hpp | 29
contrib/templater/hotspot/src/os_cpu/linux_CPU/vm/assembler_linux_CPU.cpp | 32
contrib/templater/hotspot/src/os_cpu/linux_CPU/vm/os_linux_CPU.cpp | 37
contrib/templater/j2se/src/solaris/bin/CPUS/jvm.cfg | 44
contrib/templater/j2se/src/solaris/bin/ergo_CPU.c | 58
contrib/templater/jdk/src/solaris/bin/CPUS/jvm.cfg | 44
contrib/templater/jdk/src/solaris/bin/ergo_CPU.c | 58
ports/hotspot/src/cpu/ppc/vm/assembler_ppc.cpp | 14
ports/hotspot/src/cpu/ppc/vm/assembler_ppc.hpp | 16
ports/hotspot/src/cpu/ppc/vm/cppInterpreter_ppc.cpp | 2
ports/hotspot/src/cpu/ppc/vm/disassembler_ppc.cpp | 50
ports/hotspot/src/cpu/ppc/vm/vmreg_ppc.cpp | 2
diffs (truncated from 2577 to 500 lines):
diff -r 208a6277eb21 -r 055d32cf277f ChangeLog
--- a/ChangeLog Wed Dec 12 10:57:37 2007 -0500
+++ b/ChangeLog Thu Dec 13 10:57:51 2007 -0500
@@ -1,3 +1,14 @@ 2007-12-12 Lillian Angel <langel at redhat
+2007-12-13 Gary Benson <gbenson at redhat.com>
+
+ * contrib/templater/*: Imported changes from PPC port.
+
+ * ports/hotspot/src/cpu/ppc/vm/assembler_ppc.hpp:
+ Regenerated from templater (whitespace changes only).
+ * ports/hotspot/src/cpu/ppc/vm/assembler_ppc.cpp: Likewise.
+ * ports/hotspot/src/cpu/ppc/vm/cppInterpreter_ppc.cpp: Likewise.
+ * ports/hotspot/src/cpu/ppc/vm/disassembler_ppc.cpp: Likewise.
+ * ports/hotspot/src/cpu/ppc/vm/vmreg_ppc.cpp: Likewise.
+
2007-12-12 Lillian Angel <langel at redhat.com>
Fixes Bug #76
diff -r 208a6277eb21 -r 055d32cf277f contrib/templater/hotspot/src/cpu/CPU/vm/assembler_CPU.cpp
--- a/contrib/templater/hotspot/src/cpu/CPU/vm/assembler_CPU.cpp Wed Dec 12 10:57:37 2007 -0500
+++ b/contrib/templater/hotspot/src/cpu/CPU/vm/assembler_CPU.cpp Thu Dec 13 10:57:51 2007 -0500
@@ -242,6 +242,14 @@ void Assembler::bc(int bo, int bi, addre
{
emit_instruction(16, bo, bi, branch_target(pc(), a, 14), false, false);
}
+void Assembler::bcctrl(int bo, int bi)
+{
+ emit_instruction(19, bo, bi, 0, 528, true);
+}
+void Assembler::bcl(int bo, int bi, address a)
+{
+ emit_instruction(16, bo, bi, branch_target(pc(), a, 14), false, true);
+}
void Assembler::bclr(int bo, int bi)
{
emit_instruction(19, bo, bi, 0, 16, false);
@@ -445,6 +453,10 @@ void Assembler::stdx(Register src, Regis
// Standard mnemonics common to 32- and 64-bit implementations
+void Assembler::bctrl()
+{
+ bcctrl(20, 0);
+}
void Assembler::bdnz(Label& l)
{
bc(16, 0, l);
@@ -639,49 +651,10 @@ void Assembler::pd_patch_instruction(add
#endif // PPC
#ifndef PRODUCT
-
void Assembler::pd_print_patched_instruction(address branch)
{
Unimplemented();
}
-
-void Assembler::disassemble(const char *what, address start, address end)
-{
- const char *fmt = "/tmp/aztec-%d.%c";
- char c_file[BUFSIZ], o_file[BUFSIZ];
- sprintf(c_file, fmt, getpid(), 'c');
- sprintf(o_file, fmt, getpid(), 'o');
-
- FILE *fp = fopen(c_file, "w");
- if (fp == NULL)
- fatal2("%s:%d: can't write file", __FILE__, __LINE__);
-
- fputs("unsigned char start[] = {", fp);
- for (address a = start; a < end; a++) {
- if (a != start)
- fputc(',', fp);
- fprintf(fp, "0x%02x", *a);
- }
- fputs("};\n", fp);
- fclose(fp);
-
- char cmd[BUFSIZ];
- sprintf(cmd, "gcc -m%d -c %s -o %s", wordSize * 8, c_file, o_file);
- if (system(cmd) != 0)
- fatal2("%s:%d: can't compile file", __FILE__, __LINE__);
-
- printf("%s: %p-%p:\n", what, start, end);
- fflush(stdout);
- sprintf(cmd, "objdump -D -j .data %s | grep '^....:'", o_file);
- if (system(cmd) != 0)
- fatal2("%s:%d: can't disassemble file", __FILE__, __LINE__);
- putchar('\n');
- fflush(stdout);
-
- unlink(c_file);
- unlink(o_file);
-}
-
#endif // PRODUCT
#ifdef PPC
@@ -817,7 +790,7 @@ void StackFrame::generate_prolog(MacroAs
// Calculate the aligned frame size
while (true) {
_frame_size = unaligned_size();
- if (_frame_size % 16 == 0)
+ if (_frame_size % StackAlignmentInBytes == 0)
break;
_locals++;
}
@@ -962,6 +935,12 @@ void MacroAssembler::lwax(Register dst,
extsw(dst, dst);
#endif
}
+void MacroAssembler::mpclr()
+{
+ // move pc to lr
+ // 20, 31 is a magic branch that preserves the link stack
+ bcl(20, 31, pc() + 4);
+}
// Operations which are different on PPC32/64
@@ -988,8 +967,8 @@ void MacroAssembler::call(Register func)
func = r0;
#endif // PPC64
- mtlr(func);
- blrl();
+ mtctr(func);
+ bctrl();
#ifdef PPC64
ld (r2, Address(r1, 40));
@@ -1199,21 +1178,117 @@ void MacroAssembler::cmpxchg_(Register e
bind(done);
}
-void MacroAssembler::set_last_Java_frame()
-{
- Label label;
-
- bl(label);
- bind(label);
- mflr(r0);
- store(r0, Address(Rthread, JavaThread::last_Java_pc_offset()));
- store(r1, Address(Rthread, JavaThread::last_Java_sp_offset()));
-}
-
-void MacroAssembler::reset_last_Java_frame()
-{
- load(r0, 0);
- store(r0, Address(Rthread, JavaThread::last_Java_sp_offset()));
+void MacroAssembler::call_VM_pass_args(Register arg_1,
+ Register arg_2,
+ Register arg_3)
+{
+ if (arg_1 != r4) {
+ assert(arg_2 != r4, "smashed argument");
+ assert(arg_3 != r4, "smashed argument");
+ mr(r4, arg_1);
+ }
+
+ if (arg_2 == noreg) {
+ assert (arg_3 == noreg, "what?");
+ return;
+ }
+
+ if (arg_2 != r5) {
+ assert(arg_3 != r5, "smashed argument");
+ mr(r5, arg_2);
+ }
+
+ if (arg_3 != noreg && arg_3 != r6) {
+ mr(r6, arg_3);
+ }
+}
+
+void MacroAssembler::call_VM_base(Register oop_result,
+ address entry_point,
+ CallVMFlags flags)
+{
+ StackFrame frame;
+
+ if (flags & CALL_VM_PRESERVE_LR)
+ prolog(frame);
+
+ mr(r3, Rthread);
+ call(entry_point);
+
+ if (flags & CALL_VM_PRESERVE_LR)
+ epilog(frame);
+
+ if (!(flags & CALL_VM_NO_EXCEPTION_CHECKS)) {
+ Label ok;
+ load(r0, Address(Rthread, Thread::pending_exception_offset()));
+ compare (r0, 0);
+ beq(ok);
+ unimplemented(__FILE__, __LINE__);
+ bind(ok);
+ }
+
+ if (oop_result->is_valid()) {
+ unimplemented(__FILE__, __LINE__);
+ }
+}
+
+void MacroAssembler::call_VM(Register oop_result,
+ address entry_point,
+ CallVMFlags flags)
+{
+ call_VM_base(oop_result, entry_point, flags);
+}
+void MacroAssembler::call_VM(Register oop_result,
+ address entry_point,
+ Register arg_1,
+ CallVMFlags flags)
+{
+ call_VM_pass_args(arg_1);
+ call_VM_base(oop_result, entry_point, flags);
+}
+void MacroAssembler::call_VM(Register oop_result,
+ address entry_point,
+ Register arg_1, Register arg_2,
+ CallVMFlags flags)
+{
+ call_VM_pass_args(arg_1, arg_2);
+ call_VM_base(oop_result, entry_point, flags);
+}
+void MacroAssembler::call_VM(Register oop_result,
+ address entry_point,
+ Register arg_1, Register arg_2, Register arg_3,
+ CallVMFlags flags)
+{
+ call_VM_pass_args(arg_1, arg_2, arg_3);
+ call_VM_base(oop_result, entry_point, flags);
+}
+
+void MacroAssembler::call_VM_leaf_base(address entry_point)
+{
+ mr(r3, Rthread);
+ call(entry_point);
+}
+
+void MacroAssembler::call_VM_leaf(address entry_point)
+{
+ call_VM_leaf_base(entry_point);
+}
+void MacroAssembler::call_VM_leaf(address entry_point, Register arg_1)
+{
+ call_VM_pass_args(arg_1);
+ call_VM_leaf_base(entry_point);
+}
+void MacroAssembler::call_VM_leaf(address entry_point, Register arg_1,
+ Register arg_2)
+{
+ call_VM_pass_args(arg_1, arg_2);
+ call_VM_leaf_base(entry_point);
+}
+void MacroAssembler::call_VM_leaf(address entry_point, Register arg_1,
+ Register arg_2, Register arg_3)
+{
+ call_VM_pass_args(arg_1, arg_2, arg_3);
+ call_VM_leaf_base(entry_point);
}
// Write serialization page so VM thread can do a pseudo remote membar.
@@ -1226,6 +1301,26 @@ void MacroAssembler::serialize_memory(Re
andi_(tmp1, tmp1, os::vm_page_size() - sizeof(int));
load(tmp2, (intptr_t) os::get_memory_serialize_page());
stwx(tmp1, tmp2, tmp1);
+}
+
+void MacroAssembler::null_check(Register reg, int offset) {
+ if (needs_explicit_null_check((intptr_t) offset)) {
+ // provoke OS NULL exception if reg = NULL by
+ // accessing M[reg] w/o changing any registers
+ Unimplemented();
+ }
+ else {
+ // nothing to do, (later) access of M[reg + offset]
+ // will provoke OS NULL exception if reg = NULL
+ }
+}
+
+void MacroAssembler::verify_oop(Register reg, const char* s)
+{
+ if (!VerifyOops)
+ return;
+
+ Unimplemented();
}
void MacroAssembler::calc_padding_for_alignment(
@@ -1257,7 +1352,7 @@ void MacroAssembler::maybe_extend_frame(
const Register padding = available_bytes;
sub(extra_bytes, required_bytes, available_bytes);
- calc_padding_for_alignment(padding, extra_bytes, 16);
+ calc_padding_for_alignment(padding, extra_bytes, StackAlignmentInBytes);
add(extra_bytes, extra_bytes, padding);
// Extend the frame
@@ -1362,7 +1457,9 @@ void MacroAssembler::dump_int(const char
prolog(frame);
if (src == r1) {
int framesize = frame.unaligned_size();
- framesize += (16 - (framesize & 15)) & 15;
+ framesize += (StackAlignmentInBytes -
+ (framesize & (StackAlignmentInBytes - 1))) &
+ (StackAlignmentInBytes - 1);
addi(r4, r1, framesize);
}
else if (src != r4) {
diff -r 208a6277eb21 -r 055d32cf277f contrib/templater/hotspot/src/cpu/CPU/vm/assembler_CPU.hpp
--- a/contrib/templater/hotspot/src/cpu/CPU/vm/assembler_CPU.hpp Wed Dec 12 10:57:37 2007 -0500
+++ b/contrib/templater/hotspot/src/cpu/CPU/vm/assembler_CPU.hpp Thu Dec 13 10:57:51 2007 -0500
@@ -28,12 +28,9 @@
// Non-volatile registers used by the interpreter
#ifdef PPC
-REGISTER_DECLARATION(Register, Rmethod, r31);
-REGISTER_DECLARATION(Register, Rlocals, r30);
-REGISTER_DECLARATION(Register, Rthread, r29);
-#ifdef CC_INTERP
-REGISTER_DECLARATION(Register, Rstate, r28);
-#endif // CC_INTERP
+REGISTER_DECLARATION(Register, Rthread, r31);
+REGISTER_DECLARATION(Register, Rmethod, r30);
+REGISTER_DECLARATION(Register, Rlocals, r29);
#endif // PPC
@@ -72,6 +69,18 @@ class Assembler : public AbstractAssembl
class Assembler : public AbstractAssembler {
public:
Assembler(CodeBuffer* code) : AbstractAssembler(code) {}
+
+ private:
+ static bool is_simm(int x, int nbits)
+ {
+ return -(1 << nbits - 1) <= x && x < (1 << nbits - 1);
+ }
+
+ public:
+ static bool is_simm16(int x)
+ {
+ return is_simm(x, 16);
+ }
#ifdef PPC
private:
@@ -122,6 +131,8 @@ class Assembler : public AbstractAssembl
void andi_(Register dst, Register a, int b);
void b(address a);
void bc(int bo, int bi, address a);
+ void bcctrl(int bo, int bi);
+ void bcl(int bo, int bi, address a);
void bclr(int bo, int bi);
void bclrl(int bo, int bi);
void bl(address a);
@@ -177,6 +188,7 @@ class Assembler : public AbstractAssembl
#endif // PPC64
// Standard mnemonics common to 32- and 64-bit implementations
+ void bctrl();
void bdnz(Label& l);
void beq(Label& l);
void beqlr();
@@ -225,11 +237,6 @@ class Assembler : public AbstractAssembl
static void pd_print_patched_instruction(address branch);
#endif // PRODUCT
#endif // PPC
-
- // Disassemble a region of memory to stdout
-#ifndef PRODUCT
- static void disassemble(const char *what, address start, address end);
-#endif // PRODUCT
};
@@ -321,12 +328,43 @@ class StackFrame {
#endif // PPC
+// Flags for MacroAssembler::call_VM
+
+enum CallVMFlags {
+ CALL_VM_DEFAULTS = 0,
+ CALL_VM_NO_EXCEPTION_CHECKS = 1,
+ CALL_VM_PRESERVE_LR = 2
+};
+
+
// MacroAssembler extends Assembler by frequently used macros.
//
// Instructions for which a 'better' code sequence exists depending
// on arguments should also go in here.
class MacroAssembler : public Assembler {
+ protected:
+ // Support for VM calls
+ //
+ // This is the base routine called by the different versions of
+ // call_VM_leaf. The interpreter may customize this version by
+ // overriding it for its purposes (e.g., to save/restore additional
+ // registers when doing a VM call).
+ virtual void call_VM_leaf_base(address entry_point);
+
+ // This is the base routine called by the different versions of
+ // call_VM. The interpreter may customize this version by overriding
+ // it for its purposes (e.g., to save/restore additional registers
+ // when doing a VM call).
+ virtual void call_VM_base(Register oop_result,
+ address entry_point,
+ CallVMFlags flags);
+
+ private:
+ void call_VM_pass_args(Register arg_1,
+ Register arg_2 = noreg,
+ Register arg_3 = noreg);
+
public:
MacroAssembler(CodeBuffer* code) : Assembler(code) {}
@@ -341,6 +379,7 @@ class MacroAssembler : public Assembler
void lhax(Register dst, Register a, Register b);
void lwa(Register dst, const Address& src);
void lwax(Register dst, Register a, Register b);
+ void mpclr();
// Operations which are different on PPC32/64
void call(address addr);
@@ -365,10 +404,40 @@ class MacroAssembler : public Assembler
void cmpxchg_(Register exchange, Register dst, Register compare);
- void set_last_Java_frame();
- void reset_last_Java_frame();
-
+ // Support for VM calls
+ void call_VM(Register oop_result,
+ address entry_point,
+ CallVMFlags flags = CALL_VM_DEFAULTS);
+ void call_VM(Register oop_result,
+ address entry_point,
+ Register arg_1,
+ CallVMFlags flags = CALL_VM_DEFAULTS);
+ void call_VM(Register oop_result,
+ address entry_point,
+ Register arg_1, Register arg_2,
+ CallVMFlags flags = CALL_VM_DEFAULTS);
+ void call_VM(Register oop_result,
+ address entry_point,
+ Register arg_1, Register arg_2, Register arg_3,
+ CallVMFlags flags = CALL_VM_DEFAULTS);
+
+ void call_VM_leaf(address entry_point);
+ void call_VM_leaf(address entry_point,
+ Register arg_1);
+ void call_VM_leaf(address entry_point,
+ Register arg_1, Register arg_2);
+ void call_VM_leaf(address entry_point,
+ Register arg_1, Register arg_2, Register arg_3);
+
+ // Support for serializing memory accesses between threads
void serialize_memory(Register tmp1, Register tmp2);
+
+ // Support for NULL-checks
+ void null_check(Register reg, int offset = -1);
+ static bool needs_explicit_null_check(intptr_t offset);
+
+ // Support for VerifyOops
+ void verify_oop(Register reg, const char* s = "broken oop");
void calc_padding_for_alignment(Register dst, Register src, int align);
void maybe_extend_frame(Register required_bytes, Register available_bytes);
diff -r 208a6277eb21 -r 055d32cf277f contrib/templater/hotspot/src/cpu/CPU/vm/cppInterpreter_CPU.cpp
--- a/contrib/templater/hotspot/src/cpu/CPU/vm/cppInterpreter_CPU.cpp Wed Dec 12 10:57:37 2007 -0500
+++ b/contrib/templater/hotspot/src/cpu/CPU/vm/cppInterpreter_CPU.cpp Thu Dec 13 10:57:51 2007 -0500
@@ -39,8 +39,6 @@ extern "C" void RecursiveInterpreterActi
}
#define __ _masm->
-#define STATE(field_name) \
- (Address(Rstate, byte_offset_of(BytecodeInterpreter, field_name)))
// Non-volatile registers we use
const Register Rmonitor = r27;
@@ -144,6 +142,7 @@ address CppInterpreterGenerator::generat
case T_OBJECT:
__ load (r3, STATE(_oop_temp));
+ __ verify_oop (r3);
break;
default:
@@ -201,6 +200,7 @@ address CppInterpreterGenerator::generat
break;
case T_OBJECT:
+ __ verify_oop (r3);
__ store (r3, Address(Rlocals, 0));
__ subi (Rlocals, Rlocals, wordSize);
More information about the distro-pkg-dev
mailing list