/hg/release/icedtea7-forest-2.3/hotspot: 30 new changesets

andrew at icedtea.classpath.org andrew at icedtea.classpath.org
Fri Jul 12 14:40:31 PDT 2013


changeset c55bef1f3c2e in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=c55bef1f3c2e
author: aph
date: Thu Mar 15 07:53:52 2012 -0400

	Add arm_port from IcedTea 6


changeset 733eef8af470 in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=733eef8af470
author: aph
date: Thu Mar 15 07:56:24 2012 -0400

	Add patches/arm.patch from IcedTea 6


changeset bc91339fbc87 in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=bc91339fbc87
author: aph
date: Thu Mar 15 07:57:19 2012 -0400

	Add patches/arm-debug.patch from IcedTea 6


changeset dcf6ee42e839 in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=dcf6ee42e839
author: andrew
date: Fri Jul 12 21:45:24 2013 +0100

	Add patches/arm-hsdis.patch from IcedTea 6


changeset 6f09f57b684f in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=6f09f57b684f
author: aph
date: Thu Mar 15 08:54:12 2012 -0400

	Move arm-port files to the correct place


changeset 721a0698d9c7 in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=721a0698d9c7
author: aph
date: Fri Jul 12 21:46:55 2013 +0100

	Changes for HSX22


changeset 1b5ced49aa9f in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=1b5ced49aa9f
author: aph
date: Fri Mar 16 08:36:04 2012 -0400

	Use unified syntax for thumb code.
	2012-03-16  Andrew Haley  <aph at redhat.com>

	        * hotspot/src/cpu/zero/vm/arm_cas.S: Use unified syntax
	        for thumb code.


changeset 9d94a5fd37a7 in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=9d94a5fd37a7
author: aph
date: Tue Mar 27 09:40:08 2012 -0400

	ARM: First cut of invokedynamic


changeset e6035cca61fe in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=e6035cca61fe
author: aph
date: Fri Mar 30 11:53:01 2012 -0400

	invokedynamic and aldc for JIT


changeset dc9aad1d1e45 in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=dc9aad1d1e45
author: aph
date: Fri Mar 30 13:34:30 2012 -0400

	ARM: JIT-compilation of ldc methodHandle


changeset b0e8fbcb7413 in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=b0e8fbcb7413
author: aph
date: Mon Apr 02 06:09:48 2012 -0400

	Revert change to -O0


changeset 44561baab700 in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=44561baab700
author: aph
date: Tue Apr 10 12:22:01 2012 -0400

	Tidy up, minor comment changes.


changeset bbdfa2225c43 in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=bbdfa2225c43
author: aph
date: Wed Apr 11 09:22:39 2012 -0400

	Minor review cleanups.


changeset e6d602f07305 in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=e6d602f07305
author: adinn
date: Tue May 01 16:13:47 2012 +0100

	added jvmti event generation for dynamic_generate and compiled_method_load events to ARM JIT compiler


changeset 181ca5501979 in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=181ca5501979
author: adinn
date: Wed May 16 11:21:07 2012 +0100

	modified safepoint check to rely on memory protect signal instead of polling


