Author: mturk Date: Sat Oct 17 13:45:29 2009 New Revision: 826250 URL: http://svn.apache.org/viewvc?rev=826250&view=rev Log: Use cc for compiling asembly code so we can use pre processor
Added: commons/sandbox/runtime/trunk/src/main/native/os/darwin/arch.S commons/sandbox/runtime/trunk/src/main/native/os/hpux/arch.S commons/sandbox/runtime/trunk/src/main/native/os/linux/arch.S Removed: commons/sandbox/runtime/trunk/src/main/native/os/darwin/arch_i386.S commons/sandbox/runtime/trunk/src/main/native/os/darwin/arch_ppc.S commons/sandbox/runtime/trunk/src/main/native/os/darwin/arch_ppc64.S commons/sandbox/runtime/trunk/src/main/native/os/darwin/arch_x86_64.S commons/sandbox/runtime/trunk/src/main/native/os/hpux/arch_ia32.S commons/sandbox/runtime/trunk/src/main/native/os/hpux/arch_ia64.S commons/sandbox/runtime/trunk/src/main/native/os/hpux/arch_parisc.S commons/sandbox/runtime/trunk/src/main/native/os/hpux/arch_parisc64.S commons/sandbox/runtime/trunk/src/main/native/os/linux/arch_i386.S commons/sandbox/runtime/trunk/src/main/native/os/linux/arch_ia32.S commons/sandbox/runtime/trunk/src/main/native/os/linux/arch_ia64.S commons/sandbox/runtime/trunk/src/main/native/os/linux/arch_ppc.S commons/sandbox/runtime/trunk/src/main/native/os/linux/arch_ppc64.S commons/sandbox/runtime/trunk/src/main/native/os/linux/arch_x86_64.S Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.in commons/sandbox/runtime/trunk/src/main/native/configure Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.in URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/Makefile.in?rev=826250&r1=826249&r2=826250&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/Makefile.in (original) +++ commons/sandbox/runtime/trunk/src/main/native/Makefile.in Sat Oct 17 13:45:29 2009 @@ -142,7 +142,7 @@ $(SRCDIR)/os/unix/uuid.$(OBJ) \ $(SRCDIR)/os/unix/uutils.$(OBJ) \ $(SRCDIR)/os/linux/atomics.$(OBJ) \ - $(SRCDIR)/os/linux/arch_$(MACH).$(OBJ) \ + $(SRCDIR)/os/linux/arch.$(OBJ) \ $(SRCDIR)/os/linux/cpu.$(OBJ) \ $(SRCDIR)/os/linux/env.$(OBJ) \ $(SRCDIR)/os/linux/execmem.$(OBJ) \ @@ -212,7 +212,7 @@ $(SRCDIR)/os/unix/uuid.$(OBJ) \ $(SRCDIR)/os/unix/uutils.$(OBJ) \ $(SRCDIR)/os/darwin/atomics.$(OBJ) \ - $(SRCDIR)/os/darwin/arch_$(MACH).$(OBJ) \ + $(SRCDIR)/os/darwin/arch.$(OBJ) \ $(SRCDIR)/os/darwin/cpu.$(OBJ) \ $(SRCDIR)/os/darwin/env.$(OBJ) \ $(SRCDIR)/os/darwin/platform.$(OBJ) \ @@ -247,7 +247,7 @@ $(SRCDIR)/os/unix/uuid.$(OBJ) \ $(SRCDIR)/os/unix/uutils.$(OBJ) \ $(SRCDIR)/os/hpux/atomics.$(OBJ) \ - $(SRCDIR)/os/hpux/arch_$(MACH).$(OBJ) \ + $(SRCDIR)/os/hpux/arch.$(OBJ) \ $(SRCDIR)/os/hpux/cpu.$(OBJ) \ $(SRCDIR)/os/hpux/env.$(OBJ) \ $(SRCDIR)/os/hpux/group.$(OBJ) \ Modified: commons/sandbox/runtime/trunk/src/main/native/configure URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/configure?rev=826250&r1=826249&r2=826250&view=diff ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/configure (original) +++ commons/sandbox/runtime/trunk/src/main/native/configure Sat Oct 17 13:45:29 2009 @@ -428,14 +428,17 @@ ;; esac +mcpu="_`toupper $mach`_" case "$host-$cc" in linux-gcc ) varadds cppopts -DLINUX=2 -D_GNU_SOURCE - varadds cppopts -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED + varadds cppopts -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED -D$mcpu varadds ccflags -fPIC -O3 -Wall -g + varadds asflags -c -fPIC -g -D$mcpu varadds ldflags -lrt -lpthread -ldl varadds shflags -shared -fPIC -Wl,-soname '-Wl,??@' varadds exflags '-Wl,-rpath,??(PREFIX)/??(LIBDIR):????ORIGIN' + as=gcc test ".$java_pinc" = . && java_pinc=linux ;; linux-cc ) @@ -443,8 +446,9 @@ varadds ccflags -fast -xbuiltin=none -U__MATHERR_ERRNO_DONTCARE -xnolibmopt -xnolibmil fi varadds cppopts -D_LINUX=2 -D_GNU_SOURCE - varadds cppopts -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED + varadds cppopts -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED -D$mcpu varadds ccflags -xstrconst -xdepend -O -Xa -KPIC + varadds asflags -c -KPIC -D$mcpu varadds ldflags -lpthread -ldl varadds shflags -G -KPIC -dy varadds exflags '-R:??(PREFIX)/??(LIBDIR):.' @@ -455,12 +459,14 @@ ;; darwin-gcc ) r="`uname -r | sed 's/\.//g'`" - varadds cppopts -DDARWIN=$r + varadds cppopts -DDARWIN=$r -D$mcpu varadds ccflags -fPIC -O3 -g + varadds asflags -c -fPIC -g -D$mcpu varadds ldflags -lpthread -ldl varadds exflags '-Wl,-rpath,??(PREFIX)/??(LIBDIR):.' if [ ".$has_jni" = .yes ]; then so=".jnilib"; else so=".dynlib"; fi varadds shflags -dynamiclib -flat_namespace -undefined suppress -fPIC -Wl,-dylib_install_name '-Wl,??@' + as=gcc ;; solaris-cc ) r="`uname -r | sed 's/5.//'`" @@ -471,7 +477,7 @@ varadds ccflags -fast -xbuiltin=none -U__MATHERR_ERRNO_DONTCARE -xnolibmopt -xnolibmil test ".$bits" = .64 && varadds asflags -xarch=amd64 fi - varadds cppopts -DSOLARIS2=$r + varadds cppopts -DSOLARIS2=$r -D$mcpu if [ ".$has_native_threads" = .yes ]; then varadds ccflags -mt varadds cppopts -DHAS_NATIVE_THREADS @@ -489,19 +495,21 @@ ;; hpux-cc ) r="`uname -r | sed 's/[A-Z].[0-9]*.//'`" - varadds cppopts -D_HPUX_SOURCE -DHPUX11=$r + varadds cppopts -D_HPUX_SOURCE -DHPUX11=$r -D$mcpu varadds ccflags -Ae +O2 -z +Z + varadds asflags -c +Z -D$mcpu varadds ldflags -lrt -lpthread -ldld -lm varadds shflags +Z -b varadds asflags +Z + as=cc test ".$mach" = .parisc && so=.sl test ".$java_pinc" = . && java_pinc=hp-ux ;; windows-cl ) - varadds asflags -nologo -DWIN32 -DWINNT -D_WIN32 + varadds asflags -nologo -DWIN32 -DWINNT -D_WIN32 -D$mcpu varadds ccflags -nologo -O2 -Ob2 -Oy- -Zi -D_MD -MD -W3 varadds cppopts -DWIN32 -DWINNT -D_WIN32 -D_WINDOWS -D_WINNT - varadds cppopts -D_WIN32_WINNT=0x0501 -D_WIN32_IE=0x0600 + varadds cppopts -D_WIN32_WINNT=0x0501 -D_WIN32_IE=0x0600 -D$mcpu varadds cxxopts -TP varadds ldflags kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib varadds ldflags shell32.lib rpcrt4.lib user32.lib gdi32.lib userenv.lib wtsapi32.lib @@ -521,7 +529,7 @@ ;; aix-gcc ) r="`uname -v``uname -r`" - varadds cppopts -DAIX=$r -U__STR__ -D_THREAD_SAFE -D_USE_IRS + varadds cppopts -DAIX=$r -U__STR__ -D_THREAD_SAFE -D_USE_IRS -D$mcpu varadds ccflags -fPIC -O2 -g -pthread varadds ldflags -lrt -lpthreads -lnsl varadds shflags -shared -fPIC -Wl,-soname '-Wl,??@' -Wl,-brtl @@ -562,16 +570,19 @@ case "$host$bits-$cc" in hpux64-cc ) varadds ccflags +DD64 + varadds asflags +DD64 varadds shflags +DD64 varadds exflags +DD64 if [ ".$mach" = .parisc64 ]; then varadds ccflags +DA2.0W + varadds asflags +DA2.0W varadds exflags +DA2.0W varadds asflags +DA2.0W fi ;; hpux32-cc ) varadds ccflags +DD32 + varadds asflags +DD32 varadds shflags +DD32 varadds exflags +DD32 ;; @@ -597,27 +608,18 @@ ;; *64-* ) varadds ccflags -m64 + varadds asflags -m64 varadds shflags -m64 varadds exflags -m64 ;; *32-* ) varadds ccflags -m32 + varadds asflags -m32 varadds shflags -m32 varadds exflags -m32 ;; esac -case "$host$bits-$cc" in - darwin* ) - varadds asflags -arch $mach - ;; - *64-gcc ) - varadds asflags --64 - ;; - *32-gcc ) - varadds asflags --32 - ;; -esac $EECHO "Configuring \033[1mApache Commons Runtime $vmajor.$vminor.$vpatch\033[0m. for $host$bits-$cc" echo "" Added: commons/sandbox/runtime/trunk/src/main/native/os/darwin/arch.S URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/darwin/arch.S?rev=826250&view=auto ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/os/darwin/arch.S (added) +++ commons/sandbox/runtime/trunk/src/main/native/os/darwin/arch.S Sat Oct 17 13:45:29 2009 @@ -0,0 +1,53 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. + */ + + .text + .align 4 +#if defined(_XI386_) +/* + * extern acr_uint32_t acr_AtomicAdd32(acr_atomic32_t *, acr_uint32_t) + */ + .globl _acr_AtomicAdd32 +_acr_AtomicAdd32: + movl 4(%esp), %ecx + movl 8(%esp), %eax + movl %eax, %edx + + lock /* ; lock the bus */ + xaddl %eax, (%ecx) /* ; tmp = *dst */ + /* ; dst += inc */ + /* ; %eax = tmp */ + + addl %edx, %eax /* ; return %eax + inc */ + ret +#elif defined(_X86_64_) +/* + * extern acr_uint32_t acr_AtomicAdd32(acr_atomic32_t *, acr_uint32_t) + */ + .globl _acr_AtomicAdd32 +_acr_AtomicAdd32: + movq %rdi, %rcx /* ; %rcx = dst */ + movl %esi, %edx /* ; %edx = inc */ + movl %edx, %eax /* ; */ + + lock /* ; lock the bus */ + xaddl %eax, (%rcx) /* ; tmp = *dst */ + /* ; dst += inc */ + /* ; %eax = tmp */ + + addl %edx, %eax /* ; return %eax + inc */ + ret +#endif Added: commons/sandbox/runtime/trunk/src/main/native/os/hpux/arch.S URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/hpux/arch.S?rev=826250&view=auto ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/os/hpux/arch.S (added) +++ commons/sandbox/runtime/trunk/src/main/native/os/hpux/arch.S Sat Oct 17 13:45:29 2009 @@ -0,0 +1,83 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. + */ + + .text +#if defined(_IA32_) + .psr abi32 + .psr msb + + +/* + * extern acr_uint32_t acr_AtomicAdd32(acr_atomic32_t *, acr_uint32_t); + */ + .global acr_AtomicAdd32 + .proc acr_AtomicAdd32 +acr_AtomicAdd32: + + .prologue + .body + mf + addp4 r9 = 0, r32 // Needed to be able to dereference a 32 bit pointer + ;; + ld4.acq r15 = [r9] + nop 0 + ;; +.add32_busywait: + mov ar.ccv = r15 + add r8 = r15, r33 + mov r2 = r15 + ;; + nop 0 + cmpxchg4.acq r15 = [r9], r8, ar.ccv + nop 0 + ;; + cmp4.ne p8, p9 = r2, r15 + (p9) br.ret.dpnt.many rp + br .add32_busywait + + .endp acr_AtomicAdd32 +#elif defined(_IA64_) + .align 16 + +/* + * extern acr_uint32_t acr_AtomicAdd32(acr_atomic32_t *, acr_uint32_t); + */ + + .global _acr_AtomicAdd32 + .proc acr_AtomicAdd32 +acr_AtomicAdd32: + + .prologue + .body + mf + ld4.acq r15 = [r32] + nop 0 + ;; +.add32_busywait: + mov ar.ccv = r15 + add r8 = r15, r33 + mov r2 = r15 + ;; + nop 0 + cmpxchg4.acq r15 = [r32], r8, ar.ccv + nop 0 + ;; + cmp4.ne p8, p9 = r2, r15 + (p9) br.ret.dpnt.many rp + br .add32_busywait + + .endp acr_AtomicAdd32 +#endif Added: commons/sandbox/runtime/trunk/src/main/native/os/linux/arch.S URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/linux/arch.S?rev=826250&view=auto ============================================================================== --- commons/sandbox/runtime/trunk/src/main/native/os/linux/arch.S (added) +++ commons/sandbox/runtime/trunk/src/main/native/os/linux/arch.S Sat Oct 17 13:45:29 2009 @@ -0,0 +1,127 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. + */ + + .text + +#if defined(_XI386_) + .align 8 + +/* + * extern acr_uint32_t acr_AtomicAdd32(acr_atomic32_t *, acr_uint32_t) + */ + .globl acr_AtomicAdd32 + .type acr_AtomicAdd32, @function +acr_AtomicAdd32: + movl 4(%esp), %ecx + movl 8(%esp), %eax + movl %eax, %edx + + lock /* ; lock the bus */ + xaddl %eax, (%ecx) /* ; tmp = *dst */ + /* ; dst += inc */ + /* ; %eax = tmp */ + + addl %edx, %eax /* ; return %eax + inc */ + ret + +#elif defined(_X86_64_) + .align 16 + +/* + * extern acr_uint32_t acr_AtomicAdd32(acr_atomic32_t *, acr_uint32_t) + */ + .globl acr_AtomicAdd32 + .type acr_AtomicAdd32, @function +acr_AtomicAdd32: + movq %rdi, %rcx /* ; %rcx = dst */ + movl %esi, %edx /* ; %edx = inc */ + movl %edx, %eax /* ; */ + + lock /* ; lock the bus */ + xaddl %eax, (%rcx) /* ; tmp = *dst */ + /* ; dst += inc */ + /* ; %eax = tmp */ + + addl %edx, %eax /* ; return %eax + inc */ + ret + +#elif defined(_IA32_) + .psr abi32 + .psr msb + + +/* + * extern acr_uint32_t acr_AtomicAdd32(acr_atomic32_t *, acr_uint32_t); + */ + .global acr_AtomicAdd32 + .proc acr_AtomicAdd32 +acr_AtomicAdd32: + + .prologue + .body + mf + addp4 r9 = 0, r32 // Needed to be able to dereference a 32 bit pointer + ;; + ld4.acq r15 = [r9] + nop 0 + ;; +.add32_busywait: + mov ar.ccv = r15 + add r8 = r15, r33 + mov r2 = r15 + ;; + nop 0 + cmpxchg4.acq r15 = [r9], r8, ar.ccv + nop 0 + ;; + cmp4.ne p8, p9 = r2, r15 + (p9) br.ret.dpnt.many rp + br .add32_busywait + + .endp acr_AtomicAdd32 +#elif defined(_IA64_) + .align 16 + +/* + * extern acr_uint32_t acr_AtomicAdd32(acr_atomic32_t *, acr_uint32_t); + */ + + .global _acr_AtomicAdd32 + .proc acr_AtomicAdd32 +acr_AtomicAdd32: + + .prologue + .body + mf + ld4.acq r15 = [r32] + nop 0 + ;; +.add32_busywait: + mov ar.ccv = r15 + add r8 = r15, r33 + mov r2 = r15 + ;; + nop 0 + cmpxchg4.acq r15 = [r32], r8, ar.ccv + nop 0 + ;; + cmp4.ne p8, p9 = r2, r15 + (p9) br.ret.dpnt.many rp + br .add32_busywait + + .endp acr_AtomicAdd32 + +#endif