master
Bill 2 years ago
parent 27ae26db90
commit 6f267f982d

@ -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

@ -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

@ -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

@ -11,9 +11,10 @@
<Name>msvs-py</Name>
<RootNamespace>msvs-py</RootNamespace>
<IsWindowsApplication>False</IsWindowsApplication>
<InterpreterId>Global|PythonCore|3.9</InterpreterId>
<InterpreterId>Global|PythonCore|3.10</InterpreterId>
<LaunchProvider>Standard Python launcher</LaunchProvider>
<EnableNativeCodeDebugging>True</EnableNativeCodeDebugging>
<Environment>AQ_DEBUG=1</Environment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugSymbols>true</DebugSymbols>
@ -59,6 +60,9 @@
<Compile Include="..\aquery_config.py" />
</ItemGroup>
<ItemGroup>
<InterpreterReference Include="Global|PythonCore|3.10" />
<InterpreterReference Include="Global|PythonCore|3.11" />
<InterpreterReference Include="Global|PythonCore|3.12" />
<InterpreterReference Include="Global|PythonCore|3.9" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\Python Tools\Microsoft.PythonTools.targets" />

@ -20,7 +20,7 @@ template<class T, template<typename ...> class VT>
types::GetLongType<T>
sum(const VT<T>& v) {
types::GetLongType<T> ret = 0;
for (const auto& _v : v)
for (auto _v : v)
ret += _v;
return ret;
}
@ -363,6 +363,32 @@ inline decayed_t<VT, types::GetFPType<types::GetLongType<T>>> vars(const VT<T>&
return ret;
}
template<class T, template<typename ...> class VT,
class T2, template<typename ...> class VT2
>
auto corr(const VT<T>& x, const VT2<T2>&y) {
typedef types::Coercion<decays<T>, decays<T2>> InnerType;
typedef types::GetLongType<InnerType> LongType;
typedef types::GetFPType<LongType> 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 T, template<typename ...> class VT>
inline types::GetFPType<types::GetLongType<decays<T>>> stddev(const VT<T>& arr) {
return sqrt(var(arr));

@ -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:

@ -635,3 +635,4 @@ get_procedure(Context* cxt, const char* name) {
}
void* CreateNULLServer(Context*) { return nullptr; }
void fclose_gc(void* fp) { fclose((FILE*)fp); }

@ -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<class String_T>
char* to_lpstr(const String_T& str){
char* to_lpstr(const String_T& str) {
auto ret = static_cast<char*>(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<char*>(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);

@ -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;
}

Loading…
Cancel
Save