changeset 46de0f03f7d6 in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=46de0f03f7d6
author: aph
date: Thu May 17 13:45:50 2012 -0400

	RTC Thumb2 JIT enhancements.
	2012-05-16  Andrew Haley  <aph at redhat.com>

		* src/cpu/zero/vm/thumb2.cpp:
		Throughout: T2EE_PRINT_* renamed to T2_PRINT_*.
		Route all debug info to stderr.
		We now do frameless compilation, so do all frame accesses relative
		to SP.
		Remove zombie detection pass.
		Remove dead code.
		Add OSPACE option.
		(H_LDC_W)
		(H_INVOKESTATIC_RESOLVED, H_INVOKESPECIAL_RESOLVED)
		(H_INVOKEVIRTUAL_RESOLVED, H_INVOKEVFINAL, H_MONITORENTER)
		(H_MONITOREXIT): New.
		(T2_* macros): Rename from T2EE_*.
		(SLOW_ENTRY_OFFSET, FAST_ENTRY_OFFSET): New.
		(THUMB2_CODEBUF_SIZE): Make this depend on PRODUCT.
		(H_GETSTATIC, H_PUTSTATIC, H_JSR, H_ZOMBIE, H_MONITOR): Delete.
		(H_DEADCODE, H_LDC_W, H_INVOKESTATIC_RESOLVED)
		(H_INVOKESPECIAL_RESOLVED, H_INVOKEVIRTUAL_RESOLVED)
		(H_INVOKEVFINAL): New.
		(DebugSwitch): New.
		(JAZ_V6): New local register.
		(Thumb2_pass1): Count reads and writes for register allocator.
		Delete zombie detection pass.
		(Thumb2_RegAlloc): New.
		(out_align, out_align_offset, nop_16, nop_32): New.
		(fullBarrier, storeBarrier): Chaeck for an MP OS.
		(load_local, store_local): Check for an istate reg.
		(load_istate, store_istate): New.
		(Thumb2_Load, Thumb2_LoadX2): Remove monitor stack adj.
		(Thumb2_Store, Thumb2_StoreX2): Likewise.
		(Debug): New.
		(Thumb2_save_locals, Thumb2_restore_locals, Thumb2_invoke_save)
		(Thumb2_invoke_restore, Thumb2_Exit): Remove monitor stackdepth
		adj.  Move here from below.
		(Thumb2_Accessor): Rewrite for new method header layout.
		(Thumb2_Enter): Likewise.
		Do frameless setup.
		(Thumb2_load_long): Use a single ldrexd instruction.
		(Thumb2_codegen): Align branches.
		Call Debug if we're about to enter a synchronized method.
		(opc_jsr) Add handler.
		(opc_monitorenter, opc_monitorexit): Call handler instead of
		generating code.
		(Thumb2_Initialize): Disassmble ARM and Thumb code separately.

		* src/cpu/zero/vm/cppInterpreter_arm.S:
		Throughout: the thread pointer is now in a register, so use it
		everywhere.  Set the thread pointer register at every entry point
		to the interpreter.
		Throughout: use the macros SLOW_ENTRY and FAST_ENTRY rather than
		ALIGN_CODE.
		Throughout: register tmp2 is no longer available, use other
		registers as appropriate.

		(T2JIT): Rename from THUMB2EE.
		(call_thumb2): Load all the thumb2 registers that have been
		allocated to locals.
		(accessor_entry): Check for stack overflow.
		(.fast_accessor_*): Delete dead code.
		(LOAD_FRAME): New.
		(Thumb2_invokevfinalresolved_stub)
		(Thumb2_invokevirtualresolved_stub): New.
		(Thumb2_invokestaticresolved_stub): New.
		(Thumb2_invokespecialresolved_stub): New.
		(Thumb2 stubs): Use FRAME_* rather than ISTATE_*; the frame
		pointer is no longer in a fixed register.
		(JAZ_REGSET, JAZ_*): Move delaration of JAZ registers here.
		(Thumb2_monitorenter): New.

		(normal_entry_synchronized): Rearrange so that we can load the
		thread pointer without exceeding the number of instructions that
		we can fit into the gap between SLOW_ENTRY and FAST_ENTRY.
		(normal_entry): Likewise.

		(MP_COMPILE_THRESHOLD, UP_COMPILE_THRESHOLD): Adjust.
		(TBIT): New.
		(FRAME_METHOD, FRAME_CONSTANTS, FRAME_BCP, FRAME_STACK_LIMIT)
		(FRAME_LOCALS, FRAME_STACK): New.
		(SLOW_ENTRY,  FAST_ENTRY, SLOW_ENTRY_OFFSET, FAST_ENTRY_OFFSET): New.
		(LOAD_ISTATE): New.
		(DECACHE_STACK_USING_FRAME, DECACHE_JPC_USING_FRAME): New.
		(TRACE): Save and restore IP.
		Pass istate to my_trace().

		(Opcode monitorenter): Remove all the assembler code and replace
		it with a call to Helper_monitorenter.

		* src/cpu/zero/vm/bytecodes_arm.def:
		Throughout: register tmp2 is no longer available, use other
		registers as appropriate.

		(lgetfield): Use ldrexd to load a jlong rather than an
		ldrexd/strexd loop.

		* src/cpu/zero/vm/asm_helper.cpp (ARCH_THUMB2): Renamed from
		ARCH_THUMBEE.
		(my_trace): New.
		(Helper_monitorenter): New.
		(Helper_monitorexit): New.


changeset 0bebe238c22f in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=0bebe238c22f
author: aph
date: Mon May 28 08:01:18 2012 -0400

	Use ldrexd for atomic reads on ARMv7.
	2012-05-28  Andrew Haley  <aph at redhat.com>

		* os_linux_zero.hpp (atomic_copy64): Use ldrexd for atomic reads
		on ARMv7.


changeset 3d357a7b7112 in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=3d357a7b7112
author: aph
date: Mon May 28 08:48:42 2012 -0400

	Adjust saved SP when safepointing.
	2012-05-28  Andrew Haley  <aph at redhat.com>

		* thumb2.cpp (Thumb2_Safepoint): Adjust saved SP when
		safepointing.


