Don't require NASM to build unless using the x64 decoder.

pull/13171/head
Joshua Haberman 14 years ago
parent 6f6a2937bf
commit 26264c25a5
  1. 14
      Makefile
  2. 5
      src/upb_decoder.c

@ -24,12 +24,14 @@
# Default rule: just build libupb. # Default rule: just build libupb.
all: lib all: lib
# User-specified CFLAGS.
USER_CFLAGS=$(strip $(shell test -f perf-cppflags && cat perf-cppflags))
# Basic compiler/flag setup. # Basic compiler/flag setup.
CC=gcc CC=gcc
CXX=g++ CXX=g++
CFLAGS=-std=c99 CFLAGS=-std=c99
INCLUDE=-Isrc -Itests -I. INCLUDE=-Isrc -Itests -I.
USER_CFLAGS=$(strip $(shell test -f perf-cppflags && cat perf-cppflags))
CPPFLAGS=$(INCLUDE) -Wall -Wextra -Wno-missing-field-initializers $(USER_CFLAGS) CPPFLAGS=$(INCLUDE) -Wall -Wextra -Wno-missing-field-initializers $(USER_CFLAGS)
LDLIBS=-lpthread src/libupb.a LDLIBS=-lpthread src/libupb.a
@ -117,8 +119,14 @@ LIBUPB=src/libupb.a
LIBUPB_PIC=src/libupb_pic.a LIBUPB_PIC=src/libupb_pic.a
lib: $(LIBUPB) lib: $(LIBUPB)
OBJ=$(patsubst %.c,%.o,$(SRC)) src/upb_decoder_x64.o
PICOBJ=$(patsubst %.c,%.lo,$(SRC)) src/upb_decoder_x64.lo 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
endif
$(LIBUPB): $(OBJ) $(LIBUPB): $(OBJ)
$(E) AR $(LIBUPB) $(E) AR $(LIBUPB)
$(Q) ar rcs $(LIBUPB) $(OBJ) $(Q) ar rcs $(LIBUPB) $(OBJ)

@ -248,14 +248,13 @@ void upb_decoder_run(upb_src *src, upb_status *status) {
// Decodes as many fields as possible, updating d->ptr appropriately, // Decodes as many fields as possible, updating d->ptr appropriately,
// before falling through to the slow(er) path. // before falling through to the slow(er) path.
#ifdef USE_ASSEMBLY_FASTPATH #ifdef USE_X64_FASTPATH
const char *end = UPB_MIN(d->end, d->submsg_end); const char *end = UPB_MIN(d->end, d->submsg_end);
fastdecode_ret ret = upb_fastdecode(d->ptr, end, fastdecode_ret ret = upb_fastdecode(d->ptr, end,
d->dispatcher.top->handlers.set->value, d->dispatcher.top->handlers.set->value,
d->dispatcher.top->handlers.closure, d->dispatcher.top->handlers.closure,
d->msgdef->itof.array, d->msgdef->itof.array,
d->msgdef->itof.array_size, d->msgdef->itof.array_size);
d->tmp);
CHECK_FLOW(ret.flow); CHECK_FLOW(ret.flow);
#endif #endif

Loading…
Cancel
Save