fix makefile

master v1.1.1
Avril 4 years ago
parent 282d5963d0
commit 8b862a0a21
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -3,7 +3,7 @@ INCLUDE =include
_HX_FEAT?= -DFIXED_ROW_SIZE=24 _HX_FEAT?= -DFIXED_ROW_SIZE=24
CXXFLAGS?= -pipe -O3 -march=native CXXFLAGS?= -pipe -O3 -march=native
CXXFLAGS+= -flto -felide-constructors -fgraphite -fno-strict-aliasing CXXFLAGS+= -flto -felide-constructors -fgraphite -fno-strict-aliasing -fno-exceptions -fomit-frame-pointer -fmerge-all-constants -fmodulo-sched -funswitch-loops -fsplit-loops
CXXFLAGS+= -Wall -pedantic --std=gnu++20 $(addprefix -I,$(INCLUDE)) CXXFLAGS+= -Wall -pedantic --std=gnu++20 $(addprefix -I,$(INCLUDE))
LDFLAGS?= -O3 -flto LDFLAGS?= -O3 -flto
LDFLAGS+= -lfmt LDFLAGS+= -lfmt
@ -25,7 +25,7 @@ PROF_FLAGS = -fprofile-generate
### ###
.PHONY: all .PHONY: all
all: dirs $(PROJ) all: | dirs $(PROJ)
dirs: dirs:
@mkdir -p obj/src @mkdir -p obj/src
@ -44,7 +44,7 @@ $(PROJ): $(OBJ)
pgo-generate: $(PGO_OBJ) pgo-generate: $(PGO_OBJ)
$(CXX) $^ $(CXXFLAGS) $(PROF_FLAGS) -o $@ $(LDFLAGS) $(PROF_FLAGS) $(CXX) $^ $(CXXFLAGS) $(PROF_FLAGS) -o $@ $(LDFLAGS) $(PROF_FLAGS)
pgo-profile: dirs pgo-generate pgo-profile: pgo-generate
for i in {1..$(PGO_ITERATIONS)}; do \ for i in {1..$(PGO_ITERATIONS)}; do \
dd if=/dev/urandom of=./pgo-test bs=1024 count=$(PGO_DATASET_SIZE) >> /dev/null 2>&1; \ dd if=/dev/urandom of=./pgo-test bs=1024 count=$(PGO_DATASET_SIZE) >> /dev/null 2>&1; \
printf "\rIteration $$i / $(PGO_ITERATIONS)"; \ printf "\rIteration $$i / $(PGO_ITERATIONS)"; \
@ -60,7 +60,9 @@ pgo-use: PROF_FLAGS = -fprofile-use -lgcov
pgo-use: $(PGO_OBJ) pgo-use: $(PGO_OBJ)
$(CXX) $^ $(CXXFLAGS) $(PROF_FLAGS) -o $@ $(LDFLAGS) $(PROF_FLAGS) $(CXX) $^ $(CXXFLAGS) $(PROF_FLAGS) -o $@ $(LDFLAGS) $(PROF_FLAGS)
$(PROJ)-pgo: dirs pgo-profile pgo-use $(PROJ)-pgo: | dirs pgo-profile
find ./profile -name \*.o -exec rm {} +
$(MAKE) pgo-use
mv pgo-use $@ mv pgo-use $@
strip $@ strip $@

@ -25,12 +25,12 @@ namespace hv
inline byte& operator[](std::size_t index) inline byte& operator[](std::size_t index)
{ {
if (index>=size) throw "tried to index out of bounds of map"; if (index>=size) std::terminate();
return ((byte*)block0)[index]; return ((byte*)block0)[index];
} }
inline const byte& operator[](std::size_t index) const inline const byte& operator[](std::size_t index) const
{ {
if (index>=size) throw "tried to index out of bounds of map"; if (index>=size) std::terminate();
return ((byte*)block0)[index]; return ((byte*)block0)[index];
} }
@ -64,7 +64,7 @@ namespace hv
inline const byte& operator[](std::size_t index) const inline const byte& operator[](std::size_t index) const
{ {
if (index>=size) throw "tried to index out of bounds of map"; if (index>=size) std::terminate();
return ((byte*)block0)[index]; return ((byte*)block0)[index];
} }

@ -9,12 +9,12 @@ namespace hv
memory_map::memory_map(std::uint64_t size, int&& fd) noexcept memory_map::memory_map(std::uint64_t size, int&& fd) noexcept
: is_cow(false), size(size), fd(fd), block0(mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) : is_cow(false), size(size), fd(fd), block0(mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0))
{ {
if(!block0) throw "memory_map failed"; if(!block0) std::terminate();
} }
memory_map::memory_map(std::uint64_t size, int&& fd, bool _cow) noexcept memory_map::memory_map(std::uint64_t size, int&& fd, bool _cow) noexcept
: is_cow(true), size(size), fd(fd), block0(mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0)) : is_cow(true), size(size), fd(fd), block0(mmap(nullptr, size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0))
{ {
if(!block0) throw "memory_map::cow failed"; if(!block0) std::terminate();
} }
memory_map::memory_map(std::uint64_t size, const char* file) noexcept memory_map::memory_map(std::uint64_t size, const char* file) noexcept
: memory_map(size, open(file, O_RDWR)) {} : memory_map(size, open(file, O_RDWR)) {}

Loading…
Cancel
Save