< prev index next >

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

Print this page
rev 55900 : 8207257: Add VarHandle access test for value type declared in ref type
Reviewed-by: tbd
   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   case $type in
  32     boolean|byte|short|char|int|long|float|double)
  33       args="$args -KValue"
  34       ;;
  35   esac
  36 






  37   wrong_primitive_type=boolean
  38 
  39   case $type in
  40     boolean)
  41       value1=true
  42       value2=false
  43       value3=false
  44       wrong_primitive_type=int
  45       ;;
  46     byte)
  47       value1=(byte)0x01
  48       value2=(byte)0x23
  49       value3=(byte)0x45
  50       ;;
  51     short)
  52       value1=(short)0x0123
  53       value2=(short)0x4567
  54       value3=(short)0x89AB
  55       ;;
  56     char)


  65       ;;
  66     long)
  67       value1=0x0123456789ABCDEFL
  68       value2=0xCAFEBABECAFEBABEL
  69       value3=0xDEADBEEFDEADBEEFL
  70       ;;
  71     float)
  72       value1=1.0f
  73       value2=2.0f
  74       value3=3.0f
  75       ;;
  76     double)
  77       value1=1.0d
  78       value2=2.0d
  79       value3=3.0d
  80       ;;
  81     String)
  82       value1=\"foo\"
  83       value2=\"bar\"
  84       value3=\"baz\"





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


   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 Point
  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   case $type in
  32     boolean|byte|short|char|int|long|float|double|Point)
  33       args="$args -KValue"
  34       ;;
  35   esac
  36 
  37   case $type in
  38     String|Point)
  39       args="$args -KClass"
  40       ;;
  41   esac
  42 
  43   wrong_primitive_type=boolean
  44 
  45   case $type in
  46     boolean)
  47       value1=true
  48       value2=false
  49       value3=false
  50       wrong_primitive_type=int
  51       ;;
  52     byte)
  53       value1=(byte)0x01
  54       value2=(byte)0x23
  55       value3=(byte)0x45
  56       ;;
  57     short)
  58       value1=(short)0x0123
  59       value2=(short)0x4567
  60       value3=(short)0x89AB
  61       ;;
  62     char)


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


< prev index next >