[Mono-list] [vargaz@freemail.hu: [Ikvm-developers] Eclipse under mono]

Paolo Molaro lupus@ximian.com
Sat, 10 May 2003 21:42:17 +0200


--gneEPciiIl/aKvOT
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Master hacker Zoltan did it again: he got eclipse running
with IKVM using the mono runtime.

Cheers!

lupus

-- 
-----------------------------------------------------------------
lupus@debian.org                                     debian/rules
lupus@ximian.com                             Monkeys do it better

--gneEPciiIl/aKvOT
Content-Type: message/rfc822
Content-Disposition: inline

Return-Path: <ikvm-developers-admin@lists.sourceforge.net>
Delivered-To: lupus@ximian.com
Received: from sc8-sf-list2.sourceforge.net (lists.sourceforge.net [66.35.250.206])
	by skeptopotamus.ximian.com (Postfix) with ESMTP id 69A7F63071
	for <lupus@ximian.com>; Sat, 10 May 2003 05:53:07 -0400 (EDT)
Received: from sc8-sf-list1-b.sourceforge.net ([10.3.1.13] helo=sc8-sf-list1.sourceforge.net)
	by sc8-sf-list2.sourceforge.net with esmtp (Exim 3.31-VA-mm2 #1 (Debian))
	id 19ER2h-0004CU-00; Sat, 10 May 2003 02:53:23 -0700
Received: from fmx1.freemail.hu ([195.228.242.221])
	by sc8-sf-list1.sourceforge.net with smtp (Exim 3.31-VA-mm2 #1 (Debian))
	id 19ER1h-00082r-00
	for <ikvm-developers@lists.sourceforge.net>; Sat, 10 May 2003 02:52:21 -0700
Received: (qmail 30838 invoked from network); 10 May 2003 11:52:18 +0200
Received: from fm9.freemail.hu (195.228.242.209)
  by fmx1.freemail.hu with SMTP; 10 May 2003 11:52:18 +0200
Received: (qmail 37703 invoked by uid 814275); 10 May 2003 11:52:17 +0200
From: Varga Zoltan <vargaz@freemail.hu>
To: ikvm-developers@lists.sourceforge.net
Message-ID: <freemail.20030410115217.37695@fm9.freemail.hu>
X-Originating-IP: [212.121.135.226]
X-HTTP-User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312
MIME-Version: 1.0
Content-Type: MULTIPART/MIXED; BOUNDARY="0-1804289383-1052560337=:37695"
Subject: [Ikvm-developers] Eclipse under mono
Sender: ikvm-developers-admin@lists.sourceforge.net
Errors-To: ikvm-developers-admin@lists.sourceforge.net
X-BeenThere: ikvm-developers@lists.sourceforge.net
X-Mailman-Version: 2.0.9-sf.net
Precedence: bulk
List-Help: <mailto:ikvm-developers-request@lists.sourceforge.net?subject=help>
List-Post: <mailto:ikvm-developers@lists.sourceforge.net>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/ikvm-developers>,
	<mailto:ikvm-developers-request@lists.sourceforge.net?subject=subscribe>
List-Id: <ikvm-developers.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/ikvm-developers>,
	<mailto:ikvm-developers-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum=ikvm-developers>
Date: Sat, 10 May 2003 11:52:17 +0200 (CEST)

--0-1804289383-1052560337=:37695
Content-Type: TEXT/PLAIN; CHARSET=ISO-8859-2


                                         Hi,

  I got Eclipse running under IKVM under Mono. A screenshot,
Makefiles
etc. can be found here:

http://www.nexus.hu/vargaz/

The port uses a JNI provider written in C which works with
mono. Eclipse
startup up+shuts down in about 1 minute on an 1Ghz PC, while
consuming about 90MB of memory. It works with Mono 0.24 and
current
mono CVS.

I made some modifications to IKVM which are in the attached
patch.
Could they be applied to the official version?

The modifications are:
-  ikvm.build: fix case of directory names
- ClassLoaderWrapper.cs: Create Assemblies with Run flag, so the
  runtime can apply some memory saving optimizations.
- TypeWrapper.cs: Cache field lookups
- classpath.cs: Make shared library loading work under UNIX

There is one other issue: Mono does not yet support the 
GetLoadedModules() method, so this has to be commmented out
in classpath.cs and in Handler.java.

BTW: The IBM RVM project includes a nice JNI testsuite:

http://www-124.ibm.com/developerworks/oss/jikesrvm/

The Mauve test status of mono:
191 of 7294 tests failed

Would it be possible to post the Mauve test results of IKVM
somewhere
(with -verbose) so I can compare it to the Mono version?

                                        have fun

                                                Zoltan










--0-1804289383-1052560337=:37695
Content-Type: APPLICATION/octet-stream; name="small.diff"
Content-Disposition: attachment; filename="small.diff"

Index: ikvm.build
===================================================================
RCS file: /cvsroot/ikvm/ikvm/ikvm.build,v
retrieving revision 1.2
diff -u -3 -p -u -b -r1.2 ikvm.build
--- ikvm.build	8 Jan 2003 13:35:05 -0000	1.2
+++ ikvm.build	18 Apr 2003 13:50:13 -0000
@@ -1,8 +1,8 @@
 <?xml version="1.0"?>
 <project name="ikvm" default="all">
     <target name="all">
-        <nant buildfile="ik.vm.net/ik.vm.net.build" />
-        <nant buildfile="ik.vm.jni/ik.vm.jni.build" />
+        <nant buildfile="IK.VM.NET/ik.vm.net.build" />
+        <nant buildfile="IK.VM.JNI/ik.vm.jni.build" />
         <nant buildfile="netexp/netexp.build" />
         <nant buildfile="ikvmc/ikvmc.build" />
         <nant buildfile="classpath/classpath.build" />
Index: IK.VM.NET/ClassLoaderWrapper.cs
===================================================================
RCS file: /cvsroot/ikvm/ikvm/IK.VM.NET/ClassLoaderWrapper.cs,v
retrieving revision 1.16
diff -u -3 -p -u -b -r1.16 ClassLoaderWrapper.cs
--- IK.VM.NET/ClassLoaderWrapper.cs	14 Apr 2003 09:41:58 -0000	1.16
+++ IK.VM.NET/ClassLoaderWrapper.cs	18 Apr 2003 13:50:14 -0000
@@ -567,7 +568,7 @@ class ClassLoaderWrapper
 	{
 		AssemblyName name = new AssemblyName();
 		name.Name = "ikvm_dynamic_assembly__" + (this == GetBootstrapClassLoader() ? "bootstrap" : javaClassLoader);
-		AssemblyBuilder assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(name, AssemblyBuilderAccess.RunAndSave);
+		AssemblyBuilder assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(name, AssemblyBuilderAccess.Run);
 		ModuleBuilder moduleBuilder = assemblyBuilder.DefineDynamicModule(name.Name, JVM.Debug);
 		if(JVM.Debug)
 		{
Index: IK.VM.NET/TypeWrapper.cs
===================================================================
RCS file: /cvsroot/ikvm/ikvm/IK.VM.NET/TypeWrapper.cs,v
retrieving revision 1.23
diff -u -3 -p -u -b -r1.23 TypeWrapper.cs
--- IK.VM.NET/TypeWrapper.cs	14 Apr 2003 09:41:58 -0000	1.23
+++ IK.VM.NET/TypeWrapper.cs	18 Apr 2003 13:50:14 -0000
@@ -4104,6 +4143,7 @@ sealed class FieldWrapper
 	private IntPtr cookie;
 	internal CodeEmitter EmitGet;
 	internal CodeEmitter EmitSet;
+	private FieldInfo field;
 
 	internal FieldWrapper(TypeWrapper declaringType, string name, string sig, Modifiers modifiers)
 	{
@@ -4368,7 +4408,7 @@ sealed class FieldWrapper
 		return field;
 	}
 
-	internal void SetValue(object obj, object val)
+	internal FieldInfo LookupField()
 	{
 		// TODO this is a broken implementation (for one thing, it needs to support redirection)
 		BindingFlags bindings = BindingFlags.Public | BindingFlags.NonPublic;
@@ -4380,21 +4420,24 @@ sealed class FieldWrapper
 		{
 			bindings |= BindingFlags.Instance;
 		}
-		DeclaringType.Type.GetField(name, bindings).SetValue(obj, val);
+		return DeclaringType.Type.GetField(name, bindings);
 	}
 
-	internal object GetValue(object obj)
-	{
-		// TODO this is a broken implementation (for one thing, it needs to support redirection)
-		BindingFlags bindings = BindingFlags.Public | BindingFlags.NonPublic;
-		if(IsStatic)
+	internal void SetValue(object obj, object val)
 		{
-			bindings |= BindingFlags.Static;
+		if (field == null)
+			field = LookupField ();
+		field.SetValue(obj, val);
 		}
-		else
+
+	internal object GetValue(object obj)
 		{
-			bindings |= BindingFlags.Instance;
-		}
-		return DeclaringType.Type.GetField(name, bindings).GetValue(obj);
+		if (field == null)
+			field = LookupField ();
+		return field.GetValue (obj);
 	}
 }
Index: IK.VM.NET/classpath.cs
===================================================================
RCS file: /cvsroot/ikvm/ikvm/IK.VM.NET/classpath.cs,v
retrieving revision 1.25
diff -u -3 -p -u -b -r1.25 classpath.cs
--- IK.VM.NET/classpath.cs	14 Apr 2003 09:41:58 -0000	1.25
+++ IK.VM.NET/classpath.cs	18 Apr 2003 13:50:14 -0000
@@ -456,6 +456,9 @@ namespace NativeCode.java
 
 			public static string nativeGetLibname(string pathname, string libname)
 			{
+				if (Environment.OSVersion.ToString ().IndexOf ("Unix") >= 0)
+					return "lib" + libname + ".so";
+
 				// HACK this seems like a lame way of doing things, but in order to get Eclipse to work,
 				// we have append .dll to the libname here
 				if(!libname.ToUpper().EndsWith(".DLL"))
@@ -939,10 +942,13 @@ namespace NativeCode.java
 				{
 					if(!(assemblies[i] is NetSystem.Reflection.Emit.AssemblyBuilder))
 					{
+						/*
+						  // GetLoadedModules() is not implemented under mono
 						if(assemblies[i].GetLoadedModules()[0].GetField(name) != null)
 						{
 							return assemblies[i];
 						}
+						*/
 					}
 				}
 				return null;


--0-1804289383-1052560337=:37695--



-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com

_______________________________________________
Ikvm-developers mailing list
Ikvm-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ikvm-developers

--gneEPciiIl/aKvOT--