From a145a2144ab03c8b7e585d784ef851da8515002f Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Tue, 4 Aug 2020 14:43:11 +0900 Subject: [PATCH] nothrow version(TBD) --- Makefile | 2 +- src/fp_generator.hpp | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index eef4ccc..346be6a 100644 --- a/Makefile +++ b/Makefile @@ -372,7 +372,7 @@ ecdsa-wasm: bin/emu: $(CXX) -g -o $@ src/fp.cpp src/bn_c256.cpp test/bn_c256_test.cpp -DMCL_DONT_USE_XBYAK -DMCL_DONT_USE_OPENSSL -DMCL_USE_VINT -DMCL_SIZEOF_UNIT=8 -DMCL_VINT_64BIT_PORTABLE -DMCL_VINT_FIXED_BUFFER -DMCL_MAX_BIT_SIZE=256 -I./include bin/pairing_c_min.exe: sample/pairing_c.c include/mcl/vint.hpp src/fp.cpp include/mcl/bn.hpp - $(CXX) -std=c++03 -O3 -g -fno-threadsafe-statics -fno-exceptions -fno-rtti -o $@ sample/pairing_c.c src/fp.cpp src/bn_c384_256.cpp -I./include -DMCL_DONT_USE_XBYAK -DMCL_DONT_USE_OPENSSL -DMCL_USE_VINT -DMCL_SIZEOF_UNIT=8 -DMCL_VINT_FIXED_BUFFER -DMCL_MAX_BIT_SIZE=384 -DMCL_VINT_64BIT_PORTABLE -DCYBOZU_DONT_USE_STRING -DCYBOZU_DONT_USE_EXCEPTION -DNDEBUG # -DMCL_DONT_USE_CSPRNG + $(CXX) -std=c++03 -O3 -g -fno-threadsafe-statics -fno-exceptions -fno-rtti -o $@ sample/pairing_c.c src/fp.cpp src/bn_c384_256.cpp -I./include -DXBYAK_NO_EXCEPTION -DMCL_DONT_USE_OPENSSL -DMCL_USE_VINT -DMCL_SIZEOF_UNIT=8 -DMCL_VINT_FIXED_BUFFER -DMCL_MAX_BIT_SIZE=384 -DMCL_VINT_64BIT_PORTABLE -DCYBOZU_DONT_USE_STRING -DCYBOZU_DONT_USE_EXCEPTION -DNDEBUG # -DMCL_DONT_USE_CSPRNG make_tbl: $(MAKE) ../bls/src/qcoeff-bn254.hpp diff --git a/src/fp_generator.hpp b/src/fp_generator.hpp index 2576cab..97ce9ae 100644 --- a/src/fp_generator.hpp +++ b/src/fp_generator.hpp @@ -78,7 +78,7 @@ struct MixPack { } void removeLast() { - if (!size()) throw cybozu::Exception("MixPack:removeLast:empty"); + assert(size()); if (mn > 0) { mn--; } else { @@ -248,6 +248,8 @@ struct FpGenerator : Xbyak::CodeGenerator { reset(); // reset jit code for reuse setProtectModeRW(); // read/write memory init_inner(op); + // ToDo : recover op if false + if (Xbyak::GetError()) return false; // printf("code size=%d\n", (int)getSize()); setProtectModeRE(); // set read/exec memory return true; @@ -1822,9 +1824,7 @@ private: */ void sqr2(const Reg64& y3, const Reg64& y2, const Reg64& y1, const Reg64& y0, const Reg64& x1, const Reg64& x0, const Reg64& t1, const Reg64& t0) { - if (!useMulx_) { - throw cybozu::Exception("sqr2:not support mulx"); - } + assert(useMulx_); mov(rdx, x0); mulx(y1, y0, x0); // x0^2 mov(rdx, x1); @@ -1843,9 +1843,7 @@ private: */ void mul2x2(const RegExp& px, const RegExp& py, const Reg64& t4, const Reg64& t3, const Reg64& t2, const Reg64& t1, const Reg64& t0) { - if (!useMulx_) { - throw cybozu::Exception("mul2x2:not support mulx"); - } + assert(useMulx_); #if 0 // # of add is less, but a little slower mov(t4, ptr [py + 8 * 0]);