46 testCompressedOops("-Xmx32m")
47 .shouldContain("Compressed Oops mode")
48 .shouldHaveExitValue(0);
49
50 // Explicly enabling compressed oops
51 testCompressedOops("-XX:+UseCompressedOops", "-Xmx32m")
52 .shouldContain("Compressed Oops mode")
53 .shouldHaveExitValue(0);
54
55 // Skip the following three test cases if we're on OSX or Solaris.
56 //
57 // OSX doesn't seem to care about HeapBaseMinAddress and Solaris
58 // puts the heap way up, forcing different behaviour.
59 if (!Platform.isOSX() && !Platform.isSolaris()) {
60 // Larger than 4gb heap should result in zero based with shift 3
61 testCompressedOops("-XX:+UseCompressedOops", "-Xmx5g")
62 .shouldContain("Zero based")
63 .shouldContain("Oop shift amount: 3")
64 .shouldHaveExitValue(0);
65
66 // Small heap above 4gb should result in zero based with shift 3
67 testCompressedOops("-XX:+UseCompressedOops", "-Xmx32m", "-XX:HeapBaseMinAddress=4g")
68 .shouldContain("Zero based")
69 .shouldContain("Oop shift amount: 3")
70 .shouldHaveExitValue(0);
71
72 // Small heap above 32gb should result in non-zero based with shift 3
73 testCompressedOops("-XX:+UseCompressedOops", "-Xmx32m", "-XX:HeapBaseMinAddress=32g")
74 .shouldContain("Non-zero based")
75 .shouldContain("Oop shift amount: 3")
76 .shouldHaveExitValue(0);
77
78 // 32gb heap with heap base above 64gb and object alignment set to 16 bytes should result
79 // in non-zero based with shift 4
80 testCompressedOops("-XX:+UseCompressedOops", "-Xmx32g", "-XX:ObjectAlignmentInBytes=16",
81 "-XX:HeapBaseMinAddress=64g")
82 .shouldContain("Non-zero based")
83 .shouldContain("Oop shift amount: 4")
84 .shouldHaveExitValue(0);
85
86 // 32gb heap with object alignment set to 16 bytes should result in zero based with shift 4
87 testCompressedOops("-XX:+UseCompressedOops", "-Xmx32g", "-XX:ObjectAlignmentInBytes=16")
88 .shouldContain("Zero based")
89 .shouldContain("Oop shift amount: 4")
90 .shouldHaveExitValue(0);
91 }
92
93 // Explicitly enabling compressed oops with 32gb heap should result a warning
94 testCompressedOops("-XX:+UseCompressedOops", "-Xmx32g")
95 .shouldContain("Max heap size too large for Compressed Oops")
96 .shouldHaveExitValue(0);
97
98 // 32gb heap should not result a warning
99 testCompressedOops("-Xmx32g")
100 .shouldNotContain("Max heap size too large for Compressed Oops")
101 .shouldHaveExitValue(0);
102
|
46 testCompressedOops("-Xmx32m")
47 .shouldContain("Compressed Oops mode")
48 .shouldHaveExitValue(0);
49
50 // Explicly enabling compressed oops
51 testCompressedOops("-XX:+UseCompressedOops", "-Xmx32m")
52 .shouldContain("Compressed Oops mode")
53 .shouldHaveExitValue(0);
54
55 // Skip the following three test cases if we're on OSX or Solaris.
56 //
57 // OSX doesn't seem to care about HeapBaseMinAddress and Solaris
58 // puts the heap way up, forcing different behaviour.
59 if (!Platform.isOSX() && !Platform.isSolaris()) {
60 // Larger than 4gb heap should result in zero based with shift 3
61 testCompressedOops("-XX:+UseCompressedOops", "-Xmx5g")
62 .shouldContain("Zero based")
63 .shouldContain("Oop shift amount: 3")
64 .shouldHaveExitValue(0);
65
66 // Larger than 3gb heap and HeapBaseMinAddress=1g should result in zero based with shift 3
67 testCompressedOops("-XX:+UseCompressedOops", "-Xmx3200m", "-XX:HeapBaseMinAddress=1g")
68 .shouldContain("Zero based")
69 .shouldContain("Oop shift amount: 3")
70 .shouldHaveExitValue(0);
71
72 // Small heap above 4gb should result in zero based with shift 3
73 testCompressedOops("-XX:+UseCompressedOops", "-Xmx32m", "-XX:HeapBaseMinAddress=4g")
74 .shouldContain("Zero based")
75 .shouldContain("Oop shift amount: 3")
76 .shouldHaveExitValue(0);
77
78 // Small heap above 32gb should result in non-zero based with shift 3
79 testCompressedOops("-XX:+UseCompressedOops", "-Xmx32m", "-XX:HeapBaseMinAddress=32g")
80 .shouldContain("Non-zero disjoint base")
81 .shouldContain("Oop shift amount: 3")
82 .shouldHaveExitValue(0);
83
84 // Small heap above 32gb should result in non-zero based with shift 3
85 testCompressedOops("-XX:+UseCompressedOops", "-Xmx32m", "-XX:HeapBaseMinAddress=72704m")
86 .shouldContain("Non-zero based")
87 .shouldContain("Oop shift amount: 3")
88 .shouldHaveExitValue(0);
89
90 // 32gb heap with heap base above 64gb and object alignment set to 16 bytes should result
91 // in non-zero based with shift 4
92 testCompressedOops("-XX:+UseCompressedOops", "-Xmx32g", "-XX:ObjectAlignmentInBytes=16",
93 "-XX:HeapBaseMinAddress=64g")
94 .shouldContain("Non-zero disjoint base")
95 .shouldContain("Oop shift amount: 4")
96 .shouldHaveExitValue(0);
97
98 // 32gb heap with object alignment set to 16 bytes should result in zero based with shift 4
99 testCompressedOops("-XX:+UseCompressedOops", "-Xmx32g", "-XX:ObjectAlignmentInBytes=16")
100 .shouldContain("Zero based")
101 .shouldContain("Oop shift amount: 4")
102 .shouldHaveExitValue(0);
103 }
104
105 // Explicitly enabling compressed oops with 32gb heap should result a warning
106 testCompressedOops("-XX:+UseCompressedOops", "-Xmx32g")
107 .shouldContain("Max heap size too large for Compressed Oops")
108 .shouldHaveExitValue(0);
109
110 // 32gb heap should not result a warning
111 testCompressedOops("-Xmx32g")
112 .shouldNotContain("Max heap size too large for Compressed Oops")
113 .shouldHaveExitValue(0);
114
|