This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

How to integrate gcj'ed library with JVM library..


Hello, all ~~
I'm studying about Java VM perfomance optimization.
I want to use gcj  as the optimization skill(ahead of time compiler).
The purpose is to convert the java system classes into shared library
using gcj and to integrate(link)
gcj'ed shared library  with other JVM library..
So, I already built gcc-3.0 on x86/Linux platform and succeeded
converting..
but I don't know how to link...
So.... In rough way, I tried to use JNI skill.('native' keyword and
System.loadLibrary())
For example, there is two java program, A.java and B.java.
A.java uses the method of B.java.
I compiled A.java by javac and B.java is converted to shared
library(libhello.so) by gcj..
( command : gcj -shared -o libhello.so B.java )
I executed A.class by command(java A), I got an error..

Is it possible to use JNI skill for linking libraries?
If not, how can I do?

Please help me~~


1. A.java 
------------------------------------------------------------------------
----------
public class A
{
	public native void sayHelloWorld();
	
	static{
		System.loadLibrary("hello");
	}
		
	public static void main(String args[])
	{
		new A().sayHelloWorld();
	}
}
------------------------------------------------------------------------
----------


2. B.java
------------------------------------------------------------------------
----------
public class B
{
	public void sayHelloWorld()
	{
		System.out.println("Hello, World~~");
	}
}
------------------------------------------------------------------------
----------



3. Error Messages
------------------------------------------------------------------------
----------
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0x4aae5fb6
Function name=GC_mark_from_mark_stack
Library=/usr/local/lib/libgcjgc.so.1

Current Java thread:
	at java.lang.ClassLoader$NativeLibrary.load(Native Method)
	at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1382)
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1306)
	at java.lang.Runtime.loadLibrary0(Runtime.java:749)
	at java.lang.System.loadLibrary(System.java:820)
	at A.<clinit>(A.java:7)

Dynamic libraries:
08048000-0804c000 r-xp 00000000 03:06 440914
/usr/java/jdk1.3.1/bin/i386/native_threads/java
0804c000-0804d000 rw-p 00003000 03:06 440914
/usr/java/jdk1.3.1/bin/i386/native_threads/java
40000000-40016000 r-xp 00000000 03:06 895879     /lib/ld-2.2.2.so
40016000-40017000 rw-p 00015000 03:06 895879     /lib/ld-2.2.2.so
40018000-40019000 r--p 00000000 03:06 81459
/usr/lib/locale/ko_KR.euckr/LC_IDENTIFICATION
40019000-4001a000 r--p 00000000 03:06 700413
/usr/lib/locale/ko_KR.euckr/LC_MEASUREMENT
4001a000-4001b000 r--p 00000000 03:06 81461
/usr/lib/locale/ko_KR.euckr/LC_TELEPHONE
4001b000-4001c000 r--p 00000000 03:06 390937
/usr/lib/locale/ko_KR.euckr/LC_ADDRESS
4001c000-4001d000 r--p 00000000 03:06 390942
/usr/lib/locale/ko_KR.euckr/LC_NAME
4001d000-4001e000 r--p 00000000 03:06 700417
/usr/lib/locale/ko_KR.euckr/LC_PAPER
4001e000-4001f000 r--p 00000000 03:06 48881
/usr/lib/locale/ko_KR.euckr/LC_MESSAGES/SYS_LC_MESSAGES
4001f000-40020000 r--p 00000000 03:06 977300
/usr/lib/locale/ko_KR.euckr/LC_MONETARY
40020000-40021000 r--p 00000000 03:06 977301
/usr/lib/locale/ko_KR.euckr/LC_TIME
40021000-40022000 r--p 00000000 03:06 390933
/usr/lib/locale/ko_KR.euckr/LC_NUMERIC
40022000-40023000 r-xp 00000000 03:06 261179
/usr/java/jdk1.3.1/bin/libhello.so
40023000-40025000 rw-p 00000000 03:06 261179
/usr/java/jdk1.3.1/bin/libhello.so
40025000-40032000 r-xp 00000000 03:06 260636     /lib/i686/libpthread-0.
9.so
40032000-4003a000 rw-p 0000c000 03:06 260636     /lib/i686/libpthread-0.
9.so
4003a000-40043000 r-xp 00000000 03:06 376314
/usr/java/jdk1.3.1/jre/lib/i386/native_threads/libhpi.so
40043000-40044000 rw-p 00008000 03:06 376314
/usr/java/jdk1.3.1/jre/lib/i386/native_threads/libhpi.so
40044000-402ab000 r-xp 00000000 03:06 409624
/usr/java/jdk1.3.1/jre/lib/i386/client/libjvm.so
402ab000-40411000 rw-p 00266000 03:06 409624
/usr/java/jdk1.3.1/jre/lib/i386/client/libjvm.so
40428000-4042b000 r-xp 00000000 03:06 895892     /lib/libdl-2.2.2.so
4042b000-4042c000 rw-p 00002000 03:06 895892     /lib/libdl-2.2.2.so
4042c000-40552000 r-xp 00000000 03:06 260632     /lib/i686/libc-2.2.2.so
40552000-40558000 rw-p 00125000 03:06 260632     /lib/i686/libc-2.2.2.so
4055c000-4056f000 r-xp 00000000 03:06 895897     /lib/libnsl-2.2.2.so
4056f000-40571000 rw-p 00012000 03:06 895897     /lib/libnsl-2.2.2.so
40574000-40597000 r-xp 00000000 03:06 260634     /lib/i686/libm-2.2.2.so
40597000-40598000 rw-p 00022000 03:06 260634     /lib/i686/libm-2.2.2.so
40598000-405cc000 r-xp 00000000 03:06 390967     /usr/lib/libstdc++-2-
libc6.1-1-2.9.0.so
405cc000-405d8000 rw-p 00033000 03:06 390967     /usr/lib/libstdc++-2-
libc6.1-1-2.9.0.so
405da000-405eb000 r-xp 00000000 03:06 1011217
/usr/java/jdk1.3.1/jre/lib/i386/libverify.so
405eb000-405ed000 rw-p 00010000 03:06 1011217
/usr/java/jdk1.3.1/jre/lib/i386/libverify.so
405ed000-4060e000 r-xp 00000000 03:06 1011208
/usr/java/jdk1.3.1/jre/lib/i386/libjava.so
4060e000-40610000 rw-p 00020000 03:06 1011208
/usr/java/jdk1.3.1/jre/lib/i386/libjava.so
40611000-40625000 r-xp 00000000 03:06 1011218
/usr/java/jdk1.3.1/jre/lib/i386/libzip.so
40625000-40628000 rw-p 00013000 03:06 1011218
/usr/java/jdk1.3.1/jre/lib/i386/libzip.so
40628000-41341000 r--s 00000000 03:06 507556
/usr/java/jdk1.3.1/jre/lib/rt.jar
4136e000-41613000 r--s 00000000 03:06 507547
/usr/java/jdk1.3.1/jre/lib/i18n.jar
41613000-41629000 r--s 00000000 03:06 507557
/usr/java/jdk1.3.1/jre/lib/sunrsasign.jar
49d3f000-49dc7000 r--p 00000000 03:06 977299
/usr/lib/locale/ko_KR.euckr/LC_CTYPE
49dc7000-49e10000 r--p 00000000 03:06 977298
/usr/lib/locale/ko_KR.euckr/LC_COLLATE
49e10000-49e1a000 r-xp 00000000 03:06 895913     /lib/libnss_files-
2.2.2.so
49e1a000-49e1b000 rw-p 00009000 03:06 895913     /lib/libnss_files-
2.2.2.so
4a687000-4a68d000 r-xp 00000000 03:06 440906
/usr/local/lib/libgcc_s.so.1
4a68d000-4a68f000 rw-p 00005000 03:06 440906
/usr/local/lib/libgcc_s.so.1
4a68f000-4a943000 r-xp 00000000 03:06 440749
/usr/local/lib/libgcj.so.2.0.0
4a943000-4aad5000 rw-p 002b3000 03:06 440749
/usr/local/lib/libgcj.so.2.0.0
4aada000-4aaee000 r-xp 00000000 03:06 440752
/usr/local/lib/libgcjgc.so.1.0.1
4aaee000-4aaef000 rw-p 00013000 03:06 440752
/usr/local/lib/libgcjgc.so.1.0.1
4aaf7000-4ab03000 r-xp 00000000 03:06 440746     /usr/local/lib/libzgcj.
so.0.0.0
4ab03000-4ab05000 rw-p 0000b000 03:06 440746     /usr/local/lib/libzgcj.
so.0.0.0
4ab05000-4ab08000 r-xp 00000000 03:06 228150     /usr/lib/gconv/EUC-
KR.so
4ab08000-4ab09000 rw-p 00002000 03:06 228150     /usr/lib/gconv/EUC-
KR.so
4ab09000-4ab14000 r-xp 00000000 03:06 228277
/usr/lib/gconv/libKSC.so
4ab14000-4ab15000 rw-p 0000a000 03:06 228277
/usr/lib/gconv/libKSC.so

Local Time = Tue Sep 18 11:12:32 2001
Elapsed Time = 0
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.3.1-b24 mixed mode)
#
------------------------------------------------------------------------
----------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]