diff gcc/fibonacci_heap.c @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
line wrap: on
line diff
--- a/gcc/fibonacci_heap.c	Thu Oct 25 07:37:49 2018 +0900
+++ b/gcc/fibonacci_heap.c	Thu Feb 13 11:34:05 2020 +0900
@@ -1,5 +1,5 @@
 /* Fibonacci heap for GNU compiler.
-   Copyright (C) 2016-2018 Free Software Foundation, Inc.
+   Copyright (C) 2016-2020 Free Software Foundation, Inc.
    Contributed by Martin Liska <mliska@suse.cz>
 
 This file is part of GCC.
@@ -21,6 +21,7 @@
 #include "config.h"
 #include "system.h"
 #include "coretypes.h"
+#include "alloc-pool.h"
 #include "fibonacci_heap.h"
 #include "selftest.h"
 
@@ -38,13 +39,14 @@
 static void
 test_empty_heap ()
 {
-  int_heap_t *h1 = new int_heap_t (INT_MIN);
+  pool_allocator allocator ("fibheap test", sizeof (int_heap_node_t));
+  int_heap_t *h1 = new int_heap_t (INT_MIN, &allocator);
 
   ASSERT_TRUE (h1->empty ());
   ASSERT_EQ (0, h1->nodes ());
   ASSERT_EQ (NULL, h1->min ());
 
-  int_heap_t *h2 = new int_heap_t (INT_MIN);
+  int_heap_t *h2 = new int_heap_t (INT_MIN, &allocator);
 
   int_heap_t *r = h1->union_with (h2);
   ASSERT_TRUE (r->empty ());
@@ -169,12 +171,13 @@
 test_union ()
 {
   int value = 777;
+  pool_allocator allocator ("fibheap test", sizeof (int_heap_node_t));
 
-  int_heap_t *heap1 = new int_heap_t (INT_MIN);
+  int_heap_t *heap1 = new int_heap_t (INT_MIN, &allocator);
   for (unsigned i = 0; i < 2 * TEST_HEAP_N; i++)
     heap1->insert (i, &value);
 
-  int_heap_t *heap2 = new int_heap_t (INT_MIN);
+  int_heap_t *heap2 = new int_heap_t (INT_MIN, &allocator);
   for (unsigned i = 2 * TEST_HEAP_N; i < 3 * TEST_HEAP_N; i++)
     heap2->insert (i, &value);
 
@@ -196,12 +199,13 @@
 test_union_of_equal_heaps ()
 {
   int value = 777;
+  pool_allocator allocator ("fibheap test", sizeof (int_heap_node_t));
 
-  int_heap_t *heap1 = new int_heap_t (INT_MIN);
+  int_heap_t *heap1 = new int_heap_t (INT_MIN, &allocator);
   for (unsigned i = 0; i < TEST_HEAP_N; i++)
     heap1->insert (i, &value);
 
-  int_heap_t *heap2 = new int_heap_t (INT_MIN);
+  int_heap_t *heap2 = new int_heap_t (INT_MIN, &allocator);
   for (unsigned i = 0; i < TEST_HEAP_N; i++)
     heap2->insert (i, &value);
 
@@ -219,8 +223,9 @@
 
 /* Dummy struct for testing.  */
 
-struct heap_key
+class heap_key
 {
+public:
   heap_key (int k): key (k)
   {
   }