diff --git a/Makefile b/Makefile index 75cca34..dbc2a41 100644 --- a/Makefile +++ b/Makefile @@ -238,8 +238,17 @@ $(GEN_EXE): src/gen.cpp src/llvm_gen.hpp $(CXX) -o $@ $< $(CFLAGS) src/dump_code: src/dump_code.cpp src/fp.cpp src/fp_generator.hpp - $(CXX) -o $@ src/dump_code.cpp src/fp.cpp -I include -DMCL_FREEZE_JIT -DMCL_MAX_BIT_SIZE=384 -DMCL_DONT_USE_OPENSSL -DMCL_USE_VINT -DMCL_SIZEOF_UNIT=8 -DMCL_VINT_FIXED_BUFFER + $(CXX) -o $@ src/dump_code.cpp src/fp.cpp -I include -DMCL_DUMP_JIT -DMCL_MAX_BIT_SIZE=384 -DMCL_DONT_USE_OPENSSL -DMCL_USE_VINT -DMCL_SIZEOF_UNIT=8 -DMCL_VINT_FIXED_BUFFER +src/static_code.asm: src/dump_code + $< > $@ + +obj/static_code.o: src/static_code.asm + nasm -felf64 -o $@ $< + +bin/static_code_test.exe: test/static_code_test.cpp src/fp.cpp obj/static_code.o + $(CXX) -o $@ -O3 $^ -DMCL_STATIC_JIT -DMCL_MAX_BIT_SIZE=384 -DMCL_DONT_USE_OPENSSL -DMCL_USE_VINT -DMCL_SIZEOF_UNIT=8 -DMCL_VINT_FIXED_BUFFER -I include -Wall -Wextra + asm: $(LLVM_SRC) $(LLVM_OPT) -O3 -o - $(LLVM_SRC) | $(LLVM_LLC) -O3 $(LLVM_FLAGS) -x86-asm-syntax=intel @@ -391,7 +400,7 @@ update_cybozulib: cp -a $(addprefix ../cybozulib/,$(wildcard include/cybozu/*.hpp)) include/cybozu/ clean: - $(RM) $(LIB_DIR)/*.a $(LIB_DIR)/*.$(LIB_SUF) $(OBJ_DIR)/*.o $(OBJ_DIR)/*.obj $(OBJ_DIR)/*.d $(EXE_DIR)/*.exe $(GEN_EXE) $(ASM_OBJ) $(LIB_OBJ) $(BN256_OBJ) $(BN384_OBJ) $(BN512_OBJ) $(FUNC_LIST) src/*.ll lib/*.a + $(RM) $(LIB_DIR)/*.a $(LIB_DIR)/*.$(LIB_SUF) $(OBJ_DIR)/*.o $(OBJ_DIR)/*.obj $(OBJ_DIR)/*.d $(EXE_DIR)/*.exe $(GEN_EXE) $(ASM_OBJ) $(LIB_OBJ) $(BN256_OBJ) $(BN384_OBJ) $(BN512_OBJ) $(FUNC_LIST) src/*.ll lib/*.a src/static_code.asm src/dump_code ALL_SRC=$(SRC_SRC) $(TEST_SRC) $(SAMPLE_SRC) DEPEND_FILE=$(addprefix $(OBJ_DIR)/, $(addsuffix .d,$(basename $(ALL_SRC)))) diff --git a/src/fp_generator.hpp b/src/fp_generator.hpp index 5b00fa6..7a3771f 100644 --- a/src/fp_generator.hpp +++ b/src/fp_generator.hpp @@ -23,11 +23,11 @@ #pragma warning(disable : 4458) #endif -//#define MCL_FREEZE_JIT +//#define MCL_DUMP_JIT namespace mcl { -#ifdef MCL_FREEZE_JIT +#ifdef MCL_DUMP_JIT // not profiler, but dump jit code struct Profiler { FILE *fp_; @@ -329,7 +329,7 @@ private: for (size_t i = 0; i < op.N; i++) { dq(op.p[i]); } -#ifdef MCL_FREEZE_JIT +#ifdef MCL_DUMP_JIT prof_.dumpData(p_, getCurr()); prof_.setStartAddr(getCurr()); prof_.setNameSuffix(std::string("mclx_") + suf); diff --git a/test/static_code_test.cpp b/test/static_code_test.cpp new file mode 100644 index 0000000..56d8420 --- /dev/null +++ b/test/static_code_test.cpp @@ -0,0 +1,11 @@ +#include + +using namespace mcl::bn; + +int main() +{ + initPairing(mcl::BLS12_381); + Fr x; + x = 3; + printf("%s\n", x.getStr(16).c_str()); +}