Index: depends/build/makefile.include =================================================================== --- depends/build/makefile.include (revision 430291) +++ depends/build/makefile.include (working copy) @@ -28,5 +28,5 @@ DLLPATH=$(HY_HDK)/jdk/jre/bin/ SHAREDSUB=../shared/ -CFLAGS = -O1 -march=pentium3 -DLINUX -D_REENTRANT -DIPv6_FUNCTION_SUPPORT \ - -DHYX86 $(VMDEBUG) -I$(HY_HDK)/include -I$(HY_HDK)/jdk/include -I. -I$(SHAREDSUB) +CFLAGS = -O1 $(HY_CFLAGS) -DLINUX -D_REENTRANT -DIPv6_FUNCTION_SUPPORT \ + -D$(HY_ARCH_DEFINE) $(VMDEBUG) -I$(HY_HDK)/include -I$(HY_HDK)/jdk/include -I. -I$(SHAREDSUB) Index: modules/text/build.xml =================================================================== --- modules/text/build.xml (revision 430291) +++ modules/text/build.xml (working copy) @@ -45,8 +45,13 @@ + - + + + + + Index: modules/archive/src/main/native/zip/linux/makefile =================================================================== --- modules/archive/src/main/native/zip/linux/makefile (revision 430291) +++ modules/archive/src/main/native/zip/linux/makefile (working copy) @@ -18,7 +18,7 @@ include $(HY_HDK)/build/make/makefile.include -CFLAGS += -I../../zlib_dist +CFLAGS += -fpic -I../../zlib_dist BUILDFILES = $(SHAREDSUB)zcpool.o $(SHAREDSUB)zipalloc.o \ $(SHAREDSUB)zipcache.o $(SHAREDSUB)zipsup.o LIBNAME = $(LIBPATH)libhyzip.a Index: modules/awt/src/main/native/linuxfont/linux/makefile =================================================================== --- modules/awt/src/main/native/linuxfont/linux/makefile (revision 430291) +++ modules/awt/src/main/native/linuxfont/linux/makefile (working copy) @@ -25,7 +25,12 @@ $(DLLPATH)libhysig.so $(LIBPATH)libhyzip.a $(DLLPATH)libhyzlib.so $(LIBPATH)libhycommon.a \ $(LIBPATH)libhypool.a $(LIBPATH)libhyfdlibm.a $(DLLPATH)libhythr.so $(LIBPATH)libvmi.so -SYSLIBFILES = -L/usr/X11R6/lib -lX11 -lXft +ifeq ($(HY_ARCH),x86_64) + SYSLIBFILES = -L/usr/X11R6/lib64 -lX11 -lXft +endif +ifeq ($(HY_ARCH),x86) + SYSLIBFILES = -L/usr/X11R6/lib -lX11 -lXft +endif DLLNAME=../liblinuxfont.so Index: modules/awt/src/main/native/x11wrapper/linux/makefile =================================================================== --- modules/awt/src/main/native/x11wrapper/linux/makefile (revision 430291) +++ modules/awt/src/main/native/x11wrapper/linux/makefile (working copy) @@ -26,7 +26,12 @@ $(DLLPATH)libhysig.so $(LIBPATH)libhyzip.a $(DLLPATH)libhyzlib.so $(LIBPATH)libhycommon.a \ $(LIBPATH)libhypool.a $(LIBPATH)libhyfdlibm.a $(DLLPATH)libhythr.so $(LIBPATH)libvmi.so -SYSLIBFILES = -lstdc++ -L/usr/X11R6/lib -lX11 +ifeq ($(HY_ARCH),x86_64) + SYSLIBFILES = -lstdc++ -L/usr/X11R6/lib64 -lX11 +endif +ifeq ($(HY_ARCH),x86) + SYSLIBFILES = -lstdc++ -L/usr/X11R6/lib -lX11 +endif DLLNAME=../libX11Wrapper.so Index: modules/luni/src/main/native/include/shared/hycomp.h =================================================================== --- modules/luni/src/main/native/include/shared/hycomp.h (revision 430291) +++ modules/luni/src/main/native/include/shared/hycomp.h (working copy) @@ -46,7 +46,7 @@ #define HY_PLATFORM_DOUBLE_ORDER #if defined(LINUX) /* NOTE: Linux supports different processors -- do not assume 386 */ -#if defined(LINUXPPC64) +#if defined(HYX86_64) #define DATA_TYPES_DEFINED typedef unsigned long int UDATA; /* 64bits */ typedef unsigned long int U_64; Index: modules/luni/src/main/native/port/linux/hyvmem.c =================================================================== --- modules/luni/src/main/native/port/linux/hyvmem.c (revision 430291) +++ modules/luni/src/main/native/port/linux/hyvmem.c (working copy) @@ -343,7 +343,7 @@ } /* Update identifier and commit memory if required, else return reserved memory */ - update_vmemIdentifier (identifier, baseAddress, (void *) addressKey, + update_vmemIdentifier (identifier, baseAddress, baseAddress, byteAmount, mode, largePageSize); if (0 != (HYPORT_VMEM_MEMORY_MODE_COMMIT & mode)) { Index: modules/luni/src/main/native/port/linux/hysignal.c =================================================================== --- modules/luni/src/main/native/port/linux/hysignal.c (revision 430291) +++ modules/luni/src/main/native/port/linux/hysignal.c (working copy) @@ -624,35 +624,77 @@ switch (index) { case HYPORT_SIG_GPR_X86_EDI: + case HYPORT_SIG_GPR_AMD64_RDI: case 0: +#ifdef HYX86_64 + *name = "RDI"; + *value = &info->sigContext->rdi; +#endif +#ifdef HYX86 *name = "EDI"; *value = &info->sigContext->edi; - return HYPORT_SIG_VALUE_ADDRESS; +#endif + return HYPORT_SIG_VALUE_ADDRESS; case HYPORT_SIG_GPR_X86_ESI: + case HYPORT_SIG_GPR_AMD64_RSI: case 1: +#ifdef HYX86 *name = "ESI"; *value = &info->sigContext->esi; +#endif +#ifdef HYX86_64 + *name = "RSI"; + *value = &info->sigContext->rsi; +#endif return HYPORT_SIG_VALUE_ADDRESS; case HYPORT_SIG_GPR_X86_EAX: + case HYPORT_SIG_GPR_AMD64_RAX: case 2: +#ifdef HYX86 *name = "EAX"; *value = &info->sigContext->eax; - return HYPORT_SIG_VALUE_ADDRESS; +#endif +#ifdef HYX86_64 + *name = "RAX"; + *value = &info->sigContext->rax; +#endif + return HYPORT_SIG_VALUE_ADDRESS; case HYPORT_SIG_GPR_X86_EBX: + case HYPORT_SIG_GPR_AMD64_RBX: case 3: +#ifdef HYX86 *name = "EBX"; *value = &info->sigContext->ebx; - return HYPORT_SIG_VALUE_ADDRESS; +#endif +#ifdef HYX86_64 + *name = "RBX"; + *value = &info->sigContext->rbx; +#endif + return HYPORT_SIG_VALUE_ADDRESS; case HYPORT_SIG_GPR_X86_ECX: + case HYPORT_SIG_GPR_AMD64_RCX: case 4: +#ifdef HYX86 *name = "ECX"; *value = &info->sigContext->ecx; - return HYPORT_SIG_VALUE_ADDRESS; +#endif +#ifdef HYX86_64 + *name = "RCX"; + *value = &info->sigContext->rcx; +#endif + return HYPORT_SIG_VALUE_ADDRESS; case HYPORT_SIG_GPR_X86_EDX: + case HYPORT_SIG_GPR_AMD64_RDX: case 5: +#ifdef HYX86 *name = "EDX"; *value = &info->sigContext->edx; - return HYPORT_SIG_VALUE_ADDRESS; +#endif +#ifdef HYX86_64 + *name = "RDX"; + *value = &info->sigContext->rdx; +#endif + return HYPORT_SIG_VALUE_ADDRESS; default: return HYPORT_SIG_VALUE_UNDEFINED; } @@ -675,9 +717,16 @@ { case HYPORT_SIG_CONTROL_PC: case 0: +#ifdef HYX86 *name = "EIP"; *value = (void *) &(info->sigContext->eip); - return HYPORT_SIG_VALUE_ADDRESS; +#endif +#ifdef HYX86_64 + *name = "RIP"; + *value = (void *) &(info->sigContext->rip); +#endif + return HYPORT_SIG_VALUE_ADDRESS; +#ifdef HYX86 case 1: *name = "ES"; *value = (void *) &(info->sigContext->es); @@ -686,10 +735,17 @@ *name = "DS"; *value = (void *) &(info->sigContext->ds); return HYPORT_SIG_VALUE_ADDRESS; +#endif case HYPORT_SIG_CONTROL_SP: case 3: +#ifdef HYX86 *name = "ESP"; *value = (void *) &(info->sigContext->esp); +#endif +#ifdef HYX86_64 + *name = "RSP"; + *value = (void *) &(info->sigContext->rsp); +#endif return HYPORT_SIG_VALUE_ADDRESS; case 4: *name = "EFlags"; @@ -699,15 +755,23 @@ *name = "CS"; *value = (void *) &(info->sigContext->cs); return HYPORT_SIG_VALUE_ADDRESS; +#ifdef HYX86 case 6: *name = "SS"; *value = (void *) &(info->sigContext->ss); return HYPORT_SIG_VALUE_ADDRESS; - case HYPORT_SIG_CONTROL_BP: +#endif + case HYPORT_SIG_CONTROL_BP: case 7: +#ifdef HYX86 *name = "EBP"; *value = &info->sigContext->ebp; - return HYPORT_SIG_VALUE_ADDRESS; +#endif +#ifdef HYX86_64 + *name = "RBP"; + *value = &info->sigContext->rbp; +#endif + return HYPORT_SIG_VALUE_ADDRESS; default: return HYPORT_SIG_VALUE_UNDEFINED; } @@ -726,8 +790,14 @@ Dl_info *dl_info = &(info->dl_info); *name = ""; +#ifdef HYX86 address = (void *) info->sigContext->eip; int dl_result = dladdr ((void *) info->sigContext->eip, dl_info); +#endif +#ifdef HYX86_64 + address = (void *) info->sigContext->rip; + int dl_result = dladdr ((void *) info->sigContext->rip, dl_info); +#endif switch (index) { Index: modules/luni/src/main/native/luni/linux/OSMemoryLinux32.c =================================================================== --- modules/luni/src/main/native/luni/linux/OSMemoryLinux32.c (revision 430291) +++ modules/luni/src/main/native/luni/linux/OSMemoryLinux32.c (working copy) @@ -34,7 +34,7 @@ JNIEXPORT jint JNICALL Java_org_apache_harmony_luni_platform_OSMemory_getPointerSizeImpl (JNIEnv * env, jclass clazz) { - return 4; + return sizeof(void *); } JNIEXPORT jlong JNICALL Java_org_apache_harmony_luni_platform_OSMemory_getAddress @@ -76,7 +76,7 @@ (JNIEnv * env, jobject thiz, jlong addr, jlong size){ PORT_ACCESS_FROM_ENV (env); jboolean result = 0; - int m_addr = (int)addr; + IDATA m_addr = (IDATA)addr; int PAGE_SIZE = getPageSize(); char* vec = NULL; int page_count = 0; Index: modules/luni/src/main/native/luni/linux/OSFileSystemLinux32.c =================================================================== --- modules/luni/src/main/native/luni/linux/OSFileSystemLinux32.c (revision 430291) +++ modules/luni/src/main/native/luni/linux/OSFileSystemLinux32.c (working copy) @@ -23,10 +23,13 @@ #include #include #include "vmi.h" +#include "iohelp.h" #include "IFileSystem.h" #include "OSFileSystem.h" +void *getJavaIoFileDescriptorContentsAsPointer (JNIEnv * env, jobject fd); + typedef int OSSOCKET; typedef struct hysocket_struct { @@ -223,7 +226,7 @@ (JNIEnv *env, jobject thiz, jlong fd, jobject sd, jlong offset, jlong count) { PORT_ACCESS_FROM_ENV (env); - int socket; + OSSOCKET socket; //TODO IPV6 hysocket_t hysocketP = (hysocket_t)getJavaIoFileDescriptorContentsAsPointer (env,sd); Index: modules/luni/src/main/native/thread/linux/x86/thrspinlock.s =================================================================== --- modules/luni/src/main/native/thread/linux/x86/thrspinlock.s (revision 0) +++ modules/luni/src/main/native/thread/linux/x86/thrspinlock.s (revision 0) @@ -0,0 +1,132 @@ +# Copyright 1991, 2005 The Apache Software Foundation or its licensors, as +# applicable +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +eq_HyThreadAbstractMonitor_spinCount1 = 48 +eq_HyThreadAbstractMonitor_spinCount2 = 52 +eq_HyThreadAbstractMonitor_spinCount3 = 56 +eq_HyThreadAbstractMonitor_spinlockState = 40 +eq_pointer_size = 4 +eqS_hythread_spinlock_acquire = 18 +eqS_hythread_spinlock_swapState = 16 +eqSR_hythread_spinlock_acquire = 4 +eqSR_hythread_spinlock_swapState = 4 +eqSRS_hythread_spinlock_acquire = 16 +eqSRS_hythread_spinlock_swapState = 16 +eqSS_hythread_spinlock_acquire = 72 +eqSS_hythread_spinlock_swapState = 64 +HYTHREAD_MONITOR_SPINLOCK_OWNED = 1 +HYTHREAD_MONITOR_SPINLOCK_UNOWNED = 0 + #CODE32 SEGMENT FLAT PUBLIC 'CODE' + #assume cs:flat,ds:flat,ss:flat + #CODE32 ends + #CODE32 SEGMENT FLAT PUBLIC 'CODE' + #assume cs:flat,ds:flat,ss:flat + .globl hythread_yield # an extern + .globl hythread_spinlock_acquire + .type hythread_spinlock_acquire,@function + .globl hythread_spinlock_swapState + .type hythread_spinlock_swapState,@function +## Prototype: IDATA hythread_spinlock_acquire(hythread_t self, hythread_monitor_t monitor); +## Defined in: #THREAD Args: 2 + + .text + .align 4 +hythread_spinlock_acquire: + push %ebp + mov %esp, %ebp + push %esi + push %edi + push %ebx + sub $72, %esp + movl (eqSS_hythread_spinlock_acquire+0+eqSRS_hythread_spinlock_acquire+8)(%esp), %edx + movl eq_HyThreadAbstractMonitor_spinCount3(%edx), %ecx +.L2: + movl eq_HyThreadAbstractMonitor_spinCount2(%edx), %ebx +.L3: +## Try to cmpxchg 0 into the target field (-1 indicates free) + cmpl $HYTHREAD_MONITOR_SPINLOCK_UNOWNED, eq_HyThreadAbstractMonitor_spinlockState(%edx) ## setFlags: true + jne .L10 + xor %eax, %eax + movl $HYTHREAD_MONITOR_SPINLOCK_OWNED, %esi + lock + cmpxchgl %esi, eq_HyThreadAbstractMonitor_spinlockState(%edx) + testl %eax, %eax ## setFlags: true + jnz .L10 + xor %ebx, %ebx + jmp .L1 +.L10: + .word 37107 ## PAUSE +## begin tight loop + movl eq_HyThreadAbstractMonitor_spinCount1(%edx), %eax +.L11: +## inside tight loop + decl %eax ## setFlags: true(Converted subtract 1 to dec) + jnz .L11 +## end tight loop + decl %ebx ## setFlags: true(Converted subtract 1 to dec) + jnz .L3 + movl %ecx, 64(%esp) ## save VMtemp3_1_3_(HyThreadAbstractMonitor->spinCount3) + movl %edx, 68(%esp) ## save VMtemp3_1_2_(struct HyThreadAbstractMonitor*) in_HyVMThreadSpinlocks>>#hythread_spinlock_acquire + call hythread_yield + movl 64(%esp), %ecx ## load VMtemp3_1_3_(HyThreadAbstractMonitor->spinCount3) + decl %ecx ## setFlags: true(Converted subtract 1 to dec) + movl 68(%esp), %edx ## load VMtemp3_1_2_(struct HyThreadAbstractMonitor*) in_HyVMThreadSpinlocks>>#hythread_spinlock_acquire + jnz .L2 + movl $-1, %ebx +.L1: + movl %ebx, %eax + add $72, %esp + pop %ebx + pop %edi + pop %esi + pop %ebp + ret +END_hythread_spinlock_acquire: + .size hythread_spinlock_acquire,END_hythread_spinlock_acquire - hythread_spinlock_acquire + +## Prototype: UDATA hythread_spinlock_swapState(hythread_monitor_t monitor, UDATA newState); +## Defined in: #THREAD Args: 2 + + .text + .align 4 +hythread_spinlock_swapState: + push %ebp + mov %esp, %ebp + push %esi + push %edi + push %ebx + sub $64, %esp + movl (eqSS_hythread_spinlock_swapState+0+eqSRS_hythread_spinlock_swapState+4)(%esp), %ebx + movl (eqSS_hythread_spinlock_swapState+0+eqSRS_hythread_spinlock_swapState+8)(%esp), %ecx +## If we are writing in UNOWNED, we are exiting the critical section, therefore +## have to finish up any writes + testl %ecx, %ecx ## setFlags: true + ## memory barrier (no code necessary for write barriers) + xchgl %ecx, eq_HyThreadAbstractMonitor_spinlockState(%ebx) +## if we entered the critical section, (i.e. we swapped out UNOWNED) then +## we have to issue a readBarrier + testl %ecx, %ecx ## setFlags: true + movl %ecx, %eax + add $64, %esp + pop %ebx + pop %edi + pop %esi + pop %ebp + ret +END_hythread_spinlock_swapState: + .size hythread_spinlock_swapState,END_hythread_spinlock_swapState - hythread_spinlock_swapState + + #CODE32 ends + # end of file Index: modules/luni/src/main/native/thread/linux/x86/thrhelp.s =================================================================== --- modules/luni/src/main/native/thread/linux/x86/thrhelp.s (revision 0) +++ modules/luni/src/main/native/thread/linux/x86/thrhelp.s (revision 0) @@ -0,0 +1,123 @@ +# Copyright 1991, 2005 The Apache Software Foundation or its licensors, as +# applicable +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +eq_hy_null = 0 +eq_HyThreadMonitor_pinCount = 28 +eq_pointer_size = 4 +eqS_current_stack_depth = 16 +eqS_hythread_monitor_pin = 16 +eqS_hythread_monitor_unpin = 16 +eqSR_current_stack_depth = 4 +eqSR_hythread_monitor_pin = 4 +eqSR_hythread_monitor_unpin = 4 +eqSRS_current_stack_depth = 16 +eqSRS_hythread_monitor_pin = 16 +eqSRS_hythread_monitor_unpin = 16 +eqSS_current_stack_depth = 64 +eqSS_hythread_monitor_pin = 64 +eqSS_hythread_monitor_unpin = 64 + #CODE32 SEGMENT FLAT PUBLIC 'CODE' + #assume cs:flat,ds:flat,ss:flat + #CODE32 ends + #CODE32 SEGMENT FLAT PUBLIC 'CODE' + #assume cs:flat,ds:flat,ss:flat + .globl hythread_monitor_pin + .type hythread_monitor_pin,@function + .globl current_stack_depth + .type current_stack_depth,@function + .globl hythread_monitor_unpin + .type hythread_monitor_unpin,@function + + .text + .align 4 +current_stack_depth: + push %ebp + mov %esp, %ebp + push %esi + push %edi + push %ebx + sub $64, %esp + movl %ebp, %ebx + jmp .L2 +.L1: + movl %ecx, %ebx +.L2: + movl (%ebx), %ecx + testl %ecx, %ecx ## setFlags: true + jnz .L1 + subl %ebp, %ebx + movl %ebx, %ecx + movl %ebx, %eax ## RegReg opt + add $64, %esp + pop %ebx + pop %edi + pop %esi + pop %ebp + ret +END_current_stack_depth: + .size current_stack_depth,END_current_stack_depth - current_stack_depth + +## Prototype: void hythread_monitor_pin( hythread_monitor_t monitor, hythread_t osThread); +## Defined in: #THREAD Args: 2 + + .text + .align 4 +hythread_monitor_pin: + push %ebp + mov %esp, %ebp + push %esi + push %edi + push %ebx + sub $64, %esp + movl (eqSRS_hythread_monitor_pin+0+8+eqSS_hythread_monitor_pin)(%esp), %ebx + movl (eqSRS_hythread_monitor_pin+0+4+eqSS_hythread_monitor_pin)(%esp), %ebx + lock + incl eq_HyThreadMonitor_pinCount(%ebx) ## (Converted add 1 to inc) + add $64, %esp + pop %ebx + pop %edi + pop %esi + pop %ebp + ret +END_hythread_monitor_pin: + .size hythread_monitor_pin,END_hythread_monitor_pin - hythread_monitor_pin + +## Prototype: void hythread_monitor_unpin( hythread_monitor_t monitor, hythread_t osThread); +## Defined in: #THREAD Args: 2 + + .text + .align 4 +hythread_monitor_unpin: + push %ebp + mov %esp, %ebp + push %esi + push %edi + push %ebx + sub $64, %esp + movl (eqSS_hythread_monitor_unpin+0+8+eqSRS_hythread_monitor_unpin)(%esp), %ebx + movl (eqSS_hythread_monitor_unpin+0+eqSRS_hythread_monitor_unpin+4)(%esp), %ebx + lock + decl eq_HyThreadMonitor_pinCount(%ebx) ## (Converted subtract 1 to dec) + add $64, %esp + pop %ebx + pop %edi + pop %esi + pop %ebp + ret +END_hythread_monitor_unpin: + .size hythread_monitor_unpin,END_hythread_monitor_unpin - hythread_monitor_unpin + + #CODE32 ends + # end of file Index: modules/luni/src/main/native/thread/linux/x86_64/thrspinlock.s =================================================================== --- modules/luni/src/main/native/thread/linux/x86_64/thrspinlock.s (revision 0) +++ modules/luni/src/main/native/thread/linux/x86_64/thrspinlock.s (revision 0) @@ -0,0 +1,132 @@ +# Copyright 1991, 2005 The Apache Software Foundation or its licensors, as +# applicable +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +eq_HyThreadAbstractMonitor_spinCount1 = 48 +eq_HyThreadAbstractMonitor_spinCount2 = 52 +eq_HyThreadAbstractMonitor_spinCount3 = 56 +eq_HyThreadAbstractMonitor_spinlockState = 40 +eq_pointer_size = 4 +eqS_hythread_spinlock_acquire = 18 +eqS_hythread_spinlock_swapState = 16 +eqSR_hythread_spinlock_acquire = 4 +eqSR_hythread_spinlock_swapState = 4 +eqSRS_hythread_spinlock_acquire = 16 +eqSRS_hythread_spinlock_swapState = 16 +eqSS_hythread_spinlock_acquire = 72 +eqSS_hythread_spinlock_swapState = 64 +HYTHREAD_MONITOR_SPINLOCK_OWNED = 1 +HYTHREAD_MONITOR_SPINLOCK_UNOWNED = 0 + #CODE32 SEGMENT FLAT PUBLIC 'CODE' + #assume cs:flat,ds:flat,ss:flat + #CODE32 ends + #CODE32 SEGMENT FLAT PUBLIC 'CODE' + #assume cs:flat,ds:flat,ss:flat + .globl hythread_yield # an extern + .globl hythread_spinlock_acquire + .type hythread_spinlock_acquire,@function + .globl hythread_spinlock_swapState + .type hythread_spinlock_swapState,@function +## Prototype: IDATA hythread_spinlock_acquire(hythread_t self, hythread_monitor_t monitor); +## Defined in: #THREAD Args: 2 + + .text + .align 4 +hythread_spinlock_acquire: + push %rbp + mov %rsp, %rbp + push %rsi + push %rdi + push %rbx + sub $72, %rsp + mov (eqSS_hythread_spinlock_acquire+0+eqSRS_hythread_spinlock_acquire+8)(%rsp), %rdx + mov eq_HyThreadAbstractMonitor_spinCount3(%rdx), %rcx +.L2: + mov eq_HyThreadAbstractMonitor_spinCount2(%rdx), %rbx +.L3: +## Try to cmpxchg 0 into the target field (-1 indicates free) + cmpl $HYTHREAD_MONITOR_SPINLOCK_UNOWNED, eq_HyThreadAbstractMonitor_spinlockState(%rdx) ## setFlags: true + jne .L10 + xor %rax, %rax + mov $HYTHREAD_MONITOR_SPINLOCK_OWNED, %rsi + lock + cmpxchg %rsi, eq_HyThreadAbstractMonitor_spinlockState(%rdx) + test %rax, %rax ## setFlags: true + jnz .L10 + xor %rbx, %rbx + jmp .L1 +.L10: + .word 37107 ## PAUSE +## begin tight loop + mov eq_HyThreadAbstractMonitor_spinCount1(%rdx), %rax +.L11: +## inside tight loop + dec %rax ## setFlags: true(Converted subtract 1 to dec) + jnz .L11 +## end tight loop + dec %rbx ## setFlags: true(Converted subtract 1 to dec) + jnz .L3 + mov %rcx, 64(%rsp) ## save VMtemp3_1_3_(HyThreadAbstractMonitor->spinCount3) + mov %rdx, 68(%rsp) ## save VMtemp3_1_2_(struct HyThreadAbstractMonitor*) in_HyVMThreadSpinlocks>>#hythread_spinlock_acquire + call hythread_yield + mov 64(%rsp), %rcx ## load VMtemp3_1_3_(HyThreadAbstractMonitor->spinCount3) + dec %rcx ## setFlags: true(Converted subtract 1 to dec) + mov 68(%rsp), %rdx ## load VMtemp3_1_2_(struct HyThreadAbstractMonitor*) in_HyVMThreadSpinlocks>>#hythread_spinlock_acquire + jnz .L2 + mov $-1, %rbx +.L1: + mov %rbx, %rax + add $72, %rsp + pop %rbx + pop %rdi + pop %rsi + pop %rbp + ret +END_hythread_spinlock_acquire: + .size hythread_spinlock_acquire,END_hythread_spinlock_acquire - hythread_spinlock_acquire + +## Prototype: UDATA hythread_spinlock_swapState(hythread_monitor_t monitor, UDATA newState); +## Defined in: #THREAD Args: 2 + + .text + .align 4 +hythread_spinlock_swapState: + push %rbp + mov %rsp, %rbp + push %rsi + push %rdi + push %rbx + sub $64, %rsp + mov (eqSS_hythread_spinlock_swapState+0+eqSRS_hythread_spinlock_swapState+4)(%rsp), %rbx + mov (eqSS_hythread_spinlock_swapState+0+eqSRS_hythread_spinlock_swapState+8)(%rsp), %rcx +## If we are writing in UNOWNED, we are exiting the critical section, therefore +## have to finish up any writes + test %rcx, %rcx ## setFlags: true + ## memory barrier (no code necessary for write barriers) + xchg %rcx, eq_HyThreadAbstractMonitor_spinlockState(%rbx) +## if we entered the critical section, (i.e. we swapped out UNOWNED) then +## we have to issue a readBarrier + test %rcx, %rcx ## setFlags: true + mov %rcx, %rax + add $64, %rsp + pop %rbx + pop %rdi + pop %rsi + pop %rbp + ret +END_hythread_spinlock_swapState: + .size hythread_spinlock_swapState,END_hythread_spinlock_swapState - hythread_spinlock_swapState + + #CODE32 ends + # end of file Index: modules/luni/src/main/native/thread/linux/x86_64/thrhelp.s =================================================================== --- modules/luni/src/main/native/thread/linux/x86_64/thrhelp.s (revision 0) +++ modules/luni/src/main/native/thread/linux/x86_64/thrhelp.s (revision 0) @@ -0,0 +1,123 @@ +# Copyright 1991, 2005 The Apache Software Foundation or its licensors, as +# applicable +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +eq_hy_null = 0 +eq_HyThreadMonitor_pinCount = 28 +eq_pointer_size = 4 +eqS_current_stack_depth = 16 +eqS_hythread_monitor_pin = 16 +eqS_hythread_monitor_unpin = 16 +eqSR_current_stack_depth = 4 +eqSR_hythread_monitor_pin = 4 +eqSR_hythread_monitor_unpin = 4 +eqSRS_current_stack_depth = 16 +eqSRS_hythread_monitor_pin = 16 +eqSRS_hythread_monitor_unpin = 16 +eqSS_current_stack_depth = 64 +eqSS_hythread_monitor_pin = 64 +eqSS_hythread_monitor_unpin = 64 + #CODE32 SEGMENT FLAT PUBLIC 'CODE' + #assume cs:flat,ds:flat,ss:flat + #CODE32 ends + #CODE32 SEGMENT FLAT PUBLIC 'CODE' + #assume cs:flat,ds:flat,ss:flat + .globl hythread_monitor_pin + .type hythread_monitor_pin,@function + .globl current_stack_depth + .type current_stack_depth,@function + .globl hythread_monitor_unpin + .type hythread_monitor_unpin,@function + + .text + .align 4 +current_stack_depth: + push %rbp + mov %rsp, %rbp + push %rsi + push %rdi + push %rbx + sub $64, %rsp + mov %rbp, %rbx + jmp .L2 +.L1: + mov %rcx, %rbx +.L2: + mov (%rbx), %rcx + test %rcx, %rcx ## setFlags: true + jnz .L1 + sub %rbp, %rbx + mov %rbx, %rcx + mov %rbx, %rax ## RegReg opt + add $64, %rsp + pop %rbx + pop %rdi + pop %rsi + pop %rbp + ret +END_current_stack_depth: + .size current_stack_depth,END_current_stack_depth - current_stack_depth + +## Prototype: void hythread_monitor_pin( hythread_monitor_t monitor, hythread_t osThread); +## Defined in: #THREAD Args: 2 + + .text + .align 4 +hythread_monitor_pin: + push %rbp + mov %rsp, %rbp + push %rsi + push %rdi + push %rbx + sub $64, %rsp + mov (eqSRS_hythread_monitor_pin+0+8+eqSS_hythread_monitor_pin)(%rsp), %rbx + mov (eqSRS_hythread_monitor_pin+0+4+eqSS_hythread_monitor_pin)(%rsp), %rbx + lock + incl eq_HyThreadMonitor_pinCount(%rbx) ## (Converted add 1 to inc) + add $64, %rsp + pop %rbx + pop %rdi + pop %rsi + pop %rbp + ret +END_hythread_monitor_pin: + .size hythread_monitor_pin,END_hythread_monitor_pin - hythread_monitor_pin + +## Prototype: void hythread_monitor_unpin( hythread_monitor_t monitor, hythread_t osThread); +## Defined in: #THREAD Args: 2 + + .text + .align 4 +hythread_monitor_unpin: + push %rbp + mov %rsp, %rbp + push %rsi + push %rdi + push %rbx + sub $64, %rsp + mov (eqSS_hythread_monitor_unpin+0+8+eqSRS_hythread_monitor_unpin)(%rsp), %rbx + mov (eqSS_hythread_monitor_unpin+0+eqSRS_hythread_monitor_unpin+4)(%rsp), %rbx + lock + decl eq_HyThreadMonitor_pinCount(%rbx) ## (Converted subtract 1 to dec) + add $64, %rsp + pop %rbx + pop %rdi + pop %rsi + pop %rbp + ret +END_hythread_monitor_unpin: + .size hythread_monitor_unpin,END_hythread_monitor_unpin - hythread_monitor_unpin + + #CODE32 ends + # end of file Index: modules/luni/src/main/native/thread/linux/thrspinlock.s =================================================================== --- modules/luni/src/main/native/thread/linux/thrspinlock.s (revision 430291) +++ modules/luni/src/main/native/thread/linux/thrspinlock.s (working copy) @@ -1,132 +0,0 @@ -# Copyright 1991, 2005 The Apache Software Foundation or its licensors, as -# applicable -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -eq_HyThreadAbstractMonitor_spinCount1 = 48 -eq_HyThreadAbstractMonitor_spinCount2 = 52 -eq_HyThreadAbstractMonitor_spinCount3 = 56 -eq_HyThreadAbstractMonitor_spinlockState = 40 -eq_pointer_size = 4 -eqS_hythread_spinlock_acquire = 18 -eqS_hythread_spinlock_swapState = 16 -eqSR_hythread_spinlock_acquire = 4 -eqSR_hythread_spinlock_swapState = 4 -eqSRS_hythread_spinlock_acquire = 16 -eqSRS_hythread_spinlock_swapState = 16 -eqSS_hythread_spinlock_acquire = 72 -eqSS_hythread_spinlock_swapState = 64 -HYTHREAD_MONITOR_SPINLOCK_OWNED = 1 -HYTHREAD_MONITOR_SPINLOCK_UNOWNED = 0 - #CODE32 SEGMENT FLAT PUBLIC 'CODE' - #assume cs:flat,ds:flat,ss:flat - #CODE32 ends - #CODE32 SEGMENT FLAT PUBLIC 'CODE' - #assume cs:flat,ds:flat,ss:flat - .globl hythread_yield # an extern - .globl hythread_spinlock_acquire - .type hythread_spinlock_acquire,@function - .globl hythread_spinlock_swapState - .type hythread_spinlock_swapState,@function -## Prototype: IDATA hythread_spinlock_acquire(hythread_t self, hythread_monitor_t monitor); -## Defined in: #THREAD Args: 2 - - .text - .align 4 -hythread_spinlock_acquire: - push %ebp - mov %esp, %ebp - push %esi - push %edi - push %ebx - sub $72, %esp - movl (eqSS_hythread_spinlock_acquire+0+eqSRS_hythread_spinlock_acquire+8)(%esp), %edx - movl eq_HyThreadAbstractMonitor_spinCount3(%edx), %ecx -.L2: - movl eq_HyThreadAbstractMonitor_spinCount2(%edx), %ebx -.L3: -## Try to cmpxchg 0 into the target field (-1 indicates free) - cmpl $HYTHREAD_MONITOR_SPINLOCK_UNOWNED, eq_HyThreadAbstractMonitor_spinlockState(%edx) ## setFlags: true - jne .L10 - xor %eax, %eax - movl $HYTHREAD_MONITOR_SPINLOCK_OWNED, %esi - lock - cmpxchgl %esi, eq_HyThreadAbstractMonitor_spinlockState(%edx) - testl %eax, %eax ## setFlags: true - jnz .L10 - xor %ebx, %ebx - jmp .L1 -.L10: - .word 37107 ## PAUSE -## begin tight loop - movl eq_HyThreadAbstractMonitor_spinCount1(%edx), %eax -.L11: -## inside tight loop - decl %eax ## setFlags: true(Converted subtract 1 to dec) - jnz .L11 -## end tight loop - decl %ebx ## setFlags: true(Converted subtract 1 to dec) - jnz .L3 - movl %ecx, 64(%esp) ## save VMtemp3_1_3_(HyThreadAbstractMonitor->spinCount3) - movl %edx, 68(%esp) ## save VMtemp3_1_2_(struct HyThreadAbstractMonitor*) in_HyVMThreadSpinlocks>>#hythread_spinlock_acquire - call hythread_yield - movl 64(%esp), %ecx ## load VMtemp3_1_3_(HyThreadAbstractMonitor->spinCount3) - decl %ecx ## setFlags: true(Converted subtract 1 to dec) - movl 68(%esp), %edx ## load VMtemp3_1_2_(struct HyThreadAbstractMonitor*) in_HyVMThreadSpinlocks>>#hythread_spinlock_acquire - jnz .L2 - movl $-1, %ebx -.L1: - movl %ebx, %eax - add $72, %esp - pop %ebx - pop %edi - pop %esi - pop %ebp - ret -END_hythread_spinlock_acquire: - .size hythread_spinlock_acquire,END_hythread_spinlock_acquire - hythread_spinlock_acquire - -## Prototype: UDATA hythread_spinlock_swapState(hythread_monitor_t monitor, UDATA newState); -## Defined in: #THREAD Args: 2 - - .text - .align 4 -hythread_spinlock_swapState: - push %ebp - mov %esp, %ebp - push %esi - push %edi - push %ebx - sub $64, %esp - movl (eqSS_hythread_spinlock_swapState+0+eqSRS_hythread_spinlock_swapState+4)(%esp), %ebx - movl (eqSS_hythread_spinlock_swapState+0+eqSRS_hythread_spinlock_swapState+8)(%esp), %ecx -## If we are writing in UNOWNED, we are exiting the critical section, therefore -## have to finish up any writes - testl %ecx, %ecx ## setFlags: true - ## memory barrier (no code necessary for write barriers) - xchgl %ecx, eq_HyThreadAbstractMonitor_spinlockState(%ebx) -## if we entered the critical section, (i.e. we swapped out UNOWNED) then -## we have to issue a readBarrier - testl %ecx, %ecx ## setFlags: true - movl %ecx, %eax - add $64, %esp - pop %ebx - pop %edi - pop %esi - pop %ebp - ret -END_hythread_spinlock_swapState: - .size hythread_spinlock_swapState,END_hythread_spinlock_swapState - hythread_spinlock_swapState - - #CODE32 ends - # end of file Index: modules/luni/src/main/native/thread/linux/thrhelp.s =================================================================== --- modules/luni/src/main/native/thread/linux/thrhelp.s (revision 430291) +++ modules/luni/src/main/native/thread/linux/thrhelp.s (working copy) @@ -1,123 +0,0 @@ -# Copyright 1991, 2005 The Apache Software Foundation or its licensors, as -# applicable -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -eq_hy_null = 0 -eq_HyThreadMonitor_pinCount = 28 -eq_pointer_size = 4 -eqS_current_stack_depth = 16 -eqS_hythread_monitor_pin = 16 -eqS_hythread_monitor_unpin = 16 -eqSR_current_stack_depth = 4 -eqSR_hythread_monitor_pin = 4 -eqSR_hythread_monitor_unpin = 4 -eqSRS_current_stack_depth = 16 -eqSRS_hythread_monitor_pin = 16 -eqSRS_hythread_monitor_unpin = 16 -eqSS_current_stack_depth = 64 -eqSS_hythread_monitor_pin = 64 -eqSS_hythread_monitor_unpin = 64 - #CODE32 SEGMENT FLAT PUBLIC 'CODE' - #assume cs:flat,ds:flat,ss:flat - #CODE32 ends - #CODE32 SEGMENT FLAT PUBLIC 'CODE' - #assume cs:flat,ds:flat,ss:flat - .globl hythread_monitor_pin - .type hythread_monitor_pin,@function - .globl current_stack_depth - .type current_stack_depth,@function - .globl hythread_monitor_unpin - .type hythread_monitor_unpin,@function - - .text - .align 4 -current_stack_depth: - push %ebp - mov %esp, %ebp - push %esi - push %edi - push %ebx - sub $64, %esp - movl %ebp, %ebx - jmp .L2 -.L1: - movl %ecx, %ebx -.L2: - movl (%ebx), %ecx - testl %ecx, %ecx ## setFlags: true - jnz .L1 - subl %ebp, %ebx - movl %ebx, %ecx - movl %ebx, %eax ## RegReg opt - add $64, %esp - pop %ebx - pop %edi - pop %esi - pop %ebp - ret -END_current_stack_depth: - .size current_stack_depth,END_current_stack_depth - current_stack_depth - -## Prototype: void hythread_monitor_pin( hythread_monitor_t monitor, hythread_t osThread); -## Defined in: #THREAD Args: 2 - - .text - .align 4 -hythread_monitor_pin: - push %ebp - mov %esp, %ebp - push %esi - push %edi - push %ebx - sub $64, %esp - movl (eqSRS_hythread_monitor_pin+0+8+eqSS_hythread_monitor_pin)(%esp), %ebx - movl (eqSRS_hythread_monitor_pin+0+4+eqSS_hythread_monitor_pin)(%esp), %ebx - lock - incl eq_HyThreadMonitor_pinCount(%ebx) ## (Converted add 1 to inc) - add $64, %esp - pop %ebx - pop %edi - pop %esi - pop %ebp - ret -END_hythread_monitor_pin: - .size hythread_monitor_pin,END_hythread_monitor_pin - hythread_monitor_pin - -## Prototype: void hythread_monitor_unpin( hythread_monitor_t monitor, hythread_t osThread); -## Defined in: #THREAD Args: 2 - - .text - .align 4 -hythread_monitor_unpin: - push %ebp - mov %esp, %ebp - push %esi - push %edi - push %ebx - sub $64, %esp - movl (eqSS_hythread_monitor_unpin+0+8+eqSRS_hythread_monitor_unpin)(%esp), %ebx - movl (eqSS_hythread_monitor_unpin+0+eqSRS_hythread_monitor_unpin+4)(%esp), %ebx - lock - decl eq_HyThreadMonitor_pinCount(%ebx) ## (Converted subtract 1 to dec) - add $64, %esp - pop %ebx - pop %edi - pop %esi - pop %ebp - ret -END_hythread_monitor_unpin: - .size hythread_monitor_unpin,END_hythread_monitor_unpin - hythread_monitor_unpin - - #CODE32 ends - # end of file Index: modules/luni/src/main/native/thread/linux/makefile =================================================================== --- modules/luni/src/main/native/thread/linux/makefile (revision 430291) +++ modules/luni/src/main/native/thread/linux/makefile (working copy) @@ -21,7 +21,7 @@ CFLAGS += -fpic BUILDFILES = \ - $(SHAREDSUB)thread_copyright.o thrhelp.o thrspinlock.o hythread.o \ + $(SHAREDSUB)thread_copyright.o $(HY_ARCH)/thrhelp.o $(HY_ARCH)/thrspinlock.o hythread.o \ $(SHAREDSUB)hythreadinspect.o linuxonexit.o priority.o rasthrsup.o \ $(SHAREDSUB)rwmutex.o thrcreate.o thrdsup.o $(SHAREDSUB)thrprof.o Index: modules/luni/src/main/native/fdlibm/linux/makefile =================================================================== --- modules/luni/src/main/native/fdlibm/linux/makefile (revision 430291) +++ modules/luni/src/main/native/fdlibm/linux/makefile (working copy) @@ -44,7 +44,7 @@ $(FDLIBM_DIST)w_scalb.o $(FDLIBM_DIST)w_sinh.o $(FDLIBM_DIST)w_sqrt.o # CFLAGS are overriden not just appended to -CFLAGS= -O0 -DLINUX -D_REENTRANT -DIPv6_FUNCTION_SUPPORT -DHYX86 -D_IEEE_LIBM \ +CFLAGS= -O0 -fpic -DLINUX -D_REENTRANT -DIPv6_FUNCTION_SUPPORT -DHYX86 -D_IEEE_LIBM \ -DHY_PLATFORM_DOUBLE_ORDER \ -I. -I$(SHAREDSUB) -I$(HY_HDK)/include -I$(HY_HDK)/jdk/include \ -ffloat-store $(VMDEBUG) Index: make/properties.xml =================================================================== --- make/properties.xml (revision 430291) +++ make/properties.xml (working copy) @@ -55,7 +55,7 @@ - + @@ -69,13 +69,13 @@ - + - + @@ -85,10 +85,24 @@ - + + + + - + + + + + + + + + + + + @@ -223,6 +237,9 @@ executable="${make.command}" dir="@{dir}"> + + +