changeset 7c2f5538e02d in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=7c2f5538e02d
author: aph
date: Tue May 29 10:11:11 2012 -0400

	Phase 1


changeset 5dced5a7d1e4 in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=5dced5a7d1e4
author: aph
date: Tue May 29 11:06:21 2012 -0400

	Phase 2


changeset 41fd39ce5b99 in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=41fd39ce5b99
author: aph
date: Wed May 30 10:20:02 2012 -0400

	Don't save locals at a return.


changeset f678e6078f9a in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=f678e6078f9a
author: aph
date: Thu May 31 06:42:18 2012 -0400

	Back out mistaken checkin of debug code.


changeset 392b9d0730b8 in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=392b9d0730b8
author: adinn
date: Thu Jun 07 17:49:46 2012 +0100

	corrected call from fast_method_handle_entry to CppInterpreter::method_handle_entry so that thread is loaded into r2


changeset 7e952fe03882 in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=7e952fe03882
author: aph
date: Wed Jun 06 10:09:22 2012 -0400

	Fix JIT bug that miscompiles org.eclipse.ui.internal.contexts.ContextAuthority.sourceChanged
	2012-06-06  Andrew Haley  <aph at redhat.com>

		* thumb2.cpp (Thumb2_Compile): Ask the CompilerOracle if we should
		compile this method.
		(Thumb2_iOp): Use a temporary to hold the shift count.


changeset ec8bef596010 in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=ec8bef596010
author: aph
date: Fri Jun 08 09:11:52 2012 -0400

	ARM: Rename a bunch of misleadingly-named functions
	2012-06-08  Andrew Haley  <aph at redhat.com>

		* thumb2.cpp: Rename some functions:
		Thumb2_save_locals -> Thumb2_save_local_refs
		Thumb2_restore_locals -> Thumb2_restore_local_refs
		Thumb2_invoke_save -> Thumb2_save_all_locals
		Thumb2_invoke_restore -> Thumb2_restore_all_locals


changeset 716e3ad6e2c6 in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=716e3ad6e2c6
author: aph
date: Fri Jun 08 10:25:37 2012 -0400

	Fix call to handle_special_method().  Fix compareAndSwapLong.
	2012-06-08  Andrew Haley  <aph at redhat.com>

		* thumb2.cpp (Thumb2_codegen): Move call to
		handle_special_method() outside test.
		(handle_special_method: _compareAndSwapLong): Save/restore all
		locals, not just locals of ref type.


changeset 8910dbb0a40f in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=8910dbb0a40f
author: chrisphi
date: Thu Aug 30 11:53:27 2012 -0400

	ARM: Fix trashed thread ptr after recursive re-entry from
		asm jit.


changeset ad0849bb122e in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=ad0849bb122e
author: chrisphi
date: Thu Mar 21 11:17:13 2013 -0400

	PR1363: Fedora 19 / rawhide FTBFS SIGILL
	Changed thumb2 PUSH & POP to inline functions, added detection of reg alloc failure, fails compile of method.


changeset 920cd25ec34c in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=920cd25ec34c
author: Xerxes Ranby <xerxes at zafena.se>
date: Tue May 28 19:43:58 2013 +0200

	PR1188: ASM Interpreter and Thumb2 JIT javac miscompile modulo reminder on armel
	Summary:
	The POPF1 macro used wrong destination register r0 instead of r1 on ARM armel
	causing issues with the frem bytecode.
	The frem bytecode was the only bytecode using the defect macro.


changeset 84b9ad961553 in /hg/release/icedtea7-forest-2.3/hotspot
details: http://icedtea.classpath.org/hg/release/icedtea7-forest-2.3/hotspot?cmd=changeset;node=84b9ad961553
author: chrisphi
date: Fri Jul 12 22:18:15 2013 +0100

	Changes for HSX23


