< prev index next >

test/runtime/CompressedOops/ObjectAlignment.java

Print this page




  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 8022865
  27  * @summary Tests for the -XX:ObjectAlignmentInBytes command line option
  28  * @library /testlibrary
  29  * @modules java.base/sun.misc
  30  *          java.management
  31  * @run main ObjectAlignment
  32  */
  33 import com.oracle.java.testlibrary.*;
  34 
  35 public class ObjectAlignment {
  36 
  37     public static void main(String[] args) throws Exception {
  38 
  39         if (Platform.is64bit()) {
  40             // Minimum alignment should be 8
  41             testObjectAlignment(4)
  42                 .shouldContain("error: ObjectAlignmentInBytes=4 must be greater or equal 8")
  43                 .shouldHaveExitValue(1);
  44 
  45             // Alignment has to be a power of 2
  46             testObjectAlignment(9)
  47                 .shouldContain("error: ObjectAlignmentInBytes=9 must be power of 2")
  48                 .shouldHaveExitValue(1);
  49 
  50             testObjectAlignment(-1)
  51                 .shouldContain("error: ObjectAlignmentInBytes=-1 must be power of 2")
  52                 .shouldHaveExitValue(1);
  53 




  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 8022865
  27  * @summary Tests for the -XX:ObjectAlignmentInBytes command line option
  28  * @library /testlibrary
  29  * @modules java.base/sun.misc
  30  *          java.management
  31  * @run main ObjectAlignment
  32  */
  33 import jdk.test.lib.*;
  34 
  35 public class ObjectAlignment {
  36 
  37     public static void main(String[] args) throws Exception {
  38 
  39         if (Platform.is64bit()) {
  40             // Minimum alignment should be 8
  41             testObjectAlignment(4)
  42                 .shouldContain("error: ObjectAlignmentInBytes=4 must be greater or equal 8")
  43                 .shouldHaveExitValue(1);
  44 
  45             // Alignment has to be a power of 2
  46             testObjectAlignment(9)
  47                 .shouldContain("error: ObjectAlignmentInBytes=9 must be power of 2")
  48                 .shouldHaveExitValue(1);
  49 
  50             testObjectAlignment(-1)
  51                 .shouldContain("error: ObjectAlignmentInBytes=-1 must be power of 2")
  52                 .shouldHaveExitValue(1);
  53 


< prev index next >