diff --git a/datagen.cpp b/datagen.cpp index 41fbfc0..418caf5 100644 --- a/datagen.cpp +++ b/datagen.cpp @@ -52,7 +52,7 @@ int gen_trade_data(int argc, char* argv[]) printf("No parameter supplied. Use default frac=%f, N=%d? [Y/n]\n", frac, N); char buf[4096]; fgets(buf, 4095, stdin); if((buf[0] != 'y' && buf[0] !='Y') && buf[0] != '\n') { - const auto &getParams = [&](){ puts("Type: frac N [ENTER]"); + const auto &getParams = [&](){ puts("Type: frac N n_rows [ENTER]"); for(int i = 0; i < 4096; ++i) if(buf[i] == '\n') {buf[i] = 0; break;} char* _buf = buf; frac = getFloat(_buf); N = getInt(_buf); n_rows=getInt(_buf); }; getParams(); @@ -102,7 +102,7 @@ int gen_trade_data(int argc, char* argv[]) current_price = new_price; } d[i]= {ss, i+1, (int)g_quantity(engine), current_price}; - fprintf(fp, "s%d, %d, %d, %d\n", d[i].ss, d[i].t, d[i].q, d[i].p); + fprintf(fp, "%d, %d, %d, %d\n", d[i].ss, d[i].t, d[i].q, d[i].p); last_price[ss - 1] = current_price; } fclose(fp); @@ -148,8 +148,9 @@ int gen_stock_data(int argc, char* argv[]){ fprintf(fp, "%s,%s\n", IDs[i].c_str(), names[i].c_str()); } fclose(fp); + return 0; } int main(int argc, char* argv[]){ - return gen_stock_data(argc, argv); + return gen_trade_data(argc, argv); } diff --git a/msc-plugin/libaquery.vcxproj b/msc-plugin/libaquery.vcxproj index 85cb9f2..47ae736 100644 --- a/msc-plugin/libaquery.vcxproj +++ b/msc-plugin/libaquery.vcxproj @@ -130,7 +130,7 @@ Level3 true - _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + QUERY_DECLSPEC=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpplatest stdc17 @@ -156,7 +156,7 @@ true true false - _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + QUERY_DECLSPEC=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpplatest stdc17 @@ -197,7 +197,7 @@ true true false - _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + QUERY_DECLSPEC=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpplatest stdc17 @@ -236,7 +236,7 @@ Level3 true - _CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + QUERY_DECLSPEC=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpplatest stdc17 @@ -266,7 +266,7 @@ true true false - _CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + QUERY_DECLSPEC=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpplatest stdc17 @@ -307,7 +307,7 @@ true true false - _CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + QUERY_DECLSPEC=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpplatest stdc17 diff --git a/msc-plugin/msc-plugin.vcxproj b/msc-plugin/msc-plugin.vcxproj index ab76513..6ed1a4b 100644 --- a/msc-plugin/msc-plugin.vcxproj +++ b/msc-plugin/msc-plugin.vcxproj @@ -134,7 +134,7 @@ Level3 true - _CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + QUERY_DECLSPEC=__declspec(dllimport);_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpplatest Guard @@ -166,7 +166,7 @@ true true false - _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + QUERY_DECLSPEC=__declspec(dllimport);_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpplatest $(ProjectDir)\..\monetdb\msvc @@ -209,7 +209,7 @@ true true false - _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + QUERY_DECLSPEC=__declspec(dllimport);_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpplatest $(ProjectDir)\..\monetdb\msvc @@ -250,7 +250,7 @@ Level3 true - _ALLOW_RTCc_IN_STL;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + QUERY_DECLSPEC=__declspec(dllimport);_ALLOW_RTCc_IN_STL;_CRT_SECURE_NO_WARNINGS;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpplatest false @@ -300,7 +300,7 @@ true true false - _CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + QUERY_DECLSPEC=__declspec(dllimport);_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpplatest $(ProjectDir)\..\monetdb\msvc @@ -343,7 +343,7 @@ true true false - _CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + QUERY_DECLSPEC=__declspec(dllimport);_CRT_SECURE_NO_WARNINGS;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true stdcpplatest $(ProjectDir)\..\monetdb\msvc diff --git a/msc-plugin/server.sln b/msc-plugin/server.sln index 6e2e70f..5ac7e0f 100644 --- a/msc-plugin/server.sln +++ b/msc-plugin/server.sln @@ -24,6 +24,10 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testmain", "testmain.vcxproj", "{73BD0DDA-7E66-4318-B46B-B8207AFA6355}" ProjectSection(ProjectDependencies) = postProject {8081FDAA-4D13-4B7A-ADB2-8224AF7F1C81} = {8081FDAA-4D13-4B7A-ADB2-8224AF7F1C81} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "datagen", "datagen\datagen.vcxproj", "{5AA4E63C-CFF8-467C-8872-84206CEDE7A9}" + ProjectSection(ProjectDependencies) = postProject {B52AACF7-16A6-4FCA-90AD-867D367BDA4F} = {B52AACF7-16A6-4FCA-90AD-867D367BDA4F} EndProjectSection EndProject @@ -169,6 +173,26 @@ Global {73BD0DDA-7E66-4318-B46B-B8207AFA6355}.sharedlib|x64.Build.0 = sharedlib|x64 {73BD0DDA-7E66-4318-B46B-B8207AFA6355}.sharedlib|x86.ActiveCfg = sharedlib|Win32 {73BD0DDA-7E66-4318-B46B-B8207AFA6355}.sharedlib|x86.Build.0 = sharedlib|Win32 + {5AA4E63C-CFF8-467C-8872-84206CEDE7A9}.Debug|x64.ActiveCfg = Debug|x64 + {5AA4E63C-CFF8-467C-8872-84206CEDE7A9}.Debug|x64.Build.0 = Debug|x64 + {5AA4E63C-CFF8-467C-8872-84206CEDE7A9}.Debug|x86.ActiveCfg = Debug|Win32 + {5AA4E63C-CFF8-467C-8872-84206CEDE7A9}.Debug|x86.Build.0 = Debug|Win32 + {5AA4E63C-CFF8-467C-8872-84206CEDE7A9}.Release|x64.ActiveCfg = Release|x64 + {5AA4E63C-CFF8-467C-8872-84206CEDE7A9}.Release|x64.Build.0 = Release|x64 + {5AA4E63C-CFF8-467C-8872-84206CEDE7A9}.Release|x86.ActiveCfg = Release|Win32 + {5AA4E63C-CFF8-467C-8872-84206CEDE7A9}.Release|x86.Build.0 = Release|Win32 + {5AA4E63C-CFF8-467C-8872-84206CEDE7A9}.RelWDbgInf|x64.ActiveCfg = Release|x64 + {5AA4E63C-CFF8-467C-8872-84206CEDE7A9}.RelWDbgInf|x64.Build.0 = Release|x64 + {5AA4E63C-CFF8-467C-8872-84206CEDE7A9}.RelWDbgInf|x86.ActiveCfg = Release|Win32 + {5AA4E63C-CFF8-467C-8872-84206CEDE7A9}.RelWDbgInf|x86.Build.0 = Release|Win32 + {5AA4E63C-CFF8-467C-8872-84206CEDE7A9}.shared|x64.ActiveCfg = Debug|x64 + {5AA4E63C-CFF8-467C-8872-84206CEDE7A9}.shared|x64.Build.0 = Debug|x64 + {5AA4E63C-CFF8-467C-8872-84206CEDE7A9}.shared|x86.ActiveCfg = Debug|Win32 + {5AA4E63C-CFF8-467C-8872-84206CEDE7A9}.shared|x86.Build.0 = Debug|Win32 + {5AA4E63C-CFF8-467C-8872-84206CEDE7A9}.sharedlib|x64.ActiveCfg = Debug|x64 + {5AA4E63C-CFF8-467C-8872-84206CEDE7A9}.sharedlib|x64.Build.0 = Debug|x64 + {5AA4E63C-CFF8-467C-8872-84206CEDE7A9}.sharedlib|x86.ActiveCfg = Debug|Win32 + {5AA4E63C-CFF8-467C-8872-84206CEDE7A9}.sharedlib|x86.Build.0 = Debug|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/msc-plugin/testmain.vcxproj b/msc-plugin/testmain.vcxproj index b89ef43..6ace1e2 100644 --- a/msc-plugin/testmain.vcxproj +++ b/msc-plugin/testmain.vcxproj @@ -219,6 +219,7 @@ ..\libaquery.lib;$(ProjectDir)\..\monetdb\msvc\monetdbe.lib;%(AdditionalDependencies) false /WHOLEARCHIVE:libaquery.lib %(AdditionalOptions) + true @@ -319,6 +320,7 @@ ..\libaquery.lib;$(ProjectDir)\..\monetdb\msvc\monetdbe.lib;%(AdditionalDependencies) false /WHOLEARCHIVE:libaquery.lib %(AdditionalOptions) + true diff --git a/server/cpp.hint b/server/cpp.hint index 90950e7..3c50d78 100644 --- a/server/cpp.hint +++ b/server/cpp.hint @@ -4,3 +4,4 @@ #define Ops(o) template vector_type::type> operator##o(const vector_type& r) { [[likely]] if (r.size == size) { return add(r); } else if (r.size == 1 || size == 1) { const bool lr = size == 1; const uint32_t& _size = lr ? r.size : size; const auto& _container = lr ? r.container : container; const auto& scalar = *(lr ? container : r.container); vector_type::type> ret(_size); for (int i = 0; i < _size; ++i) ret[i] = _container[i] o scalar; return ret; } } #define Op(o, x) template vector_type::type> inline x(const vector_type& r) { vector_type::type> ret(size); for (int i = 0; i < size; ++i) ret[i] = container[i] o r[i]; return ret; } #define _Make_Ops(M) M(+, add) M(-, minus) M(*, multi) M(/, div) M(%, mod) M(&, and) M(|, or) M(^, xor) +#define QUERY_DECLSPEC diff --git a/server/gc.h b/server/gc.h index d8e84f8..27ce8d9 100644 --- a/server/gc.h +++ b/server/gc.h @@ -1,7 +1,10 @@ #pragma once #include +#ifndef QUERY_DECLSPEC +#define QUERY_DECLSPEC +#endif -class ScratchSpace { +class QUERY_DECLSPEC ScratchSpace { public: void* ret; char* scratchspace; @@ -10,7 +13,7 @@ public: size_t capacity; size_t initial_capacity; void* temp_memory_fractions; - + //uint8_t status; // record maximum size constexpr static uint8_t Grow = 0x1; @@ -36,7 +39,7 @@ public: #ifndef __AQ_USE_THREADEDGC__ -class GC { +class QUERY_DECLSPEC GC { private: size_t max_slots, interval, forced_clean, diff --git a/server/unordered_dense.h b/server/unordered_dense.h index 03b6fc0..4115f6a 100644 --- a/server/unordered_dense.h +++ b/server/unordered_dense.h @@ -96,6 +96,9 @@ # define ANKERL_UNORDERED_DENSE_UNLIKELY(x) (x) // NOLINT(cppcoreguidelines-macro-usage) # endif +template +class AQHashTable; + namespace ankerl::unordered_dense { inline namespace ANKERL_UNORDERED_DENSE_NAMESPACE { @@ -418,6 +421,7 @@ public: using iterator = typename value_container_type::iterator; using const_iterator = typename value_container_type::const_iterator; using bucket_type = Bucket; + friend class AQHashTable; private: using value_idx_type = decltype(Bucket::m_value_idx); diff --git a/server/vector_type.hpp b/server/vector_type.hpp index 3cf6057..c9628e9 100644 --- a/server/vector_type.hpp +++ b/server/vector_type.hpp @@ -474,6 +474,7 @@ public: explicit AQHashTable(uint32_t sz) : ankerl::unordered_dense::set{} { this->reserve(sz); + this->m_values.reserve(sz); reversemap = static_cast(malloc(sizeof(uint32_t) * sz * 2)); mapbase = reversemap + sz; ht_base = static_cast(calloc(sz, sizeof(uint32_t)));