diffstat:

 make/linux/makefiles/gcc.make                         |     2 +
 make/linux/makefiles/vm.make                          |     2 +-
 make/linux/makefiles/zeroshark.make                   |    35 +
 src/cpu/zero/vm/arm_cas.S                             |    31 +
 src/cpu/zero/vm/asm_helper.cpp                        |   730 +
 src/cpu/zero/vm/bytecodes_arm.def                     |  7847 ++++++++++++++++
 src/cpu/zero/vm/bytecodes_zero.cpp                    |    52 +-
 src/cpu/zero/vm/bytecodes_zero.hpp                    |    41 +-
 src/cpu/zero/vm/cppInterpreter_arm.S                  |  7367 +++++++++++++++
 src/cpu/zero/vm/cppInterpreter_zero.cpp               |    11 +
 src/cpu/zero/vm/thumb2.cpp                            |  7952 +++++++++++++++++
 src/cpu/zero/vm/vm_version_zero.hpp                   |    11 +
 src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp |    14 +
 src/os_cpu/linux_zero/vm/os_linux_zero.cpp            |    25 +
 src/os_cpu/linux_zero/vm/os_linux_zero.hpp            |     6 +
 src/share/tools/hsdis/Makefile                        |    10 +-
 src/share/tools/hsdis/hsdis.c                         |     5 +
 src/share/vm/prims/jvmtiExport.cpp                    |    41 +
 src/share/vm/prims/jvmtiExport.hpp                    |     6 +
 src/share/vm/utilities/vmError.cpp                    |    13 +
 src/share/vm/utilities/vmError.hpp                    |     8 +
 tools/mkbc.c                                          |   607 +
 22 files changed, 24810 insertions(+), 6 deletions(-)

diffs (truncated from 25073 to 500 lines):

diff -r 7e85081672b2 -r 84b9ad961553 make/linux/makefiles/gcc.make
--- a/make/linux/makefiles/gcc.make	Sun Jun 23 16:53:51 2013 +0100
+++ b/make/linux/makefiles/gcc.make	Fri Jul 12 22:18:15 2013 +0100
@@ -262,6 +262,7 @@
     FASTDEBUG_CFLAGS/amd64 = -g
     FASTDEBUG_CFLAGS/arm   = -g
     FASTDEBUG_CFLAGS/ppc   = -g
+    FASTDEBUG_CFLAGS/zero  = -g
     FASTDEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
     ifeq ($(FASTDEBUG_CFLAGS/$(BUILDARCH)),)
       FASTDEBUG_CFLAGS += -gstabs
@@ -271,6 +272,7 @@
     OPT_CFLAGS/amd64 = -g
     OPT_CFLAGS/arm   = -g
     OPT_CFLAGS/ppc   = -g
+    OPT_CFLAGS/zero  = -g
     OPT_CFLAGS += $(OPT_CFLAGS/$(BUILDARCH))
     ifeq ($(OPT_CFLAGS/$(BUILDARCH)),)
       OPT_CFLAGS += -gstabs
diff -r 7e85081672b2 -r 84b9ad961553 make/linux/makefiles/vm.make
--- a/make/linux/makefiles/vm.make	Sun Jun 23 16:53:51 2013 +0100
+++ b/make/linux/makefiles/vm.make	Fri Jul 12 22:18:15 2013 +0100
@@ -223,7 +223,7 @@
 # Locate all source files in the given directory, excluding files in Src_Files_EXCLUDE.
 define findsrc
 	$(notdir $(shell find $(1)/. ! -name . -prune \
-		-a \( -name \*.c -o -name \*.cpp -o -name \*.s \) \
+		-a \( -name \*.c -o -name \*.cpp -o -name \*.s -o -name \*.S \) \
 		-a ! \( -name DUMMY $(addprefix -o -name ,$(Src_Files_EXCLUDE)) \)))
 endef
 
diff -r 7e85081672b2 -r 84b9ad961553 make/linux/makefiles/zeroshark.make
--- a/make/linux/makefiles/zeroshark.make	Sun Jun 23 16:53:51 2013 +0100
+++ b/make/linux/makefiles/zeroshark.make	Fri Jul 12 22:18:15 2013 +0100
@@ -25,6 +25,41 @@
 
 # Setup common to Zero (non-Shark) and Shark versions of VM
 
+ifeq ($(ZERO_LIBARCH),arm)
+
+Obj_Files += asm_helper.o
+Obj_Files += cppInterpreter_arm.o
+Obj_Files += thumb2.o
+
+CFLAGS += -DHOTSPOT_ASM
+
+cppInterpreter_arm.o:	offsets_arm.s bytecodes_arm.s
+thumb2.o:		offsets_arm.s
+
+offsets_arm.s:	mkoffsets
+	@echo Generating assembler offsets
+	./mkoffsets > $@
+
+bytecodes_arm.s: bytecodes_arm.def mkbc
+	@echo Generatine ARM assembler bytecode sequences
+	$(CC_COMPILE) -E -x c++ - < $< | ./mkbc - $@ $(COMPILE_DONE)
+
+mkbc:	$(GAMMADIR)/tools/mkbc.c
+	@echo Compiling mkbc tool
+	$(CC_COMPILE) -o $@ $< $(COMPILE_DONE)
+
+mkoffsets:	asm_helper.cpp
+	@echo Compiling offset generator
+	$(QUIETLY) $(REMOVE_TARGET)
+	$(CC_COMPILE) -DSTATIC_OFFSETS -o $@ $< $(COMPILE_DONE)
+
+endif
+
+%.o: %.S
+	@echo Assembling $<
+	$(QUIETLY) $(REMOVE_TARGET)
+	$(COMPILE.CC) -o $@ $< $(COMPILE_DONE)
+
 # The copied fdlibm routines in sharedRuntimeTrig.o must not be optimized
 OPT_CFLAGS/sharedRuntimeTrig.o = $(OPT_CFLAGS/NOOPT)
 # The copied fdlibm routines in sharedRuntimeTrans.o must not be optimized
