1 #!/bin/bash
2
3 #
4 # Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 #
7 # This code is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License version 2 only, as
9 # published by the Free Software Foundation.
10 #
11 # This code is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # version 2 for more details (a copy is included in the LICENSE file that
15 # accompanied this code).
16 #
17 # You should have received a copy of the GNU General Public License version
18 # 2 along with this work; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 # or visit www.oracle.com if you need additional information or have any
23 # questions.
24 #
25
26 javac -d . ../../../../jdk/make/src/classes/build/tools/spp/Spp.java
27
28 SPP=build.tools.spp.Spp
29
30 # Generates unsafe access tests for objects and all primitive types
31 # $1 = package name to Unsafe, sun.misc | jdk.internal.misc
32 # $2 = test class qualifier name, SunMisc | JdkInternalMisc
33 # $3 = module name containing the Unsafe class, for @modules
34 function generate {
35 package=$1
36 Qualifier=$2
37 module=$3
38
39 for type in boolean byte short char int long float double Object
40 do
41 Type="$(tr '[:lower:]' '[:upper:]' <<< ${type:0:1})${type:1}"
42 args="-K$type -Dtype=$type -DType=$Type"
43
44 case $type in
45 Object|int|long)
46 args="$args -KCAS -KOrdered"
47 ;;
48 esac
49
50 case $type in
51 int|long)
52 args="$args -KAtomicAdd"
53 ;;
54 esac
55
56 if [ "$package" == "jdk.internal.misc" ]; then
57 case $type in
58 boolean|byte|char|short|float|double)
59 args="$args -KCAS"
60 ;;
61 esac
62 case $type in
63 byte|char|short|float|double)
106 float)
107 value1=1.0f
108 value2=2.0f
109 value3=3.0f
110 ;;
111 double)
112 value1=1.0d
113 value2=2.0d
114 value3=3.0d
115 ;;
116 Object)
117 value1=\"foo\"
118 value2=\"bar\"
119 value3=\"baz\"
120 ;;
121 esac
122
123 args="$args -Dvalue1=$value1 -Dvalue2=$value2 -Dvalue3=$value3"
124
125 echo $args
126 java $SPP -nel -K$Qualifier -Dpackage=$package -DQualifier=$Qualifier -Dmodule=$module \
127 $args < X-UnsafeAccessTest.java.template > ${Qualifier}UnsafeAccessTest${Type}.java
128 done
129 }
130
131 generate sun.misc SunMisc jdk.unsupported
132 generate jdk.internal.misc JdkInternalMisc java.base
133
134 rm -fr build
|
1 #!/bin/bash
2
3 #
4 # Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved.
5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 #
7 # This code is free software; you can redistribute it and/or modify it
8 # under the terms of the GNU General Public License version 2 only, as
9 # published by the Free Software Foundation.
10 #
11 # This code is distributed in the hope that it will be useful, but WITHOUT
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 # version 2 for more details (a copy is included in the LICENSE file that
15 # accompanied this code).
16 #
17 # You should have received a copy of the GNU General Public License version
18 # 2 along with this work; if not, write to the Free Software Foundation,
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 #
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 # or visit www.oracle.com if you need additional information or have any
23 # questions.
24 #
25
26 javac -d . ../../../../../make/jdk/src/classes/build/tools/spp/Spp.java
27
28 SPP=build.tools.spp.Spp
29
30 # Generates unsafe access tests for objects and all primitive types
31 # $1 = package name to Unsafe, sun.misc | jdk.internal.misc
32 # $2 = test class qualifier name, SunMisc | JdkInternalMisc
33 # $3 = module name containing the Unsafe class, for @modules
34 function generate {
35 package=$1
36 Qualifier=$2
37 module=$3
38
39 for type in boolean byte short char int long float double Object
40 do
41 Type="$(tr '[:lower:]' '[:upper:]' <<< ${type:0:1})${type:1}"
42 args="-K$type -Dtype=$type -DType=$Type"
43
44 if [ "$Type" == "Object" -a "$package" == "jdk.internal.misc" ]; then
45 args="$args -DMethodAffix=Reference"
46 else
47 args="$args -DMethodAffix=$Type"
48 fi
49
50 case $type in
51 Object|int|long)
52 args="$args -KCAS -KOrdered"
53 ;;
54 esac
55
56 case $type in
57 int|long)
58 args="$args -KAtomicAdd"
59 ;;
60 esac
61
62 if [ "$package" == "jdk.internal.misc" ]; then
63 case $type in
64 boolean|byte|char|short|float|double)
65 args="$args -KCAS"
66 ;;
67 esac
68 case $type in
69 byte|char|short|float|double)
112 float)
113 value1=1.0f
114 value2=2.0f
115 value3=3.0f
116 ;;
117 double)
118 value1=1.0d
119 value2=2.0d
120 value3=3.0d
121 ;;
122 Object)
123 value1=\"foo\"
124 value2=\"bar\"
125 value3=\"baz\"
126 ;;
127 esac
128
129 args="$args -Dvalue1=$value1 -Dvalue2=$value2 -Dvalue3=$value3"
130
131 echo $args
132 out=${Qualifier}UnsafeAccessTest${Type}.java
133 rm -rf "$out"
134 java $SPP -nel -K$Qualifier -Dpackage=$package -DQualifier=$Qualifier -Dmodule=$module \
135 $args -iX-UnsafeAccessTest.java.template -o$out
136 done
137 }
138
139 generate sun.misc SunMisc jdk.unsupported
140 generate jdk.internal.misc JdkInternalMisc java.base
141
142 rm -fr build
|