diff options
-rw-r--r-- | benchmarks/math_benchmark.cpp | 28 | ||||
-rw-r--r-- | benchmarks/property_benchmark.cpp | 8 | ||||
-rw-r--r-- | benchmarks/stdio_benchmark.cpp | 2 | ||||
-rw-r--r-- | benchmarks/string_benchmark.cpp | 10 | ||||
-rw-r--r-- | libc/bionic/bionic_arc4random.cpp | 2 | ||||
-rw-r--r-- | libc/malloc_debug/backtrace.cpp | 2 |
6 files changed, 27 insertions, 25 deletions
diff --git a/benchmarks/math_benchmark.cpp b/benchmarks/math_benchmark.cpp index 36ac301c6..a411c9ca1 100644 --- a/benchmarks/math_benchmark.cpp +++ b/benchmarks/math_benchmark.cpp @@ -25,7 +25,7 @@ static const char* names[] = { "1234.0", "nan", "HUGE_VAL", "0.0" }; #define BENCHMARK_COMMON_VALS(name) BENCHMARK(name)->Arg(0)->Arg(1)->Arg(2)->Arg(3) static void SetLabel(benchmark::State& state) { - state.SetLabel(names[state.range_x()]); + state.SetLabel(names[state.range(0)]); } // Avoid optimization. @@ -61,7 +61,7 @@ BENCHMARK(BM_math_logb); static void BM_math_isfinite_macro(benchmark::State& state) { d = 0.0; - v = values[state.range_x()]; + v = values[state.range(0)]; while (state.KeepRunning()) { d += isfinite(v); } @@ -76,7 +76,7 @@ BENCHMARK_COMMON_VALS(BM_math_isfinite_macro); #endif static void BM_math_isfinite(benchmark::State& state) { d = 0.0; - v = values[state.range_x()]; + v = values[state.range(0)]; while (state.KeepRunning()) { d += test_isfinite(v); } @@ -86,7 +86,7 @@ BENCHMARK_COMMON_VALS(BM_math_isfinite); static void BM_math_isinf_macro(benchmark::State& state) { d = 0.0; - v = values[state.range_x()]; + v = values[state.range(0)]; while (state.KeepRunning()) { d += isinf(v); } @@ -96,7 +96,7 @@ BENCHMARK_COMMON_VALS(BM_math_isinf_macro); static void BM_math_isinf(benchmark::State& state) { d = 0.0; - v = values[state.range_x()]; + v = values[state.range(0)]; while (state.KeepRunning()) { d += (isinf)(v); } @@ -106,7 +106,7 @@ BENCHMARK_COMMON_VALS(BM_math_isinf); static void BM_math_isnan_macro(benchmark::State& state) { d = 0.0; - v = values[state.range_x()]; + v = values[state.range(0)]; while (state.KeepRunning()) { d += isnan(v); } @@ -116,7 +116,7 @@ BENCHMARK_COMMON_VALS(BM_math_isnan_macro); static void BM_math_isnan(benchmark::State& state) { d = 0.0; - v = values[state.range_x()]; + v = values[state.range(0)]; while (state.KeepRunning()) { d += (isnan)(v); } @@ -126,7 +126,7 @@ BENCHMARK_COMMON_VALS(BM_math_isnan); static void BM_math_isnormal_macro(benchmark::State& state) { d = 0.0; - v = values[state.range_x()]; + v = values[state.range(0)]; while (state.KeepRunning()) { d += isnormal(v); } @@ -137,7 +137,7 @@ BENCHMARK_COMMON_VALS(BM_math_isnormal_macro); #if defined(__BIONIC__) static void BM_math_isnormal(benchmark::State& state) { d = 0.0; - v = values[state.range_x()]; + v = values[state.range(0)]; while (state.KeepRunning()) { d += (__isnormal)(v); } @@ -180,7 +180,7 @@ BENCHMARK(BM_math_sin_fesetenv); static void BM_math_fpclassify(benchmark::State& state) { d = 0.0; - v = values[state.range_x()]; + v = values[state.range(0)]; while (state.KeepRunning()) { d += fpclassify(v); } @@ -190,7 +190,7 @@ BENCHMARK_COMMON_VALS(BM_math_fpclassify); static void BM_math_signbit_macro(benchmark::State& state) { d = 0.0; - v = values[state.range_x()]; + v = values[state.range(0)]; while (state.KeepRunning()) { d += signbit(v); } @@ -200,7 +200,7 @@ BENCHMARK_COMMON_VALS(BM_math_signbit_macro); static void BM_math_signbit(benchmark::State& state) { d = 0.0; - v = values[state.range_x()]; + v = values[state.range(0)]; while (state.KeepRunning()) { d += (__signbit)(v); } @@ -210,7 +210,7 @@ BENCHMARK_COMMON_VALS(BM_math_signbit); static void BM_math_fabs_macro(benchmark::State& state) { d = 0.0; - v = values[state.range_x()]; + v = values[state.range(0)]; while (state.KeepRunning()) { d += fabs(v); } @@ -220,7 +220,7 @@ BENCHMARK_COMMON_VALS(BM_math_fabs_macro); static void BM_math_fabs(benchmark::State& state) { d = 0.0; - v = values[state.range_x()]; + v = values[state.range(0)]; while (state.KeepRunning()) { d += (fabs)(v); } diff --git a/benchmarks/property_benchmark.cpp b/benchmarks/property_benchmark.cpp index 4e821176b..ef5f225fe 100644 --- a/benchmarks/property_benchmark.cpp +++ b/benchmarks/property_benchmark.cpp @@ -142,7 +142,7 @@ struct LocalPropertyTestState { }; static void BM_property_get(benchmark::State& state) { - const size_t nprops = state.range_x(); + const size_t nprops = state.range(0); LocalPropertyTestState pa(nprops); if (!pa.valid) return; @@ -155,7 +155,7 @@ static void BM_property_get(benchmark::State& state) { BENCHMARK(BM_property_get)->TEST_NUM_PROPS; static void BM_property_find(benchmark::State& state) { - const size_t nprops = state.range_x(); + const size_t nprops = state.range(0); LocalPropertyTestState pa(nprops); if (!pa.valid) return; @@ -167,7 +167,7 @@ static void BM_property_find(benchmark::State& state) { BENCHMARK(BM_property_find)->TEST_NUM_PROPS; static void BM_property_read(benchmark::State& state) { - const size_t nprops = state.range_x(); + const size_t nprops = state.range(0); LocalPropertyTestState pa(nprops); if (!pa.valid) return; @@ -190,7 +190,7 @@ static void BM_property_read(benchmark::State& state) { BENCHMARK(BM_property_read)->TEST_NUM_PROPS; static void BM_property_serial(benchmark::State& state) { - const size_t nprops = state.range_x(); + const size_t nprops = state.range(0); LocalPropertyTestState pa(nprops); if (!pa.valid) return; diff --git a/benchmarks/stdio_benchmark.cpp b/benchmarks/stdio_benchmark.cpp index a556d1723..f49677956 100644 --- a/benchmarks/stdio_benchmark.cpp +++ b/benchmarks/stdio_benchmark.cpp @@ -28,7 +28,7 @@ constexpr auto KB = 1024; template <typename Fn> void ReadWriteTest(benchmark::State& state, Fn f, bool buffered) { - size_t chunk_size = state.range_x(); + size_t chunk_size = state.range(0); FILE* fp = fopen("/dev/zero", "rw"); __fsetlocking(fp, FSETLOCKING_BYCALLER); diff --git a/benchmarks/string_benchmark.cpp b/benchmarks/string_benchmark.cpp index 0a3851265..41306db1c 100644 --- a/benchmarks/string_benchmark.cpp +++ b/benchmarks/string_benchmark.cpp @@ -27,7 +27,7 @@ constexpr auto KB = 1024; // TODO: test unaligned operation too? (currently everything will be 8-byte aligned by malloc.) static void BM_string_memcmp(benchmark::State& state) { - const size_t nbytes = state.range_x(); + const size_t nbytes = state.range(0); char* src = new char[nbytes]; char* dst = new char[nbytes]; memset(src, 'x', nbytes); memset(dst, 'x', nbytes); @@ -44,7 +44,7 @@ static void BM_string_memcmp(benchmark::State& state) { BENCHMARK(BM_string_memcmp)->AT_COMMON_SIZES; static void BM_string_memcpy(benchmark::State& state) { - const size_t nbytes = state.range_x(); + const size_t nbytes = state.range(0); char* src = new char[nbytes]; char* dst = new char[nbytes]; memset(src, 'x', nbytes); @@ -59,7 +59,7 @@ static void BM_string_memcpy(benchmark::State& state) { BENCHMARK(BM_string_memcpy)->AT_COMMON_SIZES; static void BM_string_memmove(benchmark::State& state) { - const size_t nbytes = state.range_x(); + const size_t nbytes = state.range(0); char* buf = new char[nbytes + 64]; memset(buf, 'x', nbytes + 64); @@ -73,7 +73,7 @@ static void BM_string_memmove(benchmark::State& state) { BENCHMARK(BM_string_memmove)->AT_COMMON_SIZES; static void BM_string_memset(benchmark::State& state) { - const size_t nbytes = state.range_x(); + const size_t nbytes = state.range(0); char* dst = new char[nbytes]; while (state.KeepRunning()) { @@ -86,7 +86,7 @@ static void BM_string_memset(benchmark::State& state) { BENCHMARK(BM_string_memset)->AT_COMMON_SIZES; static void BM_string_strlen(benchmark::State& state) { - const size_t nbytes = state.range_x(); + const size_t nbytes = state.range(0); char* s = new char[nbytes]; memset(s, 'x', nbytes); s[nbytes - 1] = 0; diff --git a/libc/bionic/bionic_arc4random.cpp b/libc/bionic/bionic_arc4random.cpp index d20cb6803..429ff7fda 100644 --- a/libc/bionic/bionic_arc4random.cpp +++ b/libc/bionic/bionic_arc4random.cpp @@ -38,7 +38,7 @@ #include "private/libc_logging.h" void __libc_safe_arc4random_buf(void* buf, size_t n, KernelArgumentBlock& args) { - static bool have_getrandom = syscall(SYS_getrandom, nullptr, 0, 0) == -1 && errno != ENOSYS; + static bool have_getrandom = syscall(SYS_getrandom, nullptr, 0, 0) != -1 || errno != ENOSYS; static bool have_urandom = access("/dev/urandom", R_OK) == 0; static size_t at_random_bytes_consumed = 0; diff --git a/libc/malloc_debug/backtrace.cpp b/libc/malloc_debug/backtrace.cpp index 18ce8b8d7..75a255c0e 100644 --- a/libc/malloc_debug/backtrace.cpp +++ b/libc/malloc_debug/backtrace.cpp @@ -142,6 +142,8 @@ std::string backtrace_string(const uintptr_t* frames, size_t frame_count) { if (dladdr(reinterpret_cast<void*>(frames[frame_num]), &info) != 0) { offset = reinterpret_cast<uintptr_t>(info.dli_saddr); symbol = info.dli_sname; + } else { + info.dli_fname = nullptr; } uintptr_t rel_pc = offset; |