changeset 310:a6d41e7168f1

Chapter 1.b: Add VarHandle subword CAS tests.
author shade
date Thu, 21 Jul 2016 15:22:01 +0300
parents f06e9cce30bc
children 92056492425b
files jcstress-core/src/main/java/org/openjdk/jcstress/infra/results/Bool2BooleanResult.java jcstress-core/src/main/java/org/openjdk/jcstress/infra/results/Bool2ByteResult.java jcstress-core/src/main/java/org/openjdk/jcstress/infra/results/Bool2CharResult.java jcstress-core/src/main/java/org/openjdk/jcstress/infra/results/Bool2ShortResult.java jcstress-core/src/main/java/org/openjdk/jcstress/infra/results/BooleanResult3.java jcstress-core/src/main/java/org/openjdk/jcstress/infra/results/CharResult3.java jcstress-core/src/main/java/org/openjdk/jcstress/infra/results/ShortResult3.java jcstress-test-gen/src/main/java/org/openjdk/jcstress/Values.java jcstress-test-gen/src/main/java/org/openjdk/jcstress/chapters/Chapter1bTestGenerator.java tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/large/plain/ByteTest.java tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/large/plain/CharTest.java tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/large/plain/ShortTest.java tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/large/volatiles/ByteTest.java tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/large/volatiles/CharTest.java tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/large/volatiles/ShortTest.java tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/small/plain/ByteTest.java tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/small/plain/CharTest.java tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/small/plain/ShortTest.java tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/small/volatiles/ByteTest.java tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/small/volatiles/CharTest.java tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/small/volatiles/ShortTest.java tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/fields/plain/ByteTest.java tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/fields/plain/CharTest.java tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/fields/plain/ShortTest.java tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/fields/volatiles/ByteTest.java tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/fields/volatiles/CharTest.java tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/fields/volatiles/ShortTest.java
diffstat 27 files changed, 551 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/infra/results/Bool2BooleanResult.java	Thu Jul 21 15:22:01 2016 +0300
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2005, 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 org.openjdk.jcstress.infra.results;
+
+import org.openjdk.jcstress.annotations.Result;
+
+import java.io.Serializable;
+
+@Result
+public class Bool2BooleanResult implements Serializable {
+
+    @sun.misc.Contended
+    @jdk.internal.vm.annotation.Contended
+    public boolean r1;
+
+    @sun.misc.Contended
+    @jdk.internal.vm.annotation.Contended
+    public boolean r2;
+
+    @sun.misc.Contended
+    @jdk.internal.vm.annotation.Contended
+    public boolean r3;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        Bool2BooleanResult that = (Bool2BooleanResult) o;
+
+        if (r1 != that.r1) return false;
+        if (r2 != that.r2) return false;
+        if (r3 != that.r3) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = (r1 ? 1 : 0);
+        result = 31 * result + (r2 ? 1 : 0);
+        result = 31 * result + (r3 ? 1 : 0);
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return r1 + ", " + r2 + ", " + r3;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/infra/results/Bool2ByteResult.java	Thu Jul 21 15:22:01 2016 +0300
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2005, 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 org.openjdk.jcstress.infra.results;
+
+import org.openjdk.jcstress.annotations.Result;
+
+import java.io.Serializable;
+
+@Result
+public class Bool2ByteResult implements Serializable {
+
+    @sun.misc.Contended
+    @jdk.internal.vm.annotation.Contended
+    public boolean r1;
+
+    @sun.misc.Contended
+    @jdk.internal.vm.annotation.Contended
+    public boolean r2;
+
+    @sun.misc.Contended
+    @jdk.internal.vm.annotation.Contended
+    public byte r3;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        Bool2ByteResult that = (Bool2ByteResult) o;
+
+        if (r1 != that.r1) return false;
+        if (r2 != that.r2) return false;
+        if (r3 != that.r3) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = (r1 ? 1 : 0);
+        result = 31 * result + (r2 ? 1 : 0);
+        result = 31 * result + (int) r3;
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return r1 + ", " + r2 + ", " + r3;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/infra/results/Bool2CharResult.java	Thu Jul 21 15:22:01 2016 +0300
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2005, 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 org.openjdk.jcstress.infra.results;
+
+import org.openjdk.jcstress.annotations.Result;
+
+import java.io.Serializable;
+
+@Result
+public class Bool2CharResult implements Serializable {
+
+    @sun.misc.Contended
+    @jdk.internal.vm.annotation.Contended
+    public boolean r1;
+
+    @sun.misc.Contended
+    @jdk.internal.vm.annotation.Contended
+    public boolean r2;
+
+    @sun.misc.Contended
+    @jdk.internal.vm.annotation.Contended
+    public char r3;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        Bool2CharResult that = (Bool2CharResult) o;
+
+        if (r1 != that.r1) return false;
+        if (r2 != that.r2) return false;
+        if (r3 != that.r3) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = (r1 ? 1 : 0);
+        result = 31 * result + (r2 ? 1 : 0);
+        result = 31 * result + (int) r3;
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return r1 + ", " + r2 + ", " + r3;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/infra/results/Bool2ShortResult.java	Thu Jul 21 15:22:01 2016 +0300
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2005, 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 org.openjdk.jcstress.infra.results;
+
+import org.openjdk.jcstress.annotations.Result;
+
+import java.io.Serializable;
+
+@Result
+public class Bool2ShortResult implements Serializable {
+
+    @sun.misc.Contended
+    @jdk.internal.vm.annotation.Contended
+    public boolean r1;
+
+    @sun.misc.Contended
+    @jdk.internal.vm.annotation.Contended
+    public boolean r2;
+
+    @sun.misc.Contended
+    @jdk.internal.vm.annotation.Contended
+    public short r3;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        Bool2ShortResult that = (Bool2ShortResult) o;
+
+        if (r1 != that.r1) return false;
+        if (r2 != that.r2) return false;
+        if (r3 != that.r3) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = (r1 ? 1 : 0);
+        result = 31 * result + (r2 ? 1 : 0);
+        result = 31 * result + (int) r3;
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return r1 + ", " + r2 + ", " + r3;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/infra/results/BooleanResult3.java	Thu Jul 21 15:22:01 2016 +0300
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2005, 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 org.openjdk.jcstress.infra.results;
+
+import org.openjdk.jcstress.annotations.Result;
+
+import java.io.Serializable;
+
+@Result
+public class BooleanResult3 implements Serializable {
+
+    @sun.misc.Contended
+    @jdk.internal.vm.annotation.Contended
+    public boolean r1;
+
+    @sun.misc.Contended
+    @jdk.internal.vm.annotation.Contended
+    public boolean r2;
+
+    @sun.misc.Contended
+    @jdk.internal.vm.annotation.Contended
+    public boolean r3;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        BooleanResult3 that = (BooleanResult3) o;
+
+        if (r1 != that.r1) return false;
+        if (r2 != that.r2) return false;
+        if (r3 != that.r3) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = (r1 ? 1 : 0);
+        result = 31 * result + (r2 ? 1 : 0);
+        result = 31 * result + (r3 ? 1 : 0);
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return r1 + ", " + r2 + ", " + r3;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/infra/results/CharResult3.java	Thu Jul 21 15:22:01 2016 +0300
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2005, 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 org.openjdk.jcstress.infra.results;
+
+import org.openjdk.jcstress.annotations.Result;
+
+import java.io.Serializable;
+
+@Result
+public class CharResult3 implements Serializable {
+
+    @sun.misc.Contended
+    @jdk.internal.vm.annotation.Contended
+    public char r1;
+
+    @sun.misc.Contended
+    @jdk.internal.vm.annotation.Contended
+    public char r2;
+
+    @sun.misc.Contended
+    @jdk.internal.vm.annotation.Contended
+    public char r3;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        CharResult3 that = (CharResult3) o;
+
+        if (r1 != that.r1) return false;
+        if (r2 != that.r2) return false;
+        if (r3 != that.r3) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = (int) r1;
+        result = 31 * result + (int) r2;
+        result = 31 * result + (int) r3;
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return r1 + ", " + r2 + ", " + r3;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jcstress-core/src/main/java/org/openjdk/jcstress/infra/results/ShortResult3.java	Thu Jul 21 15:22:01 2016 +0300
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2005, 2014, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 org.openjdk.jcstress.infra.results;
+
+import org.openjdk.jcstress.annotations.Result;
+
+import java.io.Serializable;
+
+@Result
+public class ShortResult3 implements Serializable {
+
+    @sun.misc.Contended
+    @jdk.internal.vm.annotation.Contended
+    public short r1;
+
+    @sun.misc.Contended
+    @jdk.internal.vm.annotation.Contended
+    public short r2;
+
+    @sun.misc.Contended
+    @jdk.internal.vm.annotation.Contended
+    public short r3;
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (o == null || getClass() != o.getClass()) return false;
+
+        ShortResult3 that = (ShortResult3) o;
+
+        if (r1 != that.r1) return false;
+        if (r2 != that.r2) return false;
+        if (r3 != that.r3) return false;
+
+        return true;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = (int) r1;
+        result = 31 * result + (int) r2;
+        result = 31 * result + (int) r3;
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return r1 + ", " + r2 + ", " + r3;
+    }
+
+}
--- a/jcstress-test-gen/src/main/java/org/openjdk/jcstress/Values.java	Thu Jul 21 00:28:16 2016 +0300
+++ b/jcstress-test-gen/src/main/java/org/openjdk/jcstress/Values.java	Thu Jul 21 15:22:01 2016 +0300
@@ -48,9 +48,9 @@
 
         DEFAULTS_LITERAL = new HashMap<>();
         DEFAULTS_LITERAL.put("boolean", "false");
-        DEFAULTS_LITERAL.put("byte",    "0");
-        DEFAULTS_LITERAL.put("char",    "'\0'");
-        DEFAULTS_LITERAL.put("short",   "0");
+        DEFAULTS_LITERAL.put("byte",    "(byte)0");
+        DEFAULTS_LITERAL.put("char",    "'\\\\\\u0000'");
+        DEFAULTS_LITERAL.put("short",   "(short)0");
         DEFAULTS_LITERAL.put("int",     "0");
         DEFAULTS_LITERAL.put("float",   "0F");
         DEFAULTS_LITERAL.put("long",    "0L");
--- a/jcstress-test-gen/src/main/java/org/openjdk/jcstress/chapters/Chapter1bTestGenerator.java	Thu Jul 21 00:28:16 2016 +0300
+++ b/jcstress-test-gen/src/main/java/org/openjdk/jcstress/chapters/Chapter1bTestGenerator.java	Thu Jul 21 15:22:01 2016 +0300
@@ -243,7 +243,7 @@
                 false,
 
                 // here value2 should equal value0 + value1 + value1, to meet GetAndAdd, AddAndGet tests
-                new String[] { "-2L", "7" },
+                new String[] { "-2L", "7L" },
                 new String[] { "-2", "7" }
         ),
 
@@ -258,29 +258,29 @@
         BOOLEAN("boolean",
                 1,
                 true,
-                new String[] {},
-                new String[] {}
+                new String[] { "true", "true" },
+                new String[] { "true", "true" }
         ),
 
         BYTE("byte",
                 Byte.BYTES,
                 true,
-                new String[] {},
-                new String[] {}
+                new String[] { "(byte)2", "(byte)7" },
+                new String[] { "2", "7" }
         ),
 
         SHORT("short",
                 Short.BYTES,
                 true,
-                new String[] {},
-                new String[] {}
+                new String[] { "(short)2", "(short)7" },
+                new String[] { "2", "7" }
         ),
 
         CHAR("char",
                 Character.BYTES,
                 true,
-                new String[] {},
-                new String[] {}
+                new String[] { "'C'", "'D'" },
+                new String[] { "C", "D" }
         ),
 
         FLOAT("float",
@@ -326,10 +326,6 @@
 
         protected abstract boolean supported(Method method, Type type);
 
-        boolean commonSupported(Method method) {
-            return (method.type == GET_SET);
-        }
-
         static final Source DATA_SOURCE = new Source() {
 
             @Override
@@ -339,15 +335,14 @@
 
             @Override
             protected boolean supported(Method method, Type type) {
-                if (commonSupported(method))
-                    return true;
-
-                if ((type == INT || type == LONG || type == STRING) && method.type == ATOMIC_UPDATE)
-                    return true;
-
-                if ((type == INT || type == LONG) && method.type == NUMERIC_ATOMIC_UPDATE)
-                    return true;
-
+                switch (method.type) {
+                    case GET_SET:
+                        return true;
+                    case ATOMIC_UPDATE:
+                        return true;
+                    case NUMERIC_ATOMIC_UPDATE:
+                        return (type == INT || type == LONG);
+                }
                 return false;
             }
 
@@ -362,16 +357,14 @@
 
             @Override
             protected boolean supported(Method method, Type type) {
-                if (commonSupported(method))
-                    return true;
-
-                if ((type == INT || type == LONG || type == FLOAT || type == DOUBLE)
-                        && method.type == ATOMIC_UPDATE)
-                    return true;
-
-                if ((type == INT || type == LONG) && method.type == NUMERIC_ATOMIC_UPDATE)
-                    return true;
-
+                switch (method.type) {
+                    case GET_SET:
+                        return true;
+                    case ATOMIC_UPDATE:
+                        return (type == INT || type == LONG || type == FLOAT || type == DOUBLE);
+                    case NUMERIC_ATOMIC_UPDATE:
+                        return (type == INT || type == LONG);
+                }
                 return false;
             }
 
--- a/tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/large/plain/ByteTest.java	Thu Jul 21 00:28:16 2016 +0300
+++ b/tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/large/plain/ByteTest.java	Thu Jul 21 15:22:01 2016 +0300
@@ -55,7 +55,7 @@
         } else {
             boolean allDefault = true;
             for (byte v : a) {
-                allDefault &= (v == 0);
+                allDefault &= (v == (byte)0);
             }
             r.r1 = allDefault ? 0 : 1;
         }
Binary file tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/large/plain/CharTest.java has changed
--- a/tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/large/plain/ShortTest.java	Thu Jul 21 00:28:16 2016 +0300
+++ b/tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/large/plain/ShortTest.java	Thu Jul 21 15:22:01 2016 +0300
@@ -55,7 +55,7 @@
         } else {
             boolean allDefault = true;
             for (short v : a) {
-                allDefault &= (v == 0);
+                allDefault &= (v == (short)0);
             }
             r.r1 = allDefault ? 0 : 1;
         }
--- a/tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/large/volatiles/ByteTest.java	Thu Jul 21 00:28:16 2016 +0300
+++ b/tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/large/volatiles/ByteTest.java	Thu Jul 21 15:22:01 2016 +0300
@@ -55,7 +55,7 @@
         } else {
             boolean allDefault = true;
             for (byte v : a) {
-                allDefault &= (v == 0);
+                allDefault &= (v == (byte)0);
             }
             r.r1 = allDefault ? 0 : 1;
         }
Binary file tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/large/volatiles/CharTest.java has changed
--- a/tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/large/volatiles/ShortTest.java	Thu Jul 21 00:28:16 2016 +0300
+++ b/tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/large/volatiles/ShortTest.java	Thu Jul 21 15:22:01 2016 +0300
@@ -55,7 +55,7 @@
         } else {
             boolean allDefault = true;
             for (short v : a) {
-                allDefault &= (v == 0);
+                allDefault &= (v == (short)0);
             }
             r.r1 = allDefault ? 0 : 1;
         }
--- a/tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/small/plain/ByteTest.java	Thu Jul 21 00:28:16 2016 +0300
+++ b/tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/small/plain/ByteTest.java	Thu Jul 21 15:22:01 2016 +0300
@@ -50,7 +50,7 @@
         byte[] a = arr;
         if (a == null) {
             // Pretend we have seen the default values
-            r.r1 = r.r2 = r.r3 = r.r4 = 0;
+            r.r1 = r.r2 = r.r3 = r.r4 = (byte)0;
         } else {
             r.r1 = a[0];
             r.r2 = a[1];
Binary file tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/small/plain/CharTest.java has changed
--- a/tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/small/plain/ShortTest.java	Thu Jul 21 00:28:16 2016 +0300
+++ b/tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/small/plain/ShortTest.java	Thu Jul 21 15:22:01 2016 +0300
@@ -50,7 +50,7 @@
         short[] a = arr;
         if (a == null) {
             // Pretend we have seen the default values
-            r.r1 = r.r2 = r.r3 = r.r4 = 0;
+            r.r1 = r.r2 = r.r3 = r.r4 = (short)0;
         } else {
             r.r1 = a[0];
             r.r2 = a[1];
--- a/tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/small/volatiles/ByteTest.java	Thu Jul 21 00:28:16 2016 +0300
+++ b/tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/small/volatiles/ByteTest.java	Thu Jul 21 15:22:01 2016 +0300
@@ -50,7 +50,7 @@
         byte[] a = arr;
         if (a == null) {
             // Pretend we have seen the default values
-            r.r1 = r.r2 = r.r3 = r.r4 = 0;
+            r.r1 = r.r2 = r.r3 = r.r4 = (byte)0;
         } else {
             r.r1 = a[0];
             r.r2 = a[1];
Binary file tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/small/volatiles/CharTest.java has changed
--- a/tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/small/volatiles/ShortTest.java	Thu Jul 21 00:28:16 2016 +0300
+++ b/tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/arrays/small/volatiles/ShortTest.java	Thu Jul 21 15:22:01 2016 +0300
@@ -50,7 +50,7 @@
         short[] a = arr;
         if (a == null) {
             // Pretend we have seen the default values
-            r.r1 = r.r2 = r.r3 = r.r4 = 0;
+            r.r1 = r.r2 = r.r3 = r.r4 = (short)0;
         } else {
             r.r1 = a[0];
             r.r2 = a[1];
--- a/tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/fields/plain/ByteTest.java	Thu Jul 21 00:28:16 2016 +0300
+++ b/tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/fields/plain/ByteTest.java	Thu Jul 21 15:22:01 2016 +0300
@@ -54,7 +54,7 @@
         Data d = this.data;
         if (d == null) {
             // Pretend we have seen the default values
-            r.r1 = r.r2 = r.r3 = r.r4 = 0;
+            r.r1 = r.r2 = r.r3 = r.r4 = (byte)0;
         } else {
             r.r1 = d.v0;
             r.r2 = d.v1;
Binary file tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/fields/plain/CharTest.java has changed
--- a/tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/fields/plain/ShortTest.java	Thu Jul 21 00:28:16 2016 +0300
+++ b/tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/fields/plain/ShortTest.java	Thu Jul 21 15:22:01 2016 +0300
@@ -54,7 +54,7 @@
         Data d = this.data;
         if (d == null) {
             // Pretend we have seen the default values
-            r.r1 = r.r2 = r.r3 = r.r4 = 0;
+            r.r1 = r.r2 = r.r3 = r.r4 = (short)0;
         } else {
             r.r1 = d.v0;
             r.r2 = d.v1;
--- a/tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/fields/volatiles/ByteTest.java	Thu Jul 21 00:28:16 2016 +0300
+++ b/tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/fields/volatiles/ByteTest.java	Thu Jul 21 15:22:01 2016 +0300
@@ -54,7 +54,7 @@
         Data d = this.data;
         if (d == null) {
             // Pretend we have seen the default values
-            r.r1 = r.r2 = r.r3 = r.r4 = 0;
+            r.r1 = r.r2 = r.r3 = r.r4 = (byte)0;
         } else {
             r.r1 = d.v0;
             r.r2 = d.v1;
Binary file tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/fields/volatiles/CharTest.java has changed
--- a/tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/fields/volatiles/ShortTest.java	Thu Jul 21 00:28:16 2016 +0300
+++ b/tests-chapter-0a/src/main/java/org/openjdk/jcstress/tests/defaultValues/fields/volatiles/ShortTest.java	Thu Jul 21 15:22:01 2016 +0300
@@ -54,7 +54,7 @@
         Data d = this.data;
         if (d == null) {
             // Pretend we have seen the default values
-            r.r1 = r.r2 = r.r3 = r.r4 = 0;
+            r.r1 = r.r2 = r.r3 = r.r4 = (short)0;
         } else {
             r.r1 = d.v0;
             r.r2 = d.v1;