精华区 [关闭][返回]

当前位置:网易精华区>>讨论区精华>>电脑技术>>● FreeBSD>>有待整理的文章-新加的文章都在这里>>JDK1.3.1-p7 Hotspot VM for -STABLE

主题:JDK1.3.1-p7 Hotspot VM for -STABLE
发信人: huanghwh(五云人)
整理人: hackerbay(2002-09-06 16:48:52), 站内信件
日本人在-STABLE下成功编译hotspot vm:
http://docs.freebsd.org getmsg.cgi?fetch=55278+0+current/freebsd-java

不过可能问题多多,至少Bill Huey不建议在-STABLE下运行.

I built HotSpot on -stable in response to Mr. Maruyama's advice.
I report the contents which worked here(These contents of a 
report were already reported on Japan FreeBSD JavaML. Please 
refer to those who can read Japanese. 
http://home.jp.freebsd.org/cgi-bin/showmail/java/155).

System(uname -a)
----------------
  FreeBSD parancell.ongs.co.jp 4.6-PRERELEASE-20020511-JPSNAP 
    FreeBSD 4.6-PRERELEASE-20020511-JPSNAP #0: 
    Thu Aug  1 19:53:25 JST 2002

Preparation
-----------
  o You need source code in /usr/src/lib/libc_r/uthread/.
    Install it by /stand/sysinstall.
  o You need Linux JDK131(/usr/ports/java/linux-sun-jdk13/).
    (I use linux_base6)
  o I use open-motif-2.1.30_3(/usr/ports/x11-toolkits/open-motif)
  o I use ja-kochi-ttfonts-20020727(/usr/ports/japanese/kochi-ttfonts)
  o I use gcc-3.1.1_20020726(/usr/ports/lang/gcc31)
  o I use jdk13 ports updated at 2002/08/06(/usr/ports/java/jdk13).
  
Build
-----
  It is assumed that a patch is in /tmp/.

Maruyama_san-os_linux.cpp.diff: 
--- hotspot1.3.1/src/os/linux/vm/os_linux.cpp   14 Jul 2002 03:02:53 -0000
+++ hotspot1.3.1/src/os/linux/vm/os_linux.cpp   26 Jul 2002 10:36:11 -0000
@@ -68,6 +68,16 @@
 
 // Port Specific Routines
 //
+#if defined(__FreeBSD__) && __FreeBSD_version <= 500000
+static int
+pthread_main_np()
+{
+ if (!_thread_initial)
+ return (-1);
+ else
+ return (pthread_equal(pthread_self(), _thread_initial) ? 1 : 0);
+}
+#endif

extern "C"
{

pthread_private.h.diff:
--- pthread_private.h.orig Mon Aug 5 21:01:59 2002
+++ pthread_private.h Mon Aug 5 22:30:32 2002
@@ -1004,6 +1004,7 @@
#endif

/* Default thread attributes: */
+#undef pthread_attr_default
SCLASS struct pthread_attr pthread_attr_default
#ifdef GLOBAL_PTHREAD_PRIVATE
= { SCHED_RR, 0, TIMESLICE_USEC, PTHREAD_DEFAULT_PRIORITY, PTHREAD_CREATE_RUNNI
NG,
@@ -1013,6 +1014,7 @@
#endif

/* Default mutex attributes: */
+#undef pthread_mutexattr_default
SCLASS struct pthread_mutex_attr pthread_mutexattr_default
#ifdef GLOBAL_PTHREAD_PRIVATE
= { PTHREAD_MUTEX_DEFAULT, PTHREAD_PRIO_NONE, 0, 0 };
@@ -1021,6 +1023,7 @@
#endif

/* Default condition variable attributes: */
+#undef pthread_condattr_default
SCLASS struct pthread_cond_attr pthread_condattr_default
#ifdef GLOBAL_PTHREAD_PRIVATE
= { COND_TYPE_FAST, 0 };

# cd /usr/ports/java/jdk13/
# make patch
# cd work
# patch < /tmp/Maruyama_san-os_linux.cpp.diff
# cd /usr/src/lib/libc_r/uthread/
# patch < /tmp/pthread_private.h.diff
# cd /usr/ports/java/jdk13/
# make WITH_NATIVE_THREADS=yes install
# cd hotspot1.3.1/build/linux/
# setenv ALT_BOOTDIR /usr/local/linux-jdk1.3.1/
# gmake core
# gmake compiler1
# gmake compiler2
# mkdir -p /usr/local/jdk1.3.1/jre/lib/i386/hotspot/

Usage
-----
Three HotSpots are built. It is performed as follows for using,
respectively.

[core HotSpot]
# cd /usr/ports/java/jdk13/work/hotspot1.3.1/build/linux/
# cp linux_i486_core/product/libjvm.so /usr/local/jdk1.3.1/jre/lib/i386/hotspot/
# cp linux_i486_core/jvmg/libjvm_g.so /usr/local/jdk1.3.1/jre/lib/i386/hotspot/

[compiler1 HotSpot]
# cd /usr/ports/java/jdk13/work/hotspot1.3.1/build/linux/
# cp linux_i486_compiler1/product/libjvm.so /usr/local/jdk1.3.1/jre/lib/i386/hotspot/
# cp linux_i486_compiler1/jvmg/libjvm_g.so /usr/local/jdk1.3.1/jre/lib/i386/hotspot/

[compiler2 HotSpot]
# cd /usr/ports/java/jdk13/work/hotspot1.3.1/build/linux/
# cp linux_i486_compiler2/product/libjvm.so /usr/local/jdk1.3.1/jre/lib/i386/hotspot/
# cp linux_i486_compiler2/jvmg/libjvm_g.so /usr/local/jdk1.3.1/jre/lib/i386/hotspot/

for example,
> java -version
    java version "1.3.1-p7"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-p7-root-020806-17:02)
    Java HotSpot(TM) Client VM (build 1.3.1-internal, mixed mode)

Comparison of execution speed
-----------------------------
  The comparison of exeuciont speed by CaffeineMark 3.0.

        Caffeine-JDK118-nojit                   score = 2519
        Caffeine-JDK122-nojit                   score = 2490
        Caffeine-JDK131-hotspot-compiler1       score = 26949
        Caffeine-JDK131-hotspot-core            score = 2217
        Caffeine-JDK131-nohotspot               score = 2495
        Caffeine-LinuxBDJDK131-hotspot          score = 28304
        Caffeine-LinuxBDJDK131-nohotspot        score = 2471
        Caffeine-LinuxIBMJDK131-jit             score = 144050
        Caffeine-LinuxSunJDK122-nojit           score = 2491
        Caffeine-LinuxSunJDK131-hotspot         score = 28499
        Caffeine-LinuxSunJDK131-nohotspot       score = 2481
        Caffeine-LinuxSunJDK140-clienthotspot   score = 26947

  A summary of a result shows the characteristic which the FreeBSD 
  version and Linux version also resembled(However, Linux IBM JDK131 
  is outside. Has not it used the source code of Sun as the base?
  The characteristic is considerably different. And it operates 
  quickly wonderfully.). That's right since the code base is the same, 
  if it is called a natural result.
  The usefulness of HotSpot can be reconfirmed as a result.

Bug
---
  A Java2D demonstration carries out a strange motion. If it passes 
  fixed time, processing will stop temporarily. 
  A source code is not displayed in SwingSet2 demonstration.
  Heavy JFC/Swing, such as Forte and ArgoUML, -- an application does 
  not start, etc.

--
Daichi GOTO
    http://www.ongs.net/daichi, [email protected]

[关闭][返回]