精华区 [关闭][返回]

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

主题:编译JDK1.3.1-p7 Hotspot
发信人: huanghwh(五云人)
整理人: hackerbay(2002-09-06 16:48:52), 站内信件
1. 环境: 最新 -CURRENT + /usr/ports/lang/gcc31;
2. cd /usr/ports/java/jdk13; make patch;
3. Hotspot似乎不能在最新 -CURRENT编译通过,这是我的patch:

==============================================
--- ./hotspot1.3.1/build/linux/makefiles/compiler2.make.old     Fri Jul 26 22:06:52 2002
+++ ./hotspot1.3.1/build/linux/makefiles/compiler2.make Fri Jul 26 19:53:42 2002
@@ -2,4 +2,4 @@

 TYPE=COMPILER2

-CFLAGS += -DCOMPILER2
+CFLAGS += -DCOMPILER2 -D__FreeBSD__
--- ./hotspot1.3.1/build/linux/makefiles/adlc.make.old  Fri Jul 26 22:07:16 2002
+++ ./hotspot1.3.1/build/linux/makefiles/adlc.make      Fri Jul 26 19:54:32 2002
@@ -53,7 +53,7 @@
 #  /usr/dist/share/devpro/5.x-sparc/bin/CC
 #  man -M /usr/dist/share/devpro/5.x-sparc/man CC

-CPP       = g++
+CPP       = g++31
 CPPFLAGS  = -DASSERT -g -o $@
 # -o      object file-name
 # +w      Additional warnings: Nonportable, Likely mistakes or inefficient
--- ./hotspot1.3.1/src/share/vm/adlc/filebuff.cpp.old   Fri Jul 26 22:07:34 2002
+++ ./hotspot1.3.1/src/share/vm/adlc/filebuff.cpp       Fri Jul 26 19:54:54 2002
@@ -19,8 +19,8 @@

 //#include <iostream> //--billh

-#include <ostream.h> //--billh
-//#include "ostream.h" //--billh
+//#include <ostream.h> //--billh
+#include "ostream.h" //--billh

 //------------------------------FileBuff---------------------------------------
 // Create a new parsing buffer
--- ./hotspot1.3.1/src/os_cpu/linux_i486/vm/os_linux_i486.cpp.old       Fri Jul26 22:07:55 2002
+++ ./hotspot1.3.1/src/os_cpu/linux_i486/vm/os_linux_i486.cpp   Fri Jul 26 20:03:02 2002
@@ -798,7 +798,7 @@
   unsigned int sum = 0;

   int         flag;
-
+  /*
   switch ((int)tid->ctxtype)
   {
      case CTX_JB_NOSIG:                // 0) jmp_buf context without signal mask for blocking IO, etc...
@@ -817,6 +817,10 @@
      default:
        break;
   }
+  */
+         sum += so->numbers[0];
+         sum += so->numbers[1];
+         sum += so->numbers[2];

   if (tp->last_sum() == sum) {
     return false;
--- ./j2sdk1.3.1/src/solaris/hpi/native_threads/src/threads_bsd.c.old   Fri Jul26 22:08:41 2002
+++ ./j2sdk1.3.1/src/solaris/hpi/native_threads/src/threads_bsd.c       Fri Jul26 20:41:37 2002
@@ -283,7 +283,7 @@
        "SUSP_COND_WAIT",       /* Suspended, still in a condition queue. */
        "susp boundless"
 };
-
+/*
 char *getSuspendStateString(enum pthread_susp suspendState)
 {
        if (suspendState < ANALRETENTIVE)
@@ -291,7 +291,7 @@
else
return &SuspendList[ANALRETENTIVE-1][0];
}
-
+*/
#define SATAN (21 + 1) /* for the error string at the end of the list */

char SignalList [SATAN][16]
@@ -526,32 +526,33 @@
*/
if (thread->state != PS_SUSPENDED)
                dumpThreadLogStates(thread);
