ikvm-commit Mailing List for IKVM.NET (Page 9)
Brought to you by:
jfrijters
You can subscribe to this list here.
| 2007 |
Jan
(25) |
Feb
(22) |
Mar
(32) |
Apr
(77) |
May
(111) |
Jun
(129) |
Jul
(223) |
Aug
(109) |
Sep
(60) |
Oct
(60) |
Nov
(36) |
Dec
(55) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(23) |
Feb
(76) |
Mar
(42) |
Apr
(49) |
May
(33) |
Jun
(64) |
Jul
(19) |
Aug
(124) |
Sep
(16) |
Oct
|
Nov
(87) |
Dec
(54) |
| 2009 |
Jan
(53) |
Feb
(116) |
Mar
(86) |
Apr
(64) |
May
(101) |
Jun
(99) |
Jul
(105) |
Aug
(63) |
Sep
(20) |
Oct
(110) |
Nov
(102) |
Dec
(36) |
| 2010 |
Jan
(87) |
Feb
(67) |
Mar
(5) |
Apr
(100) |
May
(178) |
Jun
(95) |
Jul
(22) |
Aug
(85) |
Sep
(82) |
Oct
(99) |
Nov
(119) |
Dec
(132) |
| 2011 |
Jan
(130) |
Feb
(18) |
Mar
(114) |
Apr
(8) |
May
(21) |
Jun
(53) |
Jul
(127) |
Aug
(111) |
Sep
(29) |
Oct
(28) |
Nov
(64) |
Dec
(94) |
| 2012 |
Jan
(56) |
Feb
(8) |
Mar
(65) |
Apr
(48) |
May
(22) |
Jun
(52) |
Jul
(73) |
Aug
(38) |
Sep
(18) |
Oct
(59) |
Nov
(16) |
Dec
(21) |
| 2013 |
Jan
(83) |
Feb
(151) |
Mar
(102) |
Apr
(13) |
May
(37) |
Jun
(1) |
Jul
(7) |
Aug
(42) |
Sep
(28) |
Oct
(13) |
Nov
(5) |
Dec
(3) |
| 2014 |
Jan
(3) |
Feb
(39) |
Mar
(11) |
Apr
(40) |
May
(62) |
Jun
(54) |
Jul
(21) |
Aug
(3) |
Sep
|
Oct
(15) |
Nov
(26) |
Dec
(7) |
| 2015 |
Jan
(6) |
Feb
(12) |
Mar
(51) |
Apr
(15) |
May
(7) |
Jun
(41) |
Jul
(2) |
Aug
(8) |
Sep
(5) |
Oct
(6) |
Nov
(11) |
Dec
(1) |
| 2016 |
Jan
|
Feb
(1) |
Mar
|
Apr
(1) |
May
|
Jun
(2) |
Jul
(19) |
Aug
(2) |
Sep
(2) |
Oct
|
Nov
|
Dec
|
| 2017 |
Jan
|
Feb
(2) |
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Small S. <sma...@us...> - 2014-12-17 12:11:09
|
Update of /cvsroot/ikvm/junit/src/com/sun In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv4822/src/com/sun Log Message: Directory /cvsroot/ikvm/junit/src/com/sun added to the repository |
|
From: Small S. <sma...@us...> - 2014-12-17 12:10:03
|
Update of /cvsroot/ikvm/ikvm/runtime/openjdk In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv4745/runtime/openjdk Modified Files: sun.management.cs Log Message: implements OperatingSystemMXBean.getFreePhysicalMemorySize and OperatingSystemMXBean.getTotalPhysicalMemorySize Index: sun.management.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/openjdk/sun.management.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** sun.management.cs 10 Jun 2014 12:31:41 -0000 1.8 --- sun.management.cs 17 Dec 2014 12:10:00 -0000 1.9 *************** *** 23,26 **** --- 23,27 ---- */ using System; + using System.Reflection; #if !FIRST_PASS using java.lang.management; *************** *** 106,109 **** --- 107,133 ---- static class Java_sun_management_OperatingSystemImpl { + private static long getComputerInfo(string property){ + #pragma warning disable 618 + Assembly asm = Assembly.LoadWithPartialName("Microsoft.VisualBasic"); + #pragma warning restore 618 + if (asm != null) + { + Type type = asm.GetType("Microsoft.VisualBasic.Devices.ComputerInfo"); + if (type != null) + { + try + { + ulong result = (ulong)type.GetProperty(property).GetValue(Activator.CreateInstance(type), null); + return (long)result; + } + catch (TargetInvocationException) + { + // Mono does not implement this property + } + } + } + throw new System.NotImplementedException(); + } + public static long getCommittedVirtualMemorySize0(object _this) { *************** *** 128,137 **** public static long getFreePhysicalMemorySize(object _this) { ! throw new System.NotImplementedException(); } public static long getTotalPhysicalMemorySize(object _this) { ! throw new System.NotImplementedException(); } --- 152,161 ---- public static long getFreePhysicalMemorySize(object _this) { ! return getComputerInfo("AvailablePhysicalMemory"); } public static long getTotalPhysicalMemorySize(object _this) { ! return getComputerInfo("TotalPhysicalMemory"); } |
|
From: Jeroen F. <jfr...@us...> - 2014-11-19 07:26:07
|
Update of /cvsroot/ikvm/ikvm/openjdk In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv24873 Modified Files: map.xml Log Message: Optimized [Integer|Long].[compare|divide|remainder]Unsigned(). Index: map.xml =================================================================== RCS file: /cvsroot/ikvm/ikvm/openjdk/map.xml,v retrieving revision 1.106 retrieving revision 1.107 diff -C2 -d -r1.106 -r1.107 *** map.xml 10 Nov 2014 09:18:25 -0000 1.106 --- map.xml 19 Nov 2014 07:26:05 -0000 1.107 *************** *** 2221,2224 **** --- 2221,2258 ---- </method> </implements> + <method name="compareUnsigned" sig="(II)I"> + <body> + <ldarg_0 /> + <ldarg_1 /> + <bge_un name="ge" /> + <ldc_i4_m1 /> + <ret /> + <label name="ge" /> + <ldarg_0 /> + <ldarg_1 /> + <bne_un name="ne" /> + <ldc_i4_0 /> + <ret /> + <label name="ne" /> + <ldc_i4_1 /> + <ret /> + </body> + </method> + <method name="divideUnsigned" sig="(II)I"> + <body> + <ldarg_0 /> + <ldarg_1 /> + <div_un /> + <ret /> + </body> + </method> + <method name="remainderUnsigned" sig="(II)I"> + <body> + <ldarg_0 /> + <ldarg_1 /> + <rem_un /> + <ret /> + </body> + </method> </class> <class name="java.lang.Long"> *************** *** 2228,2231 **** --- 2262,2299 ---- </method> </implements> + <method name="compareUnsigned" sig="(JJ)I"> + <body> + <ldarg_0 /> + <ldarg_1 /> + <bge_un name="ge" /> + <ldc_i4_m1 /> + <ret /> + <label name="ge" /> + <ldarg_0 /> + <ldarg_1 /> + <bne_un name="ne" /> + <ldc_i4_0 /> + <ret /> + <label name="ne" /> + <ldc_i4_1 /> + <ret /> + </body> + </method> + <method name="divideUnsigned" sig="(JJ)J"> + <body> + <ldarg_0 /> + <ldarg_1 /> + <div_un /> + <ret /> + </body> + </method> + <method name="remainderUnsigned" sig="(JJ)J"> + <body> + <ldarg_0 /> + <ldarg_1 /> + <rem_un /> + <ret /> + </body> + </method> </class> <class name="java.lang.Float"> |
|
From: Jeroen F. <jfr...@us...> - 2014-11-19 07:24:45
|
Update of /cvsroot/ikvm/ikvm/ikvmc In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv24739 Modified Files: remapper.cs Log Message: Added support for div.un and rem.un opcodes. Index: remapper.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/ikvmc/remapper.cs,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** remapper.cs 28 Apr 2014 13:34:03 -0000 1.46 --- remapper.cs 19 Nov 2014 07:24:41 -0000 1.47 *************** *** 1052,1055 **** --- 1052,1073 ---- } + [XmlType("div_un")] + public sealed class Div_Un : Simple + { + public Div_Un() + : base(OpCodes.Div_Un) + { + } + } + + [XmlType("rem_un")] + public sealed class Rem_Un : Simple + { + public Rem_Un() + : base(OpCodes.Rem_Un) + { + } + } + [XmlType("and")] public sealed class And : Simple *************** *** 1450,1453 **** --- 1468,1473 ---- [XmlElement(typeof(Sub))] [XmlElement(typeof(Mul))] + [XmlElement(typeof(Div_Un))] + [XmlElement(typeof(Rem_Un))] [XmlElement(typeof(And))] [XmlElement(typeof(Or))] |
|
From: Jeroen F. <jfr...@us...> - 2014-11-18 14:35:41
|
Update of /cvsroot/ikvm/ikvm/openjdk/java/net In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv13431 Modified Files: TwoStacksPlainDatagramSocketImpl_c.java Log Message: Implemented isAdapterIpv6Enabled(). Index: TwoStacksPlainDatagramSocketImpl_c.java =================================================================== RCS file: /cvsroot/ikvm/ikvm/openjdk/java/net/TwoStacksPlainDatagramSocketImpl_c.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TwoStacksPlainDatagramSocketImpl_c.java 7 Nov 2014 14:59:43 -0000 1.7 --- TwoStacksPlainDatagramSocketImpl_c.java 18 Nov 2014 14:35:39 -0000 1.8 *************** *** 1596,1600 **** static int isAdapterIpv6Enabled(JNIEnv env, int index) { ! return 1; } --- 1596,1612 ---- static int isAdapterIpv6Enabled(JNIEnv env, int index) { ! return java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<Integer>() { ! public Integer run() { ! try { ! for (java.util.Enumeration<InetAddress> e = NetworkInterface.getByIndex(index).getInetAddresses(); e.hasMoreElements(); ) { ! if (e.nextElement() instanceof Inet6Address) { ! return 1; ! } ! } ! } catch (SocketException x) { ! } ! return 0; ! } ! }).intValue(); } |
|
From: Jeroen F. <jfr...@us...> - 2014-11-18 11:34:07
|
Update of /cvsroot/ikvm/ikvm/runtime In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv22913 Modified Files: intrinsics.cs Log Message: More Unsafe intrinsics. Index: intrinsics.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/intrinsics.cs,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** intrinsics.cs 14 Nov 2014 15:28:34 -0000 1.46 --- intrinsics.cs 18 Nov 2014 11:34:04 -0000 1.47 *************** *** 204,207 **** --- 204,208 ---- intrinsics.Add(new IntrinsicKey("java.lang.ThreadLocal", "<init>", "()V"), ThreadLocal_new); intrinsics.Add(new IntrinsicKey("sun.misc.Unsafe", "ensureClassInitialized", "(Ljava.lang.Class;)V"), Unsafe_ensureClassInitialized); + // note that the following intrinsics don't pay off on CLR v2, but they do on CLR v4 intrinsics.Add(new IntrinsicKey("sun.misc.Unsafe", "putObject", "(Ljava.lang.Object;JLjava.lang.Object;)V"), Unsafe_putObject); intrinsics.Add(new IntrinsicKey("sun.misc.Unsafe", "putOrderedObject", "(Ljava.lang.Object;JLjava.lang.Object;)V"), Unsafe_putOrderedObject); *************** *** 211,214 **** --- 212,218 ---- intrinsics.Add(new IntrinsicKey("sun.misc.Unsafe", "compareAndSwapObject", "(Ljava.lang.Object;JLjava.lang.Object;Ljava.lang.Object;)Z"), Unsafe_compareAndSwapObject); intrinsics.Add(new IntrinsicKey("sun.misc.Unsafe", "getAndSetObject", "(Ljava.lang.Object;JLjava.lang.Object;)Ljava.lang.Object;"), Unsafe_getAndSetObject); + intrinsics.Add(new IntrinsicKey("sun.misc.Unsafe", "compareAndSwapInt", "(Ljava.lang.Object;JII)Z"), Unsafe_compareAndSwapInt); + intrinsics.Add(new IntrinsicKey("sun.misc.Unsafe", "getAndAddInt", "(Ljava.lang.Object;JI)I"), Unsafe_getAndAddInt); + intrinsics.Add(new IntrinsicKey("sun.misc.Unsafe", "compareAndSwapLong", "(Ljava.lang.Object;JJJ)Z"), Unsafe_compareAndSwapLong); return intrinsics; } *************** *** 865,869 **** } } ! return false; } --- 869,925 ---- } } ! // stack layout at call site: ! // 4 Unsafe (receiver) ! // 3 Object (obj) ! // 2 long (offset) ! // 1 Object (expect) ! // 0 Object (update) ! TypeWrapper twUnsafe = eic.GetStackTypeWrapper(0, 4); ! if (twUnsafe == VerifierTypeWrapper.Null) ! { ! return false; ! } ! for (int i = 0; ; i--) ! { ! if ((eic.Flags[eic.OpcodeIndex + i] & InstructionFlags.BranchTarget) != 0) ! { ! return false; ! } ! if (eic.GetStackTypeWrapper(i, 0) == twUnsafe) ! { ! // the pattern we recognize is: ! // aload ! // getstatic <offset field> ! if (eic.Match(i, NormalizedByteCode.__aload) && eic.GetStackTypeWrapper(i + 1, 0) == eic.Caller.DeclaringType ! && eic.Match(i + 1, NormalizedByteCode.__getstatic)) ! { ! FieldWrapper fw = GetUnsafeField(eic, eic.GetFieldref(i + 1)); ! if (fw != null && !fw.IsStatic && fw.DeclaringType == eic.Caller.DeclaringType) ! { ! Type type = fw.FieldTypeWrapper.TypeAsLocalOrStackType; ! CodeEmitterLocal update = eic.Emitter.AllocTempLocal(type); ! CodeEmitterLocal expect = eic.Emitter.AllocTempLocal(type); ! CodeEmitterLocal obj = eic.Emitter.AllocTempLocal(eic.Caller.DeclaringType.TypeAsLocalOrStackType); ! eic.Emitter.Emit(OpCodes.Stloc, update); ! eic.Emitter.Emit(OpCodes.Stloc, expect); ! eic.Emitter.Emit(OpCodes.Pop); // discard offset ! eic.Emitter.Emit(OpCodes.Stloc, obj); ! EmitConsumeUnsafe(eic); ! eic.Emitter.Emit(OpCodes.Ldloc, obj); ! eic.Emitter.Emit(OpCodes.Ldflda, fw.GetField()); ! eic.Emitter.Emit(OpCodes.Ldloc, update); ! eic.Emitter.Emit(OpCodes.Ldloc, expect); ! eic.Emitter.Emit(OpCodes.Call, AtomicReferenceFieldUpdaterEmitter.MakeCompareExchange(type)); ! eic.Emitter.Emit(OpCodes.Ldloc, expect); ! eic.Emitter.Emit(OpCodes.Ceq); ! eic.Emitter.ReleaseTempLocal(expect); ! eic.Emitter.ReleaseTempLocal(update); ! eic.NonLeaf = false; ! return true; ! } ! } ! return false; ! } ! } } *************** *** 897,912 **** } ! internal static MethodInfo MakeExchange(Type type) { ! MethodInfo interlockedExchange = null; ! foreach (MethodInfo m in JVM.Import(typeof(System.Threading.Interlocked)).GetMethods()) { ! if (m.Name == "Exchange" && m.IsGenericMethodDefinition) { ! interlockedExchange = m; ! break; } } ! return interlockedExchange.MakeGenericMethod(type); } --- 953,1121 ---- } ! private static bool Unsafe_compareAndSwapInt(EmitIntrinsicContext eic) { ! // stack layout at call site: ! // 4 Unsafe (receiver) ! // 3 Object (obj) ! // 2 long (offset) ! // 1 int (expect) ! // 0 int (update) ! TypeWrapper twUnsafe = eic.GetStackTypeWrapper(0, 4); ! if (twUnsafe == VerifierTypeWrapper.Null) { ! return false; ! } ! for (int i = 0; ; i--) ! { ! if ((eic.Flags[eic.OpcodeIndex + i] & InstructionFlags.BranchTarget) != 0) { ! return false; ! } ! if (eic.GetStackTypeWrapper(i, 0) == twUnsafe) ! { ! // the pattern we recognize is: ! // aload ! // getstatic <offset field> ! if (eic.Match(i, NormalizedByteCode.__aload) && eic.GetStackTypeWrapper(i + 1, 0) == eic.Caller.DeclaringType ! && eic.Match(i + 1, NormalizedByteCode.__getstatic)) ! { ! FieldWrapper fw = GetUnsafeField(eic, eic.GetFieldref(i + 1)); ! if (fw != null && !fw.IsStatic && fw.DeclaringType == eic.Caller.DeclaringType) ! { ! CodeEmitterLocal update = eic.Emitter.AllocTempLocal(Types.Int32); ! CodeEmitterLocal expect = eic.Emitter.AllocTempLocal(Types.Int32); ! CodeEmitterLocal obj = eic.Emitter.AllocTempLocal(eic.Caller.DeclaringType.TypeAsLocalOrStackType); ! eic.Emitter.Emit(OpCodes.Stloc, update); ! eic.Emitter.Emit(OpCodes.Stloc, expect); ! eic.Emitter.Emit(OpCodes.Pop); // discard offset ! eic.Emitter.Emit(OpCodes.Stloc, obj); ! EmitConsumeUnsafe(eic); ! eic.Emitter.Emit(OpCodes.Ldloc, obj); ! eic.Emitter.Emit(OpCodes.Ldflda, fw.GetField()); ! eic.Emitter.Emit(OpCodes.Ldloc, update); ! eic.Emitter.Emit(OpCodes.Ldloc, expect); ! eic.Emitter.Emit(OpCodes.Call, InterlockedMethods.CompareExchangeInt32); ! eic.Emitter.Emit(OpCodes.Ldloc, expect); ! eic.Emitter.Emit(OpCodes.Ceq); ! eic.Emitter.ReleaseTempLocal(expect); ! eic.Emitter.ReleaseTempLocal(update); ! eic.NonLeaf = false; ! return true; ! } ! } ! return false; ! } ! } ! } ! ! private static bool Unsafe_getAndAddInt(EmitIntrinsicContext eic) ! { ! // stack layout at call site: ! // 3 Unsafe (receiver) ! // 2 Object (obj) ! // 1 long (offset) ! // 0 int (delta) ! TypeWrapper twUnsafe = eic.GetStackTypeWrapper(0, 3); ! if (twUnsafe == VerifierTypeWrapper.Null) ! { ! return false; ! } ! for (int i = 0; ; i--) ! { ! if ((eic.Flags[eic.OpcodeIndex + i] & InstructionFlags.BranchTarget) != 0) ! { ! return false; ! } ! if (eic.GetStackTypeWrapper(i, 0) == twUnsafe) ! { ! // the pattern we recognize is: ! // aload_0 ! // getstatic <offset field> ! if (eic.Match(i, NormalizedByteCode.__aload, 0) ! && eic.Match(i + 1, NormalizedByteCode.__getstatic)) ! { ! FieldWrapper fw = GetUnsafeField(eic, eic.GetFieldref(i + 1)); ! if (fw != null && !fw.IsStatic && fw.DeclaringType == eic.Caller.DeclaringType) ! { ! CodeEmitterLocal delta = eic.Emitter.AllocTempLocal(Types.Int32); ! eic.Emitter.Emit(OpCodes.Stloc, delta); ! eic.Emitter.Emit(OpCodes.Pop); // discard offset ! eic.Emitter.Emit(OpCodes.Pop); // discard obj ! EmitConsumeUnsafe(eic); ! eic.Emitter.Emit(OpCodes.Ldarg_0); ! eic.Emitter.Emit(OpCodes.Ldflda, fw.GetField()); ! eic.Emitter.Emit(OpCodes.Ldloc, delta); ! eic.Emitter.Emit(OpCodes.Call, InterlockedMethods.AddInt32); ! eic.Emitter.Emit(OpCodes.Ldloc, delta); ! eic.Emitter.Emit(OpCodes.Sub); ! eic.Emitter.ReleaseTempLocal(delta); ! eic.NonLeaf = false; ! return true; ! } ! } ! return false; } } ! } ! ! private static bool Unsafe_compareAndSwapLong(EmitIntrinsicContext eic) ! { ! // stack layout at call site: ! // 4 Unsafe (receiver) ! // 3 Object (obj) ! // 2 long (offset) ! // 1 long (expect) ! // 0 long (update) ! TypeWrapper twUnsafe = eic.GetStackTypeWrapper(0, 4); ! if (twUnsafe == VerifierTypeWrapper.Null) ! { ! return false; ! } ! for (int i = 0; ; i--) ! { ! if ((eic.Flags[eic.OpcodeIndex + i] & InstructionFlags.BranchTarget) != 0) ! { ! return false; ! } ! if (eic.GetStackTypeWrapper(i, 0) == twUnsafe) ! { ! // the pattern we recognize is: ! // aload ! // getstatic <offset field> ! if (eic.Match(i, NormalizedByteCode.__aload) && eic.GetStackTypeWrapper(i + 1, 0) == eic.Caller.DeclaringType ! && eic.Match(i + 1, NormalizedByteCode.__getstatic)) ! { ! FieldWrapper fw = GetUnsafeField(eic, eic.GetFieldref(i + 1)); ! if (fw != null && !fw.IsStatic && fw.DeclaringType == eic.Caller.DeclaringType) ! { ! CodeEmitterLocal update = eic.Emitter.AllocTempLocal(Types.Int64); ! CodeEmitterLocal expect = eic.Emitter.AllocTempLocal(Types.Int64); ! CodeEmitterLocal obj = eic.Emitter.AllocTempLocal(eic.Caller.DeclaringType.TypeAsLocalOrStackType); ! eic.Emitter.Emit(OpCodes.Stloc, update); ! eic.Emitter.Emit(OpCodes.Stloc, expect); ! eic.Emitter.Emit(OpCodes.Pop); // discard offset ! eic.Emitter.Emit(OpCodes.Stloc, obj); ! EmitConsumeUnsafe(eic); ! eic.Emitter.Emit(OpCodes.Ldloc, obj); ! eic.Emitter.Emit(OpCodes.Ldflda, fw.GetField()); ! eic.Emitter.Emit(OpCodes.Ldloc, update); ! eic.Emitter.Emit(OpCodes.Ldloc, expect); ! eic.Emitter.Emit(OpCodes.Call, InterlockedMethods.CompareExchangeInt64); ! eic.Emitter.Emit(OpCodes.Ldloc, expect); ! eic.Emitter.Emit(OpCodes.Ceq); ! eic.Emitter.ReleaseTempLocal(expect); ! eic.Emitter.ReleaseTempLocal(update); ! eic.NonLeaf = false; ! return true; ! } ! } ! return false; ! } ! } ! } ! ! internal static MethodInfo MakeExchange(Type type) ! { ! return InterlockedMethods.ExchangeOfT.MakeGenericMethod(type); } *************** *** 958,962 **** * ... * getstatic <Field test sun/misc/Unsafe UNSAFE> ! * aload_0 * ldc "next" * invokevirtual <Method java/lang/Class getDeclaredField(Ljava/lang/String;)Ljava/lang/reflect/Field;> --- 1167,1171 ---- * ... * getstatic <Field test sun/misc/Unsafe UNSAFE> ! * aload_0 | ldc <Class> * ldc "next" * invokevirtual <Method java/lang/Class getDeclaredField(Ljava/lang/String;)Ljava/lang/reflect/Field;> *************** *** 972,978 **** && MatchInvokeVirtual(eic, ref method.Instructions[i - 2], "java.lang.Class", "getDeclaredField", "(Ljava.lang.String;)Ljava.lang.reflect.Field;") && MatchLdc(eic, ref method.Instructions[i - 3], ClassFile.ConstantType.String) ! && method.Instructions[i - 4].NormalizedOpCode == NormalizedByteCode.__aload && method.Instructions[i - 5].NormalizedOpCode == NormalizedByteCode.__getstatic && eic.ClassFile.GetFieldref(method.Instructions[i - 5].Arg1).Signature == "Lsun.misc.Unsafe;") { // search backward for the astore that corresponds to the aload (of the class object) for (int j = i - 6; j > 0; j--) --- 1181,1212 ---- && MatchInvokeVirtual(eic, ref method.Instructions[i - 2], "java.lang.Class", "getDeclaredField", "(Ljava.lang.String;)Ljava.lang.reflect.Field;") && MatchLdc(eic, ref method.Instructions[i - 3], ClassFile.ConstantType.String) ! && (method.Instructions[i - 4].NormalizedOpCode == NormalizedByteCode.__aload || method.Instructions[i - 4].NormalizedOpCode == NormalizedByteCode.__ldc) && method.Instructions[i - 5].NormalizedOpCode == NormalizedByteCode.__getstatic && eic.ClassFile.GetFieldref(method.Instructions[i - 5].Arg1).Signature == "Lsun.misc.Unsafe;") { + if (method.Instructions[i - 4].NormalizedOpCode == NormalizedByteCode.__ldc) + { + if (eic.ClassFile.GetConstantPoolClassType(method.Instructions[i - 4].Arg1) == eic.Caller.DeclaringType) + { + string fieldName = eic.ClassFile.GetConstantPoolConstantString(method.Instructions[i - 3].Arg1); + FieldWrapper fw = null; + foreach (FieldWrapper fw1 in eic.Caller.DeclaringType.GetFields()) + { + if (fw1.Name == fieldName) + { + if (fw == null) + { + fw = fw1; + } + else + { + // duplicate name + return null; + } + } + } + return fw; + } + return null; + } // search backward for the astore that corresponds to the aload (of the class object) for (int j = i - 6; j > 0; j--) |
|
From: Jeroen F. <jfr...@us...> - 2014-11-18 11:33:38
|
Update of /cvsroot/ikvm/ikvm/runtime In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv22811 Modified Files: DynamicTypeWrapper.cs atomic.cs Log Message: Added cache for methodinfos of interlocked methods. Index: atomic.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/atomic.cs,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** atomic.cs 5 Jul 2012 09:57:09 -0000 1.21 --- atomic.cs 18 Nov 2014 11:33:36 -0000 1.22 *************** *** 96,109 **** internal static MethodInfo MakeCompareExchange(Type type) { ! MethodInfo interlockedCompareExchange = null; ! foreach (MethodInfo m in JVM.Import(typeof(System.Threading.Interlocked)).GetMethods()) ! { ! if (m.Name == "CompareExchange" && m.IsGenericMethodDefinition) ! { ! interlockedCompareExchange = m; ! break; ! } ! } ! return interlockedCompareExchange.MakeGenericMethod(type); } --- 96,100 ---- internal static MethodInfo MakeCompareExchange(Type type) { ! return InterlockedMethods.CompareExchangeOfT.MakeGenericMethod(type); } *************** *** 134,135 **** --- 125,158 ---- } } + + static class InterlockedMethods + { + internal static readonly MethodInfo AddInt32; + internal static readonly MethodInfo CompareExchangeInt32; + internal static readonly MethodInfo CompareExchangeInt64; + internal static readonly MethodInfo CompareExchangeOfT; + internal static readonly MethodInfo ExchangeOfT; + + static InterlockedMethods() + { + Type type = JVM.Import(typeof(System.Threading.Interlocked)); + AddInt32 = type.GetMethod("Add", new Type[] { Types.Int32.MakeByRefType(), Types.Int32 }); + CompareExchangeInt32 = type.GetMethod("CompareExchange", new Type[] { Types.Int32.MakeByRefType(), Types.Int32, Types.Int32 }); + CompareExchangeInt64 = type.GetMethod("CompareExchange", new Type[] { Types.Int64.MakeByRefType(), Types.Int64, Types.Int64 }); + foreach (MethodInfo m in type.GetMethods()) + { + if (m.IsGenericMethodDefinition) + { + switch (m.Name) + { + case "CompareExchange": + CompareExchangeOfT = m; + break; + case "Exchange": + ExchangeOfT = m; + break; + } + } + } + } + } Index: DynamicTypeWrapper.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/DynamicTypeWrapper.cs,v retrieving revision 1.258 retrieving revision 1.259 diff -C2 -d -r1.258 -r1.259 *** DynamicTypeWrapper.cs 11 Nov 2014 15:37:09 -0000 1.258 --- DynamicTypeWrapper.cs 18 Nov 2014 11:33:36 -0000 1.259 *************** *** 4924,4932 **** if (fieldType == PrimitiveTypeWrapper.LONG) { ! ilGenerator.Emit(OpCodes.Call, JVM.Import(typeof(System.Threading.Interlocked)).GetMethod("CompareExchange", new Type[] { Types.Int64.MakeByRefType(), Types.Int64, Types.Int64 })); } else if (fieldType == PrimitiveTypeWrapper.INT) { ! ilGenerator.Emit(OpCodes.Call, JVM.Import(typeof(System.Threading.Interlocked)).GetMethod("CompareExchange", new Type[] { Types.Int32.MakeByRefType(), Types.Int32, Types.Int32 })); } else --- 4924,4932 ---- if (fieldType == PrimitiveTypeWrapper.LONG) { ! ilGenerator.Emit(OpCodes.Call, InterlockedMethods.CompareExchangeInt64); } else if (fieldType == PrimitiveTypeWrapper.INT) { ! ilGenerator.Emit(OpCodes.Call, InterlockedMethods.CompareExchangeInt32); } else |
|
From: Jeroen F. <jfr...@us...> - 2014-11-17 16:47:20
|
Update of /cvsroot/ikvm/ikvm/awt In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv19995 Modified Files: toolkit-0.95.cs Log Message: Bug fix. NetComponentPeer.getLocationOnScreen() should take insets into account. Thanks to Maria Papendieck <mar...@pu...> for this fix. Index: toolkit-0.95.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/awt/toolkit-0.95.cs,v retrieving revision 1.109 retrieving revision 1.110 diff -C2 -d -r1.109 -r1.110 *** toolkit-0.95.cs 3 Jun 2014 08:56:30 -0000 1.109 --- toolkit-0.95.cs 17 Nov 2014 16:47:17 -0000 1.110 *************** *** 2639,2643 **** return NetToolkit.Invoke<java.awt.Point>(delegate { ! Point p = new Point(); p = control.PointToScreen(p); return new java.awt.Point(p.X, p.Y); --- 2639,2643 ---- return NetToolkit.Invoke<java.awt.Point>(delegate { ! Point p = new Point(0 - getInsetsLeft(), 0 - getInsetsTop()); p = control.PointToScreen(p); return new java.awt.Point(p.X, p.Y); |
|
From: Jeroen F. <jfr...@us...> - 2014-11-17 16:46:34
|
Update of /cvsroot/ikvm/ikvm/awt In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv19884 Modified Files: graphics.cs Log Message: Bug fix. NetGraphicsDevice.getDefaultConfiguration() should take the screen into account. Thanks to Maria Papendieck <mar...@pu...> for this fix. Index: graphics.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/awt/graphics.cs,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** graphics.cs 7 Jun 2014 08:27:27 -0000 1.74 --- graphics.cs 17 Nov 2014 16:46:31 -0000 1.75 *************** *** 2243,2247 **** public override java.awt.GraphicsConfiguration getDefaultConfiguration() { ! return new NetGraphicsConfiguration(Screen.PrimaryScreen); } --- 2243,2247 ---- public override java.awt.GraphicsConfiguration getDefaultConfiguration() { ! return new NetGraphicsConfiguration(screen); } |
|
From: Jeroen F. <jfr...@us...> - 2014-11-17 11:21:22
|
Update of /cvsroot/ikvm/ikvm/runtime/openjdk In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv16821 Modified Files: sun.misc.cs Log Message: Added (conditionally compiled) statistics for some Unsafe operations (that aren't intrinsified). Index: sun.misc.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/openjdk/sun.misc.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** sun.misc.cs 17 Nov 2014 09:24:15 -0000 1.9 --- sun.misc.cs 17 Nov 2014 11:21:20 -0000 1.10 *************** *** 307,310 **** --- 307,311 ---- public static short ReadInt16(object obj, long offset) { + Stats.Log("ReadInt16"); CheckArrayBounds(obj, offset, 2); GCHandle handle = GCHandle.Alloc(obj, GCHandleType.Pinned); *************** *** 317,320 **** --- 318,322 ---- public static int ReadInt32(object obj, long offset) { + Stats.Log("ReadInt32"); CheckArrayBounds(obj, offset, 4); GCHandle handle = GCHandle.Alloc(obj, GCHandleType.Pinned); *************** *** 327,330 **** --- 329,333 ---- public static long ReadInt64(object obj, long offset) { + Stats.Log("ReadInt64"); CheckArrayBounds(obj, offset, 8); GCHandle handle = GCHandle.Alloc(obj, GCHandleType.Pinned); *************** *** 337,340 **** --- 340,344 ---- public static void WriteInt16(object obj, long offset, short value) { + Stats.Log("WriteInt16"); CheckArrayBounds(obj, offset, 2); GCHandle handle = GCHandle.Alloc(obj, GCHandleType.Pinned); *************** *** 346,349 **** --- 350,354 ---- public static void WriteInt32(object obj, long offset, int value) { + Stats.Log("WriteInt32"); CheckArrayBounds(obj, offset, 4); GCHandle handle = GCHandle.Alloc(obj, GCHandleType.Pinned); *************** *** 355,358 **** --- 360,364 ---- public static void WriteInt64(object obj, long offset, long value) { + Stats.Log("WriteInt64"); CheckArrayBounds(obj, offset, 8); GCHandle handle = GCHandle.Alloc(obj, GCHandleType.Pinned); *************** *** 449,456 **** --- 455,464 ---- if (array != null && (offset & 3) == 0) { + Stats.Log("compareAndSwapInt.array"); return Interlocked.CompareExchange(ref array[offset / 4], update, expect) == expect; } else if (obj is Array) { + Stats.Log("compareAndSwapInt.unaligned"); // unaligned or not the right array type, so we can't be atomic lock (thisUnsafe) *************** *** 471,474 **** --- 479,483 ---- cacheCompareExchangeInt32[offset] = (CompareExchangeInt32)CreateCompareExchange(offset); } + Stats.Log("compareAndSwapInt.", offset); return cacheCompareExchangeInt32[offset](obj, update, expect) == expect; } *************** *** 484,491 **** --- 493,502 ---- if (array != null && (offset & 7) == 0) { + Stats.Log("compareAndSwapLong.array"); return Interlocked.CompareExchange(ref array[offset / 8], update, expect) == expect; } else if (obj is Array) { + Stats.Log("compareAndSwapLong.unaligned"); // unaligned or not the right array type, so we can't be atomic lock (thisUnsafe) *************** *** 506,509 **** --- 517,521 ---- cacheCompareExchangeInt64[offset] = (CompareExchangeInt64)CreateCompareExchange(offset); } + Stats.Log("compareAndSwapLong.", offset); return cacheCompareExchangeInt64[offset](obj, update, expect) == expect; } *************** *** 562,569 **** --- 574,583 ---- if (array != null) { + Stats.Log("compareAndSwapObject.array"); return Atomic.CompareExchange(array, (int)offset, update, expect) == expect; } else { + Stats.Log("compareAndSwapObject.", offset); FieldInfo field = FieldWrapper.FromField(sun.misc.Unsafe.getField(offset)).GetField(); return Atomic.CompareExchange(obj, new FieldInfo[] { field }, update, expect) == expect; *************** *** 619,622 **** --- 633,684 ---- } } + + static class Stats + { + #if !FIRST_PASS && UNSAFE_STATISTICS + private static readonly Dictionary<string, int> dict = new Dictionary<string, int>(); + + static Stats() + { + java.lang.Runtime.getRuntime().addShutdownHook(new DumpStats()); + } + + sealed class DumpStats : java.lang.Thread + { + public override void run() + { + List<KeyValuePair<string, int>> list = new List<KeyValuePair<string, int>>(dict); + list.Sort(delegate(KeyValuePair<string, int> kv1, KeyValuePair<string, int> kv2) { return kv1.Value.CompareTo(kv2.Value); }); + foreach (KeyValuePair<string, int> kv in list) + { + Console.WriteLine("{0,10}: {1}", kv.Value, kv.Key); + } + } + } + #endif + + [Conditional("UNSAFE_STATISTICS")] + internal static void Log(string key) + { + #if !FIRST_PASS && UNSAFE_STATISTICS + lock (dict) + { + int count; + dict.TryGetValue(key, out count); + dict[key] = count + 1; + } + #endif + } + + [Conditional("UNSAFE_STATISTICS")] + internal static void Log(string key, long offset) + { + #if !FIRST_PASS && UNSAFE_STATISTICS + FieldWrapper field = FieldWrapper.FromField(sun.misc.Unsafe.getField(offset)); + key += field.DeclaringType.Name + "::" + field.Name; + Log(key); + #endif + } + } } |
|
From: Jeroen F. <jfr...@us...> - 2014-11-17 09:24:51
|
Update of /cvsroot/ikvm/ikvm/openjdk In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv1704 Modified Files: FORKED Log Message: Updated FORKED to include ForkJoinPool. Index: FORKED =================================================================== RCS file: /cvsroot/ikvm/ikvm/openjdk/FORKED,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** FORKED 10 Jun 2014 12:31:41 -0000 1.7 --- FORKED 17 Nov 2014 09:24:48 -0000 1.8 *************** *** 54,57 **** --- 54,58 ---- jdk/src/share/classes/java/util/concurrent/atomic/AtomicReference.java=../classpath/java/util/concurrent/atomic/AtomicReference.java jdk/src/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java=../classpath/java/util/concurrent/atomic/AtomicReferenceArray.java + jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java=java/util/concurrent/ForkJoinPool.java jdk/src/share/classes/java/util/concurrent/locks/AbstractQueuedSynchronizer.java=java/util/concurrent/locks/AbstractQueuedSynchronizer.java jdk/src/share/classes/java/util/concurrent/locks/LockSupport.java=java/util/concurrent/locks/LockSupport.java |
|
From: Jeroen F. <jfr...@us...> - 2014-11-17 09:24:18
|
Update of /cvsroot/ikvm/ikvm/runtime/openjdk In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv1644 Modified Files: sun.misc.cs Log Message: Fixed previous commit. When growing the array we should make sure we're actually growing it. Index: sun.misc.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/openjdk/sun.misc.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** sun.misc.cs 14 Nov 2014 15:27:46 -0000 1.8 --- sun.misc.cs 17 Nov 2014 09:24:15 -0000 1.9 *************** *** 522,525 **** --- 522,529 ---- T[] oldArray = array; T[] newArray = oldArray; + if (oldArray.Length >= newSize) + { + return; + } Array.Resize(ref newArray, newSize); if (Interlocked.CompareExchange(ref array, newArray, oldArray) == oldArray) |
|
From: Jeroen F. <jfr...@us...> - 2014-11-14 15:28:36
|
Update of /cvsroot/ikvm/ikvm/runtime In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv10249 Modified Files: intrinsics.cs Log Message: Added intrinsic for array version of Unsafe.getAndSetObject(). Index: intrinsics.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/intrinsics.cs,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -d -r1.45 -r1.46 *** intrinsics.cs 19 May 2014 12:43:43 -0000 1.45 --- intrinsics.cs 14 Nov 2014 15:28:34 -0000 1.46 *************** *** 210,213 **** --- 210,214 ---- intrinsics.Add(new IntrinsicKey("sun.misc.Unsafe", "getObject", "(Ljava.lang.Object;J)Ljava.lang.Object;"), Unsafe_getObjectVolatile); intrinsics.Add(new IntrinsicKey("sun.misc.Unsafe", "compareAndSwapObject", "(Ljava.lang.Object;JLjava.lang.Object;Ljava.lang.Object;)Z"), Unsafe_compareAndSwapObject); + intrinsics.Add(new IntrinsicKey("sun.misc.Unsafe", "getAndSetObject", "(Ljava.lang.Object;JLjava.lang.Object;)Ljava.lang.Object;"), Unsafe_getAndSetObject); return intrinsics; } *************** *** 867,870 **** --- 868,914 ---- } + private static bool Unsafe_getAndSetObject(EmitIntrinsicContext eic) + { + TypeWrapper tw = eic.GetStackTypeWrapper(0, 2); + if (IsSupportedArrayTypeForUnsafeOperation(tw) + && eic.GetStackTypeWrapper(0, 0).IsAssignableTo(tw.ElementTypeWrapper)) + { + Type type = tw.TypeAsLocalOrStackType.GetElementType(); + CodeEmitterLocal newValue = eic.Emitter.AllocTempLocal(type); + CodeEmitterLocal index = eic.Emitter.AllocTempLocal(Types.Int32); + CodeEmitterLocal obj = eic.Emitter.AllocTempLocal(tw.TypeAsLocalOrStackType); + eic.Emitter.Emit(OpCodes.Stloc, newValue); + eic.Emitter.Emit(OpCodes.Conv_Ovf_I4); + eic.Emitter.Emit(OpCodes.Stloc, index); + eic.Emitter.Emit(OpCodes.Stloc, obj); + EmitConsumeUnsafe(eic); + eic.Emitter.Emit(OpCodes.Ldloc, obj); + eic.Emitter.Emit(OpCodes.Ldloc, index); + eic.Emitter.Emit(OpCodes.Ldelema, type); + eic.Emitter.Emit(OpCodes.Ldloc, newValue); + eic.Emitter.Emit(OpCodes.Call, MakeExchange(type)); + eic.Emitter.ReleaseTempLocal(obj); + eic.Emitter.ReleaseTempLocal(index); + eic.Emitter.ReleaseTempLocal(newValue); + eic.NonLeaf = false; + return true; + } + return false; + } + + internal static MethodInfo MakeExchange(Type type) + { + MethodInfo interlockedExchange = null; + foreach (MethodInfo m in JVM.Import(typeof(System.Threading.Interlocked)).GetMethods()) + { + if (m.Name == "Exchange" && m.IsGenericMethodDefinition) + { + interlockedExchange = m; + break; + } + } + return interlockedExchange.MakeGenericMethod(type); + } + private static void EmitConsumeUnsafe(EmitIntrinsicContext eic) { |
|
From: Jeroen F. <jfr...@us...> - 2014-11-14 15:27:49
|
Update of /cvsroot/ikvm/ikvm/openjdk/sun/misc In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv10151/openjdk/sun/misc Modified Files: Unsafe.java Log Message: Made Unsafe interlocked operations truly atomic (except for unaligned array access and 'wrong' array type access). Index: Unsafe.java =================================================================== RCS file: /cvsroot/ikvm/ikvm/openjdk/sun/misc/Unsafe.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** Unsafe.java 6 Nov 2014 12:29:25 -0000 1.31 --- Unsafe.java 14 Nov 2014 15:27:44 -0000 1.32 *************** *** 119,123 **** } ! private static Field getField(long offset) { synchronized(fields) --- 119,123 ---- } ! static Field getField(long offset) { synchronized(fields) *************** *** 127,167 **** } ! public boolean compareAndSwapObject(Object obj, long offset, Object expect, Object update) ! { ! if(obj instanceof Object[]) ! { ! Object[] arr = (Object[])obj; ! int index = (int)offset; ! synchronized(this) ! { ! if(arr[index] == expect) ! { ! arr[index] = update; ! return true; ! } ! return false; ! } ! } ! else ! { ! Field field = getField(offset); ! synchronized(field) ! { ! try ! { ! if(field.get(obj) == expect) ! { ! field.set(obj, update); ! return true; ! } ! return false; ! } ! catch(IllegalAccessException x) ! { ! throw (InternalError)new InternalError().initCause(x); ! } ! } ! } ! } public void putObjectVolatile(Object obj, long offset, Object newValue) --- 127,131 ---- } ! public final native boolean compareAndSwapObject(Object obj, long offset, Object expect, Object update); public void putObjectVolatile(Object obj, long offset, Object newValue) *************** *** 229,267 **** private static native void WriteInt64(Object obj, long offset, long value); ! public boolean compareAndSwapInt(Object obj, long offset, int expect, int update) ! { ! if (obj instanceof cli.System.Array) ! { ! synchronized(this) ! { ! if(ReadInt32(obj, offset) == expect) ! { ! WriteInt32(obj, offset, update); ! return true; ! } ! return false; ! } ! } ! else ! { ! Field field = getField(offset); ! synchronized(field) ! { ! try ! { ! if(field.getInt(obj) == expect) ! { ! field.setInt(obj, update); ! return true; ! } ! return false; ! } ! catch(IllegalAccessException x) ! { ! throw (InternalError)new InternalError().initCause(x); ! } ! } ! } ! } public void putIntVolatile(Object obj, long offset, int newValue) --- 193,197 ---- private static native void WriteInt64(Object obj, long offset, long value); ! public final native boolean compareAndSwapInt(Object obj, long offset, int expect, int update); public void putIntVolatile(Object obj, long offset, int newValue) *************** *** 322,360 **** } ! public boolean compareAndSwapLong(Object obj, long offset, long expect, long update) ! { ! if (obj instanceof cli.System.Array) ! { ! synchronized(this) ! { ! if(ReadInt64(obj, offset) == expect) ! { ! WriteInt64(obj, offset, update); ! return true; ! } ! return false; ! } ! } ! else ! { ! Field field = getField(offset); ! synchronized(field) ! { ! try ! { ! if(field.getLong(obj) == expect) ! { ! field.setLong(obj, update); ! return true; ! } ! return false; ! } ! catch(IllegalAccessException x) ! { ! throw (InternalError)new InternalError().initCause(x); ! } ! } ! } ! } public void putLongVolatile(Object obj, long offset, long newValue) --- 252,256 ---- } ! public final native boolean compareAndSwapLong(Object obj, long offset, long expect, long update); public void putLongVolatile(Object obj, long offset, long newValue) |
|
From: Jeroen F. <jfr...@us...> - 2014-11-12 10:02:53
|
Update of /cvsroot/ikvm/ikvm/openjdk/java/util/concurrent/locks In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv13621 Modified Files: LockSupport.java Log Message: Bug fix. LockSupport.parkUntil() didn't convert milliseconds to nanoseconds. Index: LockSupport.java =================================================================== RCS file: /cvsroot/ikvm/ikvm/openjdk/java/util/concurrent/locks/LockSupport.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** LockSupport.java 10 Nov 2014 09:18:25 -0000 1.6 --- LockSupport.java 12 Nov 2014 10:02:51 -0000 1.7 *************** *** 317,321 **** Thread t = Thread.currentThread(); setBlocker(t, blocker); ! parkImpl(t, true, deadline); setBlocker(t, null); } --- 317,321 ---- Thread t = Thread.currentThread(); setBlocker(t, blocker); ! parkImpl(t, true, deadline * 1000000); setBlocker(t, null); } *************** *** 433,437 **** */ public static void parkUntil(long deadline) { ! parkImpl(Thread.currentThread(), true, deadline); } --- 433,437 ---- */ public static void parkUntil(long deadline) { ! parkImpl(Thread.currentThread(), true, deadline * 1000000); } |
|
From: Jeroen F. <jfr...@us...> - 2014-11-11 15:37:11
|
Update of /cvsroot/ikvm/ikvm/runtime In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv17027 Modified Files: DynamicTypeWrapper.cs MemberWrapper.cs Log Message: Bug fix. Conflicting default interface methods should throw IncompatibleClassChangeError instead of AbstractMethodError. Index: MemberWrapper.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/MemberWrapper.cs,v retrieving revision 1.203 retrieving revision 1.204 diff -C2 -d -r1.203 -r1.204 *** MemberWrapper.cs 11 Nov 2014 14:59:05 -0000 1.203 --- MemberWrapper.cs 11 Nov 2014 15:37:09 -0000 1.204 *************** *** 1085,1088 **** --- 1085,1093 ---- } + internal bool IsConflictError + { + get { return Error != null && Error.StartsWith("Conflicting default methods:"); } + } + internal MethodWrapper BaseMethod { Index: DynamicTypeWrapper.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/DynamicTypeWrapper.cs,v retrieving revision 1.257 retrieving revision 1.258 diff -C2 -d -r1.257 -r1.258 *** DynamicTypeWrapper.cs 11 Nov 2014 15:28:48 -0000 1.257 --- DynamicTypeWrapper.cs 11 Nov 2014 15:37:09 -0000 1.258 *************** *** 2928,2934 **** string message = mmw.Error ?? (wrapper.Name + "." + methods[index].Name + methods[index].Signature); CodeEmitter ilgen = CodeEmitter.Create(mb); ! ilgen.EmitThrow("java.lang.AbstractMethodError", message); ilgen.DoEmit(); ! wrapper.EmitLevel4Warning(HardError.AbstractMethodError, message); } #if STATIC_COMPILER --- 2928,2934 ---- string message = mmw.Error ?? (wrapper.Name + "." + methods[index].Name + methods[index].Signature); CodeEmitter ilgen = CodeEmitter.Create(mb); ! ilgen.EmitThrow(mmw.IsConflictError ? "java.lang.IncompatibleClassChangeError" : "java.lang.AbstractMethodError", message); ilgen.DoEmit(); ! wrapper.EmitLevel4Warning(mmw.IsConflictError ? HardError.IncompatibleClassChangeError : HardError.AbstractMethodError, message); } #if STATIC_COMPILER *************** *** 7163,7166 **** --- 7163,7169 ---- GetClassLoader().IssueMessage(Message.EmittedAbstractMethodError, this.Name, message); break; + case HardError.IncompatibleClassChangeError: + GetClassLoader().IssueMessage(Message.EmittedIncompatibleClassChangeError, this.Name, message); + break; default: throw new InvalidOperationException(); |
|
From: Jeroen F. <jfr...@us...> - 2014-11-11 15:28:50
|
Update of /cvsroot/ikvm/ikvm/runtime In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv15859 Modified Files: DynamicTypeWrapper.cs Log Message: Added comment about changed method overriding semantics in JDK 8u11. Index: DynamicTypeWrapper.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/DynamicTypeWrapper.cs,v retrieving revision 1.256 retrieving revision 1.257 diff -C2 -d -r1.256 -r1.257 *** DynamicTypeWrapper.cs 11 Nov 2014 15:27:34 -0000 1.256 --- DynamicTypeWrapper.cs 11 Nov 2014 15:28:48 -0000 1.257 *************** *** 2470,2473 **** --- 2470,2475 ---- // not the algorithm specified in section 5.4.5 of the JavaSE7 JVM spec // see http://weblog.ikvm.net/PermaLink.aspx?guid=bde44d8b-7ba9-4e0e-b3a6-b735627118ff and subsequent posts + // UPDATE as of JDK 7u65 and JDK 8u11, the algorithm changed again to handle package private methods differently + // this code has not been updated to reflect these changes (we're still at JDK 8 GA level) explicitOverride = false; MethodWrapper topPublicOrProtectedMethod = null; |
|
From: Jeroen F. <jfr...@us...> - 2014-11-11 15:27:36
|
Update of /cvsroot/ikvm/ikvm/runtime In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv15645 Modified Files: DynamicTypeWrapper.cs Log Message: Add some (level 4) warnings for abstract method errors that can be caused by bugs in default interface method handling. Index: DynamicTypeWrapper.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/DynamicTypeWrapper.cs,v retrieving revision 1.255 retrieving revision 1.256 diff -C2 -d -r1.255 -r1.256 *** DynamicTypeWrapper.cs 11 Nov 2014 15:03:18 -0000 1.255 --- DynamicTypeWrapper.cs 11 Nov 2014 15:27:34 -0000 1.256 *************** *** 2924,2930 **** if ((!wrapper.IsAbstract && mmw.BaseMethod.IsAbstract) || (!wrapper.IsInterface && mmw.Error != null)) { CodeEmitter ilgen = CodeEmitter.Create(mb); ! ilgen.EmitThrow("java.lang.AbstractMethodError", mmw.Error ?? (wrapper.Name + "." + methods[index].Name + methods[index].Signature)); ilgen.DoEmit(); } #if STATIC_COMPILER --- 2924,2932 ---- if ((!wrapper.IsAbstract && mmw.BaseMethod.IsAbstract) || (!wrapper.IsInterface && mmw.Error != null)) { + string message = mmw.Error ?? (wrapper.Name + "." + methods[index].Name + methods[index].Signature); CodeEmitter ilgen = CodeEmitter.Create(mb); ! ilgen.EmitThrow("java.lang.AbstractMethodError", message); ilgen.DoEmit(); + wrapper.EmitLevel4Warning(HardError.AbstractMethodError, message); } #if STATIC_COMPILER *************** *** 4224,4227 **** --- 4226,4230 ---- ilgen.EmitThrow("java.lang.AbstractMethodError", mw.DeclaringType.Name + "." + mw.Name + mw.Signature); ilgen.DoEmit(); + wrapper.EmitLevel4Warning(HardError.AbstractMethodError, mw.DeclaringType.Name + "." + mw.Name + mw.Signature); } } *************** *** 4277,4280 **** --- 4280,4284 ---- // the CLR doens't allow this, so we have to emit a method that throws an AbstractMethodError stub = true; + wrapper.EmitLevel4Warning(HardError.AbstractMethodError, classFile.Name + "." + m.Name + m.Signature); } else if (classFile.IsPublic && !classFile.IsFinal && !(m.IsPublic || m.IsProtected)) *************** *** 5621,5624 **** --- 5625,5629 ---- typeBuilder.DefineMethodOverride(mb, (MethodInfo)ifmethod.GetMethod()); wrapper.SetHasIncompleteInterfaceImplementation(); + wrapper.EmitLevel4Warning(HardError.AbstractMethodError, wrapper.Name + "." + ifmethod.Name + ifmethod.Signature); } } *************** *** 7144,7147 **** --- 7149,7170 ---- return impl.GetFieldRawTypeAnnotations(Array.IndexOf(GetFields(), fw)); } + + [Conditional("STATIC_COMPILER")] + internal void EmitLevel4Warning(HardError error, string message) + { + #if STATIC_COMPILER + if (GetClassLoader().WarningLevelHigh) + { + switch (error) + { + case HardError.AbstractMethodError: + GetClassLoader().IssueMessage(Message.EmittedAbstractMethodError, this.Name, message); + break; + default: + throw new InvalidOperationException(); + } + } + #endif + } } |
|
From: Jeroen F. <jfr...@us...> - 2014-11-11 15:03:21
|
Update of /cvsroot/ikvm/ikvm/runtime In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv12423 Modified Files: DynamicTypeWrapper.cs Log Message: Bug fix. Miranda method in base class should not interfere with default interface methods. Index: DynamicTypeWrapper.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/DynamicTypeWrapper.cs,v retrieving revision 1.254 retrieving revision 1.255 diff -C2 -d -r1.254 -r1.255 *** DynamicTypeWrapper.cs 8 Jul 2014 08:23:41 -0000 1.254 --- DynamicTypeWrapper.cs 11 Nov 2014 15:03:18 -0000 1.255 *************** *** 1273,1277 **** { MethodWrapper mw = GetMethodWrapperDuringCtor(lookup, methods, ifmethod.Name, ifmethod.Signature); ! if (mw == null) { mw = MirandaMethodWrapper.Create(wrapper, ifmethod); --- 1273,1277 ---- { MethodWrapper mw = GetMethodWrapperDuringCtor(lookup, methods, ifmethod.Name, ifmethod.Signature); ! if (mw == null || (mw.IsMirandaMethod && mw.DeclaringType != wrapper)) { mw = MirandaMethodWrapper.Create(wrapper, ifmethod); *************** *** 2909,2913 **** Debug.Assert(baseMethods[index].Length == 1 && baseMethods[index][0].DeclaringType.IsInterface); MirandaMethodWrapper mmw = (MirandaMethodWrapper)methods[index]; ! MethodAttributes attr = MethodAttributes.HideBySig | MethodAttributes.NewSlot | MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.CheckAccessOnOverride; if (wrapper.IsInterface || (wrapper.IsAbstract && mmw.BaseMethod.IsAbstract && mmw.Error == null)) { --- 2909,2919 ---- Debug.Assert(baseMethods[index].Length == 1 && baseMethods[index][0].DeclaringType.IsInterface); MirandaMethodWrapper mmw = (MirandaMethodWrapper)methods[index]; ! MethodAttributes attr = MethodAttributes.HideBySig | MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.CheckAccessOnOverride; ! MethodWrapper baseMiranda; ! if (wrapper.BaseTypeWrapper == null || (baseMiranda = wrapper.BaseTypeWrapper.GetMethodWrapper(mw.Name, mw.Signature, true)) == null || !baseMiranda.IsMirandaMethod) ! { ! // we're not overriding a miranda method in a base class, so can we set the newslot flag ! attr |= MethodAttributes.NewSlot; ! } if (wrapper.IsInterface || (wrapper.IsAbstract && mmw.BaseMethod.IsAbstract && mmw.Error == null)) { |
|
From: Jeroen F. <jfr...@us...> - 2014-11-11 14:59:07
|
Update of /cvsroot/ikvm/ikvm/runtime In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv11783 Modified Files: MemberWrapper.cs Log Message: Bug fix. Default interface methods should not conflict with their own base interfaces. Index: MemberWrapper.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/MemberWrapper.cs,v retrieving revision 1.202 retrieving revision 1.203 diff -C2 -d -r1.202 -r1.203 *** MemberWrapper.cs 27 May 2014 10:07:27 -0000 1.202 --- MemberWrapper.cs 11 Nov 2014 14:59:05 -0000 1.203 *************** *** 1055,1058 **** --- 1055,1063 ---- return this; } + else if (ifmethod.DeclaringType.ImplementsInterface(mw.DeclaringType)) + { + // we can override a base interface without problems + return this; + } else if (mw.DeclaringType.ImplementsInterface(ifmethod.DeclaringType)) { |
|
From: Jeroen F. <jfr...@us...> - 2014-11-11 14:35:34
|
Update of /cvsroot/ikvm/ikvm/runtime In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv8709 Modified Files: LambdaMetafactory.cs Log Message: Don't call IsSubTypeOf() on primitive types. Index: LambdaMetafactory.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/LambdaMetafactory.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** LambdaMetafactory.cs 9 Jul 2014 12:47:48 -0000 1.9 --- LambdaMetafactory.cs 11 Nov 2014 14:35:31 -0000 1.10 *************** *** 217,221 **** for (int i = 0, K = args.Length; i < K; i++) { ! if (!args[i].IsSubTypeOf(implParameters[i])) { Fail("For i=1..K, Di = Ai"); --- 217,225 ---- for (int i = 0, K = args.Length; i < K; i++) { ! if (args[i] == implParameters[i]) ! { ! // ok ! } ! else if (args[i].IsPrimitive || implParameters[i].IsPrimitive || !args[i].IsSubTypeOf(implParameters[i])) { Fail("For i=1..K, Di = Ai"); |
|
From: Jeroen F. <jfr...@us...> - 2014-11-10 13:37:28
|
Update of /cvsroot/ikvm/ikvm/openjdk/java/util/concurrent In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv13263 Modified Files: ForkJoinPool.java Log Message: Optimized unsafe field access. Index: ForkJoinPool.java =================================================================== RCS file: /cvsroot/ikvm/ikvm/openjdk/java/util/concurrent/ForkJoinPool.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ForkJoinPool.java 10 Nov 2014 10:00:02 -0000 1.1 --- ForkJoinPool.java 10 Nov 2014 13:37:26 -0000 1.2 *************** *** 809,813 **** if ((t = (ForkJoinTask<?>)U.getObjectVolatile(a, j)) != null && base == b && U.compareAndSwapObject(a, j, t, null)) { ! U.putOrderedInt(this, QBASE, b + 1); return t; } --- 809,813 ---- if ((t = (ForkJoinTask<?>)U.getObjectVolatile(a, j)) != null && base == b && U.compareAndSwapObject(a, j, t, null)) { ! base = b + 1; return t; } *************** *** 826,830 **** if (t != null) { if (U.compareAndSwapObject(a, j, t, null)) { ! U.putOrderedInt(this, QBASE, b + 1); return t; } --- 826,830 ---- if (t != null) { if (U.compareAndSwapObject(a, j, t, null)) { ! base = b + 1; return t; } *************** *** 989,993 **** if (base == b && U.compareAndSwapObject(a, j, t, null)) { ! U.putOrderedInt(this, QBASE, b + 1); t.doExec(); } --- 989,993 ---- if (base == b && U.compareAndSwapObject(a, j, t, null)) { ! base = b + 1; t.doExec(); } *************** *** 1013,1017 **** for (t = (CountedCompleter<?>)o, r = t;;) { if (r == root) { ! if (U.compareAndSwapInt(this, QLOCK, 0, 1)) { if (top == s && array == a && U.compareAndSwapObject(a, j, t, null)) { --- 1013,1017 ---- for (t = (CountedCompleter<?>)o, r = t;;) { if (r == root) { ! if (compareAndSwapIntQlock(0, 1)) { if (top == s && array == a && U.compareAndSwapObject(a, j, t, null)) { *************** *** 1069,1076 **** } // Unsafe mechanics private static final sun.misc.Unsafe U; - private static final long QBASE; - private static final long QLOCK; private static final int ABASE; private static final int ASHIFT; --- 1069,1077 ---- } + @ikvm.internal.InterlockedCompareAndSet("qlock") + final native boolean compareAndSwapIntQlock(int expect, int update); + // Unsafe mechanics private static final sun.misc.Unsafe U; private static final int ABASE; private static final int ASHIFT; *************** *** 1078,1087 **** try { U = sun.misc.Unsafe.getUnsafe(); - Class<?> k = WorkQueue.class; Class<?> ak = ForkJoinTask[].class; - QBASE = U.objectFieldOffset - (k.getDeclaredField("base")); - QLOCK = U.objectFieldOffset - (k.getDeclaredField("qlock")); ABASE = U.arrayBaseOffset(ak); int scale = U.arrayIndexScale(ak); --- 1079,1083 ---- *************** *** 1285,1289 **** for (;;) { if (((ps = plock) & PL_LOCK) == 0 && ! U.compareAndSwapInt(this, PLOCK, ps, nps = ps + PL_LOCK)) return nps; else if (spins >= 0) { --- 1281,1285 ---- for (;;) { if (((ps = plock) & PL_LOCK) == 0 && ! compareAndSwapIntPlock(ps, nps = ps + PL_LOCK)) return nps; else if (spins >= 0) { *************** *** 1291,1295 **** --spins; } ! else if (U.compareAndSwapInt(this, PLOCK, ps, ps | PL_SIGNAL)) { synchronized (this) { if ((plock & PL_SIGNAL) != 0) { --- 1287,1291 ---- --spins; } ! else if (compareAndSwapIntPlock(ps, ps | PL_SIGNAL)) { synchronized (this) { if ((plock & PL_SIGNAL) != 0) { *************** *** 1329,1333 **** long nc = ((long)(((u + UTC_UNIT) & UTC_MASK) | ((u + UAC_UNIT) & UAC_MASK)) << 32) | (long)e; ! if (U.compareAndSwapLong(this, CTL, c, nc)) { ForkJoinWorkerThreadFactory fac; Throwable ex = null; --- 1325,1329 ---- long nc = ((long)(((u + UTC_UNIT) & UTC_MASK) | ((u + UAC_UNIT) & UAC_MASK)) << 32) | (long)e; ! if (compareAndSwapLongCtl(c, nc)) { ForkJoinWorkerThreadFactory fac; Throwable ex = null; *************** *** 1365,1374 **** if ((handler = ueh) != null) wt.setUncaughtExceptionHandler(handler); ! do {} while (!U.compareAndSwapInt(this, INDEXSEED, s = indexSeed, s += SEED_INCREMENT) || s == 0); // skip 0 WorkQueue w = new WorkQueue(this, wt, mode, s); if (((ps = plock) & PL_LOCK) != 0 || ! !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK)) ps = acquirePlock(); int nps = (ps & SHUTDOWN) | ((ps + PL_LOCK) & ~SHUTDOWN); --- 1361,1370 ---- if ((handler = ueh) != null) wt.setUncaughtExceptionHandler(handler); ! do {} while (!compareAndSwapIntIndexSeed(s = indexSeed, s += SEED_INCREMENT) || s == 0); // skip 0 WorkQueue w = new WorkQueue(this, wt, mode, s); if (((ps = plock) & PL_LOCK) != 0 || ! !compareAndSwapIntPlock(ps, ps += PL_LOCK)) ps = acquirePlock(); int nps = (ps & SHUTDOWN) | ((ps + PL_LOCK) & ~SHUTDOWN); *************** *** 1393,1397 **** } } finally { ! if (!U.compareAndSwapInt(this, PLOCK, ps, nps)) releasePlock(nps); } --- 1389,1393 ---- } } finally { ! if (!compareAndSwapIntPlock(ps, nps)) releasePlock(nps); } *************** *** 1414,1420 **** int ps; w.qlock = -1; // ensure set ! U.getAndAddLong(this, STEALCOUNT, w.nsteals); // collect steals if (((ps = plock) & PL_LOCK) != 0 || ! !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK)) ps = acquirePlock(); int nps = (ps & SHUTDOWN) | ((ps + PL_LOCK) & ~SHUTDOWN); --- 1410,1416 ---- int ps; w.qlock = -1; // ensure set ! getAndAddLongStealCount(w.nsteals); // collect steals if (((ps = plock) & PL_LOCK) != 0 || ! !compareAndSwapIntPlock(ps, ps += PL_LOCK)) ps = acquirePlock(); int nps = (ps & SHUTDOWN) | ((ps + PL_LOCK) & ~SHUTDOWN); *************** *** 1425,1429 **** ws[idx] = null; } finally { ! if (!U.compareAndSwapInt(this, PLOCK, ps, nps)) releasePlock(nps); } --- 1421,1425 ---- ws[idx] = null; } finally { ! if (!compareAndSwapIntPlock(ps, nps)) releasePlock(nps); } *************** *** 1431,1436 **** long c; // adjust ctl counts ! do {} while (!U.compareAndSwapLong ! (this, CTL, c = ctl, (((c - AC_UNIT) & AC_MASK) | ((c - TC_UNIT) & TC_MASK) | (c & ~(AC_MASK|TC_MASK))))); --- 1427,1432 ---- long c; // adjust ctl counts ! do {} while (!compareAndSwapLongCtl ! (c = ctl, (((c - AC_UNIT) & AC_MASK) | ((c - TC_UNIT) & TC_MASK) | (c & ~(AC_MASK|TC_MASK))))); *************** *** 1449,1453 **** if (v.eventCount != (e | INT_SIGN)) break; ! if (U.compareAndSwapLong(this, CTL, c, nc)) { v.eventCount = (e + E_SEQ) & E_MASK; if ((p = v.parker) != null) --- 1445,1449 ---- if (v.eventCount != (e | INT_SIGN)) break; ! if (compareAndSwapLongCtl(c, nc)) { v.eventCount = (e + E_SEQ) & E_MASK; if ((p = v.parker) != null) *************** *** 1486,1490 **** if (ps > 0 && ws != null && (m = (ws.length - 1)) >= 0 && (q = ws[m & r & SQMASK]) != null && r != 0 && ! U.compareAndSwapInt(q, QLOCK, 0, 1)) { // lock if ((a = q.array) != null && (am = a.length - 1) > (n = (s = q.top) - q.base)) { --- 1482,1486 ---- if (ps > 0 && ws != null && (m = (ws.length - 1)) >= 0 && (q = ws[m & r & SQMASK]) != null && r != 0 && ! q.compareAndSwapIntQlock(0, 1)) { // lock if ((a = q.array) != null && (am = a.length - 1) > (n = (s = q.top) - q.base)) { *************** *** 1539,1552 **** new WorkQueue[n] : null); if (((ps = plock) & PL_LOCK) != 0 || ! !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK)) ps = acquirePlock(); if (((ws = workQueues) == null || ws.length == 0) && nws != null) workQueues = nws; int nps = (ps & SHUTDOWN) | ((ps + PL_LOCK) & ~SHUTDOWN); ! if (!U.compareAndSwapInt(this, PLOCK, ps, nps)) releasePlock(nps); } else if ((q = ws[k = r & m & SQMASK]) != null) { ! if (q.qlock == 0 && U.compareAndSwapInt(q, QLOCK, 0, 1)) { ForkJoinTask<?>[] a = q.array; int s = q.top; --- 1535,1548 ---- new WorkQueue[n] : null); if (((ps = plock) & PL_LOCK) != 0 || ! !compareAndSwapIntPlock(ps, ps += PL_LOCK)) ps = acquirePlock(); if (((ws = workQueues) == null || ws.length == 0) && nws != null) workQueues = nws; int nps = (ps & SHUTDOWN) | ((ps + PL_LOCK) & ~SHUTDOWN); ! if (!compareAndSwapIntPlock(ps, nps)) releasePlock(nps); } else if ((q = ws[k = r & m & SQMASK]) != null) { ! if (q.qlock == 0 && q.compareAndSwapIntQlock(0, 1)) { ForkJoinTask<?>[] a = q.array; int s = q.top; *************** *** 1574,1583 **** q.poolIndex = (short)k; if (((ps = plock) & PL_LOCK) != 0 || ! !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK)) ps = acquirePlock(); if ((ws = workQueues) != null && k < ws.length && ws[k] == null) ws[k] = q; int nps = (ps & SHUTDOWN) | ((ps + PL_LOCK) & ~SHUTDOWN); ! if (!U.compareAndSwapInt(this, PLOCK, ps, nps)) releasePlock(nps); } --- 1570,1579 ---- q.poolIndex = (short)k; if (((ps = plock) & PL_LOCK) != 0 || ! !compareAndSwapIntPlock(ps, ps += PL_LOCK)) ps = acquirePlock(); if ((ws = workQueues) != null && k < ws.length && ws[k] == null) ws[k] = q; int nps = (ps & SHUTDOWN) | ((ps + PL_LOCK) & ~SHUTDOWN); ! if (!compareAndSwapIntPlock(ps, nps)) releasePlock(nps); } *************** *** 1596,1601 **** final void incrementActiveCount() { long c; ! do {} while (!U.compareAndSwapLong ! (this, CTL, c = ctl, ((c & ~AC_MASK) | ((c & AC_MASK) + AC_UNIT)))); } --- 1592,1597 ---- final void incrementActiveCount() { long c; ! do {} while (!compareAndSwapLongCtl ! (c = ctl, ((c & ~AC_MASK) | ((c & AC_MASK) + AC_UNIT)))); } *************** *** 1624,1628 **** int ne = (e + E_SEQ) & E_MASK; if (w.eventCount == (e | INT_SIGN) && ! U.compareAndSwapLong(this, CTL, c, nc)) { w.eventCount = ne; if ((p = w.parker) != null) --- 1620,1624 ---- int ne = (e + E_SEQ) & E_MASK; if (w.eventCount == (e | INT_SIGN) && ! compareAndSwapLongCtl(c, nc)) { w.eventCount = ne; if ((p = w.parker) != null) *************** *** 1684,1688 **** else if (q.base == b && U.compareAndSwapObject(a, i, t, null)) { ! U.putOrderedInt(q, QBASE, b + 1); if ((b + 1) - q.top < 0) signalWork(ws, q); --- 1680,1684 ---- else if (q.base == b && U.compareAndSwapObject(a, i, t, null)) { ! q.base = b + 1; if ((b + 1) - q.top < 0) signalWork(ws, q); *************** *** 1699,1703 **** w.nextWait = e; w.eventCount = ec | INT_SIGN; ! if (!U.compareAndSwapLong(this, CTL, c, nc)) w.eventCount = ec; // back out } --- 1695,1699 ---- w.nextWait = e; w.eventCount = ec | INT_SIGN; ! if (!compareAndSwapLongCtl(c, nc)) w.eventCount = ec; // back out } *************** *** 1735,1739 **** else if ((ns = w.nsteals) != 0) { // collect steals and retry w.nsteals = 0; ! U.getAndAddLong(this, STEALCOUNT, (long)ns); } else { --- 1731,1735 ---- else if ((ns = w.nsteals) != 0) { // collect steals and retry w.nsteals = 0; ! getAndAddLongStealCount((long)ns); } else { *************** *** 1751,1763 **** if (w.eventCount == ec && ctl == c) { Thread wt = Thread.currentThread(); ! U.putObject(wt, PARKBLOCKER, this); w.parker = wt; // emulate LockSupport.park if (w.eventCount == ec && ctl == c) U.park(false, parkTime); // must recheck before park w.parker = null; ! U.putObject(wt, PARKBLOCKER, null); if (parkTime != 0L && ctl == c && deadline - System.nanoTime() <= 0L && ! U.compareAndSwapLong(this, CTL, c, pc)) stat = w.qlock = -1; // shrink pool } --- 1747,1759 ---- if (w.eventCount == ec && ctl == c) { Thread wt = Thread.currentThread(); ! wt.parkBlocker = this; w.parker = wt; // emulate LockSupport.park if (w.eventCount == ec && ctl == c) U.park(false, parkTime); // must recheck before park w.parker = null; ! wt.parkBlocker = null; if (parkTime != 0L && ctl == c && deadline - System.nanoTime() <= 0L && ! compareAndSwapLongCtl(c, pc)) stat = w.qlock = -1; // shrink pool } *************** *** 1784,1788 **** if (q != null && q.base == b && w.eventCount < 0 && v.eventCount == (e | INT_SIGN) && ! U.compareAndSwapLong(this, CTL, c, nc)) { v.eventCount = ne; if ((p = v.parker) != null) --- 1780,1784 ---- if (q != null && q.base == b && w.eventCount < 0 && v.eventCount == (e | INT_SIGN) && ! compareAndSwapLongCtl(c, nc)) { v.eventCount = ne; if ((p = v.parker) != null) *************** *** 1855,1859 **** break restart; if (U.compareAndSwapObject(a, i, t, null)) { ! U.putOrderedInt(v, QBASE, b + 1); ForkJoinTask<?> ps = joiner.currentSteal; int jt = joiner.top; --- 1851,1855 ---- break restart; if (U.compareAndSwapObject(a, i, t, null)) { ! v.base = b + 1; ForkJoinTask<?> ps = joiner.currentSteal; int jt = joiner.top; *************** *** 1955,1959 **** int ne = (e + E_SEQ) & E_MASK; if (w.eventCount == (e | INT_SIGN) && ! U.compareAndSwapLong(this, CTL, c, nc)) { w.eventCount = ne; if ((p = w.parker) != null) --- 1951,1955 ---- int ne = (e + E_SEQ) & E_MASK; if (w.eventCount == (e | INT_SIGN) && ! compareAndSwapLongCtl(c, nc)) { w.eventCount = ne; if ((p = w.parker) != null) *************** *** 1965,1974 **** (int)(c >> AC_SHIFT) + pc > 1) { long nc = ((c - AC_UNIT) & AC_MASK) | (c & ~AC_MASK); ! if (U.compareAndSwapLong(this, CTL, c, nc)) return true; // no compensation } else if (tc + pc < MAX_CAP) { long nc = ((c + TC_UNIT) & TC_MASK) | (c & ~TC_MASK); ! if (U.compareAndSwapLong(this, CTL, c, nc)) { ForkJoinWorkerThreadFactory fac; Throwable ex = null; --- 1961,1970 ---- (int)(c >> AC_SHIFT) + pc > 1) { long nc = ((c - AC_UNIT) & AC_MASK) | (c & ~AC_MASK); ! if (compareAndSwapLongCtl(c, nc)) return true; // no compensation } else if (tc + pc < MAX_CAP) { long nc = ((c + TC_UNIT) & TC_MASK) | (c & ~TC_MASK); ! if (compareAndSwapLongCtl(c, nc)) { ForkJoinWorkerThreadFactory fac; Throwable ex = null; *************** *** 2026,2031 **** } long c; // reactivate ! do {} while (!U.compareAndSwapLong ! (this, CTL, c = ctl, ((c & ~AC_MASK) | ((c & AC_MASK) + AC_UNIT)))); --- 2022,2027 ---- } long c; // reactivate ! do {} while (!compareAndSwapLongCtl ! (c = ctl, ((c & ~AC_MASK) | ((c & AC_MASK) + AC_UNIT)))); *************** *** 2099,2104 **** if (!active) { // re-establish active count active = true; ! do {} while (!U.compareAndSwapLong ! (this, CTL, c = ctl, ((c & ~AC_MASK) | ((c & AC_MASK) + AC_UNIT)))); --- 2095,2100 ---- if (!active) { // re-establish active count active = true; ! do {} while (!compareAndSwapLongCtl ! (c = ctl, ((c & ~AC_MASK) | ((c & AC_MASK) + AC_UNIT)))); *************** *** 2111,2120 **** if ((int)(nc >> AC_SHIFT) + parallelism == 0) break; // bypass decrement-then-increment ! if (U.compareAndSwapLong(this, CTL, c, nc)) active = false; } else if ((int)((c = ctl) >> AC_SHIFT) + parallelism <= 0 && ! U.compareAndSwapLong ! (this, CTL, c, ((c & ~AC_MASK) | ((c & AC_MASK) + AC_UNIT)))) break; --- 2107,2116 ---- if ((int)(nc >> AC_SHIFT) + parallelism == 0) break; // bypass decrement-then-increment ! if (compareAndSwapLongCtl(c, nc)) active = false; } else if ((int)((c = ctl) >> AC_SHIFT) + parallelism <= 0 && ! compareAndSwapLongCtl ! (c, ((c & ~AC_MASK) | ((c & AC_MASK) + AC_UNIT)))) break; *************** *** 2224,2231 **** return false; if ((ps & PL_LOCK) != 0 || ! !U.compareAndSwapInt(this, PLOCK, ps, ps += PL_LOCK)) ps = acquirePlock(); int nps = ((ps + PL_LOCK) & ~SHUTDOWN) | SHUTDOWN; ! if (!U.compareAndSwapInt(this, PLOCK, ps, nps)) releasePlock(nps); } --- 2220,2227 ---- return false; if ((ps & PL_LOCK) != 0 || ! !compareAndSwapIntPlock(ps, ps += PL_LOCK)) ps = acquirePlock(); int nps = ((ps + PL_LOCK) & ~SHUTDOWN) | SHUTDOWN; ! if (!compareAndSwapIntPlock(ps, nps)) releasePlock(nps); } *************** *** 2254,2258 **** } } ! if (U.compareAndSwapLong(this, CTL, c, c | STOP_BIT)) { for (int pass = 0; pass < 3; ++pass) { WorkQueue[] ws; WorkQueue w; Thread wt; --- 2250,2254 ---- } } ! if (compareAndSwapLongCtl(c, c | STOP_BIT)) { for (int pass = 0; pass < 3; ++pass) { WorkQueue[] ws; WorkQueue w; Thread wt; *************** *** 2285,2289 **** (cc & (TC_MASK|STOP_BIT))); if (w.eventCount == (e | INT_SIGN) && ! U.compareAndSwapLong(this, CTL, cc, nc)) { w.eventCount = (e + E_SEQ) & E_MASK; w.qlock = -1; --- 2281,2285 ---- (cc & (TC_MASK|STOP_BIT))); if (w.eventCount == (e | INT_SIGN) && ! compareAndSwapLongCtl(cc, nc)) { w.eventCount = (e + E_SEQ) & E_MASK; w.qlock = -1; *************** *** 2327,2331 **** long j = (((a.length - 1) & (s - 1)) << ASHIFT) + ABASE; if (U.getObject(a, j) == task && ! U.compareAndSwapInt(joiner, QLOCK, 0, 1)) { if (joiner.top == s && joiner.array == a && U.compareAndSwapObject(a, j, task, null)) { --- 2323,2327 ---- long j = (((a.length - 1) & (s - 1)) << ASHIFT) + ABASE; if (U.getObject(a, j) == task && ! joiner.compareAndSwapIntQlock(0, 1)) { if (joiner.top == s && joiner.array == a && U.compareAndSwapObject(a, j, task, null)) { *************** *** 3240,3254 **** } // Unsafe mechanics private static final sun.misc.Unsafe U; - private static final long CTL; - private static final long PARKBLOCKER; private static final int ABASE; private static final int ASHIFT; - private static final long STEALCOUNT; - private static final long PLOCK; - private static final long INDEXSEED; - private static final long QBASE; - private static final long QLOCK; static { --- 3236,3264 ---- } + @ikvm.internal.InterlockedCompareAndSet("ctl") + private native boolean compareAndSwapLongCtl(long expect, long update); + + @ikvm.internal.InterlockedCompareAndSet("plock") + private native boolean compareAndSwapIntPlock(int expect, int update); + + @ikvm.internal.InterlockedCompareAndSet("indexSeed") + private native boolean compareAndSwapIntIndexSeed(int expect, int update); + + @ikvm.internal.InterlockedCompareAndSet("stealCount") + private native boolean compareAndSwapLongStealCount(long expect, long update); + + private long getAndAddLongStealCount(long delta) { + for (;;) { + long value = stealCount; + if (compareAndSwapLongStealCount(value, value + delta)) { + return value; + } + } + } + // Unsafe mechanics private static final sun.misc.Unsafe U; private static final int ABASE; private static final int ASHIFT; static { *************** *** 3256,3276 **** try { U = sun.misc.Unsafe.getUnsafe(); - Class<?> k = ForkJoinPool.class; - CTL = U.objectFieldOffset - (k.getDeclaredField("ctl")); - STEALCOUNT = U.objectFieldOffset - (k.getDeclaredField("stealCount")); - PLOCK = U.objectFieldOffset - (k.getDeclaredField("plock")); - INDEXSEED = U.objectFieldOffset - (k.getDeclaredField("indexSeed")); - Class<?> tk = Thread.class; - PARKBLOCKER = U.objectFieldOffset - (tk.getDeclaredField("parkBlocker")); - Class<?> wk = WorkQueue.class; - QBASE = U.objectFieldOffset - (wk.getDeclaredField("base")); - QLOCK = U.objectFieldOffset - (wk.getDeclaredField("qlock")); Class<?> ak = ForkJoinTask[].class; ABASE = U.arrayBaseOffset(ak); --- 3266,3269 ---- |
|
From: Jeroen F. <jfr...@us...> - 2014-11-10 10:00:07
|
Update of /cvsroot/ikvm/ikvm/openjdk/java/util/concurrent In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv22927/java/util/concurrent Added Files: ForkJoinPool.java Log Message: Prepare java.util.concurrent.ForkJoinPool for forking. --- NEW FILE: ForkJoinPool.java --- /* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * [...3331 lines suppressed...] "enableContextClassLoaderOverride")); innocuousPerms.add(new RuntimePermission( "modifyThreadGroup")); innocuousAcc = new AccessControlContext(new ProtectionDomain[] { new ProtectionDomain(null, innocuousPerms) }); } public final ForkJoinWorkerThread newThread(ForkJoinPool pool) { return (ForkJoinWorkerThread.InnocuousForkJoinWorkerThread) java.security.AccessController.doPrivileged( new java.security.PrivilegedAction<ForkJoinWorkerThread>() { public ForkJoinWorkerThread run() { return new ForkJoinWorkerThread. InnocuousForkJoinWorkerThread(pool); }}, innocuousAcc); } } } |
|
From: Jeroen F. <jfr...@us...> - 2014-11-10 10:00:06
|
Update of /cvsroot/ikvm/ikvm/openjdk In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv22927 Modified Files: allsources.lst response.txt Log Message: Prepare java.util.concurrent.ForkJoinPool for forking. Index: allsources.lst =================================================================== RCS file: /cvsroot/ikvm/ikvm/openjdk/allsources.lst,v retrieving revision 1.268 retrieving revision 1.269 diff -C2 -d -r1.268 -r1.269 *** allsources.lst 29 Oct 2014 06:11:44 -0000 1.268 --- allsources.lst 10 Nov 2014 10:00:01 -0000 1.269 *************** *** 126,129 **** --- 126,130 ---- java/security/AccessController.java java/security/ProtectionDomain.java + java/util/concurrent/ForkJoinPool.java java/util/concurrent/locks/AbstractQueuedSynchronizer.java java/util/concurrent/locks/LockSupport.java *************** *** 10971,10975 **** @OPENJDK@/jdk/src/share/classes/java/util/concurrent/Executors.java @OPENJDK@/jdk/src/share/classes/java/util/concurrent/ExecutorService.java - @OPENJDK@/jdk/src/share/classes/java/util/concurrent/ForkJoinPool.java @OPENJDK@/jdk/src/share/classes/java/util/concurrent/ForkJoinTask.java @OPENJDK@/jdk/src/share/classes/java/util/concurrent/ForkJoinWorkerThread.java --- 10972,10975 ---- Index: response.txt =================================================================== RCS file: /cvsroot/ikvm/ikvm/openjdk/response.txt,v retrieving revision 1.182 retrieving revision 1.183 diff -C2 -d -r1.182 -r1.183 *** response.txt 29 Oct 2014 06:11:45 -0000 1.182 --- response.txt 10 Nov 2014 10:00:01 -0000 1.183 *************** *** 43,46 **** --- 43,47 ---- java/nio/*.class java/security/*.class + java/util/concurrent/*.class java/util/concurrent/locks/*.class gnu/java/util/*.class |
|
From: Jeroen F. <jfr...@us...> - 2014-11-10 09:18:31
|
Update of /cvsroot/ikvm/ikvm/openjdk/java/lang In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv18781/java/lang Modified Files: Thread.java Log Message: Changed Thread.parkBlocker field accessiblity to internal, to allow java.util.concurrent.ForkJoinPool direct access. Index: Thread.java =================================================================== RCS file: /cvsroot/ikvm/ikvm/openjdk/java/lang/Thread.java,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** Thread.java 29 Oct 2014 06:13:36 -0000 1.38 --- Thread.java 10 Nov 2014 09:18:25 -0000 1.39 *************** *** 257,261 **** * Accessed using java.util.concurrent.locks.LockSupport.getBlocker */ ! volatile Object parkBlocker; /* The object in which this thread is blocked in an interruptible I/O --- 257,262 ---- * Accessed using java.util.concurrent.locks.LockSupport.getBlocker */ ! @ikvm.lang.Internal // [IKVM] accessed from java.util.concurrent ! public volatile Object parkBlocker; /* The object in which this thread is blocked in an interruptible I/O |