Solving some build issues

This commit is contained in:
Daniel Lemire 2018-12-05 21:33:32 -05:00
parent 4a4bf8d98d
commit c8706c66ec
5 changed files with 10 additions and 8 deletions

View File

@ -7,7 +7,7 @@
.PHONY: clean cleandist .PHONY: clean cleandist
DEPSINCLUDE = -Idependencies/rapidjson/include -Idependencies/sajson/include -Idependencies/json11 -Idependencies/fastjson/src -Idependencies/fastjson/include -Idependencies/gason/src -Idependencies/ujson4c/3rdparty -Idependencies/ujson4c/src DEPSINCLUDE = -Idependencies/rapidjson/include -Idependencies/sajson/include -Idependencies/json11 -Idependencies/fastjson/src -Idependencies/fastjson/include -Idependencies/gason/src -Idependencies/ujson4c/3rdparty -Idependencies/ujson4c/src
CXXFLAGS = -std=c++11 -march=native -Wall -Wextra -Wshadow -Iinclude -Ibenchmark/linux $(DEPSINCLUDE) CXXFLAGS = -std=c++17 -march=native -Wall -Wextra -Wshadow -Iinclude -Ibenchmark/linux $(DEPSINCLUDE)
CFLAGS = -march=native -Idependencies/ujson4c/3rdparty -Idependencies/ujson4c/src CFLAGS = -march=native -Idependencies/ujson4c/3rdparty -Idependencies/ujson4c/src
ifeq ($(SANITIZE),1) ifeq ($(SANITIZE),1)
CXXFLAGS += -g3 -O0 -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined CXXFLAGS += -g3 -O0 -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined

View File

@ -13,6 +13,7 @@
#include <vector> #include <vector>
template <int TYPE = PERF_TYPE_HARDWARE> class LinuxEvents { template <int TYPE = PERF_TYPE_HARDWARE> class LinuxEvents {
int fd; int fd;
perf_event_attr attribs; perf_event_attr attribs;
@ -37,7 +38,7 @@ public:
int group = -1; // no group int group = -1; // no group
num_events = config_vec.size(); num_events = config_vec.size();
u32 i = 0; uint32_t i = 0;
for (auto config : config_vec) { for (auto config : config_vec) {
attribs.config = config; attribs.config = config;
fd = syscall(__NR_perf_event_open, &attribs, pid, cpu, group, flags); fd = syscall(__NR_perf_event_open, &attribs, pid, cpu, group, flags);
@ -55,7 +56,7 @@ public:
~LinuxEvents() { close(fd); } ~LinuxEvents() { close(fd); }
really_inline void start() { inline void start() {
if (ioctl(fd, PERF_EVENT_IOC_RESET, PERF_IOC_FLAG_GROUP) == -1) { if (ioctl(fd, PERF_EVENT_IOC_RESET, PERF_IOC_FLAG_GROUP) == -1) {
report_error("ioctl(PERF_EVENT_IOC_RESET)"); report_error("ioctl(PERF_EVENT_IOC_RESET)");
} }
@ -65,7 +66,7 @@ public:
} }
} }
really_inline void end(std::vector<unsigned long long> &results) { inline void end(std::vector<unsigned long long> &results) {
if (ioctl(fd, PERF_EVENT_IOC_DISABLE, PERF_IOC_FLAG_GROUP) == -1) { if (ioctl(fd, PERF_EVENT_IOC_DISABLE, PERF_IOC_FLAG_GROUP) == -1) {
report_error("ioctl(PERF_EVENT_IOC_DISABLE)"); report_error("ioctl(PERF_EVENT_IOC_DISABLE)");
} }
@ -75,7 +76,7 @@ public:
} }
// our actual results are in slots 1,3,5, ... of this structure // our actual results are in slots 1,3,5, ... of this structure
// we really should be checking our ids obtained earlier to be safe // we really should be checking our ids obtained earlier to be safe
for (u32 i = 1; i < temp_result_vec.size(); i += 2) { for (uint32_t i = 1; i < temp_result_vec.size(); i += 2) {
results[i / 2] = temp_result_vec[i]; results[i / 2] = temp_result_vec[i];
} }
} }

View File

@ -6,7 +6,7 @@
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <string_view>
#include "simdjson/common_defs.h" #include "simdjson/common_defs.h"

View File

@ -251,7 +251,8 @@ public:
really_inline void write_tape_double(double d) { really_inline void write_tape_double(double d) {
write_tape(0, 'd'); write_tape(0, 'd');
static_assert(sizeof(d) == sizeof(tape[current_loc]), "mismatch size"); static_assert(sizeof(d) == sizeof(tape[current_loc]), "mismatch size");
tape[current_loc++] = *((u64 *)&d); memcpy(& tape[current_loc++], &d, sizeof(double));
//tape[current_loc++] = *((u64 *)&d);
} }
really_inline u32 get_current_loc() { return current_loc; } really_inline u32 get_current_loc() { return current_loc; }

View File

@ -230,7 +230,7 @@ inline void foundString(const u8 *buf, const u8 *parsed_begin,
size_t thislen = parsed_end - parsed_begin; size_t thislen = parsed_end - parsed_begin;
total_string_length += thislen; total_string_length += thislen;
good_string++; good_string++;
char *end; char *end = NULL;
char bigbuffer[4096]; // if some strings exceeds 4k, this will fail! char bigbuffer[4096]; // if some strings exceeds 4k, this will fail!
if (!parse_string((const char *)buf, bigbuffer, &end)) { if (!parse_string((const char *)buf, bigbuffer, &end)) {
printf("WARNING: reference parser seems to think that the string is NOT " printf("WARNING: reference parser seems to think that the string is NOT "