зеркало из https://github.com/mono/ikvm-fork.git
*** empty log message ***
This commit is contained in:
Родитель
bc9d509e5d
Коммит
63387197a3
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0"?>
|
||||
<project name="ik.vm.jni" default="ik.vm.jni">
|
||||
<target name="ik.vm.jni">
|
||||
<mkdir dir="release"/>
|
||||
<cl outputdir="Release" pchfile="stdafx.h" options="/O2 /D WIN32 /D NDEBUG /D _WINDLL /D _MBCS /FD /EHsc /GS /Zc:wchar_t /Zc:forScope /W3 /nologo /c /Zi /clr /TP /FU ..\bin\ik.vm.net.dll">
|
||||
<sources>
|
||||
<includes name="*.cpp"/>
|
||||
|
|
|
@ -59,6 +59,7 @@ public class ByteCodeHelper
|
|||
[DebuggerStepThroughAttribute]
|
||||
public static object DynamicMultianewarray(RuntimeTypeHandle type, string clazz, int[] lengths)
|
||||
{
|
||||
Profiler.Count("DynamicMultianewarray");
|
||||
TypeWrapper wrapper = LoadTypeWrapper(type, clazz);
|
||||
return multianewarray(wrapper.TypeAsArrayType.TypeHandle, lengths);
|
||||
}
|
||||
|
@ -67,6 +68,7 @@ public class ByteCodeHelper
|
|||
[DebuggerStepThroughAttribute]
|
||||
public static object DynamicNewarray(int length, RuntimeTypeHandle type, string clazz)
|
||||
{
|
||||
Profiler.Count("DynamicNewarray");
|
||||
if(length < 0)
|
||||
{
|
||||
throw JavaException.NegativeArraySizeException();
|
||||
|
@ -79,6 +81,7 @@ public class ByteCodeHelper
|
|||
[DebuggerStepThroughAttribute]
|
||||
public static void DynamicAastore(object arrayref, int index, object val, RuntimeTypeHandle type, string clazz)
|
||||
{
|
||||
Profiler.Count("DynamicAastore");
|
||||
// TODO do we need to load the type here?
|
||||
((Array)arrayref).SetValue(val, index);
|
||||
}
|
||||
|
@ -87,6 +90,7 @@ public class ByteCodeHelper
|
|||
[DebuggerStepThroughAttribute]
|
||||
public static object DynamicAaload(object arrayref, int index, RuntimeTypeHandle type, string clazz)
|
||||
{
|
||||
Profiler.Count("DynamicAaload");
|
||||
// TODO do we need to load the type here?
|
||||
return ((Array)arrayref).GetValue(index);
|
||||
}
|
||||
|
@ -120,6 +124,7 @@ public class ByteCodeHelper
|
|||
[DebuggerStepThroughAttribute]
|
||||
public static object DynamicGetfield(object obj, string name, string sig, RuntimeTypeHandle type, string clazz)
|
||||
{
|
||||
Profiler.Count("DynamicGetfield");
|
||||
return GetFieldWrapper(ClassLoaderWrapper.GetWrapperFromType(obj.GetType()), type, clazz, name, sig, false).GetValue(obj);
|
||||
}
|
||||
|
||||
|
@ -127,6 +132,7 @@ public class ByteCodeHelper
|
|||
[DebuggerStepThroughAttribute]
|
||||
public static object DynamicGetstatic(string name, string sig, RuntimeTypeHandle type, string clazz)
|
||||
{
|
||||
Profiler.Count("DynamicGetstatic");
|
||||
return GetFieldWrapper(null, type, clazz, name, sig, true).GetValue(null);
|
||||
}
|
||||
|
||||
|
@ -134,6 +140,7 @@ public class ByteCodeHelper
|
|||
[DebuggerStepThroughAttribute]
|
||||
public static void DynamicPutfield(object obj, object val, string name, string sig, RuntimeTypeHandle type, string clazz)
|
||||
{
|
||||
Profiler.Count("DynamicPutfield");
|
||||
GetFieldWrapper(ClassLoaderWrapper.GetWrapperFromType(obj.GetType()), type, clazz, name, sig, false).SetValue(obj, val);
|
||||
}
|
||||
|
||||
|
@ -141,6 +148,7 @@ public class ByteCodeHelper
|
|||
[DebuggerStepThroughAttribute]
|
||||
public static void DynamicPutstatic(object val, string name, string sig, RuntimeTypeHandle type, string clazz)
|
||||
{
|
||||
Profiler.Count("DynamicPutstatic");
|
||||
GetFieldWrapper(null, type, clazz, name, sig, true).SetValue(null, val);
|
||||
}
|
||||
|
||||
|
@ -149,6 +157,7 @@ public class ByteCodeHelper
|
|||
[DebuggerStepThroughAttribute]
|
||||
public static void DynamicNewCheckOnly(RuntimeTypeHandle type, string clazz)
|
||||
{
|
||||
Profiler.Count("DynamicNewCheckOnly");
|
||||
TypeWrapper wrapper = LoadTypeWrapper(type, clazz);
|
||||
if(wrapper.IsAbstract || wrapper.IsInterface)
|
||||
{
|
||||
|
@ -178,6 +187,7 @@ public class ByteCodeHelper
|
|||
[DebuggerStepThroughAttribute]
|
||||
public static object DynamicClassLiteral(RuntimeTypeHandle type, string clazz)
|
||||
{
|
||||
Profiler.Count("DynamicClassLiteral");
|
||||
return NativeCode.java.lang.VMClass.getClassFromWrapper(LoadTypeWrapper(type, clazz));
|
||||
}
|
||||
|
||||
|
@ -185,6 +195,7 @@ public class ByteCodeHelper
|
|||
[DebuggerStepThroughAttribute]
|
||||
public static object DynamicCast(object obj, RuntimeTypeHandle type, string clazz)
|
||||
{
|
||||
Profiler.Count("DynamicCast");
|
||||
if(!DynamicInstanceOf(obj, type, clazz))
|
||||
{
|
||||
throw JavaException.ClassCastException(ClassLoaderWrapper.GetWrapperFromType(obj.GetType()).Name);
|
||||
|
@ -196,6 +207,7 @@ public class ByteCodeHelper
|
|||
[DebuggerStepThroughAttribute]
|
||||
public static bool DynamicInstanceOf(object obj, RuntimeTypeHandle type, string clazz)
|
||||
{
|
||||
Profiler.Count("DynamicInstanceOf");
|
||||
TypeWrapper wrapper = LoadTypeWrapper(type, clazz);
|
||||
TypeWrapper other = ClassLoaderWrapper.GetWrapperFromType(obj.GetType());
|
||||
return other.IsAssignableTo(wrapper);
|
||||
|
@ -205,6 +217,7 @@ public class ByteCodeHelper
|
|||
[DebuggerStepThroughAttribute]
|
||||
public static object DynamicInvokeSpecialNew(RuntimeTypeHandle type, string clazz, string name, string sig, object[] args)
|
||||
{
|
||||
Profiler.Count("DynamicInvokeSpecialNew");
|
||||
TypeWrapper wrapper = LoadTypeWrapper(type, clazz);
|
||||
// TODO who checks that the arg types are loadable?
|
||||
// TODO check accessibility
|
||||
|
@ -221,6 +234,7 @@ public class ByteCodeHelper
|
|||
[DebuggerStepThroughAttribute]
|
||||
public static object DynamicInvokestatic(RuntimeTypeHandle type, string clazz, string name, string sig, object[] args)
|
||||
{
|
||||
Profiler.Count("DynamicInvokestatic");
|
||||
TypeWrapper wrapper = LoadTypeWrapper(type, clazz);
|
||||
// TODO who checks that the arg types are loadable?
|
||||
// TODO check accessibility
|
||||
|
@ -237,6 +251,7 @@ public class ByteCodeHelper
|
|||
[DebuggerStepThroughAttribute]
|
||||
public static object DynamicInvokevirtual(object obj, RuntimeTypeHandle type, string clazz, string name, string sig, object[] args)
|
||||
{
|
||||
Profiler.Count("DynamicInvokevirtual");
|
||||
TypeWrapper wrapper = LoadTypeWrapper(type, clazz);
|
||||
// TODO who checks that the arg types are loadable?
|
||||
// TODO check accessibility
|
||||
|
@ -253,6 +268,7 @@ public class ByteCodeHelper
|
|||
[DebuggerStepThroughAttribute]
|
||||
public static Type DynamicGetTypeAsExceptionType(RuntimeTypeHandle type, string clazz)
|
||||
{
|
||||
Profiler.Count("DynamicGetTypeAsExceptionType");
|
||||
TypeWrapper tw = LoadTypeWrapper(type, clazz);
|
||||
tw.Finish();
|
||||
return tw.TypeAsExceptionType;
|
||||
|
|
|
@ -1026,7 +1026,7 @@ abstract class TypeWrapper
|
|||
{
|
||||
return false;
|
||||
}
|
||||
return String.CompareOrdinal(name, skip1, wrapper.name, skip2, index1) == 0;
|
||||
return String.CompareOrdinal(name, skip1, wrapper.name, skip2, index1 - skip1) == 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1118,6 +1118,12 @@ class Compiler
|
|||
prevBlock.LeaveStubs(block);
|
||||
}
|
||||
|
||||
if(!ma.IsReachable(i))
|
||||
{
|
||||
// skip any unreachable instructions
|
||||
continue;
|
||||
}
|
||||
|
||||
// if there was a forward branch to this instruction, it is forward reachable
|
||||
instructionIsForwardReachable |= block.HasLabel(i);
|
||||
|
||||
|
@ -1127,7 +1133,7 @@ class Compiler
|
|||
|
||||
// if the instruction is only backward reachable, ECMA says it must have an empty stack,
|
||||
// so we move the stack to locals
|
||||
if(!instructionIsForwardReachable && ma.IsReachable(i))
|
||||
if(!instructionIsForwardReachable)
|
||||
{
|
||||
int stackHeight = ma.GetStackHeight(i);
|
||||
if(stackHeight != 0)
|
||||
|
@ -1150,6 +1156,8 @@ class Compiler
|
|||
|
||||
// if we're entering an exception block, we need to setup the exception block and
|
||||
// transfer the stack into it
|
||||
// Note that an exception block that *starts* at an unreachable instruction,
|
||||
// is completely unreachable, because it is impossible to branch into an exception block.
|
||||
for(; exceptionIndex < exceptions.Length && exceptions[exceptionIndex].start_pc == instr.PC; exceptionIndex++)
|
||||
{
|
||||
int stackHeight = ma.GetStackHeight(i);
|
||||
|
@ -1194,12 +1202,6 @@ class Compiler
|
|||
}
|
||||
}
|
||||
|
||||
if(!ma.IsReachable(i))
|
||||
{
|
||||
// skip any unreachable instructions
|
||||
continue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
switch(instr.NormalizedOpCode)
|
||||
|
|
|
@ -23,6 +23,8 @@ java/net/SocketInputStream.java
|
|||
java/net/SocketOutputStream.java
|
||||
sun/misc/Ref.java
|
||||
../../classpath/gnu/classpath/RawData.java
|
||||
../../classpath/gnu/classpath/ServiceFactory.java
|
||||
../../classpath/gnu/classpath/ServiceProviderLoadingAction.java
|
||||
../../classpath/gnu/java/awt/BitMaskExtent.java
|
||||
../../classpath/gnu/java/awt/BitwiseXORComposite.java
|
||||
../../classpath/gnu/java/awt/Buffers.java
|
||||
|
@ -277,6 +279,7 @@ sun/misc/Ref.java
|
|||
../../classpath/gnu/java/rmi/server/ProtocolConstants.java
|
||||
../../classpath/gnu/java/rmi/server/RMIDefaultSocketFactory.java
|
||||
../../classpath/gnu/java/rmi/server/RMIHashes.java
|
||||
../../classpath/gnu/java/rmi/server/RMIIncomingThread.java
|
||||
../../classpath/gnu/java/rmi/server/RMIObjectInputStream.java
|
||||
../../classpath/gnu/java/rmi/server/RMIObjectOutputStream.java
|
||||
../../classpath/gnu/java/rmi/server/RMIVoidValue.java
|
||||
|
@ -1414,6 +1417,8 @@ sun/misc/Ref.java
|
|||
../../classpath/javax/accessibility/AccessibleTableModelChange.java
|
||||
../../classpath/javax/accessibility/AccessibleText.java
|
||||
../../classpath/javax/accessibility/AccessibleValue.java
|
||||
../../classpath/javax/imageio/spi/RegisterableService.java
|
||||
../../classpath/javax/imageio/spi/ServiceRegistry.java
|
||||
../../classpath/javax/naming/AuthenticationException.java
|
||||
../../classpath/javax/naming/AuthenticationNotSupportedException.java
|
||||
../../classpath/javax/naming/BinaryRefAddr.java
|
||||
|
|
|
@ -281,6 +281,7 @@ public final class FileDescriptor
|
|||
try
|
||||
{
|
||||
if(false) throw new cli.System.IO.IOException();
|
||||
stream.Flush();
|
||||
return stream.ReadByte();
|
||||
}
|
||||
catch(cli.System.IO.IOException x)
|
||||
|
@ -307,6 +308,7 @@ public final class FileDescriptor
|
|||
try
|
||||
{
|
||||
if(false) throw new cli.System.IO.IOException();
|
||||
stream.Flush();
|
||||
int count = stream.Read(ByteArrayHack.cast(buf), offset, len);
|
||||
if(count == 0)
|
||||
{
|
||||
|
@ -345,6 +347,8 @@ public final class FileDescriptor
|
|||
{
|
||||
if(false) throw new cli.System.IO.IOException();
|
||||
stream.Write(ByteArrayHack.cast(buf), offset, len);
|
||||
// NOTE FileStream buffers the output, so we have to flush explicitly
|
||||
stream.Flush();
|
||||
}
|
||||
catch(cli.System.IO.IOException x)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2003 Jeroen Frijters
|
||||
Copyright (C) 2003, 2004 Jeroen Frijters
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
@ -230,7 +230,7 @@ final class VMRuntime
|
|||
* @return the newly created process
|
||||
* @throws NullPointerException if cmd or env have null elements
|
||||
*/
|
||||
static Process exec(String[] cmd, String[] env, File dir)
|
||||
static Process exec(String[] cmd, String[] env, File dir) throws java.io.IOException
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for(int i = 1; i < cmd.length; i++)
|
||||
|
@ -268,8 +268,20 @@ final class VMRuntime
|
|||
si.get_EnvironmentVariables().set_Item(env[i].substring(0, pos), env[i].substring(pos + 1));
|
||||
}
|
||||
}
|
||||
// TODO map the exceptions
|
||||
return new DotNetProcess(cli.System.Diagnostics.Process.Start(si));
|
||||
try
|
||||
{
|
||||
if(false) throw new cli.System.ComponentModel.Win32Exception();
|
||||
if(false) throw new cli.System.InvalidOperationException();
|
||||
return new DotNetProcess(cli.System.Diagnostics.Process.Start(si));
|
||||
}
|
||||
catch(cli.System.ComponentModel.Win32Exception x1)
|
||||
{
|
||||
throw new java.io.IOException(x1.getMessage());
|
||||
}
|
||||
catch(cli.System.InvalidOperationException x2)
|
||||
{
|
||||
throw new java.io.IOException(x2.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private static class DotNetProcess extends Process
|
||||
|
@ -439,17 +451,17 @@ final class VMRuntime
|
|||
home = cli.System.Environment.GetEnvironmentVariable("HOME");
|
||||
if(home == null)
|
||||
{
|
||||
// TODO may be there is a better way
|
||||
// TODO maybe there is a better way
|
||||
// NOTE on MS .NET this doesn't return the correct path
|
||||
// (it returns "C:\\Documents and Settings\\username\\My Documents", but we really need
|
||||
// "C:\\Documents and Settings\\username" to be compatible with Sun)
|
||||
// "C:\\Documents and Settings\\username" to be compatible with Sun, that's why we use %USERPROFILE% if it exists)
|
||||
home = cli.System.Environment.GetFolderPath(cli.System.Environment.SpecialFolder.wrap(cli.System.Environment.SpecialFolder.Personal));
|
||||
}
|
||||
}
|
||||
p.setProperty("user.home", home);
|
||||
p.setProperty("user.dir", cli.System.Environment.get_CurrentDirectory());
|
||||
p.setProperty("awt.toolkit", "ikvm.awt.NetToolkit, awt, Version=1.0, Culture=neutral, PublicKeyToken=null");
|
||||
// HACK since we cannot use URL here, we manually encode the assembly name
|
||||
// HACK since we cannot use URL here (it depends on the properties being set), we manually encode the spaces in the assembly name
|
||||
p.setProperty("gnu.classpath.home.url", "ikvmres://" + cli.System.String.Replace(cli.System.Reflection.Assembly.GetExecutingAssembly().get_FullName(), " ", "%20") + "/lib");
|
||||
}
|
||||
|
||||
|
|
|
@ -158,6 +158,18 @@ public class Starter
|
|||
}
|
||||
}
|
||||
|
||||
private class WaitShutdownHook : java.lang.Thread
|
||||
{
|
||||
public override void run()
|
||||
{
|
||||
Console.Error.WriteLine("IKVM runtime terminated. Waiting for Ctrl+C...");
|
||||
for(;;)
|
||||
{
|
||||
System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[StackTraceInfo(Hidden = true, EatFrames = 1)]
|
||||
[STAThread] // NOTE this is here because otherwise SWT's RegisterDragDrop (a COM thing) doesn't work
|
||||
static int Main(string[] args)
|
||||
|
@ -166,6 +178,7 @@ public class Starter
|
|||
System.Threading.Thread.CurrentThread.Name = "main";
|
||||
bool jar = false;
|
||||
bool saveAssembly = false;
|
||||
bool waitOnExit = false;
|
||||
string mainClass = null;
|
||||
string[] vmargs = null;
|
||||
for(int i = 0; i < args.Length; i++)
|
||||
|
@ -185,6 +198,10 @@ public class Starter
|
|||
{
|
||||
new Timer();
|
||||
}
|
||||
else if(args[i] == "-Xwait")
|
||||
{
|
||||
waitOnExit = true;
|
||||
}
|
||||
else if(args[i] == "-jar")
|
||||
{
|
||||
jar = true;
|
||||
|
@ -255,6 +272,7 @@ public class Starter
|
|||
Console.Error.WriteLine(" set search path for bootstrap classes and resources");
|
||||
Console.Error.WriteLine(" -Xtrace:<string> Displays all tracepoints with the given name");
|
||||
Console.Error.WriteLine(" -Xmethodtrace:<string> Builds method trace into the specified output methods");
|
||||
Console.Error.WriteLine(" -Xwait Keep process hanging around after exit");
|
||||
return 1;
|
||||
}
|
||||
try
|
||||
|
@ -325,6 +343,10 @@ public class Starter
|
|||
{
|
||||
java.lang.Runtime.getRuntime().addShutdownHook(new SaveAssemblyShutdownHook(clazz));
|
||||
}
|
||||
if(waitOnExit)
|
||||
{
|
||||
java.lang.Runtime.getRuntime().addShutdownHook(new WaitShutdownHook());
|
||||
}
|
||||
try
|
||||
{
|
||||
method.invoke(null, new object[] { vmargs });
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2002 Jeroen Frijters
|
||||
Copyright (C) 2002, 2003, 2004 Jeroen Frijters
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
@ -281,7 +281,7 @@ class Compiler
|
|||
}
|
||||
guessFileKind = false;
|
||||
}
|
||||
if(main == null && manifestMainClass != null)
|
||||
if(main == null && manifestMainClass != null && (guessFileKind || target != System.Reflection.Emit.PEFileKinds.Dll))
|
||||
{
|
||||
Console.Error.WriteLine("Note: using main class {0} based on jar manifest", manifestMainClass);
|
||||
main = manifestMainClass;
|
||||
|
|
Загрузка…
Ссылка в новой задаче