From: <ls...@us...> - 2009-01-04 16:31:57
|
Revision: 4828 http://jnode.svn.sourceforge.net/jnode/?rev=4828&view=rev Author: lsantha Date: 2009-01-04 16:31:52 +0000 (Sun, 04 Jan 2009) Log Message: ----------- VM interface cleanups. Modified Paths: -------------- trunk/core/src/classpath/vm/java/lang/Thread.java trunk/core/src/mmtk-vm/org/mmtk/vm/Strings.java trunk/core/src/openjdk/java/java/lang/System.java trunk/core/src/openjdk/vm/java/lang/NativeShutdown.java trunk/core/src/openjdk/vm/java/lang/NativeString.java trunk/core/src/openjdk/vm/java/lang/NativeSystem.java trunk/core/src/openjdk/vm/java/lang/NativeThrowable.java trunk/core/src/openjdk/vm/java/lang/reflect/NativeArray.java Removed Paths: ------------- trunk/core/src/classpath/java/java/lang/reflect/ trunk/core/src/classpath/vm/java/lang/VMCompiler.java trunk/core/src/classpath/vm/java/lang/VMDouble.java trunk/core/src/classpath/vm/java/lang/VMFloat.java trunk/core/src/classpath/vm/java/lang/VMMath.java trunk/core/src/classpath/vm/java/lang/VMObject.java trunk/core/src/classpath/vm/java/lang/VMString.java trunk/core/src/classpath/vm/java/lang/VMThrowable.java trunk/core/src/classpath/vm/java/lang/reflect/VMArray.java Modified: trunk/core/src/classpath/vm/java/lang/Thread.java =================================================================== --- trunk/core/src/classpath/vm/java/lang/Thread.java 2009-01-04 14:07:46 UTC (rev 4827) +++ trunk/core/src/classpath/vm/java/lang/Thread.java 2009-01-04 16:31:52 UTC (rev 4828) @@ -41,7 +41,6 @@ import java.util.Map; import java.util.WeakHashMap; import java.util.HashMap; -import java.lang.reflect.Constructor; import org.jnode.security.JNodePermission; @@ -50,7 +49,6 @@ import org.jnode.vm.annotation.Internal; import org.jnode.vm.annotation.SharedStatics; import org.jnode.vm.classmgr.VmIsolatedStatics; -import org.jnode.vm.isolate.IsolateThread; import org.jnode.vm.scheduler.MonitorManager; import org.jnode.vm.scheduler.VmProcessor; import org.jnode.vm.scheduler.VmThread; @@ -1258,7 +1256,7 @@ if (!isAlive()) { return EMPTY_STACK_TRACE; } - return VMThrowable.backTrace2stackTrace(VmThread.getStackTrace(vmThread)); + return NativeThrowable.backTrace2stackTrace(VmThread.getStackTrace(vmThread)); } else { // Don't need JVM help for current thread return (new Exception()).getStackTrace(); @@ -1468,4 +1466,5 @@ // blocker = b; // } } + } Deleted: trunk/core/src/classpath/vm/java/lang/VMCompiler.java =================================================================== --- trunk/core/src/classpath/vm/java/lang/VMCompiler.java 2009-01-04 14:07:46 UTC (rev 4827) +++ trunk/core/src/classpath/vm/java/lang/VMCompiler.java 2009-01-04 16:31:52 UTC (rev 4828) @@ -1,94 +0,0 @@ -/* - * $Id$ - * - * JNode.org - * Copyright (C) 2003-2006 JNode.org - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This library 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 Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; If not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package java.lang; - -/** - * This class is just a per-VM reflection of java.lang.Compiler. All methods are - * defined identically. - */ -final class VMCompiler { - /** - * Don't allow new `Compiler's to be made. - */ - private VMCompiler() { - } - - /** - * Compile the class named by <code>oneClass</code>. - * - * @param oneClass - * the class to compile - * @return <code>false</code> if no compiler is available or compilation - * failed, <code>true</code> if compilation succeeded - * @throws NullPointerException - * if oneClass is null - */ - public static boolean compileClass(Class oneClass) { - // Never succeed. - return false; - } - - /** - * Compile the classes whose name matches <code>classNames</code>. - * - * @param classNames - * the name of classes to compile - * @return <code>false</code> if no compiler is available or compilation - * failed, <code>true</code> if compilation succeeded - * @throws NullPointerException - * if classNames is null - */ - public static boolean compileClasses(String classNames) { - // Note the incredibly lame interface. Always fail. - return false; - } - - /** - * This method examines the argument and performs an operation according to - * the compilers documentation. No specific operation is required. - * - * @param arg - * a compiler-specific argument - * @return a compiler-specific value, including null - * @throws NullPointerException - * if the compiler doesn't like a null arg - */ - public static Object command(Object arg) { - // Our implementation defines this to a no-op. - return null; - } - - /** - * Calling <code>Compiler.enable()</code> will cause the compiler to - * resume operation if it was previously disabled; provided that a compiler - * even exists. - */ - public static void enable() { - } - - /** - * Calling <code>Compiler.disable()</code> will cause the compiler to be - * suspended; provided that a compiler even exists. - */ - public static void disable() { - } -} Deleted: trunk/core/src/classpath/vm/java/lang/VMDouble.java =================================================================== --- trunk/core/src/classpath/vm/java/lang/VMDouble.java 2009-01-04 14:07:46 UTC (rev 4827) +++ trunk/core/src/classpath/vm/java/lang/VMDouble.java 2009-01-04 16:31:52 UTC (rev 4828) @@ -1,348 +0,0 @@ -/* - * $Id$ - * - * JNode.org - * Copyright (C) 2003-2006 JNode.org - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This library 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 Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; If not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package java.lang; - -import org.jnode.vm.VmMagic; -import org.jnode.vm.annotation.MagicPermission; - -/** - * VM specific double routines. - * - * @author Ewout Prangsma (ep...@us...) - */ -@MagicPermission -public final class VMDouble { - private char[] chars; - - private int length; - - private int index; - - /** - * Convert the double to the IEEE 754 floating-point "double format" bit - * layout. Bit 63 (the most significant) is the sign bit, bits 62-52 (masked - * by 0x7ff0000000000000L) represent the exponent, and bits 51-0 (masked by - * 0x000fffffffffffffL) are the mantissa. This function collapses all - * versions of NaN to 0x7ff8000000000000L. The result of this function can - * be used as the argument to <code>Double.longBitsToDouble(long)</code> - * to obtain the original <code>double</code> value. - * - * @param value - * the <code>double</code> to convert - * @return the bits of the <code>double</code> - * @see #longBitsToDouble(long) - */ - public static long doubleToLongBits(double value) { - if (Double.isNaN(value)) { - return 0x7ff8000000000000L; - } else { - return VmMagic.doubleToRawLongBits(value); - } - } - - /** - * Convert the double to the IEEE 754 floating-point "double format" bit - * layout. Bit 63 (the most significant) is the sign bit, bits 62-52 (masked - * by 0x7ff0000000000000L) represent the exponent, and bits 51-0 (masked by - * 0x000fffffffffffffL) are the mantissa. This function leaves NaN alone, - * rather than collapsing to a canonical value. The result of this function - * can be used as the argument to <code>Double.longBitsToDouble(long)</code> - * to obtain the original <code>double</code> value. - * - * @param value - * the <code>double</code> to convert - * @return the bits of the <code>double</code> - * @see #longBitsToDouble(long) - */ - public static long doubleToRawLongBits(double value) { - return VmMagic.doubleToRawLongBits(value); - } - - /** - * Convert the argument in IEEE 754 floating-point "double format" bit - * layout to the corresponding float. Bit 63 (the most significant) is the - * sign bit, bits 62-52 (masked by 0x7ff0000000000000L) represent the - * exponent, and bits 51-0 (masked by 0x000fffffffffffffL) are the mantissa. - * This function leaves NaN alone, so that you can recover the bit pattern - * with <code>Double.doubleToRawLongBits(double)</code>. - * - * @param bits - * the bits to convert - * @return the <code>double</code> represented by the bits - * @see #doubleToLongBits(double) - * @see #doubleToRawLongBits(double) - */ - public static double longBitsToDouble(long bits) { - return VmMagic.longBitsToDouble(bits); - } - - private int parseUnsignedInt() throws NumberFormatException { - if (index >= length) - throw new NumberFormatException(); - - int start = index; - int value = 0; - - for (; index < length; index++) { - int d = Character.digit(chars[index], 10); - if (d < 0) - break; - value *= 10; - value += d; - } - - if (index == start) - throw new NumberFormatException(); - - return value; - } - - private int parseSignedInt() throws NumberFormatException { - if (index >= length) - throw new NumberFormatException(); - - char sign = ' '; - - switch (chars[index]) { - case '-': - sign = '-'; - index++; - break; - - case '+': - sign = '+'; - index++; - break; - } - - int value = parseUnsignedInt(); - - return (sign == '-') ? -value : value; - } - - private double parseFractionalPart(boolean nonEmpty) - throws NumberFormatException { - if (index >= length) - throw new NumberFormatException(); - - int start = index; - double value = 0.0d; - - for (; index < length; index++) { - int d = Character.digit(chars[index], 10); - if (d < 0) - break; - value += d; - value /= 10; - } - - if (nonEmpty && (index == start)) - throw new NumberFormatException(); - - return value; - } - - private double parseExponent(double value) throws NumberFormatException { - if (index >= chars.length) - return value; - - switch (chars[index]) { - case 'f': - case 'F': - case 'd': - case 'D': - return value; - - case 'e': - case 'E': - index++; - break; - - default: - throw new NumberFormatException(); - } - - int exponent = parseSignedInt(); - - char ch = 0; - if (index < chars.length && ((ch = chars[index]) != 'f' && ch != 'F' && ch != 'd' && ch != 'D')) - throw new NumberFormatException(); - - return value * Math.pow(10.0, exponent); - } - - public static double parseDouble(String s) { - return new VMDouble(s).parse(); - } - - public double parse() throws NumberFormatException { - if (index >= chars.length) - throw new NumberFormatException(); - - char sign = '+'; - - switch (chars[index]) { - case '-': - sign = '-'; - index++; - break; - - case '+': - sign = '+'; - index++; - break; - } - - if (index >= chars.length) - throw new NumberFormatException(); - - double value = 0; - - if (chars[index] == '.') { - index++; - value = parseFractionalPart(true); - value = parseExponent(value); - } else { - value = parseUnsignedInt(); - - if (index < chars.length){ - if(chars[index] == '.'){ - index++; - value += parseFractionalPart(false); - } - } - - - value = parseExponent(value); - } - - return (sign == '-') ? -value : value; - } - - public VMDouble(String s) { - chars = s.toCharArray(); - length = chars.length; - index = 0; - } - - /** - * Convert the <code>double</code> to a <code>String</code>. - * Floating-point string representation is fairly complex: here is a rundown - * of the possible values. "<code>[-]</code>" indicates that a negative - * sign will be printed if the value (or exponent) is negative. " - * <code><number></code>" means a string of digits ('0' to '9'). " - * <code><digit></code>" means a single digit ('0' to '9'). <br> - * - * <table border=1> - * <tr> - * <th>Value of Double</th> - * <th>String Representation</th> - * </tr> - * <tr> - * <td>[+-] 0</td> - * <td><code>[-]0.0</code></td> - * </tr> - * <tr> - * <td>Between [+-] 10 <sup>-3 </sup> and 10 <sup>7 </sup>, exclusive</td> - * <td><code>[-]number.number</code></td> - * </tr> - * <tr> - * <td>Other numeric value</td> - * <td><code>[-]<digit>.<number> - * E[-]<number></code> - * </td> - * </tr> - * <tr> - * <td>[+-] infinity</td> - * <td><code>[-]Infinity</code></td> - * </tr> - * <tr> - * <td>NaN</td> - * <td><code>NaN</code></td> - * </tr> - * </table> - * - * Yes, negative zero <em>is</em> a possible value. Note that there is - * <em>always</em> a <code>.</code> and at least one digit printed after - * it: even if the number is 3, it will be printed as <code>3.0</code>. - * After the ".", all digits will be printed except trailing zeros. The - * result is rounded to the shortest decimal number which will parse back to - * the same double. - * - * <p> - * To create other output formats, use {@link java.text.NumberFormat}. - * - * @XXX specify where we are not in accord with the spec. - * - * @param v - * the <code>double</code> to convert - * @return the <code>String</code> representing the <code>double</code> - */ - public static String toString(double v, boolean isFloat) { - - final int MAX_DIGITS = isFloat ? 10 : 19; - - if (Double.isNaN(v)) - return "NaN"; - if (v == Double.POSITIVE_INFINITY) - return "Infinity"; - if (v == Double.NEGATIVE_INFINITY) - return "-Infinity"; - - boolean negative = (doubleToLongBits(v) & (1L << 63)) != 0; - double m = negative ? -v : v; - - if (m == 0.0d) - return negative ? "-0.0" : "0.0"; - - StringBuffer result = new StringBuffer(MAX_DIGITS * 2); - if (negative) { - result.append('-'); - } - - if (m >= 1e-3 && m < 1e7) { - int digits = 0; - long digit = (long) (m - 0.5d); - result.append(digit); - result.append('.'); - m -= digit; - while ((m > 0.0d) && (digits < MAX_DIGITS)) { - m *= 10.0d; - digit = (long) (m - 0.5d); - m -= digit; - result.append(digit); - digits++; - } - if (digits == 0) { - result.append('0'); - } - } else { - int exponent = (int) (Math.log(m) / Math.log(10.0d)); - double mantissa = m / Math.pow(10.0d, exponent); - result.append(toString(mantissa, isFloat)); - result.append('E'); - result.append(Integer.toString(exponent)); - } - - return result.toString(); - } -} Deleted: trunk/core/src/classpath/vm/java/lang/VMFloat.java =================================================================== --- trunk/core/src/classpath/vm/java/lang/VMFloat.java 2009-01-04 14:07:46 UTC (rev 4827) +++ trunk/core/src/classpath/vm/java/lang/VMFloat.java 2009-01-04 16:31:52 UTC (rev 4828) @@ -1,97 +0,0 @@ -/* - * $Id$ - * - * JNode.org - * Copyright (C) 2003-2006 JNode.org - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This library 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 Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; If not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package java.lang; - -import org.jnode.vm.VmMagic; -import org.jnode.vm.annotation.MagicPermission; - -/* - * This class is a reference version, mainly for compiling a class library jar. - * It is likely that VM implementers replace this with their own version that - * can communicate effectively with the VM. - */ - -/** - * Code relocated from java.lang.Float by - * - * @author Dave Grove <gr...@us...> - */ -@MagicPermission -final class VMFloat { - /** - * Convert the float to the IEEE 754 floating-point "single format" bit - * layout. Bit 31 (the most significant) is the sign bit, bits 30-23 (masked - * by 0x7f800000) represent the exponent, and bits 22-0 (masked by - * 0x007fffff) are the mantissa. This function collapses all versions of NaN - * to 0x7fc00000. The result of this function can be used as the argument to - * <code>Float.intBitsToFloat(int)</code> to obtain the original - * <code>float</code> value. - * - * @param value - * the <code>float</code> to convert - * @return the bits of the <code>float</code> - * @see #intBitsToFloat(int) - */ - static int floatToIntBits(float value) { - if (Float.isNaN(value)) { - return 0x7fc00000; - } else { - return VmMagic.floatToRawIntBits(value); - } - } - - /** - * Convert the float to the IEEE 754 floating-point "single format" bit - * layout. Bit 31 (the most significant) is the sign bit, bits 30-23 (masked - * by 0x7f800000) represent the exponent, and bits 22-0 (masked by - * 0x007fffff) are the mantissa. This function leaves NaN alone, rather than - * collapsing to a canonical value. The result of this function can be used - * as the argument to <code>Float.intBitsToFloat(int)</code> to obtain the - * original <code>float</code> value. - * - * @param value - * the <code>float</code> to convert - * @return the bits of the <code>float</code> - * @see #intBitsToFloat(int) - */ - static int floatToRawIntBits(float value) { - return VmMagic.floatToRawIntBits(value); - } - - /** - * Convert the argument in IEEE 754 floating-point "single format" bit - * layout to the corresponding float. Bit 31 (the most significant) is the - * sign bit, bits 30-23 (masked by 0x7f800000) represent the exponent, and - * bits 22-0 (masked by 0x007fffff) are the mantissa. This function leaves - * NaN alone, so that you can recover the bit pattern with - * <code>Float.floatToRawIntBits(float)</code>. - * - * @param bits - * the bits to convert - * @return the <code>float</code> represented by the bits - * @see #floatToIntBits(float) - * @see #floatToRawIntBits(float) - */ - static float intBitsToFloat(int bits) { - return VmMagic.intBitsToFloat(bits); - } -} // class VMFloat Deleted: trunk/core/src/classpath/vm/java/lang/VMMath.java =================================================================== --- trunk/core/src/classpath/vm/java/lang/VMMath.java 2009-01-04 14:07:46 UTC (rev 4827) +++ trunk/core/src/classpath/vm/java/lang/VMMath.java 2009-01-04 16:31:52 UTC (rev 4828) @@ -1,541 +0,0 @@ -/* VMMath.java -- Common mathematical functions. - Copyright (C) 2006 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath 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 for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package java.lang; - -import gnu.classpath.Configuration; - -class VMMath -{ - - static - { - if (Configuration.INIT_LOAD_LIBRARY) - { - System.loadLibrary("javalang"); - } - } - - /** - * The trigonometric function <em>sin</em>. The sine of NaN or infinity is - * NaN, and the sine of 0 retains its sign. This is accurate within 1 ulp, - * and is semi-monotonic. - * - * @param a the angle (in radians) - * @return sin(a) - */ - public static double sin(double a) { - return StrictMath.sin(a); - } - - /** - * The trigonometric function <em>cos</em>. The cosine of NaN or infinity is - * NaN. This is accurate within 1 ulp, and is semi-monotonic. - * - * @param a the angle (in radians) - * @return cos(a) - */ - public static double cos(double a) { - return StrictMath.cos(a); - } - - /** - * The trigonometric function <em>tan</em>. The tangent of NaN or infinity - * is NaN, and the tangent of 0 retains its sign. This is accurate within 1 - * ulp, and is semi-monotonic. - * - * @param a the angle (in radians) - * @return tan(a) - */ - public static double tan(double a) { - return StrictMath.tan(a); - } - - /** - * The trigonometric function <em>arcsin</em>. The range of angles returned - * is -pi/2 to pi/2 radians (-90 to 90 degrees). If the argument is NaN or - * its absolute value is beyond 1, the result is NaN; and the arcsine of - * 0 retains its sign. This is accurate within 1 ulp, and is semi-monotonic. - * - * @param a the sin to turn back into an angle - * @return arcsin(a) - */ - public static double asin(double a) { - return StrictMath.asin(a); - } - - /** - * The trigonometric function <em>arccos</em>. The range of angles returned - * is 0 to pi radians (0 to 180 degrees). If the argument is NaN or - * its absolute value is beyond 1, the result is NaN. This is accurate - * within 1 ulp, and is semi-monotonic. - * - * @param a the cos to turn back into an angle - * @return arccos(a) - */ - public static double acos(double a) { - return StrictMath.acos(a); - } - - /** - * The trigonometric function <em>arcsin</em>. The range of angles returned - * is -pi/2 to pi/2 radians (-90 to 90 degrees). If the argument is NaN, the - * result is NaN; and the arctangent of 0 retains its sign. This is accurate - * within 1 ulp, and is semi-monotonic. - * - * @param a the tan to turn back into an angle - * @return arcsin(a) - * @see #atan2(double, double) - */ - public static double atan(double a) { - return StrictMath.atan(a); - } - - /** - * A special version of the trigonometric function <em>arctan</em>, for - * converting rectangular coordinates <em>(x, y)</em> to polar - * <em>(r, theta)</em>. This computes the arctangent of x/y in the range - * of -pi to pi radians (-180 to 180 degrees). Special cases:<ul> - * <li>If either argument is NaN, the result is NaN.</li> - * <li>If the first argument is positive zero and the second argument is - * positive, or the first argument is positive and finite and the second - * argument is positive infinity, then the result is positive zero.</li> - * <li>If the first argument is negative zero and the second argument is - * positive, or the first argument is negative and finite and the second - * argument is positive infinity, then the result is negative zero.</li> - * <li>If the first argument is positive zero and the second argument is - * negative, or the first argument is positive and finite and the second - * argument is negative infinity, then the result is the double value - * closest to pi.</li> - * <li>If the first argument is negative zero and the second argument is - * negative, or the first argument is negative and finite and the second - * argument is negative infinity, then the result is the double value - * closest to -pi.</li> - * <li>If the first argument is positive and the second argument is - * positive zero or negative zero, or the first argument is positive - * infinity and the second argument is finite, then the result is the - * double value closest to pi/2.</li> - * <li>If the first argument is negative and the second argument is - * positive zero or negative zero, or the first argument is negative - * infinity and the second argument is finite, then the result is the - * double value closest to -pi/2.</li> - * <li>If both arguments are positive infinity, then the result is the - * double value closest to pi/4.</li> - * <li>If the first argument is positive infinity and the second argument - * is negative infinity, then the result is the double value closest to - * 3*pi/4.</li> - * <li>If the first argument is negative infinity and the second argument - * is positive infinity, then the result is the double value closest to - * -pi/4.</li> - * <li>If both arguments are negative infinity, then the result is the - * double value closest to -3*pi/4.</li> - * - * </ul><p>This is accurate within 2 ulps, and is semi-monotonic. To get r, - * use sqrt(x*x+y*y). - * - * @param y the y position - * @param x the x position - * @return <em>theta</em> in the conversion of (x, y) to (r, theta) - * @see #atan(double) - */ - public static double atan2(double y, double x) { - return StrictMath.atan2(y, x); - } - - /** - * Take <em>e</em><sup>a</sup>. The opposite of <code>log()</code>. If the - * argument is NaN, the result is NaN; if the argument is positive infinity, - * the result is positive infinity; and if the argument is negative - * infinity, the result is positive zero. This is accurate within 1 ulp, - * and is semi-monotonic. - * - * @param a the number to raise to the power - * @return the number raised to the power of <em>e</em> - * @see #log(double) - * @see #pow(double, double) - */ - public static double exp(double a) { - return StrictMath.exp(a); - } - - /** - * Take ln(a) (the natural log). The opposite of <code>exp()</code>. If the - * argument is NaN or negative, the result is NaN; if the argument is - * positive infinity, the result is positive infinity; and if the argument - * is either zero, the result is negative infinity. This is accurate within - * 1 ulp, and is semi-monotonic. - * - * <p>Note that the way to get log<sub>b</sub>(a) is to do this: - * <code>ln(a) / ln(b)</code>. - * - * @param a the number to take the natural log of - * @return the natural log of <code>a</code> - * @see #exp(double) - */ - public static double log(double a) { - return StrictMath.log(a); - } - - /** - * Take a square root. If the argument is NaN or negative, the result is - * NaN; if the argument is positive infinity, the result is positive - * infinity; and if the result is either zero, the result is the same. - * This is accurate within the limits of doubles. - * - * <p>For other roots, use pow(a, 1 / rootNumber). - * - * @param a the numeric argument - * @return the square root of the argument - * @see #pow(double, double) - */ - public static double sqrt(double a) { - return StrictMath.sqrt(a); - } - - /** - * Raise a number to a power. Special cases:<ul> - * <li>If the second argument is positive or negative zero, then the result - * is 1.0.</li> - * <li>If the second argument is 1.0, then the result is the same as the - * first argument.</li> - * <li>If the second argument is NaN, then the result is NaN.</li> - * <li>If the first argument is NaN and the second argument is nonzero, - * then the result is NaN.</li> - * <li>If the absolute value of the first argument is greater than 1 and - * the second argument is positive infinity, or the absolute value of the - * first argument is less than 1 and the second argument is negative - * infinity, then the result is positive infinity.</li> - * <li>If the absolute value of the first argument is greater than 1 and - * the second argument is negative infinity, or the absolute value of the - * first argument is less than 1 and the second argument is positive - * infinity, then the result is positive zero.</li> - * <li>If the absolute value of the first argument equals 1 and the second - * argument is infinite, then the result is NaN.</li> - * <li>If the first argument is positive zero and the second argument is - * greater than zero, or the first argument is positive infinity and the - * second argument is less than zero, then the result is positive zero.</li> - * <li>If the first argument is positive zero and the second argument is - * less than zero, or the first argument is positive infinity and the - * second argument is greater than zero, then the result is positive - * infinity.</li> - * <li>If the first argument is negative zero and the second argument is - * greater than zero but not a finite odd integer, or the first argument is - * negative infinity and the second argument is less than zero but not a - * finite odd integer, then the result is positive zero.</li> - * <li>If the first argument is negative zero and the second argument is a - * positive finite odd integer, or the first argument is negative infinity - * and the second argument is a negative finite odd integer, then the result - * is negative zero.</li> - * <li>If the first argument is negative zero and the second argument is - * less than zero but not a finite odd integer, or the first argument is - * negative infinity and the second argument is greater than zero but not a - * finite odd integer, then the result is positive infinity.</li> - * <li>If the first argument is negative zero and the second argument is a - * negative finite odd integer, or the first argument is negative infinity - * and the second argument is a positive finite odd integer, then the result - * is negative infinity.</li> - * <li>If the first argument is less than zero and the second argument is a - * finite even integer, then the result is equal to the result of raising - * the absolute value of the first argument to the power of the second - * argument.</li> - * <li>If the first argument is less than zero and the second argument is a - * finite odd integer, then the result is equal to the negative of the - * result of raising the absolute value of the first argument to the power - * of the second argument.</li> - * <li>If the first argument is finite and less than zero and the second - * argument is finite and not an integer, then the result is NaN.</li> - * <li>If both arguments are integers, then the result is exactly equal to - * the mathematical result of raising the first argument to the power of - * the second argument if that result can in fact be represented exactly as - * a double value.</li> - * - * </ul><p>(In the foregoing descriptions, a floating-point value is - * considered to be an integer if and only if it is a fixed point of the - * method {@link #ceil(double)} or, equivalently, a fixed point of the - * method {@link #floor(double)}. A value is a fixed point of a one-argument - * method if and only if the result of applying the method to the value is - * equal to the value.) This is accurate within 1 ulp, and is semi-monotonic. - * - * @param a the number to raise - * @param b the power to raise it to - * @return a<sup>b</sup> - */ - public static double pow(double a, double b) { - return StrictMath.pow(a, b); - } - - /** - * Get the IEEE 754 floating point remainder on two numbers. This is the - * value of <code>x - y * <em>n</em></code>, where <em>n</em> is the closest - * double to <code>x / y</code> (ties go to the even n); for a zero - * remainder, the sign is that of <code>x</code>. If either argument is NaN, - * the first argument is infinite, or the second argument is zero, the result - * is NaN; if x is finite but y is infinite, the result is x. This is - * accurate within the limits of doubles. - * - * @param x the dividend (the top half) - * @param y the divisor (the bottom half) - * @return the IEEE 754-defined floating point remainder of x/y - * @see #rint(double) - */ - public static double IEEEremainder(double x, double y) { - return StrictMath.IEEEremainder(x, y); - } - - /** - * Take the nearest integer that is that is greater than or equal to the - * argument. If the argument is NaN, infinite, or zero, the result is the - * same; if the argument is between -1 and 0, the result is negative zero. - * Note that <code>Math.ceil(x) == -Math.floor(-x)</code>. - * - * @param a the value to act upon - * @return the nearest integer >= <code>a</code> - */ - public static double ceil(double a) { - return StrictMath.ceil(a); - } - - /** - * Take the nearest integer that is that is less than or equal to the - * argument. If the argument is NaN, infinite, or zero, the result is the - * same. Note that <code>Math.ceil(x) == -Math.floor(-x)</code>. - * - * @param a the value to act upon - * @return the nearest integer <= <code>a</code> - */ - public static double floor(double a) { - return StrictMath.floor(a); - } - - /** - * Take the nearest integer to the argument. If it is exactly between - * two integers, the even integer is taken. If the argument is NaN, - * infinite, or zero, the result is the same. - * - * @param a the value to act upon - * @return the nearest integer to <code>a</code> - */ - public static double rint(double a) { - return StrictMath.rint(a); - } - - /** - * <p> - * Take a cube root. If the argument is NaN, an infinity or zero, then - * the original value is returned. The returned result must be within 1 ulp - * of the exact result. For a finite value, <code>x</code>, the cube root - * of <code>-x</code> is equal to the negation of the cube root - * of <code>x</code>. - * </p> - * <p> - * For a square root, use <code>sqrt</code>. For other roots, use - * <code>pow(a, 1 / rootNumber)</code>. - * </p> - * - * @param a the numeric argument - * @return the cube root of the argument - * @see #sqrt(double) - * @see #pow(double, double) - */ - public static double cbrt(double a) { - return StrictMath.cbrt(a); - } - - /** - * <p> - * Returns the hyperbolic cosine of the given value. For a value, - * <code>x</code>, the hyperbolic cosine is <code>(e<sup>x</sup> + - * e<sup>-x</sup>)/2</code> - * with <code>e</code> being <a href="#E">Euler's number</a>. The returned - * result must be within 2.5 ulps of the exact result. - * </p> - * <p> - * If the supplied value is <code>NaN</code>, then the original value is - * returned. For either infinity, positive infinity is returned. - * The hyperbolic cosine of zero must be 1.0. - * </p> - * - * @param a the numeric argument - * @return the hyperbolic cosine of <code>a</code>. - * @since 1.5 - */ - public static double cosh(double a) { - return StrictMath.cosh(a); - } - - /** - * <p> - * Returns <code>e<sup>a</sup> - 1. For values close to 0, the - * result of <code>expm1(a) + 1</code> tend to be much closer to the - * exact result than simply <code>exp(x)</code>. The result must be within - * 1 ulp of the exact result, and results must be semi-monotonic. For finite - * inputs, the returned value must be greater than or equal to -1.0. Once - * a result enters within half a ulp of this limit, the limit is returned. - * </p> - * <p> - * For <code>NaN</code>, positive infinity and zero, the original value - * is returned. Negative infinity returns a result of -1.0 (the limit). - * </p> - * - * @param a the numeric argument - * @return <code>e<sup>a</sup> - 1</code> - * @since 1.5 - */ - public static double expm1(double a) { - return StrictMath.expm1(a); - } - - /** - * <p> - * Returns the hypotenuse, <code>a<sup>2</sup> + b<sup>2</sup></code>, - * without intermediate overflow or underflow. The returned result must be - * within 1 ulp of the exact result. If one parameter is held constant, - * then the result in the other parameter must be semi-monotonic. - * </p> - * <p> - * If either of the arguments is an infinity, then the returned result - * is positive infinity. Otherwise, if either argument is <code>NaN</code>, - * then <code>NaN</code> is returned. - * </p> - * - * @param a the first parameter. - * @param b the second parameter. - * @return the hypotenuse matching the supplied parameters. - * @since 1.5 - */ - public static double hypot(double a, double b) { - //todo fix it according to the documantation - return a*a + b*b; - } - - /** - * <p> - * Returns the base 10 logarithm of the supplied value. The returned - * result must within 1 ulp of the exact result, and the results must be - * semi-monotonic. - * </p> - * <p> - * Arguments of either <code>NaN</code> or less than zero return - * <code>NaN</code>. An argument of positive infinity returns positive - * infinity. Negative infinity is returned if either positive or negative - * zero is supplied. Where the argument is the result of - * <code>10<sup>n</sup</code>, then <code>n</code> is returned. - * </p> - * - * @param a the numeric argument. - * @return the base 10 logarithm of <code>a</code>. - * @since 1.5 - */ - public static double log10(double a) { - //todo fix it according to the documantation - return log(a)/log(10); - } - - /** - * <p> - * Returns the natural logarithm resulting from the sum of the argument, - * <code>a</code> and 1. For values close to 0, the - * result of <code>log1p(a)</code> tend to be much closer to the - * exact result than simply <code>log(1.0+a)</code>. The returned - * result must be within 1 ulp of the exact result, and the results must be - * semi-monotonic. - * </p> - * <p> - * Arguments of either <code>NaN</code> or less than -1 return - * <code>NaN</code>. An argument of positive infinity or zero - * returns the original argument. Negative infinity is returned from an - * argument of -1. - * </p> - * - * @param a the numeric argument. - * @return the natural logarithm of <code>a</code> + 1. - * @since 1.5 - */ - public static double log1p(double a) { - //todo fix it according to the documantation - return log(a + 1); - } - - /** - * <p> - * Returns the hyperbolic sine of the given value. For a value, - * <code>x</code>, the hyperbolic sine is <code>(e<sup>x</sup> - - * e<sup>-x</sup>)/2</code> - * with <code>e</code> being <a href="#E">Euler's number</a>. The returned - * result must be within 2.5 ulps of the exact result. - * </p> - * <p> - * If the supplied value is <code>NaN</code>, an infinity or a zero, then the - * original value is returned. - * </p> - * - * @param a the numeric argument - * @return the hyperbolic sine of <code>a</code>. - * @since 1.5 - */ - public static double sinh(double a) { - return StrictMath.sinh(a); - } - - /** - * <p> - * Returns the hyperbolic tangent of the given value. For a value, - * <code>x</code>, the hyperbolic tangent is <code>(e<sup>x</sup> - - * e<sup>-x</sup>)/(e<sup>x</sup> + e<sup>-x</sup>)</code> - * (i.e. <code>sinh(a)/cosh(a)</code>) - * with <code>e</code> being <a href="#E">Euler's number</a>. The returned - * result must be within 2.5 ulps of the exact result. The absolute value - * of the exact result is always less than 1. Computed results are thus - * less than or equal to 1 for finite arguments, with results within - * half a ulp of either positive or negative 1 returning the appropriate - * limit value (i.e. as if the argument was an infinity). - * </p> - * <p> - * If the supplied value is <code>NaN</code> or zero, then the original - * value is returned. Positive infinity returns +1.0 and negative infinity - * returns -1.0. - * </p> - * - * @param a the numeric argument - * @return the hyperbolic tangent of <code>a</code>. - * @since 1.5 - */ - public static double tanh(double a) { - return StrictMath.tanh(a); - } -} Deleted: trunk/core/src/classpath/vm/java/lang/VMObject.java =================================================================== --- trunk/core/src/classpath/vm/java/lang/VMObject.java 2009-01-04 14:07:46 UTC (rev 4827) +++ trunk/core/src/classpath/vm/java/lang/VMObject.java 2009-01-04 16:31:52 UTC (rev 4828) @@ -1,106 +0,0 @@ -/* - * $Id$ - * - * JNode.org - * Copyright (C) 2003-2006 JNode.org - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This library 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 Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; If not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package java.lang; - -import org.jnode.vm.VmSystem; -import org.jnode.vm.scheduler.MonitorManager; - -/** - * Object is the ultimate superclass of every class (excepting interfaces). As - * such, it needs help from the VM. - * - * @author John Keiser - * @author Eric Blake <eb...@em...> - */ -final class VMObject { - - /** - * Gets the class of a given object. - * @param o - * @return - */ - public static Class getClass(Object o) { - return VmSystem.getClass(o); - } - - /** - * The VM is expected to make a field-for-field shallow copy of the - * argument. Thus, the copy has the same runtime type as the argument. Note, - * however, that the cloned object must still be finalizable, even if the - * original has already had finalize() invoked on it. - * - * @param c - * the Cloneable to clone - * @return the clone - */ - static Object clone(Cloneable c) { - return VmSystem.clone(c); - } - - /** - * Wakes up one of the threads that is waiting on this Object's monitor. - * Only the owner of a lock on the Object may call this method. The Thread - * to wake up is chosen arbitrarily. - * - * @param o the object doing the notify - * @throw IllegalMonitorStateException if this Thread does not own the - * lock on the Object - */ - static void notify(Object o) throws IllegalMonitorStateException { - MonitorManager.notify(o); - } - - /** - * Wakes up all of the threads waiting on this Object's monitor. Only the - * owner of the lock on this Object may call this method. - * - * @param o - * the object doing the notifyAll - * @throws IllegalMonitorStateException - * if this Thread does not own the lock on the Object - */ - static void notifyAll(Object o) throws IllegalMonitorStateException { - MonitorManager.notifyAll(o); - } - - /** - * Waits a specified amount of time for notify() or notifyAll() to be called - * on this Object. The VM does not have to pay attention to the ns argument, - * if it does not have that much granularity. - * - * @param o - * the object to suspend on - * @param ms - * milliseconds to wait (1,000 milliseconds = 1 second) - * @param ns - * nanoseconds to wait beyond ms (1,000,000 nanoseconds == 1 - * millisecond) - * @throws IllegalMonitorStateException - * if this Thread does not own the lock on the Object - * @throws InterruptedException - * if some other Thread interrupts this Thread - */ - static void wait(Object o, long ms, int ns) - throws IllegalMonitorStateException, InterruptedException { - MonitorManager.wait(o, ms); - } -} Deleted: trunk/core/src/classpath/vm/java/lang/VMString.java =================================================================== --- trunk/core/src/classpath/vm/java/lang/VMString.java 2009-01-04 14:07:46 UTC (rev 4827) +++ trunk/core/src/classpath/vm/java/lang/VMString.java 2009-01-04 16:31:52 UTC (rev 4828) @@ -1,75 +0,0 @@ -/* - * $Id$ - * - * JNode.org - * Copyright (C) 2003-2006 JNode.org - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This library 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 Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; If not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package java.lang; - -import java.lang.ref.WeakReference; -import java.util.WeakHashMap; -import org.jnode.vm.annotation.SharedStatics; - -/* - * This class is a reference version, mainly for compiling a class library jar. - * It is likely that VM implementers replace this with their own version that - * can communicate effectively with the VM. - */ - -/** - * Code relocated from java.lang.String by - * - * @author Dave Grove <gr...@us...> - */ -@SharedStatics -final class VMString { - - /** - * Holds the references for each intern()'d String. If all references to the - * string disappear, and the VM properly supports weak references, the - * String will be GC'd. - */ - private static final WeakHashMap<String, WeakReference<String>> internTable = new WeakHashMap<String, WeakReference<String>>(); - - /** - * Fetches this String from the intern hashtable. If two Strings are - * considered equal, by the equals() method, then intern() will return the - * same String instance. ie. if (s1.equals(s2)) then (s1.intern() == - * s2.intern()). All string literals and string-valued constant expressions - * are already interned. - * - * @param str - * the String to intern - * @return the interned String - */ - static String intern(String str) { - synchronized (internTable) { - final WeakReference<String> ref = internTable.get(str); - if (ref != null) { - final String s = ref.get(); - // If s is null, then no strong references exist to the String; - // the weak hash map will soon delete the key. - if (s != null) { - return s; - } - } - internTable.put(str, new WeakReference<String>(str)); - } - return str; - } -} Deleted: trunk/core/src/classpath/vm/java/lang/VMThrowable.java =================================================================== --- trunk/core/src/classpath/vm/java/lang/VMThrowable.java 2009-01-04 14:07:46 UTC (rev 4827) +++ trunk/core/src/classpath/vm/java/lang/VMThrowable.java 2009-01-04 16:31:52 UTC (rev 4828) @@ -1,100 +0,0 @@ -/* - * $Id$ - * - * JNode.org - * Copyright (C) 2003-2006 JNode.org - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published - * by the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. - * - * This library 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 Lesser General Public - * License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library; If not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package java.lang; - -import org.jnode.vm.VmStackFrame; -import org.jnode.vm.classmgr.VmMethod; -import org.jnode.vm.classmgr.VmType; -import org.jnode.vm.scheduler.VmProcessor; -import org.jnode.vm.scheduler.VmThread; - -/** - * VM dependant state and support methods for Throwable. - * It is deliberately package local and final and should only be accessed - * by the Throwable class. - * <p> - * This is the GNU Classpath reference implementation, it should be adapted - * for a specific VM. The reference implementation does nothing. - * - * @author Mark Wielaard (ma...@kl...) - */ -final class VMThrowable -{ - /** - * VM private data. - */ - private transient Object vmdata; - private Object[] backtrace; - - /** - * Private contructor, create VMThrowables with fillInStackTrace(); - */ - private VMThrowable() { } - - /** - * Fill in the stack trace with the current execution stack. - * Called by <code>Throwable.fillInStackTrace()</code> to get the state of - * the VM. Can return null when the VM does not support caputing the VM - * execution state. - * - * @return a new VMThrowable containing the current execution stack trace. - * @see Throwable#fillInStackTrace() - */ - static VMThrowable fillInStackTrace(Throwable t) - { - VMThrowable vmt = new VMThrowable(); - vmt.backtrace = VmThread.getStackTrace(VmProcessor.current().getCurrentThread()); - return vmt; - - } - - /** - * Returns an <code>StackTraceElement</code> array based on the execution - * state of the VM as captured by <code>fillInStackTrace</code>. - * Called by <code>Throwable.getStackTrace()</code>. - * - * @return a non-null but possible zero length array of StackTraceElement. - * @see Throwable#getStackTrace() - */ - StackTraceElement[] getStackTrace(Throwable t) - { - return backTrace2stackTrace(backtrace); - } - - static StackTraceElement[] backTrace2stackTrace(Object[] backtrace) { - final VmStackFrame[] vm_trace = (VmStackFrame[]) backtrace; - final int length = vm_trace.length; - final StackTraceElement[] trace = new StackTraceElement[length]; - for(int i = length; i-- > 0; ){ - final VmStackFrame frame = vm_trace[i]; - final String location = frame.getLocationInfo(); - final int lineNumber = "?".equals(location) ? -1 : Integer.parseInt(location); - final VmMethod method = frame.getMethod(); - final VmType<?> vmClass = (method == null) ? null : method.getDeclaringClass(); - final String fname = (vmClass == null) ? null : vmClass.getSourceFile(); - final String cname = (vmClass == null) ? "<unknown class>" : vmClass.getName(); - final String mname = (method == null) ? "<unknown method>" : method.getName(); - trace[i] = new StackTraceElement(cname, mname, fname, method == null || method.isNative() ? -2 : lineNumber); - } - return trace; - } -} Deleted: trunk/core/src/classpath/vm/java/lang/reflect/VMArray.java =================================================================== --- trunk/core/src/classpath/vm/java/lang/reflect/VMArray.java 2009-01-04 14:07:46 UTC (rev 4827) +++ trunk/core/src/classpath/vm/java/lang/reflect/VMArray.java 2009-01-04 16:31:52 UTC (rev 4828) @@ -1,91 +0,0 @@ -/* java.lang.reflect.VMArray - VM class for array manipulation by reflection. - Copyright (C) 1998, 1999, 2001, 2003, 2005 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath 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 for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package java.lang.reflect; - -import gnu.classpath.Configuration; -import org.jnode.vm.classmgr.VmType; -import org.jnode.vm.classmgr.VmClassLoader; -import org.jnode.vm.classmgr.VmArrayClass; -import org.jnode.vm.Vm; -import java.security.AccessController; -import java.security.PrivilegedAction; - -class VMArray -{ - - static - { - if (Configuration.INIT_LOAD_LIBRARY) - { - System.loadLibrary("javalangreflect"); - } - } - - /** - * Dynamically create an array of objects. - * - * @param type guaranteed to be a valid object type - * @param dim the length of the array - * @return the new array - * @throws NegativeArraySizeException if dim is negative - * @throws OutOfMemoryError if memory allocation fails - */ - static Object createObjectArray(final Class type, int dim) { - final VmType vmClass = AccessController.doPrivileged( - new PrivilegedAction<VmType>() { - public VmType run() { - return VmType.fromClass(type); - } - }); - - final String arrClsName = vmClass.getArrayClassName(); - final VmType arrCls; - try { - final VmClassLoader curLoader = vmClass.getLoader(); - arrCls = curLoader.loadClass(arrClsName, true); - if (arrCls == null) { - throw new NoClassDefFoundError(arrClsName); - } - } catch (ClassNotFoundException ex) { - throw new NoClassDefFoundError(arrClsName); - } - - return Vm.getHeapManager().newArray((VmArrayClass) arrCls, dim); - } -} Modified: trunk/core/src/mmtk-vm/org/mmtk/vm/Strings.java =================================================================== --- trunk/core/src/mmtk-vm/org/mmtk/vm/Strings.java 2009-01-04 14:07:46 UTC (rev 4827) +++ trunk/core/src/mmtk-vm/org/mmtk/vm/Strings.java 2009-01-04 16:31:52 UTC (rev 4828) @@ -34,7 +34,7 @@ } public static float parseFloat(String value) { - return (float)VMDouble.parseDouble(value); + return (float)Double.parseDouble(value); } /** Modified: trunk/core/src/openjdk/java/java/lang/System.java =================================================================== --- trunk/core/src/openjdk/java/java/lang/System.java 2009-01-04 14:07:46 UTC (rev 4827) +++ trunk/core/src/openjdk/java/java/lang/System.java 2009-01-04 16:31:52 UTC (rev 4828) @@ -27,10 +27,8 @@ import java.io.*; import java.util.Properties; import java.util.PropertyPermission; -import java.util.StringTokenizer; import java.security.AccessController; import java.security.PrivilegedAction; -import java.security.AllPermission; import java.nio.channels.Channel; import java.nio.channels.spi.SelectorProvider; import sun.nio.ch.Interruptible; @@ -39,6 +37,8 @@ import sun.security.util.SecurityConstants; import sun.reflect.annotation.AnnotationType; import gnu.classpath.SystemProperties; +import org.jnode.util.SystemInputStream; +import org.jnode.vm.VmSystem; /** * The <code>System</code> class contains several useful class fields @@ -71,8 +71,9 @@ * corresponds to keyboard input or another input source specified by * the host environment or user. */ - public final static InputStream in = VMSystem.makeStandardInputStream();//jnode nullInputStream(); + public final static InputStream in = SystemInputStream.getInstance();//jnode nullInputStream(); + /** * The "standard" output stream. This stream is already * open and ready to accept output data. Typically this stream @@ -98,8 +99,9 @@ * @see java.io.PrintStream#println(java.lang.Object) * @see java.io.PrintStream#println(java.lang.String) */ - public final static PrintStream out = VMSystem.makeStandardOutputStream();//jnode nullPrintStream(); + public final static PrintStream out = VmSystem.getSy... [truncated message content] |