Top Description Fields Constructors Methods
org.codehaus.groovy.vmplugin.v8

public Class IndyMath

extends Object
Class Inheritance
Imports
groovy.lang.MetaMethod, org.codehaus.groovy.GroovyBugError, java.lang.invoke.MethodHandle, .MethodType, java.math.BigDecimal, java.util.HashMap, .Map

This class contains math operations used by indy instead of the normal meta method and call site caching system. The goal is to avoid boxing, thus use primitive types for parameters and return types where possible.

Warning

This class is for internal use only. Do not use it outside of the org.codehaus.groovy.vmplugin.v7 package of groovy-core.

Field Summary

Modifier and TypeField and Description
private static final MethodType
private static final MethodType
private static final MethodType
private static final MethodType
private static final MethodType
private static final MethodType
private static final MethodType
private static final MethodType
private static final MethodType
private static final MethodType
private static final MethodType
private static final MethodType
private static final MethodType
private static final MethodType
private static final Map<String, Map<MethodType, MethodHandle>>
private static final MethodType

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static int
and(int a, int b)

public static long
and(long a, long b)

public static boolean
chooseMathMethod(Selector info, MetaMethod metaMethod)

Choose a method to replace the originally chosen metaMethod to have a more efficient call path.

public static double
div(double a, double b)

public static int
leftShift(int a, int b)

public static long
leftShift(long a, long b)

private static void
makeMapEntry(String method, MethodType[] keys, MethodType[] values)

public static int
minus(int a, int b)

public static long
minus(long a, long b)

public static double
minus(double a, double b)

public static int
mod(int a, int b)

public static long
mod(long a, long b)

public static int
multiply(int a, int b)

public static long
multiply(long a, long b)

public static double
multiply(double a, double b)

public static int
next(int i)

public static long
next(long l)

public static double
next(double d)

public static int
or(int a, int b)

public static long
or(long a, long b)

public static int
plus(int a, int b)

public static long
plus(long a, long b)

public static double
plus(double a, double b)

public static int
previous(int i)

public static long
previous(long l)

public static double
previous(double d)

public static int
rightShift(int a, int b)

public static long
rightShift(long a, long b)

private static MethodType
widenOperators(MethodType mt)

Widens the operators.

public static int
xor(int a, int b)

public static long
xor(long a, long b)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DDback to summary
private static final MethodType DD
DDDback to summary
private static final MethodType DDD
DDVback to summary
private static final MethodType DDV
DVback to summary
private static final MethodType DV
GGVback to summary
private static final MethodType GGV
GVback to summary
private static final MethodType GV
IIback to summary
private static final MethodType II
IIIback to summary
private static final MethodType III
IIVback to summary
private static final MethodType IIV
IVback to summary
private static final MethodType IV
LLback to summary
private static final MethodType LL
LLLback to summary
private static final MethodType LLL
LLVback to summary
private static final MethodType LLV
LVback to summary
private static final MethodType LV
METHODSback to summary
private static final Map<String, Map<MethodType, MethodHandle>> METHODS
OOVback to summary
private static final MethodType OOV

Constructor Detail

IndyMathback to summary
public IndyMath()

Method Detail

andback to summary
public static int and(int a, int b)
andback to summary
public static long and(long a, long b)
chooseMathMethodback to summary
public static boolean chooseMathMethod(Selector info, MetaMethod metaMethod)

Choose a method to replace the originally chosen metaMethod to have a more efficient call path.

divback to summary
public static double div(double a, double b)
leftShiftback to summary
public static int leftShift(int a, int b)
leftShiftback to summary
public static long leftShift(long a, long b)
makeMapEntryback to summary
private static void makeMapEntry(String method, MethodType[] keys, MethodType[] values) throws NoSuchMethodException, IllegalAccessException
minusback to summary
public static int minus(int a, int b)
minusback to summary
public static long minus(long a, long b)
minusback to summary
public static double minus(double a, double b)
modback to summary
public static int mod(int a, int b)
modback to summary
public static long mod(long a, long b)
multiplyback to summary
public static int multiply(int a, int b)
multiplyback to summary
public static long multiply(long a, long b)
multiplyback to summary
public static double multiply(double a, double b)
nextback to summary
public static int next(int i)
nextback to summary
public static long next(long l)
nextback to summary
public static double next(double d)
orback to summary
public static int or(int a, int b)
orback to summary
public static long or(long a, long b)
plusback to summary
public static int plus(int a, int b)
plusback to summary
public static long plus(long a, long b)
plusback to summary
public static double plus(double a, double b)
previousback to summary
public static int previous(int i)
previousback to summary
public static long previous(long l)
previousback to summary
public static double previous(double d)
rightShiftback to summary
public static int rightShift(int a, int b)
rightShiftback to summary
public static long rightShift(long a, long b)
widenOperatorsback to summary
private static MethodType widenOperators(MethodType mt)

Widens the operators. For math operations like a+b we generally execute them using a conversion to certain types. If a for example is an int and b a byte, we do the operation using integer math. This method gives a simplified MethodType that contains the two operators with this widening according to Groovy rules applied. That means both parameters in the MethodType will have the same type.

xorback to summary
public static int xor(int a, int b)
xorback to summary
public static long xor(long a, long b)