-
-       switch ((int)thread->ctxtype)
-       {
-               case CTX_JB_NOSIG:      /* 0) jmp_buf context without signal mask for blocking IO, etc... */
-               case CTX_JB:            /* 1) should never be CTX_JB */
-               case CTX_SJB:           /* 2) should never be CTX_SJB */
-                       clear_gc_registers(javaThread);
-#ifdef DEBUG_BSD_NATIVE_THREADS
-                       goto Terminate;
-#endif
-                       break;
-               case CTX_UC:            /* 3) */
+       clear_gc_registers(javaThread);
+       //record_uc(javaThread, &thread->ctx.uc);
+       //      switch ((int)thread->ctxtype)
+       //{
+       //              case CTX_JB_NOSIG:      /* 0) jmp_buf context without signal mask for blocking IO, etc... */
+       //              case CTX_JB:            /* 1) should never be CTX_JB */
+       //      case CTX_SJB:           /* 2) should never be CTX_SJB */
+       //              clear_gc_registers(javaThread);
+       //#ifdef DEBUG_BSD_NATIVE_THREADS
+       //                      goto Terminate;
+       //#endif
+       //                      break;
+       //              case CTX_UC:            /* 3) */
                        /* context is a ucontext_t */
-                       record_uc(javaThread, &thread->ctx.uc);
-#ifdef DEBUG_BSD_NATIVE_THREADS
-                       goto Terminate;
-#endif
-                       break;
-               default:
-#ifdef DEBUG_BSD_NATIVE_THREADS
-                       fprintf(stderr, "ctxtype failed %d.\n", thread->ctxtype);
-                       goto TermFailed;
-#endif
-                       break;
-       }
-
+       //                      record_uc(javaThread, &thread->ctx.uc);
+       //#ifdef DEBUG_BSD_NATIVE_THREADS
+       //                      goto Terminate;
+       //#endif
+       //                      break;
+       //              default:
+       //#ifdef DEBUG_BSD_NATIVE_THREADS
+       //                      fprintf(stderr, "ctxtype failed %d.\n", thread->ctxtype);
+       //                      goto TermFailed;
+       //#endif
+       //                      break;
+       //      }
+       /*
 #ifdef DEBUG_BSD_NATIVE_THREADS
 TermFailed:
        fprintf(stderr, "Failed to find pthread struct.\n"); fflush(stderr);
@@ -560,6 +561,7 @@
 Terminate:
        dumpThreadStates();
 #endif
+       */
 }

 void record_uc(sys_thread_t *t, ucontext_t *uc) 
==============================================  

  #cd /usr/ports/java/jdk13/work
  #patch< my.patch;

4. 正常从ports编译jdk1.3.1-p7;
#setenv WITH_NATIVE_THREADS;
#cd /usr/ports/java/jdk13;make install;

5. 编译Hotspot
#cd /usr/ports/java/jdk13/work/hotspot1.3.1/build/linux;
#setenv ALT_BOOTDIR /usr/local/jdk1.3.1;
#gmake core compiler1 compiler2;

6.按 Bill Huey 说明安装hotspot:

d) Install it using some variation of:

==============================================

#!/bin/csh

#set files="linux_i486_compiler1/jvmg/libjvm_g.so"

set files="linux_i486_core/product/libjvm.so linux_i486_core/jvmg/libjvm_g.so"
#set files="linux_i486_compiler1/product/libjvm.so linux_i486_compiler1/jvmg/libjvm_g.so"
#set files="linux_i486_compiler2/product/libjvm.so linux_i486_compiler2/jvmg/libjvm_g.so"

ls -l $files

set destination=../../../j2sdk1.3.1/build/bsd-i386/lib/i386/hotspot

rm -rf $destination
mkdir $destination

echo cp $files $destination
cp $files $destination

ls -l $destination

==============================================

e) Modify jvm.cfg to use the HotSpot libraries.

f) Run the JVM.

7. 大功告成. 不过有很多warning msg喔!

--hwh




[关闭][返回]