diff -r 7e85081672b2 -r 84b9ad961553 src/cpu/zero/vm/arm_cas.S
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/cpu/zero/vm/arm_cas.S	Fri Jul 12 22:18:15 2013 +0100
@@ -0,0 +1,31 @@
+#ifdef __ARM_ARCH_7A__
+@	jlong
+@	arm_val_compare_and_swap_long(volatile void *ptr,
+@				 jlong oldval,
+@				 jlong newval) {
+	.pushsection .text
+	.global arm_val_compare_and_swap_long
+#ifdef __thumb__
+	.syntax	unified
+	.thumb_func
+#endif
+	.type arm_val_compare_and_swap_long, %function
+arm_val_compare_and_swap_long:
+	stmfd	sp!, {r4, r5, r6, r7}
+	ldrd	r4, [sp, #16]
+	dmb	sy
+0:	ldrexd	r6, [r0]
+	cmp	r6, r2
+	it	eq
+	cmpeq	r7, r3
+	bne	1f
+	strexd	r1, r4, [r0]
+	cmp	r1, #0
+	bne	0b
+	dmb	sy
+1:	mov	r0, r6
+	mov	r1, r7
+	ldmfd	sp!, {r4, r5, r6, r7}
+	bx	lr
+	.popsection
+#endif // __ARM_ARCH_7A__
diff -r 7e85081672b2 -r 84b9ad961553 src/cpu/zero/vm/asm_helper.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/cpu/zero/vm/asm_helper.cpp	Fri Jul 12 22:18:15 2013 +0100
@@ -0,0 +1,730 @@
+/*
+ * Copyright 2009, 2010 Edward Nevill
+ * Copyright 2011, Red Hat
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+#ifdef __arm__
+
+#define	ARCH_THUMB2	(1<<16)
+#define ARCH_VFP	(1<<17)
+#define ARCH_CLZ	(1<<18)
+
+#include "precompiled.hpp"
+#include "asm/assembler.hpp"
+#include "interp_masm_zero.hpp"
+#include "interpreter/bytecodeInterpreter.hpp"
+#include "interpreter/bytecodeInterpreter.inline.hpp"
+#include "interpreter/interpreter.hpp"
+#include "interpreter/interpreterRuntime.hpp"
+#include "oops/methodDataOop.hpp"
+#include "oops/methodOop.hpp"
+#include "oops/oop.inline.hpp"
+#include "prims/jvmtiExport.hpp"
+#include "prims/jvmtiThreadState.hpp"
+#include "runtime/deoptimization.hpp"
+#include "runtime/frame.inline.hpp"
+#include "runtime/sharedRuntime.hpp"
+#include "runtime/stubRoutines.hpp"
+#include "runtime/synchronizer.hpp"
+#include "runtime/vframeArray.hpp"
+#include "utilities/debug.hpp"
+
+#ifndef STATIC_OFFSETS
+
+#include <linux/auxvec.h>
+#include <asm/hwcap.h>
+
+#define VECBUFF_SIZE 64
+
+static char valuebuf[128];
+
+// Return the name of the current method.  Not multi-thread safe.
+extern "C" char*
+meth(interpreterState istate) {
+  istate->method()->name_and_sig_as_C_string(valuebuf, sizeof valuebuf);
+  char *p = valuebuf + strlen(valuebuf);
+  sprintf(p, ": " PTR_FORMAT " (bci %d)",
+	  (intptr_t) istate->bcp(),
+	  istate->method()->bci_from(istate->bcp()));
+  return valuebuf;
+}
+
+// Used for debugging the interpreter.  The macro TRACE in
+// cppInterpreter_arm.S calls this routine, and you can trap on a
+// particular method.
+#define NAME1 "sun.nio.ch.FileChannelImpl$Unmapper.run()V"
+#define EQ(S1, S2) (S1 && (strncmp(S1, S2, strlen(S2)) == 0))
+extern "C" void my_trace(void *jpc, void *istate)
+{
+  char *name = meth((interpreterState)istate);
+  if (EQ(name, NAME1));
+    asm volatile("nop");  // Somewhere to put a breakpoint
+}
+
+extern "C" unsigned hwcap(void)
+{
+  int fd;
+  unsigned vecs[VECBUFF_SIZE];
+  unsigned *p;
+  int i, n;
+  unsigned rc = 0;
+  unsigned arch = 4;
+ 
+  fd = open("/proc/self/auxv", O_RDONLY);
+  if (fd < 0) return 0;
+  do {
+    n = read(fd, vecs, VECBUFF_SIZE * sizeof(unsigned));
+    p = vecs;
+    i = n/8;
+    while (--i >= 0) {
+      unsigned tag = *p++;
+      unsigned value = *p++;
+      if (tag == 0) goto fini;
+      if (tag == AT_HWCAP) {
+	if (value & HWCAP_THUMBEE) rc |= ARCH_THUMB2;
+	if (value & HWCAP_VFP) rc |= ARCH_VFP;
+      } else if (tag == AT_PLATFORM) {
+	const char *s = (const char *)value;
+	int c;
+
+	if (*s++ == 'v') {
+	  arch = 0;
+	  while ((isdigit)(c = *s++)) arch = arch * 10 + c - '0';
+	}
+      }
+    }
+  } while (n == VECBUFF_SIZE * sizeof(unsigned));
+fini:
+  close(fd);
+//  printf("arch = %d, rc = 0x%08x\n", arch, rc);
+  if (arch >= 5) rc |= ARCH_CLZ;
+  if (arch >= 7) rc |= ARCH_THUMB2;
+  return rc | (1<<arch);
+}
+
+/* Thease functions allow the ASM interpreter to call CPP virtual functions.
+ * Otherwise the ASM interpreter has to grup around in the VTABLE which is
+ * not very portable.
+ */
+extern "C" bool JavaThread_is_lock_owned(JavaThread *r0, address r1)
+{
+	return r0->is_lock_owned(r1);
+}
+
+extern "C" HeapWord **CollectedHeap_top_addr(CollectedHeap *r0)
+{
+	return r0->top_addr();
+}
+
+extern "C" HeapWord **CollectedHeap_end_addr(CollectedHeap *r0)
+{
+	return r0->end_addr();
+}
+
+extern "C" char *SharedRuntime_generate_class_cast_message(const char *name, const char *klass)
+{
+	return SharedRuntime::generate_class_cast_message(name, klass);
+}
+
+#define HELPER_THROW(thread, name, msg) Exceptions::_throw_msg(thread, __FILE__, __LINE__, name, msg)
+
+class VMStructs {
+public:
+  static inline klassOop klass_at_addr(constantPoolOop constants, u2 index) {
+    return (klassOop) *constants->obj_at_addr_raw(index);
+  }
+};
+
+extern "C" oop Helper_new(interpreterState istate, unsigned index)
+{
+    JavaThread *thread = istate->thread();
+
+    constantPoolOop constants = istate->method()->constants();
+    oop result = NULL;
+    if (!constants->tag_at(index).is_unresolved_klass()) {
+      // Make sure klass is initialized and doesn't have a finalizer
+      oop entry = VMStructs::klass_at_addr(constants, index);
+      klassOop k_entry = (klassOop) entry;
+      instanceKlass* ik = (instanceKlass*) k_entry->klass_part();
+      if ( ik->is_initialized() && ik->can_be_fastpath_allocated() ) {
+	size_t obj_size = ik->size_helper();
+	// If the TLAB isn't pre-zeroed then we'll have to do it
+	bool need_zero = !ZeroTLAB;
+	if (UseTLAB) {
+	  result = (oop) thread->tlab().allocate(obj_size);
+	}
+	if (result == NULL && !CMSIncrementalMode) {
+	  need_zero = true;
+	  // Try allocate in shared eden
+    retry:
+	  HeapWord* compare_to = *Universe::heap()->top_addr();
+	  HeapWord* new_top = compare_to + obj_size;
+	  if (new_top <= *Universe::heap()->end_addr()) {
+	    if (Atomic::cmpxchg_ptr(new_top, Universe::heap()->top_addr(), compare_to) != compare_to) {
+	      goto retry;
+	    }
+	    result = (oop) compare_to;
+	  }
+	}
+	if (result != NULL) {
+	  // Initialize object (if nonzero size and need) and then the header
+	  if (need_zero ) {
+	    HeapWord* to_zero = (HeapWord*) result + sizeof(oopDesc) / oopSize;
+	    obj_size -= sizeof(oopDesc) / oopSize;
+	    if (obj_size > 0 ) {
+	      memset(to_zero, 0, obj_size * HeapWordSize);
+	    }
+	  }
+	  if (UseBiasedLocking) {
+	    result->set_mark(ik->prototype_header());
+	  } else {
+	    result->set_mark(markOopDesc::prototype());
+	  }
+	  result->set_klass_gap(0);
+	  result->set_klass(k_entry);
+	  return result;
+	}
+      }
+    }
+    // Slow case allocation
+    InterpreterRuntime::_new(thread, istate->method()->constants(), index);
+    result = thread->vm_result();
+    thread->set_vm_result(NULL);
+    return result;
+}
+
+extern "C" int Helper_instanceof(interpreterState istate, unsigned index, oop tos)
+{
+    if (tos == NULL) return 0;
+
+    // Constant pool may have actual klass or unresolved klass. If it is
+    // unresolved we must resolve it
+    if (istate->method()->constants()->tag_at(index).is_unresolved_klass()) {
+      InterpreterRuntime::quicken_io_cc(istate->thread());
+      if (istate->thread()->has_pending_exception()) return 0;
+    }
+    klassOop klassOf = VMStructs::klass_at_addr(istate->method()->constants(), index);
+    klassOop objKlassOop = tos->klass();
+    //
+    // Check for compatibilty. This check must not GC!!
+    // Seems way more expensive now that we must dispatch
+    //
+    return objKlassOop == klassOf || objKlassOop->klass_part()->is_subtype_of(klassOf);
+}
+
+extern "C" oop Helper_checkcast(interpreterState istate, unsigned index, oop tos)
+{
+    if (tos == NULL) return NULL;
+
+    // Constant pool may have actual klass or unresolved klass. If it is
+    // unresolved we must resolve it
+    if (istate->method()->constants()->tag_at(index).is_unresolved_klass()) {
+      oop except_oop;
+      InterpreterRuntime::quicken_io_cc(istate->thread());
+      if (except_oop = istate->thread()->pending_exception()) return except_oop;
+    }
+    klassOop klassOf = VMStructs::klass_at_addr(istate->method()->constants(), index);
+    klassOop objKlassOop = tos->klass(); //ebx
+    //
+    // Check for compatibilty. This check must not GC!!
+    // Seems way more expensive now that we must dispatch
+    //
+    if (objKlassOop != klassOf && !objKlassOop->klass_part()->is_subtype_of(klassOf)) {
+      ResourceMark rm(istate->thread());
+      const char* objName = Klass::cast(objKlassOop)->external_name();
+      const char* klassName = Klass::cast(klassOf)->external_name();
+      char* message = SharedRuntime::generate_class_cast_message(objName, klassName);
+      ThreadInVMfromJava trans(istate->thread());
+      HELPER_THROW(istate->thread(), vmSymbols::java_lang_ClassCastException(), message);
+    }
+    return istate->thread()->pending_exception();
+}
+
+extern "C" oop Helper_monitorenter(interpreterState istate, oop lockee)
+{
+    BasicObjectLock* limit = istate->monitor_base();
+    BasicObjectLock* most_recent = (BasicObjectLock*) istate->stack_base();
+    BasicObjectLock* entry = NULL;
+    markOop displaced;
+    JavaThread *thread = istate->thread();
+
+    if (lockee == NULL) {
+      HELPER_THROW(istate->thread(), vmSymbols::java_lang_NullPointerException(), "");
+      goto handle_exception;
+    }
+    while (most_recent != limit ) {
+      if (most_recent->obj() == NULL) entry = most_recent;
+      else if (most_recent->obj() == lockee) break;
+      most_recent++;
+    }
+    if (entry == NULL) {
+      int monitor_words = frame::interpreter_frame_monitor_size();
+      ZeroStack *stack = thread->zero_stack();
+
+      if (monitor_words > stack->available_words()) {
+        InterpreterRuntime::throw_StackOverflowError(thread);
+	goto handle_exception;
+      } else {
+	stack->alloc(monitor_words * wordSize);
+
+	for (intptr_t *p = istate->stack() + 1; p < istate->stack_base(); p++)
+	  *(p - monitor_words) = *p;
+
+	istate->set_stack_limit(istate->stack_limit() - monitor_words);
+	istate->set_stack(istate->stack() - monitor_words);
+	istate->set_stack_base(istate->stack_base() - monitor_words);
+
+	entry = (BasicObjectLock *) istate->stack_base();
+      }
+    }
+    entry->set_obj(lockee);
+    displaced = lockee->mark()->set_unlocked();
+    entry->lock()->set_displaced_header(displaced);
+    if (Atomic::cmpxchg_ptr(entry, lockee->mark_addr(), displaced) != displaced) {
+      // Is it simple recursive case?
+      if (thread->is_lock_owned((address) displaced->clear_lock_bits())) {
+	entry->lock()->set_displaced_header(NULL);
+      } else {
+	InterpreterRuntime::monitorenter(thread, entry);
+      }
+    }
+handle_exception:
+    return thread->pending_exception();
+}
+
+extern "C" oop Helper_monitorexit(interpreterState istate, oop lockee)
+{
+    BasicObjectLock* limit = istate->monitor_base();
+    BasicObjectLock* most_recent = (BasicObjectLock*) istate->stack_base();
+    JavaThread *thread = istate->thread();
+
+    if (lockee == NULL) {
+      HELPER_THROW(istate->thread(), vmSymbols::java_lang_NullPointerException(), "");
+      goto handle_exception;
+    }
+    while (most_recent != limit ) {
+      if ((most_recent)->obj() == lockee) {
+	BasicLock* lock = most_recent->lock();
+	markOop header = lock->displaced_header();
+	most_recent->set_obj(NULL);
+	if (header != NULL) {
+	  if (Atomic::cmpxchg_ptr(header, lockee->mark_addr(), lock) != lock) {
+	    // restore object for the slow case
+	    most_recent->set_obj(lockee);
+	    InterpreterRuntime::monitorexit(thread, most_recent);
+	  }
+	}
+	return thread->pending_exception();
+      }
+      most_recent++;
+    }
+    InterpreterRuntime::throw_illegal_monitor_state_exception(thread);
+handle_exception:
+    return thread->pending_exception();
+}
+
+extern "C" oop Helper_aastore(interpreterState istate, oop value, int index, arrayOop arrayref)
+{
+    if (arrayref == NULL) {
+      ThreadInVMfromJava trans(istate->thread());
+      HELPER_THROW(istate->thread(), vmSymbols::java_lang_NullPointerException(), "");
+    } else if ((uint32_t)index >= (uint32_t)arrayref->length()) {
+      char message[jintAsStringSize];
+      sprintf(message, "%d", index);
+      HELPER_THROW(istate->thread(), vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), message);
+    } else {
+      if (value != NULL) {
+	/* Check assignability of value into arrayref */
+	klassOop rhsKlassOop = value->klass(); // EBX (subclass)
+	klassOop elemKlassOop = ((objArrayKlass*) arrayref->klass()->klass_part())->element_klass();
+	//
+	// Check for compatibilty. This check must not GC!!
+	// Seems way more expensive now that we must dispatch
+	//
+	if (rhsKlassOop != elemKlassOop && !rhsKlassOop->klass_part()->is_subtype_of(elemKlassOop)) {
+	  HELPER_THROW(istate->thread(), vmSymbols::java_lang_ArrayStoreException(), "");
+	  goto handle_exception;
+	}
+      }
+      oop* elem_loc = (oop*)(((address) arrayref->base(T_OBJECT)) + index * sizeof(oop));
+      // *(oop*)(((address) arrayref->base(T_OBJECT)) + index * sizeof(oop)) = value;
+      *elem_loc = value;
+      // Mark the card
+      BarrierSet* bs = Universe::heap()->barrier_set();
+      static volatile jbyte* _byte_map_base = (volatile jbyte*)(((CardTableModRefBS*)bs)->byte_map_base);
+      OrderAccess::release_store(&_byte_map_base[(uintptr_t)elem_loc >> CardTableModRefBS::card_shift], 0);
+    }
+handle_exception:
+    return istate->thread()->pending_exception();
+}
+
+extern "C" void Helper_aputfield(oop obj)
+{
+      BarrierSet* bs = Universe::heap()->barrier_set();
+      static volatile jbyte* _byte_map_base = (volatile jbyte*)(((CardTableModRefBS*)bs)->byte_map_base);
+      OrderAccess::release_store(&_byte_map_base[(uintptr_t)obj >> CardTableModRefBS::card_shift], 0);
+}
+
+extern "C" oop Helper_synchronized_enter(JavaThread *thread, BasicObjectLock *mon)
+{
+    BasicLock *lock = mon->lock();
+    markOop displaced = lock->displaced_header();



More information about the distro-pkg-dev mailing list