Unreviewed, build fix for MallocBench in Linux 32bit
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 8 Oct 2017 02:55:44 +0000 (02:55 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 8 Oct 2017 02:55:44 +0000 (02:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=177856

* MallocBench/MallocBench/Interpreter.cpp:
(Interpreter::Interpreter):
(Interpreter::readOps):
Suppress warnings in some GCC versions.

* MallocBench/MallocBench/big.cpp:
(benchmark_big):
* MallocBench/MallocBench/medium.cpp:
(benchmark_medium):
Build fix for Linux 32bit.

* MallocBench/MallocBench/message.cpp:
(benchmark_message_many):
Use more efficient WorkQueue allocation.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223026 268f45cc-cd09-0410-ab3c-d52691b4dbfc

PerformanceTests/ChangeLog
PerformanceTests/MallocBench/MallocBench/Interpreter.cpp
PerformanceTests/MallocBench/MallocBench/big.cpp
PerformanceTests/MallocBench/MallocBench/medium.cpp
PerformanceTests/MallocBench/MallocBench/message.cpp

index 29e9e20..3f3c3ce 100644 (file)
@@ -1,3 +1,23 @@
+2017-10-07  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        Unreviewed, build fix for MallocBench in Linux 32bit
+        https://bugs.webkit.org/show_bug.cgi?id=177856
+
+        * MallocBench/MallocBench/Interpreter.cpp:
+        (Interpreter::Interpreter):
+        (Interpreter::readOps):
+        Suppress warnings in some GCC versions.
+
+        * MallocBench/MallocBench/big.cpp:
+        (benchmark_big):
+        * MallocBench/MallocBench/medium.cpp:
+        (benchmark_medium):
+        Build fix for Linux 32bit.
+
+        * MallocBench/MallocBench/message.cpp:
+        (benchmark_message_many):
+        Use more efficient WorkQueue allocation.
+
 2017-10-05  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         Unreviewed, use std::vector instead of variable length array
index 8c6cf3f..585d52f 100644 (file)
@@ -42,6 +42,8 @@
 
 #include "mbmalloc.h"
 
+#define UNUSED_PARAM(variable) (void)variable
+
 Interpreter::Interpreter(const char* fileName, bool shouldFreeAllObjects, bool useThreadId)
     : m_shouldFreeAllObjects(shouldFreeAllObjects)
     , m_useThreadId(useThreadId)
@@ -68,7 +70,8 @@ Interpreter::Interpreter(const char* fileName, bool shouldFreeAllObjects, bool u
     while (remaining) {
         size_t bytes = std::min(remaining, ops.size() * sizeof(Op));
         remaining -= bytes;
-        read(m_fd, ops.data(), bytes);
+        auto ret = read(m_fd, ops.data(), bytes);
+        UNUSED_PARAM(ret);
 
         size_t opCount = bytes / sizeof(Op);
         for (size_t i = 0; i < opCount; ++i) {
@@ -124,7 +127,8 @@ bool Interpreter::readOps()
 
     size_t bytes = std::min(m_remaining, m_ops.size() * sizeof(Op));
     m_remaining -= bytes;
-    read(m_fd, m_ops.data(), bytes);
+    auto ret = read(m_fd, m_ops.data(), bytes);
+    UNUSED_PARAM(ret);
     m_opsCursor = 0;
     m_opsInBuffer = bytes / sizeof(Op);
     
index e1e75ec..3fbf4f6 100644 (file)
@@ -58,7 +58,7 @@ void benchmark_big(CommandLine& commandLine)
         bzero(objects, objectCount * sizeof(Object));
 
         for (size_t i = 0, remaining = vmSize; remaining > objectSizeMin; ++i) {
-            size_t size = min(remaining, max(objectSizeMin, random() % objectSizeMax));
+            size_t size = min<size_t>(remaining, max<size_t>(objectSizeMin, random() % objectSizeMax));
             objects[i] = { (double*)mbmalloc(size), size };
             bzero(objects[i].p, size);
             remaining -= size;
index c6c1f18..2bf0c35 100644 (file)
@@ -58,7 +58,7 @@ void benchmark_medium(CommandLine& commandLine)
         bzero(objects, objectCount * sizeof(Object));
 
         for (size_t i = 0, remaining = vmSize; remaining > objectSizeMin; ++i) {
-            size_t size = min(remaining, max(objectSizeMin, random() % objectSizeMax));
+            size_t size = min<size_t>(remaining, max<size_t>(objectSizeMin, random() % objectSizeMax));
             objects[i] = { (double*)mbmalloc(size), size };
             bzero(objects[i].p, size);
             remaining -= size;
index d6a53e1..ff239b6 100644 (file)
@@ -210,16 +210,12 @@ void benchmark_message_many(CommandLine& commandLine)
     const size_t quantum = 16;
 
     const size_t queueCount = cpuCount() - 1;
-    std::vector<std::unique_ptr<WorkQueue>> queues;
-    queues.reserve(queueCount);
-    for (size_t i = 0; i < queueCount; ++i)
-        queues.emplace_back(std::make_unique<WorkQueue>());
-
+    auto queues = std::make_unique<WorkQueue[]>(queueCount);
     for (size_t i = 0; i < times; i += quantum) {
         for (size_t j = 0; j < quantum; ++j) {
             for (size_t k = 0; k < queueCount; ++k) {
                 Message* message = new Message;
-                queues[k]->dispatchAsync([message] {
+                queues[k].dispatchAsync([message] {
                     size_t hash = message->hash();
                     if (hash)
                         abort();
@@ -229,9 +225,9 @@ void benchmark_message_many(CommandLine& commandLine)
         }
 
         for (size_t i = 0; i < queueCount; ++i)
-            queues[i]->dispatchSync([] { });
+            queues[i].dispatchSync([] { });
     }
 
     for (size_t i = 0; i < queueCount; ++i)
-        queues[i]->dispatchSync([] { });
+        queues[i].dispatchSync([] { });
 }