< prev index next >

test/jdk/java/lang/invoke/VarHandles/generate-vh-tests.sh

Print this page

  1 #!/bin/bash
  2 
  3 javac -d . ../../../../../../make/jdk/src/classes/build/tools/spp/Spp.java
  4 
  5 SPP=build.tools.spp.Spp
  6 
  7 # Generates variable handle tests for objects and all primitive types
  8 # This is likely to be a temporary testing approach as it may be more
  9 # desirable to generate code using ASM which will allow more flexibility
 10 # in the kinds of tests that are generated.
 11 
 12 for type in boolean byte short char int long float double String
 13 do
 14   Type="$(tr '[:lower:]' '[:upper:]' <<< ${type:0:1})${type:1}"
 15   args="-K$type -Dtype=$type -DType=$Type"
 16 
 17   args="$args -KCAS"
 18 
 19   case $type in
 20     byte|short|char|int|long|float|double)
 21       args="$args -KAtomicAdd"
 22       ;;
 23   esac
 24 
 25   case $type in
 26     boolean|byte|short|char|int|long)
 27       args="$args -KBitwise"
 28       ;;
 29   esac
 30 











 31   wrong_primitive_type=boolean
 32 
 33   case $type in
 34     boolean)
 35       value1=true
 36       value2=false
 37       value3=false
 38       wrong_primitive_type=int
 39       ;;
 40     byte)
 41       value1=(byte)0x01
 42       value2=(byte)0x23
 43       value3=(byte)0x45
 44       ;;
 45     short)
 46       value1=(short)0x0123
 47       value2=(short)0x4567
 48       value3=(short)0x89AB
 49       ;;
 50     char)

 60     long)
 61       value1=0x0123456789ABCDEFL
 62       value2=0xCAFEBABECAFEBABEL
 63       value3=0xDEADBEEFDEADBEEFL
 64       ;;
 65     float)
 66       value1=1.0f
 67       value2=2.0f
 68       value3=3.0f
 69       ;;
 70     double)
 71       value1=1.0d
 72       value2=2.0d
 73       value3=3.0d
 74       ;;
 75     String)
 76       value1=\"foo\"
 77       value2=\"bar\"
 78       value3=\"baz\"
 79       ;;





 80   esac
 81 
 82   args="$args -Dvalue1=$value1 -Dvalue2=$value2 -Dvalue3=$value3 -Dwrong_primitive_type=$wrong_primitive_type"
 83 
 84   echo $args
 85   out=VarHandleTestAccess${Type}.java
 86   rm -f $out
 87   java $SPP -nel $args -iX-VarHandleTestAccess.java.template -o$out
 88   out=VarHandleTestMethodHandleAccess${Type}.java
 89   rm -f $out
 90   java $SPP -nel $args -iX-VarHandleTestMethodHandleAccess.java.template -o$out
 91   out=VarHandleTestMethodType${Type}.java
 92   rm -f $out
 93   java $SPP -nel $args -iX-VarHandleTestMethodType.java.template -o$out
 94 done
 95 
 96 for type in short char int long float double
 97 do
 98   Type="$(tr '[:lower:]' '[:upper:]' <<< ${type:0:1})${type:1}"
 99   args="-K$type -Dtype=$type -DType=$Type"

  1 #!/bin/bash
  2 
  3 javac -d . ../../../../../../make/jdk/src/classes/build/tools/spp/Spp.java
  4 
  5 SPP=build.tools.spp.Spp
  6 
  7 # Generates variable handle tests for objects and all primitive types
  8 # This is likely to be a temporary testing approach as it may be more
  9 # desirable to generate code using ASM which will allow more flexibility
 10 # in the kinds of tests that are generated.
 11 
 12 for type in boolean byte short char int long float double String Value
 13 do
 14   Type="$(tr '[:lower:]' '[:upper:]' <<< ${type:0:1})${type:1}"
 15   args="-K$type -Dtype=$type -DType=$Type"
 16 
 17   args="$args -KCAS"
 18 
 19   case $type in
 20     byte|short|char|int|long|float|double)
 21       args="$args -KAtomicAdd"
 22       ;;
 23   esac
 24 
 25   case $type in
 26     boolean|byte|short|char|int|long)
 27       args="$args -KBitwise"
 28       ;;
 29   esac
 30 
 31  # Object = objects of identity or value class
 32  # Value = value class 
 33   case $type in
 34     String)
 35       args="$args -KObject"
 36       ;;
 37     Value)
 38       args="$args -KObject -KValue"
 39       ;;
 40   esac
 41 
 42   wrong_primitive_type=boolean
 43 
 44   case $type in
 45     boolean)
 46       value1=true
 47       value2=false
 48       value3=false
 49       wrong_primitive_type=int
 50       ;;
 51     byte)
 52       value1=(byte)0x01
 53       value2=(byte)0x23
 54       value3=(byte)0x45
 55       ;;
 56     short)
 57       value1=(short)0x0123
 58       value2=(short)0x4567
 59       value3=(short)0x89AB
 60       ;;
 61     char)

 71     long)
 72       value1=0x0123456789ABCDEFL
 73       value2=0xCAFEBABECAFEBABEL
 74       value3=0xDEADBEEFDEADBEEFL
 75       ;;
 76     float)
 77       value1=1.0f
 78       value2=2.0f
 79       value3=3.0f
 80       ;;
 81     double)
 82       value1=1.0d
 83       value2=2.0d
 84       value3=3.0d
 85       ;;
 86     String)
 87       value1=\"foo\"
 88       value2=\"bar\"
 89       value3=\"baz\"
 90       ;;
 91     Value)
 92       value1="Value.getInstance(10)"
 93       value2="Value.getInstance(20)"
 94       value3="Value.getInstance(30)"
 95       ;;
 96   esac
 97 
 98   args="$args -Dvalue1=$value1 -Dvalue2=$value2 -Dvalue3=$value3 -Dwrong_primitive_type=$wrong_primitive_type"
 99 
100   echo $args
101   out=VarHandleTestAccess${Type}.java
102   rm -f $out
103   java $SPP -nel $args -iX-VarHandleTestAccess.java.template -o$out
104   out=VarHandleTestMethodHandleAccess${Type}.java
105   rm -f $out
106   java $SPP -nel $args -iX-VarHandleTestMethodHandleAccess.java.template -o$out
107   out=VarHandleTestMethodType${Type}.java
108   rm -f $out
109   java $SPP -nel $args -iX-VarHandleTestMethodType.java.template -o$out
110 done
111 
112 for type in short char int long float double
113 do
114   Type="$(tr '[:lower:]' '[:upper:]' <<< ${type:0:1})${type:1}"
115   args="-K$type -Dtype=$type -DType=$Type"
< prev index next >