8 *
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 #include "precompiled.hpp"
25 #include "memory/allocation.hpp"
26 #include "memory/metachunk.hpp"
27 #include "unittest.hpp"
28 #include "utilities/copy.hpp"
29 #include "utilities/debug.hpp"
30
31 class MetachunkTest {
32 public:
33 static MetaWord* initial_top(Metachunk* metachunk) {
34 return metachunk->initial_top();
35 }
36 static MetaWord* top(Metachunk* metachunk) {
37 return metachunk->top();
38 }
39
40 };
41
42 TEST(Metachunk, basic) {
43 size_t size = 2 * 1024 * 1024;
44 void* memory = malloc(size);
45 ASSERT_TRUE(NULL != memory) << "Failed to malloc 2MB";
46
47 Metachunk* metachunk = ::new (memory) Metachunk(size / BytesPerWord, NULL);
|
8 *
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 #include "precompiled.hpp"
25 #include "memory/allocation.hpp"
26 #include "memory/metachunk.hpp"
27 #include "unittest.hpp"
28 #include "utilities/align.hpp"
29 #include "utilities/copy.hpp"
30 #include "utilities/debug.hpp"
31
32 class MetachunkTest {
33 public:
34 static MetaWord* initial_top(Metachunk* metachunk) {
35 return metachunk->initial_top();
36 }
37 static MetaWord* top(Metachunk* metachunk) {
38 return metachunk->top();
39 }
40
41 };
42
43 TEST(Metachunk, basic) {
44 size_t size = 2 * 1024 * 1024;
45 void* memory = malloc(size);
46 ASSERT_TRUE(NULL != memory) << "Failed to malloc 2MB";
47
48 Metachunk* metachunk = ::new (memory) Metachunk(size / BytesPerWord, NULL);
|