From 3820fec9d75b5312f2898dad82ac8f6b839c7081 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Sun, 11 Mar 2012 16:26:46 -0600 Subject: [PATCH] fix OS X OpenJDK 7 build --- makefile | 3 ++- openjdk-src.mk | 46 +++++++++++++++++++++++++-------------- src/classpath-openjdk.cpp | 31 ++++++++++++++++++++++++-- 3 files changed, 61 insertions(+), 19 deletions(-) diff --git a/makefile b/makefile index 9408df6d9c..636bbf2147 100755 --- a/makefile +++ b/makefile @@ -310,7 +310,8 @@ ifeq ($(platform),darwin) version-script-flag = lflags = $(common-lflags) -ldl -framework CoreFoundation ifneq ($(arch),arm) - lflags += -framework CoreServices + lflags += -framework CoreServices -framework SystemConfiguration \ + -framework Security endif ifeq ($(bootimage),true) bootimage-lflags = -Wl,-segprot,__RWX,rwx,rwx diff --git a/openjdk-src.mk b/openjdk-src.mk index a2dd051cce..dfe455b4bb 100644 --- a/openjdk-src.mk +++ b/openjdk-src.mk @@ -236,9 +236,6 @@ else openjdk-sources += \ $(openjdk-src)/solaris/native/common/jdk_util_md.c \ $(openjdk-src)/solaris/native/common/jni_util_md.c \ - $(openjdk-src)/solaris/native/common/deps/syscalls_fp.c \ - $(openjdk-src)/solaris/native/common/deps/gconf2/gconf_fp.c \ - $(openjdk-src)/solaris/native/common/deps/glib2/gio_fp.c \ $(openjdk-src)/solaris/native/java/io/canonicalize_md.c \ $(openjdk-src)/solaris/native/java/io/Console_md.c \ $(openjdk-src)/solaris/native/java/io/FileDescriptor_md.c \ @@ -276,25 +273,19 @@ else $(openjdk-src)/solaris/native/sun/nio/ch/ServerSocketChannelImpl.c \ $(openjdk-src)/solaris/native/sun/nio/ch/SocketChannelImpl.c \ $(openjdk-src)/solaris/native/sun/nio/ch/SocketDispatcher.c \ - $(openjdk-src)/solaris/native/sun/nio/ch/EPollArrayWrapper.c \ $(openjdk-src)/solaris/native/sun/nio/ch/PollArrayWrapper.c \ $(openjdk-src)/solaris/native/sun/nio/ch/InheritedChannel.c \ $(openjdk-src)/solaris/native/sun/nio/ch/NativeThread.c \ $(openjdk-src)/solaris/native/sun/nio/fs/UnixNativeDispatcher.c \ - ifeq ($(platform),linux) - openjdk-sources += \ - $(openjdk-src)/solaris/native/java/net/linux_close.c - endif - openjdk-headers-classes += \ java.net.PlainDatagramSocketImpl \ java.io.UnixFileSystem \ sun.nio.ch.InheritedChannel \ - sun.nio.ch.EPollArrayWrapper \ sun.nio.fs.UnixNativeDispatcher \ - openjdk-cflags += "-I$(openjdk-src)/solaris/javavm/export" \ + openjdk-cflags += \ + "-I$(openjdk-src)/solaris/javavm/export" \ "-I$(openjdk-src)/solaris/native/common" \ "-I$(openjdk-src)/solaris/native/java/io" \ "-I$(openjdk-src)/solaris/native/java/lang" \ @@ -304,11 +295,34 @@ else "-I$(openjdk-src)/solaris/native/sun/nio/ch" \ "-I$(openjdk-src)/solaris/javavm/include" \ "-I$(openjdk-src)/solaris/hpi/include" \ - "-I$(openjdk-src)/solaris/native/common/deps" \ - "-I$(openjdk-src)/solaris/native/common/deps/glib2" \ - "-I$(openjdk-src)/solaris/native/common/deps/gconf2" \ - $(shell pkg-config --cflags glib-2.0) \ - $(shell pkg-config --cflags gconf-2.0) + "-I$(openjdk-src)/solaris/native/common/deps" + + ifeq ($(platform),linux) + openjdk-sources += \ + $(openjdk-src)/solaris/native/java/net/linux_close.c \ + $(openjdk-src)/solaris/native/common/deps/syscalls_fp.c \ + $(openjdk-src)/solaris/native/common/deps/gconf2/gconf_fp.c \ + $(openjdk-src)/solaris/native/common/deps/glib2/gio_fp.c \ + $(openjdk-src)/solaris/native/sun/nio/ch/EPollArrayWrapper.c + + openjdk-headers-classes += \ + sun.nio.ch.EPollArrayWrapper + + openjdk-cflags += \ + "-I$(openjdk-src)/solaris/native/common/deps/glib2" \ + "-I$(openjdk-src)/solaris/native/common/deps/gconf2" \ + $(shell pkg-config --cflags glib-2.0) \ + $(shell pkg-config --cflags gconf-2.0) + endif + + ifeq ($(platform),darwin) + openjdk-sources += \ + $(openjdk-src)/solaris/native/java/lang/java_props_macosx.c \ + $(openjdk-src)/solaris/native/java/net/bsd_close.c + + openjdk-cflags += \ + -DMACOSX + endif endif openjdk-local-sources = \ diff --git a/src/classpath-openjdk.cpp b/src/classpath-openjdk.cpp index 713bea71ec..184fd81667 100644 --- a/src/classpath-openjdk.cpp +++ b/src/classpath-openjdk.cpp @@ -440,9 +440,14 @@ class MyClasspath : public Classpath { PROTECT(t, class_); object name = makeClassNameString(t, getClassName(t, class_)); + PROTECT(t, name); - return vm::makeJclass - (t, 0, 0, name, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, class_); + object c = allocate(t, FixedSizeOfJclass, true); + setObjectClass(t, c, type(t, Machine::JclassType)); + set(t, c, JclassName, name); + set(t, c, JclassVmClass, class_); + + return c; } virtual object @@ -2299,6 +2304,24 @@ Avian_sun_misc_Unsafe_registerNatives // ignore } +extern "C" JNIEXPORT void +Avian_sun_misc_Perf_registerNatives +(Thread*, object, uintptr_t*) +{ + // ignore +} + +extern "C" JNIEXPORT int64_t +Avian_sun_misc_Perf_createLong +(Thread* t, object, uintptr_t*) +{ + return reinterpret_cast + (t->m->processor->invoke + (t, resolveMethod + (t, root(t, Machine::BootLoader), "java/nio/ByteBuffer", "allocate", + "(I)Ljava/nio/ByteBuffer;"), 0, 8)); +} + extern "C" JNIEXPORT int64_t Avian_sun_misc_Unsafe_addressSize (Thread*, object, uintptr_t*) @@ -2750,6 +2773,7 @@ Avian_sun_misc_Unsafe_copyMemory memcpy(dst, src, count); } +extern "C" JNIEXPORT void JNICALL Avian_sun_misc_Unsafe_monitorEnter (Thread* t, object, uintptr_t* arguments) { @@ -5308,6 +5332,9 @@ extern "C" JNIEXPORT jboolean JNICALL EXPORT(JVM_CX8Field)(JNIEnv*, jobject*, jfieldID*, jlong, jlong) { abort(); } +extern "C" JNIEXPORT void JNICALL +JVM_SetNativeThreadName(JNIEnv*, jobject, jstring) { abort(); } + } // namespace local } // namespace