# HG changeset patch # User Doug Simon # Date 1349282362 -7200 # Node ID 55c54c4bdcfca0c82e4ac654e9862836172f76da # Parent 8fd4201ce98c848304a8b6112e34b0ffecf2eb68 moved UnsignedMath to com.oracle.graal.api.code diff -r 8fd4201ce98c -r 55c54c4bdcfc graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/UnsignedMath.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/UnsignedMath.java Wed Oct 03 18:39:22 2012 +0200 @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2011, 2011, Oracle and/or its affiliates. All rights reserved. + * 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. + * + * 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. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.api.code; + +//JaCoCo Exclude + +/** + * Utilities for unsigned comparisons. + * All methods have correct, but slow, standard Java implementations so that + * they can be used with compilers not supporting the intrinsics. + */ +public class UnsignedMath { + private static final long MASK = 0xffffffffL; + + /** + * Unsigned comparison aboveThan for two numbers. + */ + public static boolean aboveThan(int a, int b) { + return (a & MASK) > (b & MASK); + } + + /** + * Unsigned comparison aboveOrEqual for two numbers. + */ + public static boolean aboveOrEqual(int a, int b) { + return (a & MASK) >= (b & MASK); + } + + /** + * Unsigned comparison belowThan for two numbers. + */ + public static boolean belowThan(int a, int b) { + return (a & MASK) < (b & MASK); + } + + /** + * Unsigned comparison belowOrEqual for two numbers. + */ + public static boolean belowOrEqual(int a, int b) { + return (a & MASK) <= (b & MASK); + } + + /** + * Unsigned comparison aboveThan for two numbers. + */ + public static boolean aboveThan(long a, long b) { + return (a > b) ^ ((a < 0) != (b < 0)); + } + + /** + * Unsigned comparison aboveOrEqual for two numbers. + */ + public static boolean aboveOrEqual(long a, long b) { + return (a >= b) ^ ((a < 0) != (b < 0)); + } + + /** + * Unsigned comparison belowThan for two numbers. + */ + public static boolean belowThan(long a, long b) { + return (a < b) ^ ((a < 0) != (b < 0)); + } + + /** + * Unsigned comparison belowOrEqual for two numbers. + */ + public static boolean belowOrEqual(long a, long b) { + return (a <= b) ^ ((a < 0) != (b < 0)); + } +} + diff -r 8fd4201ce98c -r 55c54c4bdcfc graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java Wed Oct 03 18:34:46 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java Wed Oct 03 18:39:22 2012 +0200 @@ -22,12 +22,12 @@ */ package com.oracle.graal.hotspot.snippets; +import static com.oracle.graal.api.code.UnsignedMath.*; import static com.oracle.graal.hotspot.nodes.CastFromHub.*; import static com.oracle.graal.hotspot.snippets.HotSpotSnippetUtils.*; import static com.oracle.graal.snippets.SnippetTemplate.Arguments.*; import static com.oracle.graal.snippets.nodes.DirectObjectStoreNode.*; import static com.oracle.graal.snippets.nodes.ExplodeLoopNode.*; -import static com.oracle.max.criutils.UnsignedMath.*; import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; diff -r 8fd4201ce98c -r 55c54c4bdcfc graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/UnsignedMathSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/UnsignedMathSnippets.java Wed Oct 03 18:34:46 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/UnsignedMathSnippets.java Wed Oct 03 18:39:22 2012 +0200 @@ -25,8 +25,8 @@ import static com.oracle.graal.nodes.MaterializeNode.*; import static com.oracle.graal.nodes.calc.Condition.*; +import com.oracle.graal.api.code.*; import com.oracle.graal.snippets.*; -import com.oracle.max.criutils.*; /** * Snippets for {@link UnsignedMath}. diff -r 8fd4201ce98c -r 55c54c4bdcfc graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/Condition.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/Condition.java Wed Oct 03 18:34:46 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/Condition.java Wed Oct 03 18:39:22 2012 +0200 @@ -25,7 +25,6 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.graph.*; -import com.oracle.max.criutils.*; /** * Condition codes used in conditionals. diff -r 8fd4201ce98c -r 55c54c4bdcfc graal/com.oracle.max.criutils/overview.html --- a/graal/com.oracle.max.criutils/overview.html Wed Oct 03 18:34:46 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ - - - - - - - - -Documentation for the com.oracle.max.criutils project. - - - diff -r 8fd4201ce98c -r 55c54c4bdcfc graal/com.oracle.max.criutils/src/com/oracle/max/criutils/UnsignedMath.java --- a/graal/com.oracle.max.criutils/src/com/oracle/max/criutils/UnsignedMath.java Wed Oct 03 18:34:46 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2011, 2011, Oracle and/or its affiliates. All rights reserved. - * 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. - * - * 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. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.max.criutils; - -//JaCoCo Exclude - -/** - * Utilities for unsigned comparisons. - * All methods have correct, but slow, standard Java implementations so that - * they can be used with compilers not supporting the intrinsics. - */ -public class UnsignedMath { - private static final long MASK = 0xffffffffL; - - /** - * Unsigned comparison aboveThan for two numbers. - */ - public static boolean aboveThan(int a, int b) { - return (a & MASK) > (b & MASK); - } - - /** - * Unsigned comparison aboveOrEqual for two numbers. - */ - public static boolean aboveOrEqual(int a, int b) { - return (a & MASK) >= (b & MASK); - } - - /** - * Unsigned comparison belowThan for two numbers. - */ - public static boolean belowThan(int a, int b) { - return (a & MASK) < (b & MASK); - } - - /** - * Unsigned comparison belowOrEqual for two numbers. - */ - public static boolean belowOrEqual(int a, int b) { - return (a & MASK) <= (b & MASK); - } - - /** - * Unsigned comparison aboveThan for two numbers. - */ - public static boolean aboveThan(long a, long b) { - return (a > b) ^ ((a < 0) != (b < 0)); - } - - /** - * Unsigned comparison aboveOrEqual for two numbers. - */ - public static boolean aboveOrEqual(long a, long b) { - return (a >= b) ^ ((a < 0) != (b < 0)); - } - - /** - * Unsigned comparison belowThan for two numbers. - */ - public static boolean belowThan(long a, long b) { - return (a < b) ^ ((a < 0) != (b < 0)); - } - - /** - * Unsigned comparison belowOrEqual for two numbers. - */ - public static boolean belowOrEqual(long a, long b) { - return (a <= b) ^ ((a < 0) != (b < 0)); - } -} - diff -r 8fd4201ce98c -r 55c54c4bdcfc mx/projects --- a/mx/projects Wed Oct 03 18:34:46 2012 +0200 +++ b/mx/projects Wed Oct 03 18:39:22 2012 +0200 @@ -133,7 +133,7 @@ # graal.nodes project@com.oracle.graal.nodes@subDir=graal project@com.oracle.graal.nodes@sourceDirs=src,test -project@com.oracle.graal.nodes@dependencies=com.oracle.max.criutils,com.oracle.graal.graph +project@com.oracle.graal.nodes@dependencies=com.oracle.graal.api.code,com.oracle.graal.graph project@com.oracle.graal.nodes@checkstyle=com.oracle.graal.graph project@com.oracle.graal.nodes@javaCompliance=1.7 @@ -230,7 +230,7 @@ # graal.asm project@com.oracle.graal.asm@subDir=graal project@com.oracle.graal.asm@sourceDirs=src -project@com.oracle.graal.asm@dependencies=com.oracle.max.criutils +project@com.oracle.graal.asm@dependencies=com.oracle.graal.api.code project@com.oracle.graal.asm@checkstyle=com.oracle.graal.graph project@com.oracle.graal.asm@javaCompliance=1.7 @@ -240,10 +240,3 @@ project@com.oracle.graal.asm.amd64@dependencies=com.oracle.graal.asm project@com.oracle.graal.asm.amd64@checkstyle=com.oracle.graal.graph project@com.oracle.graal.asm.amd64@javaCompliance=1.7 - -# max.criutils -project@com.oracle.max.criutils@subDir=graal -project@com.oracle.max.criutils@sourceDirs=src -project@com.oracle.max.criutils@dependencies=com.oracle.graal.api.code -project@com.oracle.max.criutils@checkstyle=com.oracle.graal.graph -project@com.oracle.max.criutils@javaCompliance=1.7