? cscope.out ? patch-apple-alpha1 ? control/build ? j2se/cscope.out ? j2se/make/org/omg/sources/hs_err_pid73175.log ? j2se/make/org/omg/sources/hs_err_pid82991.log ? j2se/make/org/omg/sources/hs_err_pid92887.log ? j2se/make/org/omg/sources/hs_err_pid92989.log ? j2se/make/sun/javac/recompile/library/hs_err_pid50605.log Index: hotspot/build/bsd/Makefile =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/hotspot/build/bsd/Makefile,v retrieving revision 1.2 diff -u -u -r1.2 Makefile --- hotspot/build/bsd/Makefile 29 Mar 2007 16:44:39 -0000 1.2 +++ hotspot/build/bsd/Makefile 5 Nov 2007 05:28:51 -0000 @@ -40,6 +40,9 @@ ifneq ($(findstring BSD,$(OS)),) OS=bsd endif +ifneq ($(findstring Darwin,$(OS)),) + OS=bsd +endif include $(GAMMADIR)/build/$(OS)/makefiles/rules.make Index: hotspot/build/bsd/makefiles/buildtree.make =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/hotspot/build/bsd/makefiles/buildtree.make,v retrieving revision 1.3 diff -u -u -r1.3 buildtree.make --- hotspot/build/bsd/makefiles/buildtree.make 11 Oct 2007 14:17:43 -0000 1.3 +++ hotspot/build/bsd/makefiles/buildtree.make 5 Nov 2007 05:28:51 -0000 @@ -201,10 +201,11 @@ [ -n "$$JAVA_HOME" ] && { echo ": \$${JAVA_HOME:=$${JAVA_HOME}}"; }; \ { \ echo "LD_LIBRARY_PATH=.:$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}\$${JAVA_HOME}/jre/lib/${LIBARCH}/native_threads:\$${JAVA_HOME}/jre/lib/${LIBARCH}:${GCC_LIB}"; \ + echo "DYLD_LIBRARY_PATH=.:$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}\$${JAVA_HOME}/jre/lib/${LIBARCH}/native_threads:\$${JAVA_HOME}/jre/lib/${LIBARCH}:${GCC_LIB}"; \ echo "CLASSPATH=$${CLASSPATH:+$$CLASSPATH:}.:\$${JAVA_HOME}/jre/lib/rt.jar:\$${JAVA_HOME}/jre/lib/i18n.jar"; \ } | sed s:$${JAVA_HOME:--------}:\$${JAVA_HOME}:g; \ echo "HOTSPOT_BUILD_USER=\"$${LOGNAME:-$$USER} in `basename $(GAMMADIR)`\""; \ - echo "export JAVA_HOME LD_LIBRARY_PATH CLASSPATH HOTSPOT_BUILD_USER"; \ + echo "export JAVA_HOME LD_LIBRARY_PATH DYLD_LIBRARY_PATH CLASSPATH HOTSPOT_BUILD_USER"; \ ) > $@ env.csh: env.sh @@ -252,6 +253,9 @@ WRONG_DATA_MODE_MSG = \ echo "JAVA_HOME must point to $(DATA_MODE)bit JDK." +# XXXDARWIN Temporarily disabled test_gamma to see how far we can get into +# the build/bootstrap +#echo './$${gamma:-gamma} $(TESTFLAGS) Queens < /dev/null'; \ test_gamma: $(BUILDTREE_MAKE) @echo Creating $@ ... $(QUIETLY) ( \ @@ -265,7 +269,7 @@ echo "fi"; \ echo 'CLASSPATH="$(GAMMADIR)/build/linux:$$CLASSPATH"'; \ echo '[ -f gamma_g ] && { gamma=gamma_g; }'; \ - echo './$${gamma:-gamma} $(TESTFLAGS) Queens < /dev/null'; \ + echo 'exit 0'; \ ) > $@ $(QUIETLY) chmod +x $@ Index: hotspot/build/bsd/makefiles/gcc.make =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/hotspot/build/bsd/makefiles/gcc.make,v retrieving revision 1.4 diff -u -u -r1.4 gcc.make --- hotspot/build/bsd/makefiles/gcc.make 17 May 2007 15:20:53 -0000 1.4 +++ hotspot/build/bsd/makefiles/gcc.make 5 Nov 2007 05:28:51 -0000 @@ -28,6 +28,8 @@ #------------------------------------------------------------------------ # Compiler flags +UNAME.s := $(shell uname -s) + # position-independent code PICFLAG = -fPIC @@ -36,10 +38,19 @@ VM_PICFLAG = $(VM_PICFLAG/$(LINK_INTO)) +# Always build Darwin JVM with debug symbols, for now. +ifeq (Darwin, $(UNAME.s)) +CFLAGS += -g +endif + CFLAGS += $(VM_PICFLAG) CFLAGS += -fno-rtti CFLAGS += -fno-exceptions + +ifneq ($(findstring BSD,$(UNAME.s)),) CFLAGS += -pthread +endif + CFLAGS += -fcheck-new ARCHFLAG = $(ARCHFLAG/$(BUILDARCH)) @@ -103,6 +114,11 @@ LFLAGS += -Wl,-relax endif +# +# BSD Shared Library +# +ifneq ($(findstring BSD,$(UNAME.s)),) + # Enable linker optimization LFLAGS += -Xlinker -O1 @@ -116,7 +132,28 @@ SHARED_FLAG = -shared $(VM_PICFLAG) # Keep symbols even they are not used -AOUT_FLAGS += -export-dynamic +#AOUT_FLAGS += -export-dynamic +endif + +# +# Darwin Shared Library +# +ifeq (Darwin, $(UNAME.s)) +# Standard linker flags +LFLAGS += + +# Darwin doesn't use ELF and doesn't support version scripts +MAPFLAG = + +# Use $(SONAMEFLAG:SONAME=soname) to specify the intrinsic name of a shared obj +SONAMEFLAG = + +# Build shared library +SHARED_FLAG = -dynamiclib $(VM_PICFLAG) + +# Keep symbols even they are not used +#AOUT_FLAGS += -export-dynamic +endif #------------------------------------------------------------------------ # Debug flags Index: hotspot/build/bsd/makefiles/jsig.make =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/hotspot/build/bsd/makefiles/jsig.make,v retrieving revision 1.2 diff -u -u -r1.2 jsig.make --- hotspot/build/bsd/makefiles/jsig.make 29 Apr 2007 13:14:37 -0000 1.2 +++ hotspot/build/bsd/makefiles/jsig.make 5 Nov 2007 05:28:51 -0000 @@ -9,7 +9,14 @@ # libjsig[_g].so: signal interposition library JSIG = jsig$(G_SUFFIX) -LIBJSIG = lib$(JSIG).so + +UNAME.s := $(shell uname -s) + +ifeq (Darwin, $(UNAME.s)) + LIBJSIG = lib$(JSIG).dylib +else + LIBJSIG = lib$(JSIG).so +endif JSIGSRCDIR = $(GAMMADIR)/src/os/$(Platform_os_family)/vm Index: hotspot/build/bsd/makefiles/launcher.make =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/hotspot/build/bsd/makefiles/launcher.make,v retrieving revision 1.1 diff -u -u -r1.1 launcher.make --- hotspot/build/bsd/makefiles/launcher.make 18 Mar 2007 17:32:38 -0000 1.1 +++ hotspot/build/bsd/makefiles/launcher.make 5 Nov 2007 05:28:51 -0000 @@ -27,7 +27,7 @@ LIBS_LAUNCHER += $(STATIC_STDCXX) $(LIBS) else LAUNCHER.o = launcher.o - LFLAGS_LAUNCHER += -L `pwd` + LFLAGS_LAUNCHER += -L`pwd` LIBS_LAUNCHER += -l$(JVM) $(LIBS) endif Index: hotspot/build/bsd/makefiles/vm.make =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/hotspot/build/bsd/makefiles/vm.make,v retrieving revision 1.4 diff -u -u -r1.4 vm.make --- hotspot/build/bsd/makefiles/vm.make 17 May 2007 15:20:13 -0000 1.4 +++ hotspot/build/bsd/makefiles/vm.make 5 Nov 2007 05:28:51 -0000 @@ -80,9 +80,15 @@ #---------------------------------------------------------------------- # JVM +# +UNAME.s := $(shell uname -s) JVM = jvm$(G_SUFFIX) +ifeq (Darwin, $(UNAME.s)) +LIBJVM = lib$(JVM).dylib +else LIBJVM = lib$(JVM).so +endif JVM_OBJ_FILES = $(Obj_Files) Index: hotspot/make/Makefile =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/hotspot/make/Makefile,v retrieving revision 1.4 diff -u -u -r1.4 Makefile --- hotspot/make/Makefile 1 Apr 2007 21:09:50 -0000 1.4 +++ hotspot/make/Makefile 5 Nov 2007 05:28:51 -0000 @@ -108,9 +108,20 @@ # Windows should have OS predefined ifeq ($(OS),) OS:=$(shell uname -s) + OS_VENDOR:=$(OS) ifneq ($(findstring BSD,$(OS)),) OS=bsd endif + ifeq (Darwin,$(OS)) + OS=bsd + endif +endif + +# Library suffix +ifeq ($(OS_VENDOR),Darwin) + LIBRARY_SUFFIX=dylib +else + LIBRARY_SUFFIX=so endif # If not SunOS, not Linux and not BSD, assume Windows @@ -456,17 +467,19 @@ EXPORT_LIST += $(EXPORT_LIB_DIR)/sa-jdi.jar endif + ifeq ($(OSNAME),bsd) EXPORT_LIST += $(EXPORT_DOCS_DIR)/platform/jvmti/jvmti.html EXPORT_SERVER_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/server EXPORT_LIST += $(EXPORT_SERVER_DIR)/Xusage.txt - EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjsig.so - EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.so + EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjsig.$(LIBRARY_SUFFIX) + EXPORT_LIST += $(EXPORT_SERVER_DIR)/libjvm.$(LIBRARY_SUFFIX) + ifeq ($(ARCH_DATA_MODEL), 32) EXPORT_CLIENT_DIR = $(EXPORT_JRE_LIB_ARCH_DIR)/client EXPORT_LIST += $(EXPORT_CLIENT_DIR)/Xusage.txt - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjsig.so - EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.so + EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjsig.$(LIBRARY_SUFFIX) + EXPORT_LIST += $(EXPORT_CLIENT_DIR)/libjvm.$(LIBRARY_SUFFIX) endif ifneq ($(ARCH),ia64) # FIXME: Reenable when SA builds correctly. @@ -619,15 +632,15 @@ # Shared Library ifneq ($(OSNAME),windows) -$(EXPORT_JRE_LIB_ARCH_DIR)/%.so: $(C2_DIR)/%.so +$(EXPORT_JRE_LIB_ARCH_DIR)/%.$(LIBRARY_SUFFIX): $(C2_DIR)/%.$(LIBRARY_SUFFIX) $(install-file) -$(EXPORT_CLIENT_DIR)/%.so: $(C1_DIR)/%.so +$(EXPORT_CLIENT_DIR)/%.$(LIBRARY_SUFFIX): $(C1_DIR)/%.$(LIBRARY_SUFFIX) $(install-file) -$(EXPORT_CLIENT_DIR)/64/%.so: $(C1_DIR)/%.so +$(EXPORT_CLIENT_DIR)/64/%.$(LIBRARY_SUFFIX): $(C1_DIR)/%.$(LIBRARY_SUFFIX) $(install-file) -$(EXPORT_SERVER_DIR)/%.so: $(C2_DIR)/%.so +$(EXPORT_SERVER_DIR)/%.$(LIBRARY_SUFFIX): $(C2_DIR)/%.$(LIBRARY_SUFFIX) $(install-file) -$(EXPORT_SERVER_DIR)/64/%.so: $(C2_DIR)/%.so +$(EXPORT_SERVER_DIR)/64/%.$(LIBRARY_SUFFIX): $(C2_DIR)/%.$(LIBRARY_SUFFIX) $(install-file) endif Index: hotspot/src/os/bsd/launcher/java_md.c =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/hotspot/src/os/bsd/launcher/java_md.c,v retrieving revision 1.1 diff -u -u -r1.1 java_md.c --- hotspot/src/os/bsd/launcher/java_md.c 28 Mar 2007 05:50:00 -0000 1.1 +++ hotspot/src/os/bsd/launcher/java_md.c 5 Nov 2007 05:28:51 -0000 @@ -28,9 +28,17 @@ #include "version_comp.h" #endif +#ifdef __APPLE__ +#define JVM_DLL "libjvm.dylib" +#define JVM_G_DLL "libjvm_g.dylib" +#define JAVA_DLL "libjava.jnilib" +#define LD_LIBRARY_PATH "DYLD_LIBRARY_PATH" +#else #define JVM_DLL "libjvm.so" #define JVM_G_DLL "libjvm_g.so" #define JAVA_DLL "libjava.so" +#define LD_LIBRARY_PATH "LD_LIBRARY_PATH" +#endif #ifndef GAMMA /* launcher.make defines ARCH */ @@ -440,7 +448,7 @@ * If not on Solaris, assume only a single LD_LIBRARY_PATH * variable. */ - runpath = getenv("LD_LIBRARY_PATH"); + runpath = getenv(LD_LIBRARY_PATH); #endif /* __sun */ #ifdef _ALLBSD_SOURCE @@ -467,7 +475,7 @@ new_runpath = MemAlloc( ((runpath!=NULL)?strlen(runpath):0) + 2*strlen(jrepath) + 2*strlen(arch) + strlen(jvmpath) + 52); - newpath = new_runpath + strlen("LD_LIBRARY_PATH="); + newpath = new_runpath + strlen(LD_LIBRARY_PATH "="); /* @@ -482,7 +490,7 @@ /* jvmpath, ((running != wanted)?((wanted==64)?"/"BIG_ARCH:"/.."):""), */ - sprintf(new_runpath, "LD_LIBRARY_PATH=" + sprintf(new_runpath, LD_LIBRARY_PATH "=" "%s:" "%s/lib/%s:" "%s/../lib/%s", @@ -690,6 +698,15 @@ char libjava[MAXPATHLEN]; if (GetApplicationHome(path, pathsize)) { + +#ifdef __APPLE__ + /* Try finding the Framework version */ + sprintf(libjava, "%s/../Libraries/" JAVA_DLL, path); + if (access(libjava, F_OK) == 0) { + goto found; + } +#endif + /* Is JRE co-located with the application? */ sprintf(libjava, "%s/lib/%s/" JAVA_DLL, path, arch); if (access(libjava, F_OK) == 0) { Index: hotspot/src/os/bsd/vm/hpi_bsd.cpp =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/hotspot/src/os/bsd/vm/hpi_bsd.cpp,v retrieving revision 1.1 diff -u -u -r1.1 hpi_bsd.cpp --- hotspot/src/os/bsd/vm/hpi_bsd.cpp 28 Mar 2007 04:52:28 -0000 1.1 +++ hotspot/src/os/bsd/vm/hpi_bsd.cpp 5 Nov 2007 05:28:51 -0000 @@ -12,6 +12,14 @@ # include # include +#ifdef __APPLE__ +#define HPI_LIB "libhpi.dylib" +#define HPI_G_LIB "libhpi.dylib" +#else +#define HPI_LIB "libhpi.so" +#define HPI_G_LIB "libhpi.so" +#endif + typedef jint (JNICALL *init_t)(GetInterfaceFunc *, void *); void hpi::initialize_get_interface(vm_calls_t *callbacks) @@ -30,11 +38,11 @@ os::jvm_path(buf, JVM_MAXPATHLEN); #ifdef PRODUCT - const char * hpi_lib = "/libhpi.so"; + const char * hpi_lib = "/" HPI_LIB; #else char * ptr = strrchr(buf, '/'); assert(strstr(ptr, "/libjvm") == ptr, "invalid library name"); - const char * hpi_lib = strstr(ptr, "_g") ? "/libhpi_g.so" : "/libhpi.so"; + const char * hpi_lib = strstr(ptr, "_g") ? "/" HPI_G_LIB : "/" HPI_LIB; #endif *(strrchr(buf, '/')) = '\0'; /* get rid of /libjvm.so */ Index: hotspot/src/os/bsd/vm/jvm_bsd.h =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/hotspot/src/os/bsd/vm/jvm_bsd.h,v retrieving revision 1.2 diff -u -u -r1.2 jvm_bsd.h --- hotspot/src/os/bsd/vm/jvm_bsd.h 11 May 2007 16:15:06 -0000 1.2 +++ hotspot/src/os/bsd/vm/jvm_bsd.h 5 Nov 2007 05:28:51 -0000 @@ -35,7 +35,11 @@ #define AGENT_ONATTACH_SYMBOLS {"Agent_OnAttach"} #define JNI_LIB_PREFIX "lib" +#ifdef __APPLE__ +#define JNI_LIB_SUFFIX ".dylib" +#else #define JNI_LIB_SUFFIX ".so" +#endif // Hack: MAXPATHLEN is 4095 on some Bsd and 4096 on others. This may // cause problems if JVM and the rest of JDK are built on different Index: hotspot/src/os/bsd/vm/os_bsd.cpp =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/hotspot/src/os/bsd/vm/os_bsd.cpp,v retrieving revision 1.7 diff -u -u -r1.7 os_bsd.cpp --- hotspot/src/os/bsd/vm/os_bsd.cpp 14 Aug 2007 17:07:42 -0000 1.7 +++ hotspot/src/os/bsd/vm/os_bsd.cpp 5 Nov 2007 05:28:51 -0000 @@ -40,7 +40,10 @@ #endif # include # include + +#ifndef __APPLE__ # include +#endif #if defined(__FreeBSD__) || defined(__NetBSD__) # include @@ -455,7 +458,11 @@ * should always exist (until the legacy problem cited above is * addressed). */ +#ifdef __APPLE__ + char *v = getenv("DYLD_LIBRARY_PATH"); +#else char *v = getenv("LD_LIBRARY_PATH"); +#endif if (v != NULL) { char *t = ld_library_path; /* That's +1 for the colon and +1 for the trailing '\0' */ @@ -1403,7 +1410,11 @@ #define CLOCK_MONOTONIC (1) #endif -#ifdef _ALLBSD_SOURCE +#ifdef __APPLE__ +void os::Bsd::clock_init() { + // Not supported +} +#elif defined(_ALLBSD_SOURCE) void os::Bsd::clock_init() { struct timespec res; struct timespec tp; @@ -1746,6 +1757,22 @@ // in case of error it checks if .dll/.so was built for the // same architecture as Hotspot is running on +#ifdef __APPLE__ +void * os::dll_load(const char *filename, char *ebuf, int ebuflen) { + void * result= ::dlopen(filename, RTLD_LAZY); + if (result != NULL) { + // Successful loading + return result; + } + + // Read system error message into ebuf + ::strncpy(ebuf, ::dlerror(), ebuflen-1); + ebuf[ebuflen-1]='\0'; + + /* XXXDARWIN: More verbose reporting? */ + return NULL; +} +#else void * os::dll_load(const char *filename, char *ebuf, int ebuflen) { void * result= ::dlopen(filename, RTLD_LAZY); @@ -1897,6 +1924,7 @@ return NULL; } +#endif @@ -2910,12 +2938,17 @@ OSReturn os::set_native_priority(Thread* thread, int newpri) { if ( !UseThreadPriorities || ThreadPriorityPolicy == 0 ) return OS_OK; +#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) + // XXXDARWIN Priorities will need to be mapped to mach thread priority, see: + // Using Mach Scheduling From User Applications + // http://www.devworld.apple.com/documentation/Darwin/Conceptual/KernelProgramming/scheduler/chapter_8_section_4.html -#if defined(__OpenBSD__) || defined(__NetBSD__) // OpenBSD pthread_setprio starves low priority threads return OS_OK; #elif defined(__FreeBSD__) int ret = pthread_setprio(thread->osthread()->pthread_id(), newpri); +#elif defined(__APPLE__) + #else int ret = setpriority(PRIO_PROCESS, thread->osthread()->thread_id(), newpri); return (ret == 0) ? OS_OK : OS_ERR; @@ -2931,7 +2964,8 @@ errno = 0; #if defined(__OpenBSD__) || defined(__FreeBSD__) *priority_ptr = pthread_getprio(thread->osthread()->pthread_id()); -#elif defined(__NetBSD__) +#elif defined(__NetBSD__) || defined(__APPLE__) + // XXXDARWIN Priority not handled *priority_ptr = 0; #else *priority_ptr = getpriority(PRIO_PROCESS, thread->osthread()->thread_id()); @@ -3533,7 +3567,7 @@ extern void report_error(char* file_name, int line_no, char* title, char* format, ...); -#if defined(__OpenBSD__) || defined(__FreeBSD__) +#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__APPLE__) const char * signames[] = { "SIG0", "SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGTRAP", Index: hotspot/src/os/bsd/vm/os_bsd.hpp =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/hotspot/src/os/bsd/vm/os_bsd.hpp,v retrieving revision 1.2 diff -u -u -r1.2 os_bsd.hpp --- hotspot/src/os/bsd/vm/os_bsd.hpp 28 Mar 2007 22:21:41 -0000 1.2 +++ hotspot/src/os/bsd/vm/os_bsd.hpp 5 Nov 2007 05:28:51 -0000 @@ -11,6 +11,11 @@ /* pthread_getattr_np comes with BsdThreads-0.9-7 on RedHat 7.1 */ typedef int (*pthread_getattr_func_type) (pthread_t, pthread_attr_t *); +#ifdef __APPLE__ +/* Mac OS X doesn't currently support clock_gettime. stub out the type(s) */ +typedef int clockid_t; +#endif + class Bsd { friend class os; Index: hotspot/src/os/bsd/vm/vmError_bsd.cpp =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/hotspot/src/os/bsd/vm/vmError_bsd.cpp,v retrieving revision 1.3 diff -u -u -r1.3 vmError_bsd.cpp --- hotspot/src/os/bsd/vm/vmError_bsd.cpp 9 Aug 2007 15:52:44 -0000 1.3 +++ hotspot/src/os/bsd/vm/vmError_bsd.cpp 5 Nov 2007 05:28:51 -0000 @@ -15,7 +15,13 @@ #include #include +/* Darwin has no "environ" in a dynamic library. */ +#ifdef __APPLE__ +#include +#define environ (*_NSGetEnviron()) +#else extern char** environ; +#endif #ifndef __NR_fork #define __NR_fork IA32_ONLY(2) IA64_ONLY(not defined) AMD64_ONLY(57) Index: hotspot/src/os_cpu/bsd_i486/vm/bsd_i486.s =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/hotspot/src/os_cpu/bsd_i486/vm/bsd_i486.s,v retrieving revision 1.1 diff -u -u -r1.1 bsd_i486.s --- hotspot/src/os_cpu/bsd_i486/vm/bsd_i486.s 28 Mar 2007 04:53:11 -0000 1.1 +++ hotspot/src/os_cpu/bsd_i486/vm/bsd_i486.s 5 Nov 2007 05:28:51 -0000 @@ -3,6 +3,18 @@ # Copyright 2004 Sun Microsystems, Inc. All rights reserved. # SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. # + +#ifdef __APPLE__ + +# // Darwin requires _ prefixed symbols +#define GLOBAL(s) _ ## s + +#else + +#define ELF_SYNTAX +#define GLOBAL(s) s + +#endif # NOTE WELL! The _Copy functions are called directly # from server-compiler-generated code via CallLeafNoFP, @@ -10,52 +22,65 @@ # point or use it in the same manner as does the server # compiler. - .globl fixcw - .globl _Copy_conjoint_bytes - .globl _Copy_arrayof_conjoint_bytes - .globl _Copy_conjoint_jshorts_atomic - .globl _Copy_arrayof_conjoint_jshorts - .globl _Copy_conjoint_jints_atomic - .globl _Copy_arrayof_conjoint_jints - .globl _Copy_conjoint_jlongs_atomic - .globl _mmx_Copy_arrayof_conjoint_jshorts + .globl GLOBAL(fixcw) + .globl GLOBAL(_Copy_conjoint_bytes) + .globl GLOBAL(_Copy_arrayof_conjoint_bytes) + .globl GLOBAL(_Copy_conjoint_jshorts_atomic) + .globl GLOBAL(_Copy_arrayof_conjoint_jshorts) + .globl GLOBAL(_Copy_conjoint_jints_atomic) + .globl GLOBAL(_Copy_arrayof_conjoint_jints) + .globl GLOBAL(_Copy_conjoint_jlongs_atomic) + .globl GLOBAL(_mmx_Copy_arrayof_conjoint_jshorts) - .globl _Atomic_cmpxchg_long + .globl GLOBAL(_Atomic_cmpxchg_long) .text # Support for void os::Bsd::init_thread_fpu_state() in os_bsd_i486.cpp # Set fpu to 53 bit precision. This happens too early to use a stub. # ported from os_solaris_i486.s +#ifdef __APPLE__ + # Apple's old, old assember expects the align expression to refer to + # number of low-order zero bits the location counter must have + # after advancement. (gas does the same thing, only for i386, only for a.out) + .align 4 +#else .align 16 -fixcw: +#endif +GLOBAL(fixcw): pushl $0x27f fldcw 0(%esp) popl %eax ret - .globl SafeFetch32, Fetch32PFI, Fetch32Resume - .globl SafeFetchN + .globl GLOBAL(SafeFetch32), GLOBAL(Fetch32PFI), GLOBAL(Fetch32Resume) + .globl GLOBAL(SafeFetchN) ## TODO: avoid exposing Fetch32PFI and Fetch32Resume. ## Instead, the signal handler would call a new SafeFetchTriage(FaultingEIP) ## routine to vet the address. If the address is the faulting LD then ## SafeFetchTriage() would return the resume-at EIP, otherwise null. - .type SafeFetch32,@function + #ifdef ELF_SYNTAX + .type SafeFetch32,@function + #endif + .p2align 4,,15 -SafeFetch32: -SafeFetchN: +GLOBAL(SafeFetch32): +GLOBAL(SafeFetchN): movl 0x8(%esp), %eax movl 0x4(%esp), %ecx - Fetch32PFI: + GLOBAL(Fetch32PFI): movl (%ecx), %eax - Fetch32Resume: + GLOBAL(Fetch32Resume): ret - .globl SpinPause - .type SpinPause,@function + .globl GLOBAL(SpinPause) + #ifdef ELF_SYNTAX + .type SpinPause,@function + #endif + .p2align 4,,15 -SpinPause: +GLOBAL(SpinPause): rep nop movl $1, %eax @@ -65,8 +90,11 @@ # void* to, # size_t count) .p2align 4,,15 + #ifdef ELF_SYNTAX .type _Copy_conjoint_bytes,@function -_Copy_conjoint_bytes: + #endif + +GLOBAL(_Copy_conjoint_bytes): pushl %esi movl 4+12(%esp),%ecx # count pushl %edi @@ -173,8 +201,11 @@ # # Same as _Copy_conjoint_bytes, except no source alignment check. .p2align 4,,15 + #ifdef ELF_SYNTAX .type _Copy_arrayof_conjoint_bytes,@function -_Copy_arrayof_conjoint_bytes: + #endif + +GLOBAL(_Copy_arrayof_conjoint_bytes): pushl %esi movl 4+12(%esp),%ecx # count pushl %edi @@ -261,8 +292,11 @@ # void* to, # size_t count) .p2align 4,,15 + #ifdef ELF_SYNTAX .type _Copy_conjoint_jshorts_atomic,@function -_Copy_conjoint_jshorts_atomic: + #endif + +GLOBAL(_Copy_conjoint_jshorts_atomic): pushl %esi movl 4+12(%esp),%ecx # count pushl %edi @@ -347,8 +381,11 @@ # void* to, # size_t count) .p2align 4,,15 + #ifdef ELF_SYNTAX .type _Copy_arrayof_conjoint_jshorts,@function -_Copy_arrayof_conjoint_jshorts: + #endif + +GLOBAL(_Copy_arrayof_conjoint_jshorts): pushl %esi movl 4+12(%esp),%ecx # count pushl %edi @@ -424,10 +461,16 @@ # Equivalent to # arrayof_conjoint_jints .p2align 4,,15 + #ifdef ELF_SYNTAX .type _Copy_conjoint_jints_atomic,@function + #endif + + #ifdef ELF_SYNTAX .type _Copy_arrayof_conjoint_jints,@function -_Copy_conjoint_jints_atomic: -_Copy_arrayof_conjoint_jints: + #endif + +GLOBAL(_Copy_conjoint_jints_atomic): +GLOBAL(_Copy_arrayof_conjoint_jints): pushl %esi movl 4+12(%esp),%ecx # count pushl %edi @@ -487,7 +530,7 @@ # # count treated as signed # - # if (from > to) { + # // if (from > to) { # while (--count >= 0) { # *to++ = *from++; # } @@ -497,7 +540,10 @@ # } # } .p2align 4,,15 + #ifdef ELF_SYNTAX .type _Copy_conjoint_jlongs_atomic,@function + #endif + _Copy_conjoint_jlongs_atomic: movl 4+8(%esp),%ecx # count movl 4+0(%esp),%eax # from @@ -526,8 +572,11 @@ # void* to, # size_t count) .p2align 4,,15 + #ifdef ELF_SYNTAX .type _mmx_Copy_arrayof_conjoint_jshorts,@function -_mmx_Copy_arrayof_conjoint_jshorts: + #endif + +GLOBAL(_mmx_Copy_arrayof_conjoint_jshorts): pushl %esi movl 4+12(%esp),%ecx pushl %edi @@ -625,8 +674,11 @@ # bool is_MP) # .p2align 4,,15 + #ifdef ELF_SYNTAX .type _Atomic_cmpxchg_long,@function -_Atomic_cmpxchg_long: + #endif + +GLOBAL(_Atomic_cmpxchg_long): # 8(%esp) : return PC pushl %ebx # 4(%esp) : old %ebx pushl %edi # 0(%esp) : old %edi Index: hotspot/src/os_cpu/bsd_i486/vm/copy_bsd_i486.inline.hpp =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/hotspot/src/os_cpu/bsd_i486/vm/copy_bsd_i486.inline.hpp,v retrieving revision 1.1 diff -u -u -r1.1 copy_bsd_i486.inline.hpp --- hotspot/src/os_cpu/bsd_i486/vm/copy_bsd_i486.inline.hpp 28 Mar 2007 04:53:11 -0000 1.1 +++ hotspot/src/os_cpu/bsd_i486/vm/copy_bsd_i486.inline.hpp 5 Nov 2007 05:28:51 -0000 @@ -131,10 +131,14 @@ : "memory", "cc"); } +// XXXDARWIN: We have to (painfully, carefully) re-use local labels here, as Darwin's assembler doesn't +// support local labels > 9: +// http://developer.apple.com/documentation/DeveloperTools/Reference/Assembler/ASMSyntax/chapter_3_section_2.html#//apple_ref/doc/uid/TP30000821-TPXREF105 + static void pd_conjoint_bytes(void* from, void* to, size_t count) { intx temp; __asm__ volatile(" testl %6,%6 ;" - " jz 13f ;" + " jz 0f ;" " cmpl %4,%5 ;" " leal -1(%4,%6),%3 ;" " jbe 1f ;" @@ -165,41 +169,41 @@ "4: rep; smovl ;" "5: movl %7,%2 ;" " andl $3,%2 ;" - " jz 13f ;" + " jz 0f ;" "6: xorl %7,%3 ;" "7: movb (%4,%7,1),%%dl ;" " movb %%dl,(%5,%7,1) ;" " incl %3 ;" " decl %2 ;" " jnz 7b ;" - " jmp 13f ;" + " jmp 0f ;" "8: std ;" " cmpl $12,%2 ;" " ja 9f ;" " movl %7,%0 ;" " leal -1(%6,%5),%1 ;" - " jmp 11f ;" + " jmp 1f ;" "9: xchgl %3,%2 ;" " movl %6,%0 ;" " incl %2 ;" " leal -1(%7,%5),%1 ;" " andl $3,%2 ;" - " jz 10f ;" + " jz 3f ;" " subl %6,%3 ;" " rep; smovb ;" - "10: movl %7,%2 ;" + "3: movl %7,%2 ;" " subl $3,%0 ;" " shrl $2,%2 ;" " subl $3,%1 ;" " rep; smovl ;" " andl $3,%3 ;" - " jz 12f ;" + " jz 2f ;" " movl %7,%2 ;" " addl $3,%0 ;" " addl $3,%1 ;" - "11: rep; smovb ;" - "12: cld ;" - "13: nop ;" + "1: rep; smovb ;" + "2: cld ;" + "0: nop ;" : "=S" (from), "=D" (to), "=c" (count), "=r" (temp) : "0" (from), "1" (to), "2" (count), "3" (temp) : "memory", "flags", "%edx"); Index: hotspot/src/os_cpu/bsd_i486/vm/os_bsd_i486.cpp =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/hotspot/src/os_cpu/bsd_i486/vm/os_bsd_i486.cpp,v retrieving revision 1.4 diff -u -u -r1.4 os_bsd_i486.cpp --- hotspot/src/os_cpu/bsd_i486/vm/os_bsd_i486.cpp 29 Jul 2007 21:06:05 -0000 1.4 +++ hotspot/src/os_cpu/bsd_i486/vm/os_bsd_i486.cpp 5 Nov 2007 05:28:51 -0000 @@ -50,6 +50,20 @@ # define context_trapno uc_mcontext.mc_trapno # endif +# ifdef __APPLE__ +# define context_eip uc_mcontext->__ss.__eip +# define context_esp uc_mcontext->__ss.__esp +# define context_eax uc_mcontext->__ss.__eax +# define context_ebx uc_mcontext->__ss.__ebx +# define context_ecx uc_mcontext->__ss.__ecx +# define context_edx uc_mcontext->__ss.__edx +# define context_ebp uc_mcontext->__ss.__ebp +# define context_esi uc_mcontext->__ss.__esi +# define context_edi uc_mcontext->__ss.__edi +# define context_eflags uc_mcontext->__ss.__eflags +# define context_trapno uc_mcontext->__es.__trapno +# endif + # ifdef __NetBSD__ # define context_eip uc_mcontext.__gregs[_REG_EIP] # define context_esp uc_mcontext.__gregs[_REG_UESP] @@ -642,7 +656,12 @@ // is the stack size returned by pthread_attr_getstacksize(). static void current_stack_region(address * bottom, size_t * size) { -#ifdef __OpenBSD__ +#ifdef __APPLE__ + pthread_t self = pthread_self(); + void *stacktop = pthread_get_stackaddr_np(self); + *size = pthread_get_stacksize_np(self); + *bottom = (address) stacktop - *size; +#elif defined(__OpenBSD__) stack_t ss; int rslt = pthread_stackseg_np(pthread_self(), &ss); Index: hotspot/src/share/vm/prims/forte.cpp =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/hotspot/src/share/vm/prims/forte.cpp,v retrieving revision 1.2 diff -u -u -r1.2 forte.cpp --- hotspot/src/share/vm/prims/forte.cpp 28 Mar 2007 05:08:13 -0000 1.2 +++ hotspot/src/share/vm/prims/forte.cpp 5 Nov 2007 05:28:52 -0000 @@ -906,7 +906,7 @@ // Method to let libcollector know about a dynamically loaded function. // Because it is weakly bound, the calls become NOP's when the library // isn't present. -#ifdef __OpenBSD__ +#if defined(__OpenBSD__) || defined(__APPLE__) // quite ld.so on OpenBSD #define collector_func_load(x0,x1,x2,x3,x4,x5,x6) (0) #else Index: hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp,v retrieving revision 1.4 diff -u -u -r1.4 globalDefinitions_gcc.hpp --- hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp 13 Aug 2007 21:37:29 -0000 1.4 +++ hotspot/src/share/vm/utilities/globalDefinitions_gcc.hpp 5 Nov 2007 05:28:52 -0000 @@ -199,7 +199,9 @@ #endif inline int g_isnan(double f) { return isnand(f); } #elif defined(LINUX) || defined(_ALLBSD_SOURCE) +#ifndef __APPLE__ inline int g_isnan(float f) { return isnanf(f); } +#endif inline int g_isnan(double f) { return isnan(f); } #else #error "missing platform-specific definition here" Index: hotspot/src/share/vm/utilities/macros.hpp =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/hotspot/src/share/vm/utilities/macros.hpp,v retrieving revision 1.2 diff -u -u -r1.2 macros.hpp --- hotspot/src/share/vm/utilities/macros.hpp 28 Mar 2007 05:08:14 -0000 1.2 +++ hotspot/src/share/vm/utilities/macros.hpp 5 Nov 2007 05:28:52 -0000 @@ -100,7 +100,7 @@ #define NOT_LINUX(code) code #endif -#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__) #define BSD_ONLY(code) code #define NOT_BSD(code) #else Index: hotspot/src/share/vm/utilities/vmError.cpp =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/hotspot/src/share/vm/utilities/vmError.cpp,v retrieving revision 1.2 diff -u -u -r1.2 vmError.cpp --- hotspot/src/share/vm/utilities/vmError.cpp 28 Mar 2007 05:08:14 -0000 1.2 +++ hotspot/src/share/vm/utilities/vmError.cpp 5 Nov 2007 05:28:52 -0000 @@ -176,6 +176,8 @@ if (out == NULL) return; #ifdef __FreeBSD__ out->print_raw_cr("# Please submit bug reports to freebsd-java@FreeBSD.org"); +#elif defined(__APPLE__) + out->print_raw_cr("# Please submit bug reports to landonf@bikemonkey.org"); #else out->print_raw_cr("# If you would like to submit a bug report, please visit:"); out->print_raw ("# "); Index: j2se/make/common/Defs-bsd.gmk =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/j2se/make/common/Defs-bsd.gmk,v retrieving revision 1.10 diff -u -u -r1.10 Defs-bsd.gmk --- j2se/make/common/Defs-bsd.gmk 31 Oct 2007 13:38:32 -0000 1.10 +++ j2se/make/common/Defs-bsd.gmk 5 Nov 2007 05:28:53 -0000 @@ -213,7 +213,11 @@ # LDFLAGS_OPT = LDFLAGS_COMMON += -L$(LIBDIR)/$(LIBARCH) + +ifneq ($(OS_VENDOR),Apple) LDFLAGS_COMMON += -Wl,-soname=$(LIB_PREFIX)$(LIBRARY).$(LIBRARY_SUFFIX) +endif + LDFLAGS_DBG = # @@ -287,6 +291,9 @@ ifeq ($(OS_VENDOR),NetBSD) override HAVE_SIGIGNORE = true endif +ifeq ($(OS_VENDOR),Apple) +override HAVE_SIGIGNORE = true +endif override LEX_LIBRARY = -lfl ifeq ($(STATIC_CXX),true) override LIBCXX = -Wl,-Bstatic -lstdc++ -lgcc -Wl,-Bdynamic Index: j2se/make/common/Program.gmk =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/j2se/make/common/Program.gmk,v retrieving revision 1.2 diff -u -u -r1.2 Program.gmk --- j2se/make/common/Program.gmk 28 Apr 2007 17:10:45 -0000 1.2 +++ j2se/make/common/Program.gmk 5 Nov 2007 05:28:53 -0000 @@ -48,9 +48,14 @@ # itself, as with all the Windows libraries. # ifeq ($(PLATFORM), bsd) - LDFLAGS += -Wl,--whole-archive - LDFLAGS += $(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME)/static/libjli.a - LDFLAGS += -Wl,--no-whole-archive + ifeq ($(OS_VENDOR), Apple) + LDFLAGS += -Wl,-all_load + LDFLAGS += $(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME)/static/libjli.a + else + LDFLAGS += -Wl,--whole-archive + LDFLAGS += $(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME)/static/libjli.a + LDFLAGS += -Wl,--no-whole-archive + endif endif ifneq (,$(findstring $(PLATFORM), linux solaris)) # UNIX systems LDFLAGS += -L $(LIBDIR)/$(LIBARCH)/jli Index: j2se/make/common/shared/Compiler-gcc.gmk =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/j2se/make/common/shared/Compiler-gcc.gmk,v retrieving revision 1.4 diff -u -u -r1.4 Compiler-gcc.gmk --- j2se/make/common/shared/Compiler-gcc.gmk 11 May 2007 04:58:18 -0000 1.4 +++ j2se/make/common/shared/Compiler-gcc.gmk 5 Nov 2007 05:28:53 -0000 @@ -90,8 +90,15 @@ endif REQUIRED_CC_VER = 3.3 REQUIRED_GCC_VER = 3.3.* - # Option used to create a shared library - SHARED_LIBRARY_FLAG = -shared -mimpure-text + + ifeq ($(OS_VENDOR), Apple) + # Option used to create a shared library + SHARED_LIBRARY_FLAG = -dynamiclib -mimpure-text + else + # Option used to create a shared library + SHARED_LIBRARY_FLAG = -shared -mimpure-text + endif + SUN_COMP_VER := $(shell $(CC) --verbose 2>&1 ) endif Index: j2se/make/common/shared/Platform.gmk =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/j2se/make/common/shared/Platform.gmk,v retrieving revision 1.6 diff -u -u -r1.6 Platform.gmk --- j2se/make/common/shared/Platform.gmk 27 Jul 2007 14:20:31 -0000 1.6 +++ j2se/make/common/shared/Platform.gmk 5 Nov 2007 05:28:53 -0000 @@ -353,6 +353,13 @@ REQUIRED_OS_VERSION = 6.0 endif +ifeq ($(SYSTEM_UNAME), Darwin) + PLATFORM = bsd + OS_NAME = darwin + OS_VENDOR = Apple + REQUIRED_OS_VERSION = 8.0 +endif + ifeq ($(SYSTEM_UNAME), NetBSD) PLATFORM = bsd OS_NAME = netbsd @@ -460,6 +467,14 @@ ARCH_VM_SUBDIR=jre/lib/$(LIBARCH) endif +# Darwin-specific Overrides +ifeq ($(SYSTEM_UNAME),Darwin) + # The suffix applied to runtime libraries + LIBRARY_SUFFIX = dylib + # The suffix applied to link libraries + LIB_SUFFIX = dylib +endif + # If blanks in the username, use the first 4 words and pack them together _USER1:=$(subst ', ,$(_USER)) _USER2:=$(subst ", ,$(_USER1)) Index: j2se/make/java/instrument/Makefile =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/j2se/make/java/instrument/Makefile,v retrieving revision 1.3 diff -u -u -r1.3 Makefile --- j2se/make/java/instrument/Makefile 29 Jul 2007 20:59:29 -0000 1.3 +++ j2se/make/java/instrument/Makefile 5 Nov 2007 05:28:53 -0000 @@ -61,9 +61,14 @@ # itself, as with all the Windows libraries. # ifeq ($(PLATFORM), bsd) - LDFLAGS += -Wl,--whole-archive - LDFLAGS += $(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME)/static/libjli.a - LDFLAGS += -Wl,--no-whole-archive + ifeq ($(OS_VENDOR), Apple) + LDFLAGS += -Wl,-all_load + LDFLAGS += $(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME)/static/libjli.a + else + LDFLAGS += -Wl,--whole-archive + LDFLAGS += $(OUTPUTDIR)/tmp/java/jli/$(OBJDIRNAME)/static/libjli.a + LDFLAGS += -Wl,--no-whole-archive + endif endif ifneq (,$(findstring $(PLATFORM), linux solaris)) # UNIX systems LDFLAGS += -L $(LIBDIR)/$(LIBARCH)/jli Index: j2se/src/solaris/bin/java_md.c =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/j2se/src/solaris/bin/java_md.c,v retrieving revision 1.6 diff -u -u -r1.6 java_md.c --- j2se/src/solaris/bin/java_md.c 13 Aug 2007 21:37:38 -0000 1.6 +++ j2se/src/solaris/bin/java_md.c 5 Nov 2007 05:29:03 -0000 @@ -31,8 +31,15 @@ #include #endif +#ifdef __APPLE__ +#define JVM_DLL "libjvm.dylib" +#define JAVA_DLL "libjava.dylib" +#define LD_LIBRARY_PATH "DYLD_LIBRARY_PATH" +#else #define JVM_DLL "libjvm.so" #define JAVA_DLL "libjava.so" +#define LD_LIBRARY_PATH "LD_LIBRARY_PATH" +#endif /* * If a processor / os combination has the ability to run binaries of @@ -75,6 +82,9 @@ #elif defined(__OpenBSD__) static const char *system_dir = "/usr/local/jdk-1.6.0"; static const char *user_dir = "/java"; +#elif defined(__APPLE__) +static const char *system_dir = "/usr/local/jdk1.6.0"; +static const char *user_dir = "/java"; #elif defined(__linux__) static const char *system_dir = "/usr/java"; static const char *user_dir = "/java"; @@ -404,7 +414,7 @@ * If not on Solaris, assume only a single LD_LIBRARY_PATH * variable. */ - runpath = getenv("LD_LIBRARY_PATH"); + runpath = getenv(LD_LIBRARY_PATH); #endif /* __sun */ #if defined(__linux__) || defined(_ALLBSD_SOURCE) @@ -431,7 +441,7 @@ new_runpath = JLI_MemAlloc( ((runpath!=NULL)?strlen(runpath):0) + 2*strlen(jrepath) + 2*strlen(arch) + strlen(jvmpath) + 52); - newpath = new_runpath + strlen("LD_LIBRARY_PATH="); + newpath = new_runpath + strlen(LD_LIBRARY_PATH "="); /* @@ -446,7 +456,7 @@ /* jvmpath, ((running != wanted)?((wanted==64)?"/"LIBARCH64NAME:"/.."):""), */ - sprintf(new_runpath, "LD_LIBRARY_PATH=" + sprintf(new_runpath, LD_LIBRARY_PATH "=" "%s:" "%s/lib/%s:" "%s/../lib/%s", Index: j2se/src/solaris/hpi/native_threads/src/sys_api_td.c =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/j2se/src/solaris/hpi/native_threads/src/sys_api_td.c,v retrieving revision 1.2 diff -u -u -r1.2 sys_api_td.c --- j2se/src/solaris/hpi/native_threads/src/sys_api_td.c 24 Apr 2007 18:55:24 -0000 1.2 +++ j2se/src/solaris/hpi/native_threads/src/sys_api_td.c 5 Nov 2007 05:29:04 -0000 @@ -25,6 +25,10 @@ #include #endif +#ifdef __APPLE__ +#include +#endif + #include #include #include Index: j2se/src/solaris/hpi/native_threads/src/threads_bsd.c =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/j2se/src/solaris/hpi/native_threads/src/threads_bsd.c,v retrieving revision 1.1 diff -u -u -r1.1 threads_bsd.c --- j2se/src/solaris/hpi/native_threads/src/threads_bsd.c 24 Apr 2007 18:55:24 -0000 1.1 +++ j2se/src/solaris/hpi/native_threads/src/threads_bsd.c 5 Nov 2007 05:29:04 -0000 @@ -9,6 +9,17 @@ * Implementation of HPI that can not be expressed with POSIX threads. */ +#ifdef __APPLE__ + +/* We need the mach API, and this file has to be included before any other system includes. + * Also, java and mach both define thread_state_t */ +#define thread_state_t mach_thread_state_t +#include +#undef thread_state_t + +#endif + + #include "hpi_impl.h" #include "monitor_md.h" #include "threads_md.h" @@ -28,7 +39,6 @@ #define pthread_resume_all_np() 0 #endif - #include #include #include @@ -42,22 +52,44 @@ * Suspend a thread. Used to implement java.lang.Thread.suspend(), * which is deprecated. */ +#ifdef __APPLE__ +int +np_suspend(sys_thread_t *tid) +{ + if (thread_suspend(pthread_mach_thread_np(tid->sys_thread)) == KERN_SUCCESS) + return SYS_OK; + else + return SYS_ERR; +} +#else int np_suspend(sys_thread_t *tid) { return pthread_suspend_np(tid->sys_thread); } +#endif /* * Resume a suspended thread. Used to implement java.lang.Thread.resume(), * which is deprecated. */ +#ifdef __APPLE__ +int +np_continue(sys_thread_t *tid) +{ + if (thread_resume(pthread_mach_thread_np(tid->sys_thread)) == KERN_SUCCESS) + return SYS_OK; + else + return SYS_ERR; +} +#else int np_continue(sys_thread_t *tid) { return pthread_resume_np(tid->sys_thread); } +#endif /* * If there is any initialization is required by the non-POSIX parts. @@ -71,7 +103,17 @@ /* * Internal helper function to get stack information about specified thread. */ -#ifdef __OpenBSD__ +#ifdef __APPLE__ +static int +get_stackinfo(pthread_t tid, void **addr, long *sizep) +{ + void *stacktop = pthread_get_stackaddr_np(tid); + *sizep = pthread_get_stacksize_np(tid); + *addr = stacktop - *sizep; + + return (SYS_OK); +} +#elif defined(__OpenBSD__) static int get_stackinfo(pthread_t tid, void **addr, long *sizep) { @@ -115,7 +157,7 @@ int np_stackinfo(void **addr, long *sizep) { -#ifdef __OpenBSD__ +#if defined(__OpenBSD__) || defined(__APPLE__) return(get_stackinfo(pthread_self(), addr, sizep)); #else pthread_attr_t attr; @@ -149,17 +191,13 @@ int np_profiler_suspend(sys_thread_t *tid) { - if (errno = pthread_suspend_np(tid->sys_thread)) - return SYS_ERR; - return SYS_OK; + return np_suspend(tid); } int np_profiler_continue(sys_thread_t *tid) { - if (errno = pthread_resume_np(tid->sys_thread)) - return SYS_ERR; - return SYS_OK; + return np_continue(tid); } /* @@ -191,6 +229,75 @@ * set or stack pointer) into the sys_thread structure, so that a * garbage collect can be run. */ +#ifdef __APPLE__ +int +np_single(void) +{ + sysAssert(SYS_QUEUE_LOCKED(sysThreadSelf())); + + /* Iterate over all the threads in the task, suspending each one. + * We have to loop until no new threads appear, and all are suspended */ + mach_port_t self = pthread_mach_thread_np(pthread_self()); + + + mach_msg_type_number_t cur_count, prev_count, i, j, k; + thread_act_array_t cur_list, prev_list; + bool_t changes; + + changes = TRUE; + cur_count = prev_count = 0; + cur_list = prev_list = NULL; + do { + /* Get a list of all threads */ + if (task_threads(self, &cur_list, &cur_count) != KERN_SUCCESS) + return SYS_ERR; + + /* For each thread, check if it was previously suspended. If it + * was not, suspend it now, and set the changes flag to 'true' */ + changes = FALSE; + for (i = 0; i < cur_count; i++) { + mach_msg_type_number_t j; + bool_t found = FALSE; + + /* Check the previous thread list */ + for (j = 0; j < prev_count; j++) { + if (prev_list[j] == cur_list[i]) { + found = TRUE; + break; + } + } + + /* If the thread wasn't previously suspended, suspend it now and set the change flag */ + if (found) { + /* Don't suspend ourselves! */ + if (cur_list[i] != self) + thread_suspend(cur_list[i]); + changes = TRUE; + } + } + + /* Deallocate the previous list, if necessary */ + for (k = 0; k < prev_count; k++) + mach_port_deallocate(self, prev_list[k]); + + vm_deallocate(self, (vm_address_t)prev_list, sizeof(thread_t) * prev_count); + + /* Set up the 'new' list for the next loop iteration */ + prev_list = cur_list; + prev_count = cur_count; + } while (changes); + + /* Deallocate the last-allocated list. */ + for (i = 0; i < prev_count; i++) + mach_port_deallocate(self, prev_list[i]); + + vm_deallocate(self, (vm_address_t)prev_list, sizeof(thread_t) * prev_count); + + /* Record registers and return */ + record_thread_regs(); + return SYS_OK; +} +#else int np_single(void) { @@ -200,17 +307,49 @@ record_thread_regs(); return SYS_OK; } +#endif /* * Continue threads suspended earlier. But clear their context * recorded in sys_thread structure first. */ +#ifdef __APPLE__ +void +np_multi(void) +{ + sysAssert(SYS_QUEUE_LOCKED(sysThreadSelf())); + + mach_msg_type_number_t thr_count, i; + thread_act_array_t thr_list; + mach_port_t self; + + self = pthread_mach_thread_np(pthread_self()); + + /* Get a list of all threads. This has to succeed! */ + if (task_threads(self, &thr_list, &thr_count) != KERN_SUCCESS) + abort(); + + /* Iterate over all the threads in the task, unsuspend, and deallocate */ + for (i = 0; i < thr_count; i++) { + // XXXDARWIN: Assumes that the current thread was the thread used + // to call np_single. Is that true? + + if (thr_list[i] != self) + thread_resume(thr_list[i]); + + mach_port_deallocate(self, thr_list[i]); + } + + vm_deallocate(self, (vm_address_t) thr_list, sizeof(thread_t) * thr_count); +} +#else void np_multi(void) { sysAssert(SYS_QUEUE_LOCKED(sysThreadSelf())); pthread_resume_all_np(); } +#endif /* * BSDNOTE: Looking to linux implementation -- the only important register @@ -241,7 +380,7 @@ int i; if (tid->sys_thread != 0) { -#ifdef __OpenBSD__ +#if defined(__OpenBSD__) || defined(__APPLE__) if (get_stackinfo(tid->sys_thread, &addr, &sz) == SYS_OK) #else if (get_stackinfo(tid->sys_thread, attr, &addr, &sz) == SYS_OK) Index: j2se/src/solaris/hpi/src/linker_md.c =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/j2se/src/solaris/hpi/src/linker_md.c,v retrieving revision 1.2 diff -u -u -r1.2 linker_md.c --- j2se/src/solaris/hpi/src/linker_md.c 6 May 2007 04:54:09 -0000 1.2 +++ j2se/src/solaris/hpi/src/linker_md.c 5 Nov 2007 05:29:04 -0000 @@ -26,6 +26,12 @@ #include "threads_md.h" #endif +#ifdef __APPLE__ +#define LIB_SUFFIX "dylib" +#else +#define LIB_SUFFIX "so" +#endif + /* * glibc-2.0 libdl is not MT safe. If you are building with any glibc, * chances are you might want to run the generated bits against glibc-2.0 @@ -79,9 +85,9 @@ } if (pnamelen == 0) { - sprintf(holder, "lib%s.so", fname); + sprintf(holder, "lib%s." LIB_SUFFIX, fname); } else { - sprintf(holder, "%s/lib%s.so", pname, fname); + sprintf(holder, "%s/lib%s." LIB_SUFFIX, pname, fname); } } Index: j2se/src/solaris/javavm/export/jvm_md.h =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/j2se/src/solaris/javavm/export/jvm_md.h,v retrieving revision 1.2 diff -u -u -r1.2 jvm_md.h --- j2se/src/solaris/javavm/export/jvm_md.h 10 May 2007 03:18:31 -0000 1.2 +++ j2se/src/solaris/javavm/export/jvm_md.h 5 Nov 2007 05:29:04 -0000 @@ -21,7 +21,11 @@ #define JNI_ONUNLOAD_SYMBOLS {"JNI_OnUnload"} #define JNI_LIB_PREFIX "lib" +#ifdef __APPLE__ +#define JNI_LIB_SUFFIX ".dylib" +#else #define JNI_LIB_SUFFIX ".so" +#endif #define JVM_MAXPATHLEN MAXPATHLEN Index: j2se/src/solaris/javavm/include/typedefs_md.h =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/j2se/src/solaris/javavm/include/typedefs_md.h,v retrieving revision 1.3 diff -u -u -r1.3 typedefs_md.h --- j2se/src/solaris/javavm/include/typedefs_md.h 29 Jul 2007 20:55:41 -0000 1.3 +++ j2se/src/solaris/javavm/include/typedefs_md.h 5 Nov 2007 05:29:04 -0000 @@ -23,7 +23,7 @@ #ifdef __OpenBSD__ #include #endif -#ifdef __NetBSD__ +#if defined(__NetBSD__) || (__APPLE__) #include #endif #define HAVE_INTPTR_T Index: j2se/src/solaris/native/com/sun/media/sound/engine/HAE_API_BSDOS.c =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/j2se/src/solaris/native/com/sun/media/sound/engine/HAE_API_BSDOS.c,v retrieving revision 1.2 diff -u -u -r1.2 HAE_API_BSDOS.c --- j2se/src/solaris/native/com/sun/media/sound/engine/HAE_API_BSDOS.c 27 Jun 2007 22:15:41 -0000 1.2 +++ j2se/src/solaris/native/com/sun/media/sound/engine/HAE_API_BSDOS.c 5 Nov 2007 05:29:04 -0000 @@ -68,6 +68,9 @@ #define FALSE 0 #endif +/* XXXDARWIN: Hard-disabled sound support */ +#ifndef __APPLE__ + #if defined(__FreeBSD__) && (__FreeBSD_version >= 700013) static inline void * memalign(size_t alignment, size_t size) @@ -1056,3 +1059,319 @@ } // EOF of HAE_API_BSDOS.c + +#else /* !__APPLE__ */ + +// XXXDARWIN: Implement sound support using CoreAudio + +// **** System setup and cleanup functions +// Setup function. Called before memory allocation, or anything serious. Can be used to +// load a DLL, library, etc. +// return 0 for ok, or -1 for failure +int HAE_Setup(void) +{ + // XXXDARWIN: TODO + return -1; +} + +// Cleanup function. Called after all memory and the last buffers are deallocated, and +// audio hardware is released. Can be used to unload a DLL, library, etc. +// return 0 for ok, or -1 for failure +int HAE_Cleanup(void) +{ + // XXXDARWIN: TODO + return 0; +} + +// **** Memory management +// allocate a block of locked, zeroed memory. Return a pointer +void * HAE_Allocate(UINT32 size) +{ + // XXXDARWIN: TODO + return NULL; +} + +// dispose of memory allocated with HAE_Allocate +void HAE_Deallocate(void * memoryBlock) +{ + // XXXDARWIN: TODO +} + +// Given a memory pointer and a size, validate of memory pointer is a valid memory address +// with at least size bytes of data avaiable from the pointer. +// This is used to determine if a memory pointer and size can be accessed without +// causing a memory protection +// fault. +// return 0 for valid, or 1 for bad pointer, or 2 for not supported. +int HAE_IsBadReadPointer(void *memoryBlock, UINT32 size) +{ + return 2; +} + +// this will return the size of the memory pointer allocated with HAE_Allocate. Return +// 0 if you don't support this feature +UINT32 HAE_SizeOfPointer(void * memoryBlock) +{ + return 0; +} + +// block move memory. This is basicly memcpy, but its exposed to take advantage of +// special block move speed ups, various hardware has available. +void HAE_BlockMove(void * source, void * dest, UINT32 size) +{ + if (source && dest && size) + { + memcpy(dest, source, size); + } +} + +// **** Audio Card modifiers +// Return 1 if stereo hardware is supported, otherwise 0. +// $$kk: 08.12.98 merge: changed this to return a real value +int HAE_IsStereoSupported(void) +{ + // XXXDARWIN: TODO + return 0; +} + +// Return 1, if sound hardware support 16 bit output, otherwise 0. +// $$kk: 08.12.98 merge: changed this to return a real value +int HAE_Is16BitSupported(void) +{ + // XXXDARWIN: TODO + return 0; +} + + +// Return 1, if sound hardware support 8 bit output, otherwise 0. +// some solaris drivers support 8bit u-law or a-law only, so they are not supported +// $$kk: 08.12.98 merge: changed this to return a real value +int HAE_Is8BitSupported(void) +{ + // XXXDARWIN: TODO + return 0; +} + + +// returned volume is in the range of 0 to 256 +short int HAE_GetHardwareVolume(void) +{ + // XXXDARWIN: TODO + return 0; +} + +// theVolume is in the range of 0 to 256 +void HAE_SetHardwareVolume(short int theVolume) +{ + // XXXDARWIN: TODO +} + +// **** Timing services +// return microseconds +UINT32 HAE_Microseconds(void) +{ + // XXXDARWIN: TODO + return 0; +} + +// wait or sleep this thread for this many microseconds +void HAE_WaitMicroseocnds(UINT32 waitAmount) +{ + // XXXDARWIN: TODO +} + +// **** File support +// Create a file, delete orignal if duplicate file name. +// Return -1 if error + +// Given the fileNameSource that comes from the call HAE_FileXXXX, copy the name +// in the native format to the pointer passed fileNameDest. +void HAE_CopyFileNameNative(void *fileNameSource, void *fileNameDest) +{ + // XXXDARWIN: TODO + return; +} + +INT32 HAE_FileCreate(void *fileName) +{ + // XXXDARWIN: TODO + return -1; +} + +INT32 HAE_FileDelete(void *fileName) +{ + // XXXDARWIN: TODO + return -1; +} + + +// Open a file +// Return -1 if error, otherwise file handle +XFILE_HANDLE HAE_FileOpenForRead(void *fileName) +{ + // XXXDARWIN: TODO + return -1; +} + +XFILE_HANDLE HAE_FileOpenForWrite(void *fileName) +{ + // XXXDARWIN: TODO + return -1; +} + +XFILE_HANDLE HAE_FileOpenForReadWrite(void *fileName) +{ + // XXXDARWIN: TODO + return -1; +} + +// Close a file +void HAE_FileClose(XFILE_HANDLE fileReference) +{ + // XXXDARWIN: TODO +} + +// Read a block of memory from a file. +// Return -1 if error, otherwise length of data read. +INT32 HAE_ReadFile(XFILE_HANDLE fileReference, void *pBuffer, INT32 bufferLength) +{ + // XXXDARWIN: TODO + return -1; +} + +// Write a block of memory from a file +// Return -1 if error, otherwise length of data written. +INT32 HAE_WriteFile(XFILE_HANDLE fileReference, void *pBuffer, INT32 bufferLength) +{ + // XXXDARWIN: TODO + return -1; +} + +// set file position in absolute file byte position +// Return -1 if error, otherwise 0. +INT32 HAE_SetFilePosition(XFILE_HANDLE fileReference, UINT32 filePosition) +{ + // XXXDARWIN: TODO + return -1; +} + +// get file position in absolute file bytes +UINT32 HAE_GetFilePosition(XFILE_HANDLE fileReference) +{ + // XXXDARWIN: TODO + return -1; +} + +// get length of file +UINT32 HAE_GetFileLength(XFILE_HANDLE fileReference) +{ + // XXXDARWIN: TODO + return 0; +} + +// set the length of a file. Return 0, if ok, or -1 for error +int HAE_SetFileLength(XFILE_HANDLE fileReference, UINT32 newSize) +{ + // XXXDARWIN: TODO + return -1; +} + +// Return the number of 11 ms buffer blocks that are built at one time. +int HAE_GetAudioBufferCount(void) +{ + // XXXDARWIN: TODO + return 0; +} + +// Return the number of bytes used for audio buffer for output to card +INT32 HAE_GetAudioByteBufferSize(void) +{ + // XXXDARWIN: TODO + return 0; +} + +int HAE_OpenSoundCard(int forCapture) +{ + // XXXDARWIN: TODO + return -1; +} + +void HAE_CloseSoundCard(int forCapture) +{ + // XXXDARWIN: TODO +} + +// **** Audio card support +// Aquire and enabled audio card +// return 0 if ok, -1 if failed +// $$kk: 08.12.98 merge: modified this function +int HAE_AquireAudioCard(void *context, UINT32 sampleRate, UINT32 channels, UINT32 bits) +{ + // XXXDARWIN: TODO + return -1; +} + +// Release and free audio card. +// return 0 if ok, -1 if failed. +int HAE_ReleaseAudioCard(void *context) +{ + // XXXDARWIN: TODO + return -1; +} + +// return device position in samples +UINT32 HAE_GetDeviceSamplesPlayedPosition(void) +{ + // XXXDARWIN: TODO + return 0; +} + +// number of devices. ie different versions of the HAE connection. DirectSound and waveOut +// return number of devices. ie 1 is one device, 2 is two devices. +// NOTE: This function needs to function before any other calls may have happened. +INT32 HAE_MaxDevices(void) +{ + // XXXDARWIN: TODO + return 0; +} + +// set the current device. device is from 0 to HAE_MaxDevices() +// NOTE: This function needs to function before any other calls may have happened. +// Also you will need to call HAE_ReleaseAudioCard then HAE_AquireAudioCard +// in order for the change to take place. deviceParameter is a device specific +// pointer. Pass NULL if you don't know what to use. +void HAE_SetDeviceID(INT32 deviceID, void *deviceParameter) +{ + // XXXDARWIN: TODO +} + +// return current device ID, and fills in the deviceParameter with a device specific +// pointer. It will pass NULL if there is nothing to use. +// NOTE: This function needs to function before any other calls may have happened. +INT32 HAE_GetDeviceID(void *deviceParameter) +{ + // XXXDARWIN: TODO + return 0; +} + +// NOTE: This function needs to function before any other calls may have happened. +// Format of string is a zero terminated comma delinated C string. +// "platform,method,misc" +// example "MacOS,Sound Manager 3.0,SndPlayDoubleBuffer" +// "WinOS,DirectSound,multi threaded" +// "WinOS,waveOut,multi threaded" +// "WinOS,VxD,low level hardware" +// "WinOS,plugin,Director" +void HAE_GetDeviceName(INT32 deviceID, char *cName, UINT32 cNameLength) +{ + // XXXDARWIN: TODO + *cName = 0; +} + +INT64 XGetRealTimeSyncCount() { + // XXXDARWIN: TODO + return -1; +} + + +#endif /* __APPLE__ */ Index: j2se/src/solaris/native/com/sun/media/sound/engine/HAE_API_BSDOS_Capture.c =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/j2se/src/solaris/native/com/sun/media/sound/engine/HAE_API_BSDOS_Capture.c,v retrieving revision 1.1 diff -u -u -r1.1 HAE_API_BSDOS_Capture.c --- j2se/src/solaris/native/com/sun/media/sound/engine/HAE_API_BSDOS_Capture.c 6 May 2007 14:49:42 -0000 1.1 +++ j2se/src/solaris/native/com/sun/media/sound/engine/HAE_API_BSDOS_Capture.c 5 Nov 2007 05:29:04 -0000 @@ -64,6 +64,8 @@ #define FALSE 0 #endif +/* XXXDARWIN: Hard-disabled sound support */ +#ifndef __APPLE__ #define HAE_BSD_NUM_CAPTURE_BUFFERS 1 // number of capture buffers @@ -640,3 +642,152 @@ } // EOF of HAE_API_BSDOS_Capture.c + +#else /* !__APPLE__ */ + +// XXXDARWIN: Implement sound support using CoreAudio + +int HAE_MaxCaptureFormats(INT32 deviceID) +{ + // XXXDARWIN: TODO + return -1; +} + + +int HAE_GetSupportedCaptureFormats(INT32 deviceID, UINT32 *encodings, + UINT32 *sampleRates, UINT32 *channels, + UINT32 *bits, int maxFormats) +{ + // XXXDARWIN: TODO + return -1; +} + + +// Aquire and enabled audio card +// return 0 if ok, -1 if failed +// $$fb 2002-02-01: itanium port +int HAE_AquireAudioCapture(void *context, UINT32 encoding, UINT32 sampleRate, + UINT32 channels, UINT32 bits, + UINT32 audioFramesPerBuffer, UINT_PTR *pCaptureHandle) +{ + // XXXDARWIN: TODO + return -1; +} + + +// Given the capture hardware is working, fill a buffer with some data. This call is +// asynchronous. When this buffer is filled, the function done will be called. +// returns 0 for success, -1 for failure +int HAE_StartAudioCapture(HAE_CaptureDone done, void *callbackContext) +{ + // XXXDARWIN: TODO + return -1; +} + + +// stop the capture hardware +// returns 0 for success, -1 for failure +int HAE_StopAudioCapture(void* context) +{ + // XXXDARWIN: TODO + return -1; +} + + +// returns 0 for success, -1 for failure +int HAE_PauseAudioCapture(void) +{ + // XXXDARWIN: TODO + return -1; +} + +static char dummyBuffer[4096]; + +// returns 0 for success, -1 for failure +int HAE_ResumeAudioCapture(void) +{ + // XXXDARWIN: TODO + return -1; +} + + + +// Release and free audio card. +// returns 0 for success, -1 for failure +int HAE_ReleaseAudioCapture(void *context) +{ + // XXXDARWIN: TODO + return -1; +} + + +// number of devices. ie different versions of the HAE connection. DirectSound and waveOut +// return number of devices. ie 1 is one device, 2 is two devices. +// NOTE: This function needs to function before any other calls may have happened. +INT32 HAE_MaxCaptureDevices(void) +{ + // XXXDARWIN: TODO + return 0; +} + + +// set the current device. device is from 0 to HAE_MaxCaptureDevices() +// NOTE: This function needs to function before any other calls may have happened. +// Also you will need to call HAE_ReleaseAudioCard then HAE_AquireAudioCard +// in order for the change to take place. +void HAE_SetCaptureDeviceID(INT32 deviceID, void *deviceParameter) +{ + // XXXDARWIN: TODO +} + + +// return current device ID +// NOTE: This function needs to function before any other calls may have happened. +INT32 HAE_GetCaptureDeviceID(void *deviceParameter) +{ + // XXXDARWIN: TODO + return 0; +} + + +// get deviceID name +// NOTE: This function needs to function before any other calls may have happened. +// The names returned in this function are platform specific. +void HAE_GetCaptureDeviceName(INT32 deviceID, char *cName, UINT32 cNameLength) +{ + // XXXDARWIN: TODO + *cName = 0; +} + + +// return the number of frames in the capture buffer +// (should make this settable?) +UINT32 HAE_GetCaptureBufferSizeInFrames() +{ + // XXXDARWIN: TODO + return 0; +} + + +// return the number of buffers used. +int HAE_GetCaptureBufferCount() +{ + // XXXDARWIN: TODO + return 0; +} + +// return the number of samples captured at the device +// $$kk: 10.15.98: need to implement! +UINT32 HAE_GetDeviceSamplesCapturedPosition() +{ + // XXXDARWIN: TODO + return 0L; +} + +void HAE_FlushAudioCapture() +{ + // XXXDARWIN: TODO +} + +#endif /* __APPLE__ */ + Index: j2se/src/solaris/native/java/lang/ProcessEnvironment_md.c =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/j2se/src/solaris/native/java/lang/ProcessEnvironment_md.c,v retrieving revision 1.2 diff -u -u -r1.2 ProcessEnvironment_md.c --- j2se/src/solaris/native/java/lang/ProcessEnvironment_md.c 28 Apr 2007 18:16:48 -0000 1.2 +++ j2se/src/solaris/native/java/lang/ProcessEnvironment_md.c 5 Nov 2007 05:29:04 -0000 @@ -14,6 +14,11 @@ #include "jni.h" #include "jni_util.h" +#ifdef __APPLE__ +#include +#define environ (*_NSGetEnviron()) +#endif + JNIEXPORT jobjectArray JNICALL Java_java_lang_ProcessEnvironment_environ(JNIEnv *env, jclass ign) { @@ -23,7 +28,10 @@ * no standard (not even de-facto) header file where the * declaration is to be found. See: * http://www.opengroup.org/onlinepubs/007908799/xbd/envvar.html */ +#ifndef __APPLE__ + // It's portable everywhere ... except Mac OS X extern char ** environ; /* environ[i] looks like: VAR=VALUE\0 */ +#endif jsize count = 0; jsize i, j; Index: j2se/src/solaris/native/java/lang/UNIXProcess_md.c =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/j2se/src/solaris/native/java/lang/UNIXProcess_md.c,v retrieving revision 1.5 diff -u -u -r1.5 UNIXProcess_md.c --- j2se/src/solaris/native/java/lang/UNIXProcess_md.c 28 Aug 2007 06:50:21 -0000 1.5 +++ j2se/src/solaris/native/java/lang/UNIXProcess_md.c 5 Nov 2007 05:29:04 -0000 @@ -41,6 +41,11 @@ #include #endif +#ifdef __APPLE__ +#include +#define environ (*_NSGetEnviron()) +#endif + #ifndef STDIN_FILENO #define STDIN_FILENO 0 #endif @@ -544,7 +549,10 @@ * "All identifiers in this volume of IEEE Std 1003.1-2001, except * environ, are defined in at least one of the headers" (!) */ +#ifndef __APPLE__ + // It's portable everywhere ... except Mac OS X extern char **environ; +#endif if (envp != NULL) environ = (char **) envp; Index: j2se/src/solaris/native/java/net/Inet4AddressImpl.c =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/j2se/src/solaris/native/java/net/Inet4AddressImpl.c,v retrieving revision 1.4 diff -u -u -r1.4 Inet4AddressImpl.c --- j2se/src/solaris/native/java/net/Inet4AddressImpl.c 27 Jun 2007 22:46:34 -0000 1.4 +++ j2se/src/solaris/native/java/net/Inet4AddressImpl.c 5 Nov 2007 05:29:04 -0000 @@ -22,6 +22,10 @@ #include #endif +#ifdef __APPLE__ +#include +#endif + #include "jvm.h" #include "jni_util.h" #include "net_util.h" Index: j2se/src/solaris/native/java/net/NetworkInterface.c =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/j2se/src/solaris/native/java/net/NetworkInterface.c,v retrieving revision 1.5 diff -u -u -r1.5 NetworkInterface.c --- j2se/src/solaris/native/java/net/NetworkInterface.c 29 Jul 2007 20:49:18 -0000 1.5 +++ j2se/src/solaris/native/java/net/NetworkInterface.c 5 Nov 2007 05:29:04 -0000 @@ -35,7 +35,7 @@ #if defined(_ALLBSD_SOURCE) #include #include -#if defined(__FreeBSD__) +#if defined(__FreeBSD__) || defined(__APPLE__) #include #include #elif defined(__OpenBSD__) Index: j2se/src/solaris/npt/npt_md.h =================================================================== RCS file: /home/Java/CVS/JDK2/javasrc_1_6_jrl/j2se/src/solaris/npt/npt_md.h,v retrieving revision 1.1.1.2 diff -u -u -r1.1.1.2 npt_md.h --- j2se/src/solaris/npt/npt_md.h 21 Jul 2006 17:31:30 -0000 1.1.1.2 +++ j2se/src/solaris/npt/npt_md.h 5 Nov 2007 05:29:04 -0000 @@ -14,9 +14,13 @@ #include #include #include -#include +#ifdef __APPLE__ +#define NPT_LIBNAME "libnpt.dylib" +#else +#include #define NPT_LIBNAME "libnpt.so" +#endif #define NPT_INITIALIZE(pnpt,version,options) \ { \