summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2011-04-01 15:40:06 -0700
committerJoshua Haberman <joshua@reverberate.org>2011-04-01 15:40:06 -0700
commit9eb4d695c49a85f7f72ad68c3c31affd61fef984 (patch)
tree79b7fde57e6f31a19405688a5f9e29e3f9cf7ab2 /Makefile
parent19517cc6f39871abf4a0705b49cfed9049ca6033 (diff)
First rough version of the JIT.
It can successfully parse SpeedMessage1. Preliminary results: 750MB/s on Core2 2.4GHz. This number is 2.5x proto2. This isn't apples-to-apples, because proto2 is parsing to a struct and we are just doing stream parsing, but for apps that are currently using proto2, this is the improvement they would see if they could move to stream-based processing. Unfortunately perf-regression-test.py is broken, and I'm not 100% sure why. It would be nice to fix it first (to ensure that there are no performance regressions for the table-based decoder) but I'm really impatient to get the JIT checked in.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile33
1 files changed, 20 insertions, 13 deletions
diff --git a/Makefile b/Makefile
index 41e4c8f..4a2b80d 100644
--- a/Makefile
+++ b/Makefile
@@ -38,7 +38,7 @@ endif
# Basic compiler/flag setup.
CC=gcc
CXX=g++
-CFLAGS=-std=c99
+CFLAGS=-std=gnu99
INCLUDE=-Isrc -Itests -I.
CPPFLAGS=$(INCLUDE) -Wall -Wextra $(USER_CFLAGS)
LDLIBS=-lpthread src/libupb.a
@@ -86,9 +86,6 @@ STREAM= \
src/upb_strstream.c \
src/upb_glue.c \
-ASMCORE= \
- src/upb_decoder_x64.asm
-
# Parts of core that are yet to be converted.
OTHERSRC=src/upb_encoder.c
@@ -115,7 +112,10 @@ ALLSRC=$(CORE) $(STREAM) $(BENCHMARKS_SRC) $(TESTS_SRC)
clean_leave_profile:
rm -rf $(LIBUPB) $(LIBUPB_PIC)
rm -rf $(call rwildcard,,*.o) $(call rwildcard,,*.lo) $(call rwildcard,,*.dSYM)
+ rm -rf src/upb_decoder_x86.h
rm -rf benchmark/google_messages.proto.pb benchmark/google_messages.pb.* benchmarks/b.* benchmarks/*.pb*
+ rm -rf src/jit_debug_elf_file.o
+ rm -rf src/jit_debug_elf_file.h
rm -rf $(TESTS) tests/t.*
rm -rf src/descriptor.pb
rm -rf src/upbc deps
@@ -135,9 +135,11 @@ lib: $(LIBUPB)
OBJ=$(patsubst %.c,%.o,$(SRC))
PICOBJ=$(patsubst %.c,%.lo,$(SRC))
-ifneq (, $(findstring DUSE_X64_FASTPATH, $(USER_CFLAGS)))
- OBJ += src/upb_decoder_x64.o
- PICOBJ += src/upb_decoder_x64.o
+ifneq (, $(findstring DUPB_USE_JIT_X64, $(USER_CFLAGS)))
+src/upb_decoder.o: src/upb_decoder_x86.h
+ ifeq (, $(findstring DNDEBUG, $(USER_CFLAGS)))
+ $(error "JIT only works with -DNDEBUG enabled!")
+ endif
endif
$(LIBUPB): $(OBJ)
$(E) AR $(LIBUPB)
@@ -164,13 +166,18 @@ src/upb_def.lo: src/upb_def.c
$(E) 'CC -fPIC' $<
$(Q) $(CC) $(CFLAGS) $(CPPFLAGS) $(DEF_OPT) -c -o $@ $< -fPIC
-src/upb_decoder_x64.o: src/upb_decoder_x64.asm
- $(E) NASM $<
- $(Q) nasm -Ox src/upb_decoder_x64.asm -o src/upb_decoder_x64.o -f macho64
+src/upb_decoder_x86.h: src/jit_debug_elf_file.h
+src/upb_decoder_x86.h: src/upb_decoder_x86.dasc
+ $(E) DYNASM $<
+ $(Q) lua dynasm/dynasm.lua src/upb_decoder_x86.dasc > src/upb_decoder_x86.h
+
+src/jit_debug_elf_file.o: src/jit_debug_elf_file.s
+ $(E) GAS $<
+ $(Q) gcc -c src/jit_debug_elf_file.s -o src/jit_debug_elf_file.o
-src/upb_decoder_x64.lo: src/upb_decoder_x64.asm
- $(E) NASM $<
- $(Q) nasm -Ox src/upb_decoder_x64.asm -o src/upb_decoder_x64.lo -f macho64
+src/jit_debug_elf_file.h: src/jit_debug_elf_file.o
+ $(E) XXD $<
+ $(Q) xxd -i src/jit_debug_elf_file.o > src/jit_debug_elf_file.h
# Function to expand a wildcard pattern recursively.
rwildcard=$(strip $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2)$(filter $(subst *,%,$2),$d)))
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback