< prev index next >

test/runtime/CompressedOops/ObjectAlignment.java

Print this page




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  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  * @run main ObjectAlignment
  30  */
  31 import com.oracle.java.testlibrary.*;
  32 
  33 public class ObjectAlignment {
  34 
  35     public static void main(String[] args) throws Exception {
  36 
  37         if (Platform.is64bit()) {
  38             // Minimum alignment should be 8
  39             testObjectAlignment(4)
  40                 .shouldContain("error: ObjectAlignmentInBytes=4 must be greater or equal 8")
  41                 .shouldHaveExitValue(1);
  42 
  43             // Alignment has to be a power of 2
  44             testObjectAlignment(9)
  45                 .shouldContain("error: ObjectAlignmentInBytes=9 must be power of 2")
  46                 .shouldHaveExitValue(1);
  47 
  48             testObjectAlignment(-1)




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  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  * @build com.oracle.java.testlibrary.*
  30  * @run main ObjectAlignment
  31  */
  32 import com.oracle.java.testlibrary.*;
  33 
  34 public class ObjectAlignment {
  35 
  36     public static void main(String[] args) throws Exception {
  37 
  38         if (Platform.is64bit()) {
  39             // Minimum alignment should be 8
  40             testObjectAlignment(4)
  41                 .shouldContain("error: ObjectAlignmentInBytes=4 must be greater or equal 8")
  42                 .shouldHaveExitValue(1);
  43 
  44             // Alignment has to be a power of 2
  45             testObjectAlignment(9)
  46                 .shouldContain("error: ObjectAlignmentInBytes=9 must be power of 2")
  47                 .shouldHaveExitValue(1);
  48 
  49             testObjectAlignment(-1)


< prev index next >