diff --git a/aquery_config.py b/aquery_config.py
index fe6b3b5..752d754 100644
--- a/aquery_config.py
+++ b/aquery_config.py
@@ -2,7 +2,7 @@
## GLOBAL CONFIGURATION FLAGS
-version_string = '0.7.6a'
+version_string = '0.7.7a'
add_path_to_ldpath = True
rebuild_backend = False
run_backend = True
@@ -28,7 +28,8 @@ def init_config():
# os.environ['CXX'] = 'C:/Program Files/LLVM/bin/clang.exe'
os.environ['THREADING'] = '1'
os.environ['AQUERY_ITC_USE_SEMPH'] = '1'
-
+ if 'AQ_DEBUG' not in os.environ:
+ os.environ['AQ_DEBUG'] = '0'
if ('__config_initialized__' not in globals() or
not __config_initialized__):
import sys
@@ -50,6 +51,7 @@ def init_config():
if os_platform == 'win':
add_dll_dir(cygroot)
add_dll_dir(os.path.abspath('./msc-plugin'))
+ add_dll_dir(os.path.abspath('./deps'))
if build_driver == 'Auto':
try:
import vswhere
diff --git a/build.py b/build.py
index bdd81b8..bf14ece 100644
--- a/build.py
+++ b/build.py
@@ -164,6 +164,7 @@ class build_manager:
return True
def server(self):
+ print(self.opt)
loc = os.path.abspath('./msc-plugin/server.vcxproj')
self.get_flags()
self.build_cmd = [['del', 'server.so'], [aquery_config.msbuildroot, loc, self.opt, self.platform]]
@@ -186,7 +187,7 @@ class build_manager:
def __init__(self) -> None:
self.method = 'make'
self.cxx = ''
- self.OptimizationLv = '4' # [O0, O1, O2, O3, Ofast]
+ self.OptimizationLv = '0' # [O0, O1, O2, O3, Ofast]
self.Platform = 'amd64'
self.PCH = os.environ['PCH'] if 'PCH' in os.environ else 1
self.StaticLib = 1
diff --git a/engine/ast.py b/engine/ast.py
index ea95b6d..723b436 100644
--- a/engine/ast.py
+++ b/engine/ast.py
@@ -75,7 +75,8 @@ class projection(ast_node):
):
self.force_use_spgb = (
force_use_spgb |
- context.system_state.cfg.backend_type == Backend_Type.BACKEND_AQuery.value
+ (context.system_state.cfg.backend_type ==
+ Backend_Type.BACKEND_AQuery.value)
)
self.subq_type = subq_type
super().__init__(parent, node, context)
@@ -1444,10 +1445,10 @@ class outfile(ast_node):
file_pointer = 'fp_' + base62uuid(6)
self.addc(f'FILE* {file_pointer} = fopen("{filename}", "wb");')
self.addc(f'{self.parent.out_table.contextname_cpp}->printall("{sep}", "\\n", nullptr, {file_pointer});')
- if self.context.use_gc:
- self.addc(f'GC::gc_handle->reg({file_pointer}, 65536, [](void* fp){{fclose((FILE*)fp);}});')
- else:
- self.addc(f'fclose({file_pointer});')
+ # if self.context.use_gc:
+ # self.addc(f'GC::gc_handle->reg({file_pointer}, 65536, fclose_gc);')
+ # else:
+ self.addc(f'fclose({file_pointer});')
self.context.ccode += self.ccode
diff --git a/msvs-py/msvs-py.pyproj b/msvs-py/msvs-py.pyproj
index be50d88..eb1fe67 100644
--- a/msvs-py/msvs-py.pyproj
+++ b/msvs-py/msvs-py.pyproj
@@ -11,9 +11,10 @@
msvs-py
msvs-py
False
- Global|PythonCore|3.9
+ Global|PythonCore|3.10
Standard Python launcher
True
+ AQ_DEBUG=1
true
@@ -59,6 +60,9 @@
+
+
+
diff --git a/server/aggregations.h b/server/aggregations.h
index 5b67e03..252c169 100644
--- a/server/aggregations.h
+++ b/server/aggregations.h
@@ -20,7 +20,7 @@ template class VT>
types::GetLongType
sum(const VT& v) {
types::GetLongType ret = 0;
- for (const auto& _v : v)
+ for (auto _v : v)
ret += _v;
return ret;
}
@@ -363,6 +363,32 @@ inline decayed_t>> vars(const VT&
return ret;
}
+template class VT,
+ class T2, template class VT2
+>
+auto corr(const VT& x, const VT2&y) {
+ typedef types::Coercion, decays> InnerType;
+ typedef types::GetLongType LongType;
+ typedef types::GetFPType FPType;
+ // assert(x.size == y.size);
+ const uint32_t& len = x.size;
+ LongType sx{0}, sy{0}, sxy{0}, sx2{0}, sy2{0};
+ for (uint32_t i = 0; i < len; ++i){
+ sx += x[i];
+ sx2 += x[i] * x[i];
+ sy += y[i];
+ sxy += x[i] * y[i];
+ sy2 += y[i] * y[i];
+ }
+ return (sxy - FPType(sx*sy))
+ /
+ (len * sqrt(
+ (sx2 - FPType(sx*sx)/len) * (sy2 - FPType(sy*sy)/len)
+ )
+ );
+}
+
+
template class VT>
inline types::GetFPType>> stddev(const VT& arr) {
return sqrt(var(arr));
diff --git a/server/gc.h b/server/gc.h
index 27ce8d9..226fefc 100644
--- a/server/gc.h
+++ b/server/gc.h
@@ -36,7 +36,7 @@ public:
// reset scratch space to initial capacity.
void cleanup();
};
-
+void fclose_gc(void*);
#ifndef __AQ_USE_THREADEDGC__
class QUERY_DECLSPEC GC {
@@ -103,7 +103,6 @@ public:
}
constexpr static void(*_free) (void*) = free;
};
-
#else
class GC {
public:
diff --git a/server/libaquery.cpp b/server/libaquery.cpp
index c095460..cacc2b4 100644
--- a/server/libaquery.cpp
+++ b/server/libaquery.cpp
@@ -635,3 +635,4 @@ get_procedure(Context* cxt, const char* name) {
}
void* CreateNULLServer(Context*) { return nullptr; }
+void fclose_gc(void* fp) { fclose((FILE*)fp); }
\ No newline at end of file
diff --git a/server/server.cpp b/server/server.cpp
index ed820bc..d74d3b4 100644
--- a/server/server.cpp
+++ b/server/server.cpp
@@ -67,11 +67,11 @@ typedef void (*module_init_fn)(Context*);
int n_recv = 0;
char** n_recvd = nullptr;
-__AQEXPORT__(void) wait_engine(){
+__AQEXPORT__(void) wait_engine() {
PROMPT_ACQUIRE();
}
-__AQEXPORT__(void) wake_engine(){
+__AQEXPORT__(void) wake_engine() {
ENGINE_RELEASE();
}
@@ -108,7 +108,7 @@ have_hge() {
Context* _g_cxt;
__AQEXPORT__(StoredProcedure)
-get_procedure_ex(const char* name){
+get_procedure_ex(const char* name) {
return get_procedure(_g_cxt, name);
}
@@ -134,13 +134,13 @@ void activate_callback_based_trigger(Context* context, const char* cmd)
// This function contains heap allocations, free after use
template
-char* to_lpstr(const String_T& str){
+char* to_lpstr(const String_T& str) {
auto ret = static_cast(malloc(str.size() + 1));
memcpy(ret, str.c_str(), str.size());
ret[str.size()] = '\0';
return ret;
}
-char* copy_lpstr(const char* str){
+char* copy_lpstr(const char* str) {
auto len = strlen(str);
auto ret = static_cast(malloc(len + 1));
memcpy(ret, str, len + 1);
@@ -639,7 +639,7 @@ extern "C" int __DLLEXPORT__ dllmain(int argc, char** argv) {
cxt->log("ready: %s\n", ready? "true":"false");
while (running) {
std::this_thread::sleep_for(1ms);
- if(ready){
+ if(ready) {
cxt->log("running: %s\n", running? "true":"false");
cxt->log("ready: %s\n", ready? "true":"false");
void* handle = dlopen("./dll.so", RTLD_NOW);
diff --git a/server/vector_type.hpp b/server/vector_type.hpp
index dd5f8b5..188a135 100644
--- a/server/vector_type.hpp
+++ b/server/vector_type.hpp
@@ -355,7 +355,7 @@ public:
inline vector_type<_Ty> subvec_deep(uint32_t start = 0) const { return subvec_deep(start, size); }
vector_type<_Ty> getRef() { return vector_type<_Ty>(container, size); }
~vector_type() {
- if (capacity > 0) GC::gc_handle->reg(container, sizeof(_Ty) * capacity);//free(container);
+ if (capacity > 0) GC::gc_handle->reg(container, sizeof(_Ty) * capacity);//*/free(container);
container = nullptr;
size = capacity = 0;
}