netlist: emscripten can not use specialization efficiently.

* Consequently prefer to save on compile time and size.
This commit is contained in:
couriersud 2020-09-17 19:45:24 +02:00
parent e62e2d759b
commit ec742d3eda
3 changed files with 14 additions and 0 deletions

View File

@ -1,5 +1,7 @@
#include "plib/pdynlib.h" #include "plib/pdynlib.h"
#if !defined(__EMSCRIPTEN__)
// elim // elim
static void nl_gcr_11c2ae166b240b6e_10_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV) static void nl_gcr_11c2ae166b240b6e_10_double_double(double * __restrict V, const double * __restrict go, const double * __restrict gt, const double * __restrict Idr, const double * const * __restrict cnV)
@ -72411,8 +72413,12 @@ static void nl_gcr_feae15b80dd73620_7_double_double(double * __restrict V, const
V[0] = (RHS0 - tmp0) / m_A0; V[0] = (RHS0 - tmp0) / m_A0;
} }
#endif
extern const plib::dynlib_static_sym nl_static_solver_syms[]; extern const plib::dynlib_static_sym nl_static_solver_syms[];
const plib::dynlib_static_sym nl_static_solver_syms[] = { const plib::dynlib_static_sym nl_static_solver_syms[] = {
#if !defined(__EMSCRIPTEN__)
// elim // elim
{"nl_gcr_11c2ae166b240b6e_10_double_double", reinterpret_cast<void *>(&nl_gcr_11c2ae166b240b6e_10_double_double)}, {"nl_gcr_11c2ae166b240b6e_10_double_double", reinterpret_cast<void *>(&nl_gcr_11c2ae166b240b6e_10_double_double)},
// tankbatt // tankbatt
@ -72809,5 +72815,7 @@ const plib::dynlib_static_sym nl_static_solver_syms[] = {
{"nl_gcr_fd2796828f1ebd00_36_double_double", reinterpret_cast<void *>(&nl_gcr_fd2796828f1ebd00_36_double_double)}, {"nl_gcr_fd2796828f1ebd00_36_double_double", reinterpret_cast<void *>(&nl_gcr_fd2796828f1ebd00_36_double_double)},
// starfire // starfire
{"nl_gcr_feae15b80dd73620_7_double_double", reinterpret_cast<void *>(&nl_gcr_feae15b80dd73620_7_double_double)}, {"nl_gcr_feae15b80dd73620_7_double_double", reinterpret_cast<void *>(&nl_gcr_feae15b80dd73620_7_double_double)},
#endif
{"", nullptr} {"", nullptr}
}; };

View File

@ -694,18 +694,22 @@ void tool_app_t::static_compile()
throw netlist::nl_exception(netlist::MF_FILE_OPEN_ERROR(opt_out())); throw netlist::nl_exception(netlist::MF_FILE_OPEN_ERROR(opt_out()));
sout << "#include \"plib/pdynlib.h\"\n\n"; sout << "#include \"plib/pdynlib.h\"\n\n";
sout << "#if !defined(__EMSCRIPTEN__)\n\n";
for (auto &e : map) for (auto &e : map)
{ {
sout << "// " << putf8string(e.second.m_module) << "\n"; sout << "// " << putf8string(e.second.m_module) << "\n";
sout << putf8string(e.second.m_code); sout << putf8string(e.second.m_code);
} }
sout << "#endif\n\n";
sout << "extern const plib::dynlib_static_sym nl_static_solver_syms[];\n"; sout << "extern const plib::dynlib_static_sym nl_static_solver_syms[];\n";
sout << "const plib::dynlib_static_sym nl_static_solver_syms[] = {\n"; sout << "const plib::dynlib_static_sym nl_static_solver_syms[] = {\n";
sout << "#if !defined(__EMSCRIPTEN__)\n\n";
for (auto &e : map) for (auto &e : map)
{ {
sout << "// " << putf8string(e.second.m_module) << "\n"; sout << "// " << putf8string(e.second.m_module) << "\n";
sout << "\t{\"" << putf8string(e.first) << "\", reinterpret_cast<void *>(&" << putf8string(e.first) << ")},\n"; sout << "\t{\"" << putf8string(e.first) << "\", reinterpret_cast<void *>(&" << putf8string(e.first) << ")},\n";
} }
sout << "#endif\n\n";
sout << "{\"\", nullptr}\n"; sout << "{\"\", nullptr}\n";
sout << "};\n"; sout << "};\n";

View File

@ -227,6 +227,7 @@ namespace devices
std::size_t net_count = nets.size(); std::size_t net_count = nets.size();
switch (net_count) switch (net_count)
{ {
#if !defined(__EMSCRIPTEN__)
case 1: case 1:
return plib::make_unique<solver::matrix_solver_direct1_t<FT>, device_arena>(*this, sname, nets, params); return plib::make_unique<solver::matrix_solver_direct1_t<FT>, device_arena>(*this, sname, nets, params);
case 2: case 2:
@ -243,6 +244,7 @@ namespace devices
return create_solver<FT, 7>(7, sname, params, nets); return create_solver<FT, 7>(7, sname, params, nets);
case 8: case 8:
return create_solver<FT, 8>(8, sname, params, nets); return create_solver<FT, 8>(8, sname, params, nets);
#endif
default: default:
log().info(MI_NO_SPECIFIC_SOLVER(net_count)); log().info(MI_NO_SPECIFIC_SOLVER(net_count));
if (net_count <= 16) if (net_count <= 16)