From 409befb672439d0c7637f026c02770d63c327d96 Mon Sep 17 00:00:00 2001 From: Churkin Aleksey Date: Tue, 24 Mar 2026 14:33:17 +0300 Subject: [PATCH 1/9] ci: submodules are gone No need to run git submodule .. in CI anymore. --- .github/workflows/build.yml | 12 ------------ .github/workflows/release.yml | 3 --- 2 files changed, 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1d6df6dec8..90fdb73631 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -223,18 +223,6 @@ jobs: ;; esac - - name: "Clone required repos" - uses: actions/checkout@master - with: - repository: profelis/das-fmt # Path to repository with das-fmt scripts - ref: refs/pull/4/head - path: das-fmt - - - name: "Clone submodules" - if: matrix.target != 'linux_arm' # support opengl in glfw on linux arm - run: | - # Some of them will be disabled, but who cares - git submodule update --init --recursive $(cat ci/release_modules.txt | grep -v "^#" | cut -d':' -f1 | sed 's|^|modules/|' | xargs) - name: "Build: Daslang" run: | set -eux diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8f6aa3ef54..425e4cae54 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -189,9 +189,6 @@ jobs: ./vcpkg/vcpkg install openssl:${{ matrix.architecture == 32 && 'x86' || 'x64' }}-windows --binarycaching echo "VCPKG_ROOT=$(pwd)/vcpkg" >> $GITHUB_ENV echo "CMAKE_TOOLCHAIN_FILE=$(pwd)/vcpkg/scripts/buildsystems/vcpkg.cmake" >> $GITHUB_ENV - - name: "Clone submodules" - run: | - git submodule update --init --recursive $(cat ci/release_modules.txt | grep -v "^#" | cut -d':' -f1 | sed 's|^|modules/|' | xargs) - name: "Build: Daslang Linux with modules" if: runner.os != 'Windows' run: | From 86d2e79c52eec59dc1d3cb5ae5d67cd289d45615 Mon Sep 17 00:00:00 2001 From: Churkin Aleksey Date: Tue, 24 Mar 2026 12:57:15 +0300 Subject: [PATCH 2/9] compiler: remove unused root files There were some files/scripts/configs in the root directory that was unused, removed them. --- CMakeCpuDetect.txt | 0 generate_gcc.sh | 10 -- generate_gcc_linux.sh | 10 -- generate_gcc_linux_release.sh | 8 - generate_gcc_release.sh | 10 -- generate_msvc.bat | 8 - generate_msvc_2019.bat | 8 - generate_msvc_2022.bat | 8 - generate_msvc_32.bat | 8 - generate_xcode.sh | 10 -- generate_xcode_min.sh | 20 --- make_empty_folder.bat | 8 - modules.py | 301 ---------------------------------- remove_folder.bat | 7 - sync.bat | 51 ------ sync_folder.bat | 2 - todo | 46 ------ 17 files changed, 515 deletions(-) delete mode 100644 CMakeCpuDetect.txt delete mode 100755 generate_gcc.sh delete mode 100644 generate_gcc_linux.sh delete mode 100644 generate_gcc_linux_release.sh delete mode 100755 generate_gcc_release.sh delete mode 100644 generate_msvc.bat delete mode 100644 generate_msvc_2019.bat delete mode 100644 generate_msvc_2022.bat delete mode 100644 generate_msvc_32.bat delete mode 100755 generate_xcode.sh delete mode 100755 generate_xcode_min.sh delete mode 100644 make_empty_folder.bat delete mode 100644 modules.py delete mode 100644 remove_folder.bat delete mode 100644 sync.bat delete mode 100644 sync_folder.bat delete mode 100644 todo diff --git a/CMakeCpuDetect.txt b/CMakeCpuDetect.txt deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/generate_gcc.sh b/generate_gcc.sh deleted file mode 100755 index 87b4e329d5..0000000000 --- a/generate_gcc.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -e - -time { - - rm -r -f cmake_temp - mkdir cmake_temp - cd cmake_temp - - CC=gcc-10 CXX=g++-10 cmake -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_INSTALL_PREFIX=. -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12 -G "Unix Makefiles" ../ -} diff --git a/generate_gcc_linux.sh b/generate_gcc_linux.sh deleted file mode 100644 index 70ccc0b268..0000000000 --- a/generate_gcc_linux.sh +++ /dev/null @@ -1,10 +0,0 @@ -rm -r -f cmake_temp - -mkdir cmake_temp - -cd cmake_temp - -CC=gcc-9 CXX=g++-9 cmake -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_INSTALL_PREFIX=. -DCMAKE_BUILD_TYPE=DEBUG -DDAS_CLANG_BIND_DISABLED=TRUE -G "Unix Makefiles" ../ - - - diff --git a/generate_gcc_linux_release.sh b/generate_gcc_linux_release.sh deleted file mode 100644 index 0ec116e842..0000000000 --- a/generate_gcc_linux_release.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -e - -rm -r -f cmake_temp -mkdir cmake_temp -cd cmake_temp - -#-DDAS_CLANG_BIND_DISABLED=FALSE -cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DDAS_LLVM_DISABLED=FALSE -DDAS_GLFW_DISABLED=TRUE -G Ninja diff --git a/generate_gcc_release.sh b/generate_gcc_release.sh deleted file mode 100755 index 4dc38f0d26..0000000000 --- a/generate_gcc_release.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -e - -time { - - rm -r -f cmake_temp - mkdir cmake_temp - cd cmake_temp - - CC=gcc-9 CXX=g++-9 cmake -DCMAKE_OSX_ARCHITECTURES="x86_64" -DCMAKE_INSTALL_PREFIX=. -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12 -G "Unix Makefiles" ../ -} diff --git a/generate_msvc.bat b/generate_msvc.bat deleted file mode 100644 index 87df912634..0000000000 --- a/generate_msvc.bat +++ /dev/null @@ -1,8 +0,0 @@ - -rd /Q /S cmake_temp -mkdir cmake_temp -cd cmake_temp - -set CMAKE_GENERATOR=Visual Studio 14 2015 Win64 - -cmake -G "%CMAKE_GENERATOR%" -DCMAKE_INSTALL_PREFIX=. ..\ diff --git a/generate_msvc_2019.bat b/generate_msvc_2019.bat deleted file mode 100644 index 2e32594ab5..0000000000 --- a/generate_msvc_2019.bat +++ /dev/null @@ -1,8 +0,0 @@ - -rd /Q /S cmake_temp -mkdir cmake_temp -cd cmake_temp - -set CMAKE_GENERATOR=Visual Studio 16 2019 - -cmake -G "%CMAKE_GENERATOR%" -DCMAKE_INSTALL_PREFIX=. ..\ diff --git a/generate_msvc_2022.bat b/generate_msvc_2022.bat deleted file mode 100644 index 8f30acc48e..0000000000 --- a/generate_msvc_2022.bat +++ /dev/null @@ -1,8 +0,0 @@ - -rd /Q /S cmake_temp -mkdir cmake_temp -cd cmake_temp - -set CMAKE_GENERATOR=Visual Studio 17 2022 - -cmake -G "%CMAKE_GENERATOR%" -DCMAKE_INSTALL_PREFIX=. ..\ diff --git a/generate_msvc_32.bat b/generate_msvc_32.bat deleted file mode 100644 index 613bdda12a..0000000000 --- a/generate_msvc_32.bat +++ /dev/null @@ -1,8 +0,0 @@ - -rd /Q /S cmake_temp -mkdir cmake_temp -cd cmake_temp - -set CMAKE_GENERATOR=Visual Studio 14 2015 - -cmake -G "%CMAKE_GENERATOR%" -DCMAKE_INSTALL_PREFIX=. ..\ diff --git a/generate_xcode.sh b/generate_xcode.sh deleted file mode 100755 index cb496b9140..0000000000 --- a/generate_xcode.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -e - -time { - - rm -r -f cmake_temp - mkdir cmake_temp - cd cmake_temp - - CC=clang CXX=clang++ cmake -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_INSTALL_PREFIX=. -DCMAKE_BUILD_TYPE=RELWITHDEBINFO -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12 -G Xcode ../ -} diff --git a/generate_xcode_min.sh b/generate_xcode_min.sh deleted file mode 100755 index f343f2721d..0000000000 --- a/generate_xcode_min.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -e - -time { - - rm -r -f cmake_temp - mkdir cmake_temp - cd cmake_temp - - CC=clang CXX=clang++ cmake -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" \ - -DDAS_GLFW_DISABLED:BOOL=TRUE \ - -DDAS_IMGUI_DISABLED:BOOL=TRUE \ - -DDAS_CLANG_BIND_DISABLED:BOOL=TRUE \ - -DDAS_LLVM_DISABLED:BOOL=TRUE \ - -DDAS_AUDIO_DISABLED:BOOL=TRUE \ - -DDAS_STDDLG_DISABLED:BOOL=TRUE \ - -DDAS_STBIMAGE_DISABLED:BOOL=TRUE \ - -DDAS_STBTRUETYPE_DISABLED:BOOL=TRUE \ - -DCMAKE_INSTALL_PREFIX=. -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12 -G Xcode ../ - -} diff --git a/make_empty_folder.bat b/make_empty_folder.bat deleted file mode 100644 index 6050036ed2..0000000000 --- a/make_empty_folder.bat +++ /dev/null @@ -1,8 +0,0 @@ -DEL /F/Q/S %1\*.* > NUL -If %ERRORLEVEL% NEQ 0 ECHO DELETE %1 FAILED -RMDIR /Q/S %1 -If %ERRORLEVEL% NEQ 0 ECHO RMDIR %1 FAILED -MKDIR %1 -If %ERRORLEVEL% NEQ 0 ECHO MKDIR %1 FAILED - - diff --git a/modules.py b/modules.py deleted file mode 100644 index 0c270c8357..0000000000 --- a/modules.py +++ /dev/null @@ -1,301 +0,0 @@ -import os -import sys -import subprocess -import argparse -from typing import List, Dict - - -options_table = { - "dasClangBind": "DAS_CLANG_BIND_DISABLED", - "dasGlfw": "DAS_GLFW_DISABLED", - "dasGlsl": "", - "dasHV": "DAS_HV_DISABLED", - "dasImgui": "DAS_IMGUI_DISABLED", - "dasLLVM": "DAS_LLVM_DISABLED", - "dasOpenGL": "", - "dasAudio": "DAS_AUDIO_DISABLED", - "dasStbImage": "DAS_STBIMAGE_DISABLED", - "dasStbTrueType": "DAS_STBTRUETYPE_DISABLED", - "dasStdDlg": "DAS_STDDLG_DISABLED" -} - -cmake_options_cache: Dict[str, str] = {} - - -def goto_build_directory() -> str: - oldpath = os.getcwd() - - try: - os.chdir(cmake_path) - except FileNotFoundError: - print("ERROR: cmake build directory cannot be found, maybe it was deleted or was entered incorrectly.") - exit(1) - - try: - if not os.path.exists("CMakeCache.txt"): - raise FileNotFoundError - except FileNotFoundError: - print("ERROR: CMakeCache.txt cannot be found, maybe it was moved or deleted.") - exit(1) - - return oldpath - - -def goback_to_directory(oldpath: str): - try: - os.chdir(oldpath) - except FileNotFoundError: - print("ERROR: can't go back to %s, maybe project directory was renamed" % oldpath) - exit(1) - - -def get_all_submodule_names() -> List[str]: - all_submodules_path = os.path.join(os.getcwd(), "modules") - dir_elems = os.listdir(all_submodules_path) - - submodules_list = [] - for elem in dir_elems: - if os.path.isdir(os.path.join(all_submodules_path, elem)): - submodules_list.append(elem) - - return submodules_list - - -def fill_cmake_options_cache(all_modules: List[str]): - oldpath = goto_build_directory() - - cmake_output = subprocess.run(["cmake", "-N", "-LA", "."], stdout=subprocess.PIPE, encoding='utf-8') - if cmake_output.stderr is not None: - print("ERROR: there was an error executing 'cmake -N -LA .', stderr:") - print(cmake_output.stderr) - exit(1) - - cache_list = cmake_output.stdout - goback_to_directory(oldpath) - - for module in all_modules: - - option_name = options_table.setdefault(module, "") - - if option_name == "": - cmake_options_cache[module] = " " - continue - - for cache_str in cache_list.split("\n"): - if cache_str.find(option_name) != -1: - status = cache_str[cache_str.find("=") + 1:] - if status == "ON": - cmake_options_cache[module] = "-" - elif status == "OFF": - cmake_options_cache[module] = "+" - break - - -def print_all_option_values(all_modules: List[str], selected_module: str): - if not cmake_options_cache or len(all_modules) != len(cmake_options_cache): - fill_cmake_options_cache(all_modules) - - for module, sign in cmake_options_cache.items(): - output = "" - - if module == selected_module: - output += "-> " - else: - output += " " - - output += sign + " : " + module - - if sign == " ": - output += " - option for this module is unknown" - - print(output) - - -def able_selected_submodule(submodule_name: str): - option_name = options_table[submodule_name] - - submodule_path = os.path.join(os.getcwd(), "modules", submodule_name) - - if not os.listdir(submodule_path): - if subprocess.call(["git", "submodule", "update", "--init", "--recursive", "modules/" + submodule_name]) == 0: - print("%s cloned successfully!" % submodule_name) - else: - print("ERROR: there was an error executing 'git submodule update --init --recursive' for %s submodule." % submodule_name) - return - - oldpath = goto_build_directory() - - if subprocess.call(["cmake", "-D" + option_name + ":BOOL=OFF ", oldpath]) == 0: - print("%s turned on successfully (see log above)!" % submodule_name) - else: - print("ERROR: there was an error executing 'cmake -D%s:BOOL=OFF %s' " % (option_name, oldpath)) - - goback_to_directory(oldpath) - - -def disable_selected_submodule(submodule_name: str): - option_name = options_table[submodule_name] - - oldpath = goto_build_directory() - - if subprocess.call(["cmake", "-D" + option_name + ":BOOL=ON ", oldpath]) == 0: - print("%s turned off successfully (see log above)!" % submodule_name) - else: - print("ERROR: there was an error executing 'cmake -D%s:BOOL=ON %s' " % (option_name, oldpath)) - - goback_to_directory(oldpath) - - -def disable_all_submodules(): - for module, sign in cmake_options_cache.items(): - if sign == "+": - disable_selected_submodule(module) - - all_submodules = get_all_submodule_names() - fill_cmake_options_cache(all_submodules) - - -def change_submodule_availability(submodule: str): - status = cmake_options_cache[submodule] - - if status == "+": - disable_selected_submodule(submodule) - elif status == "-": - able_selected_submodule(submodule) - else: - print("Option with this name (%s) doesn't exist." % submodule) - - all_submodules = get_all_submodule_names() - fill_cmake_options_cache(all_submodules) - - -def cmd_submodule_configuration(on_list: List[str], off_list: List[str], all_modules: List[str]): - if on_list is not None: - for on_sub in on_list: - if on_sub not in all_modules: - print("Submodule with this name (%s) doesn't exist." % on_sub) - continue - able_selected_submodule(on_sub) - - if off_list is not None: - for off_sub in off_list: - if off_sub not in all_modules: - print("Submodule with this name (%s) doesn't exist." % off_sub) - continue - disable_selected_submodule(off_sub) - - -class _Getch: - """Gets a single character from standard input. Does not echo to the -screen.""" - def __init__(self): - try: - self.impl = _GetchWindows() - except ImportError: - self.impl = _GetchUnix() - - def __call__(self): return self.impl() - - -class _GetchUnix: - def __init__(self): - import tty, sys - - def __call__(self): - import sys, tty, termios - fd = sys.stdin.fileno() - old_settings = termios.tcgetattr(fd) - try: - tty.setraw(sys.stdin.fileno()) - ch = sys.stdin.read(1) - finally: - termios.tcsetattr(fd, termios.TCSADRAIN, old_settings) - return ch - - -class _GetchWindows: - def __init__(self): - import msvcrt - - def __call__(self): - import msvcrt - ch = msvcrt.getch() - if ch == '\000' or ch == '\xe0': - return msvcrt.getch() - return ch - - -getch = _Getch() - - -if __name__ == "__main__": - parser = argparse.ArgumentParser( - description='''This is cmake/git configuration tool. - It allows to manage cmake submodules options and turn them on (in case they were off) - or turn off (in case they were on). Tool also clones the submodule while it turns it on, - if it hasn't been cloned yet. - example: D:\daScript> python3 modules.py --path --on --off ''') - - parser.add_argument( - "--path", required=True, - # metavar="" , - help='''relative path to build directory processed by cmake''') - - parser.add_argument ( - "--on", nargs='+', - help='''list of submodules for turning on''') - - parser.add_argument ( - "--off", nargs='+', - help='''list of submodules for turning off''') - - if len(sys.argv) == 1: - parser.print_help() - exit(0) - - args = parser.parse_args() - cmake_path = args.path - - submodules_list = get_all_submodule_names() - selected_submodule_ind = 0 - - if args.on is not None or args.off is not None: - cmd_submodule_configuration(args.on, args.off, submodules_list) - print("\nPress any key to continue ...") - getch() - - is_break_out = False - while not is_break_out: - os.system('cls' if os.name=='nt' else 'clear') - - print("Q - exit, U - update list, D - disable all modules, arrows/J/K - navigation, enter - toggle module state") - print_all_option_values(submodules_list, submodules_list[selected_submodule_ind]) - - c = getch() - - is_up = ord(c) == 72 if os.name=='nt' else ord(c) == 65 - is_down = ord(c) == 80 if os.name=='nt' else ord(c) == 66 - - if ord(c) == 113: # q - is_break_out = True - break - - elif ord(c) == 117: # u - submodules_list = get_all_submodule_names() - fill_cmake_options_cache(submodules_list) - - elif ord(c) == 100: # d - disable_all_submodules() - print("\nPress any key to continue ...") - getch() - - elif selected_submodule_ind > 0 and (is_up or ord(c) == 107): # up: pgup or k - selected_submodule_ind -= 1 - - elif selected_submodule_ind < len(submodules_list) - 1 and (is_down or ord(c) == 106): # down: pgdn or j - selected_submodule_ind += 1 - - elif ord(c) == 13: # enter - change_submodule_availability(submodules_list[selected_submodule_ind]) - print("\nPress any key to continue ...") - getch() diff --git a/remove_folder.bat b/remove_folder.bat deleted file mode 100644 index 57d1db702e..0000000000 --- a/remove_folder.bat +++ /dev/null @@ -1,7 +0,0 @@ -DEL /F/Q/S %1\*.* > NUL -If %ERRORLEVEL% NEQ 0 ECHO DELETE %1 FAILED -RMDIR /Q/S %1 -If %ERRORLEVEL% NEQ 0 ECHO RMDIR %1 FAILED - - - diff --git a/sync.bat b/sync.bat deleted file mode 100644 index 46f94c5cee..0000000000 --- a/sync.bat +++ /dev/null @@ -1,51 +0,0 @@ -@ECHO OFF - -SET SRC_DIR=C:\Users\Boris\Work\yzg -SET DEST_DIR=E:\Dagor4\Prog\1stPartyLibs\daScript -SET PATCH_DIR=%SRC_DIR%\patch - -echo create patch -call make_empty_folder.bat %PATCH_DIR% -xcopy %DEST_DIR%\jamfile.* %PATCH_DIR% /S > NUL -If %ERRORLEVEL% NEQ 0 ECHO CREATE PATCH %1 FAILED - -echo syncing examples -call make_empty_folder.bat %DEST_DIR%\examples -call sync_folder.bat %SRC_DIR%\examples %DEST_DIR%\examples -call remove_folder.bat %DEST_DIR%\examples\profile\tests\angelscript -call remove_folder.bat %DEST_DIR%\examples\profile\tests\squirrel -call remove_folder.bat %DEST_DIR%\examples\profile\tests\lua -call remove_folder.bat %DEST_DIR%\examples\profile\tests\js - -echo syncing utils -call make_empty_folder.bat %DEST_DIR%\utils -call sync_folder.bat %SRC_DIR%\utils %DEST_DIR%\utils - -echo syncing include -call make_empty_folder.bat %DEST_DIR%\include -call sync_folder.bat %SRC_DIR%\include %DEST_DIR%\include -call remove_folder.bat %DEST_DIR%\include\dag_noise -call remove_folder.bat %DEST_DIR%\include\vecmath - -echo syncing src -call make_empty_folder.bat %DEST_DIR%\src -call sync_folder.bat %SRC_DIR%\src %DEST_DIR%\src - -echo syncing src -call make_empty_folder.bat %DEST_DIR%\daslib -call sync_folder.bat %SRC_DIR%\daslib %DEST_DIR%\daslib - -echo syncing doc -call make_empty_folder.bat %DEST_DIR%\doc -call sync_folder.bat %SRC_DIR%\doc %DEST_DIR%\doc - -echo syncing site -call make_empty_folder.bat %DEST_DIR%\site -call sync_folder.bat %SRC_DIR%\site %DEST_DIR%\site - -echo applying patch -xcopy %PATCH_DIR% %DEST_DIR% /D /I /E /F /Y /H /R > NUL -If %ERRORLEVEL% NEQ 0 ECHO APPLY PATCH FAILED - -echo removing patch -call remove_folder.bat %PATCH_DIR% diff --git a/sync_folder.bat b/sync_folder.bat deleted file mode 100644 index b5a0389982..0000000000 --- a/sync_folder.bat +++ /dev/null @@ -1,2 +0,0 @@ -xcopy %1 %2 /D /I /E /F /Y /H /R > NUL -If %ERRORLEVEL% NEQ 0 ECHO SYNC %1 FAILED diff --git a/todo b/todo deleted file mode 100644 index 250e0b986f..0000000000 --- a/todo +++ /dev/null @@ -1,46 +0,0 @@ -before r2v - ../../profile/fib.das - fibbonacci loop took: 0.734948 - fibbonacci recursive took: 0.608842 - ../../profile/native.das - native loop took: 2.343531 - ../../profile/primes.das - primes loop took: 3.574839 -after r2v - ../../profile/fib.das - fibbonacci loop took: 0.450230 - fibbonacci recursive took: 0.597284 - ../../profile/native.das - native loop took: 1.463391 - ../../profile/primes.das - primes loop took: 1.840420 -after ptr goo - ../../profile/tests/fib.das - fibbonacci loop took: 0.197751 - fibbonacci recursive took: 0.442276 - ../../profile/tests/native.das - native loop took: 1.329884 - ../../profile/tests/primes.das - primes loop took: 1.681099 - -before invokeEx - es-update took: 0.000116 - es-update-ref took: 0.000110 - es-update-ref-const took: 0.000127 - query-1 took: 0.000182 - query-2 took: 0.000217 - query-3 took: 1.906434 -after invokeEx - es-update took: 0.000115 - es-update-ref took: 0.000110 - es-update-ref-const took: 0.000122 - query-1 took: 0.000168 - query-2 took: 0.000193 - query-3 took: 1.507901 -after ptr goo - es-update took: 0.000086 - es-update-ref took: 0.000085 - es-update-ref-const took: 0.000113 - query-1 took: 0.000167 - query-2 took: 0.000194 - query-3 took: 1.468511 \ No newline at end of file From 088080f41cd203cb791f22fcb150e219ee81f2f1 Mon Sep 17 00:00:00 2001 From: Churkin Aleksey Date: Tue, 24 Mar 2026 13:19:23 +0300 Subject: [PATCH 3/9] jit: allow JIT when COP is not set Let's remove guard preventing JIT if code is not set. Now llvm_jit and llvm_macro separated. So if anyone wants to manually JIT some function he can use llvm_jit.das. And including llvm_macro leads to JIT-ing all functions. Also updated default dll lookup to das_root/lib. --- modules/dasLLVM/daslib/llvm_macro.das | 4 ---- modules/dasLLVM/examples/hello_jit.das | 1 + modules/dasLLVM/examples/hello_llvm_jit_function.das | 3 +++ src/builtin/module_builtin_dasbind.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/dasLLVM/daslib/llvm_macro.das b/modules/dasLLVM/daslib/llvm_macro.das index 6602a90d69..b76993fab8 100644 --- a/modules/dasLLVM/daslib/llvm_macro.das +++ b/modules/dasLLVM/daslib/llvm_macro.das @@ -83,10 +83,6 @@ def finalize_jit(use_dll : bool; gen_exe : bool; lib_handle : DLLHandle?) : JitS class JIT_LLVM : AstSimulateMacro { def override simulate(prog : Program?; var ctx : Context?) : bool { return true if (is_in_completion() || is_compiling_macros() || is_folding()) - if (!prog.policies.jit_enabled) { - error("jit is disabled. use `-jit` option for daScript, or enable jit via CodeOfPolicies") - return false - } var funcs : array var disabled : array var disableJitVisitor = new DisableJitVisitor() diff --git a/modules/dasLLVM/examples/hello_jit.das b/modules/dasLLVM/examples/hello_jit.das index 4feac0acf8..44efcc5f95 100644 --- a/modules/dasLLVM/examples/hello_jit.das +++ b/modules/dasLLVM/examples/hello_jit.das @@ -1,5 +1,6 @@ options gen2 require jit +require llvm/daslib/llvm_macro // This require will jit all functions [jit] def add(a, b : int) { diff --git a/modules/dasLLVM/examples/hello_llvm_jit_function.das b/modules/dasLLVM/examples/hello_llvm_jit_function.das index 3e6e2aab3c..10bf43cc7a 100644 --- a/modules/dasLLVM/examples/hello_llvm_jit_function.das +++ b/modules/dasLLVM/examples/hello_llvm_jit_function.das @@ -40,7 +40,10 @@ def main { LLVMVerifyModule(mod, LLVMVerifierFailureAction.LLVMAbortProcessAction) var engine : LLVMExecutionEngineRef LLVMLinkInMCJIT() + LLVMInitializeAllTargetInfos() LLVMInitializeAllTargets() + LLVMInitializeAllTargetMCs() + LLVMInitializeAllAsmPrinters() LLVMCreateJITCompilerForModule(engine, mod) var pfun = LLVMGetFunctionAddress(engine, "sum") unsafe { diff --git a/src/builtin/module_builtin_dasbind.cpp b/src/builtin/module_builtin_dasbind.cpp index aa35b7e129..b240418e04 100644 --- a/src/builtin/module_builtin_dasbind.cpp +++ b/src/builtin/module_builtin_dasbind.cpp @@ -231,7 +231,7 @@ FastCallWrapper getExtraWrapper ( int nargs, int res, int perm ) { */ } if ( !libhandle ) { - libhandle = loadDynamicLibrary((getDasRoot() + "/" + library).c_str()); + libhandle = loadDynamicLibrary((getDasRoot() + "/lib/" + library).c_str()); } } } From d711899911ffc0363434b42194cd21bb95562de7 Mon Sep 17 00:00:00 2001 From: Boris Batkin Date: Tue, 24 Mar 2026 08:21:41 -0700 Subject: [PATCH 4/9] Enable ast_match tests in interpreter mode (skip AOT and JIT) Co-Authored-By: Claude Opus 4.6 (1M context) --- tests/.das_test | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/.das_test b/tests/.das_test index 076b9e316b..1a1a8575df 100644 --- a/tests/.das_test +++ b/tests/.das_test @@ -32,7 +32,12 @@ def can_visit_folder(folder_name : string; var result : bool?) { } } if (folder_name == "ast_match") { - *result = false - return + let args <- get_command_line_arguments() + for (arg in args) { + if (arg == "--use-aot" || arg == "-jit") { + *result = false + return + } + } } } From 80e3cb3ea276fedc73d365c1ec956e68a472af26 Mon Sep 17 00:00:00 2001 From: Boris Batkin Date: Tue, 24 Mar 2026 09:11:33 -0700 Subject: [PATCH 5/9] Add debug_expression prints to qm_run and qm_run_function Temporary diagnostics to debug CI failures on linux 64 Release. Prints the full AST being matched before every qmatch/qmatch_function call. Co-Authored-By: Claude Opus 4.6 (1M context) --- daslib/ast_match.das | 2 ++ 1 file changed, 2 insertions(+) diff --git a/daslib/ast_match.das b/daslib/ast_match.das index 5715f3bf74..2af19a689d 100644 --- a/daslib/ast_match.das +++ b/daslib/ast_match.das @@ -47,6 +47,7 @@ struct QMatchResult { def qm_run(var expr : ExpressionPtr&; blk : block<(var arg : ExpressionPtr) : QMatchResult>) : QMatchResult { //! Invoke a matching block on the expression. //! Used internally by the ``qmatch`` macro. + print("qm_run input: {debug_expression(expr)}\n") return invoke(blk, expr) } @@ -55,6 +56,7 @@ def qm_run_function(var func : FunctionPtr&; blk : block<(var body : ExpressionP if (func == null) { return qm_fail_null() } + print("qm_run_function func={func.name}\n body: {debug_expression(func.body)}\n") return invoke(blk, func.body, get_ptr(func)) } From 5a0f563749dcfc29a186ea824dc157eb374e7ed4 Mon Sep 17 00:00:00 2001 From: Boris Batkin Date: Tue, 24 Mar 2026 09:52:59 -0700 Subject: [PATCH 6/9] Skip ast_match under coverage -- UAF in coverage + compile-time AST introspection Coverage instrumentation modifies function bodies while compile-time macros hold references to them, causing heap-use-after-free (confirmed with ASAN). Also removes temporary debug prints. Co-Authored-By: Claude Opus 4.6 (1M context) --- daslib/ast_match.das | 2 -- tests/.das_test | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/daslib/ast_match.das b/daslib/ast_match.das index 2af19a689d..5715f3bf74 100644 --- a/daslib/ast_match.das +++ b/daslib/ast_match.das @@ -47,7 +47,6 @@ struct QMatchResult { def qm_run(var expr : ExpressionPtr&; blk : block<(var arg : ExpressionPtr) : QMatchResult>) : QMatchResult { //! Invoke a matching block on the expression. //! Used internally by the ``qmatch`` macro. - print("qm_run input: {debug_expression(expr)}\n") return invoke(blk, expr) } @@ -56,7 +55,6 @@ def qm_run_function(var func : FunctionPtr&; blk : block<(var body : ExpressionP if (func == null) { return qm_fail_null() } - print("qm_run_function func={func.name}\n body: {debug_expression(func.body)}\n") return invoke(blk, func.body, get_ptr(func)) } diff --git a/tests/.das_test b/tests/.das_test index 1a1a8575df..3158d979bf 100644 --- a/tests/.das_test +++ b/tests/.das_test @@ -34,7 +34,7 @@ def can_visit_folder(folder_name : string; var result : bool?) { if (folder_name == "ast_match") { let args <- get_command_line_arguments() for (arg in args) { - if (arg == "--use-aot" || arg == "-jit") { + if (arg == "--use-aot" || arg == "-jit" || starts_with(arg, "--cov-path")) { *result = false return } From 1c6f4f28428e6fbaf621751ba1b1b9d4a0e97ef9 Mon Sep 17 00:00:00 2001 From: Churkin Aleksey Date: Wed, 25 Mar 2026 01:09:11 +0300 Subject: [PATCH 7/9] jit: add dummy terminator If JIT was compiled earlier without this change it cause LLVM IR verification fail (e.g. on benchctl util). --- modules/dasLLVM/daslib/llvm_jit.das | 4 ++++ utils/CMakeLists.txt | 1 + 2 files changed, 5 insertions(+) diff --git a/modules/dasLLVM/daslib/llvm_jit.das b/modules/dasLLVM/daslib/llvm_jit.das index 22c16a701f..4e3a7cc1b4 100644 --- a/modules/dasLLVM/daslib/llvm_jit.das +++ b/modules/dasLLVM/daslib/llvm_jit.das @@ -2714,6 +2714,10 @@ class public LlvmJitVisitor : AstVisitor { LLVMPositionBuilderAtEnd(g_builder, blk.if_end) if (blk.if_true_terminates && blk.if_false_terminates) { LLVMBuildUnreachable(g_builder) + // Dead code after fully-terminating if-else still gets visited. + // Position builder at a dummy block to avoid a CE. + var dead_block = append_basic_block("dead_at_line_{int(expr.at.line)}_") + LLVMPositionBuilderAtEnd(g_builder, dead_block) } return expr } diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index d3eb5a21ea..450a751b24 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -4,6 +4,7 @@ set(DAS_UTILS aot + benchctl dascov daspkg mcp From eddc91618783a3d0b179f15ab690155fb016405d Mon Sep 17 00:00:00 2001 From: Churkin Aleksey Date: Mon, 23 Mar 2026 23:21:18 +0300 Subject: [PATCH 8/9] ci: add extended checks Extended checks will include tests not related to compiler itself. This check will have `build` folder cached to reduce CI time. - daslang_static run (it's similar to daslang, so no need to run it in every configuration) - tests coverage - das-fmt - standalone executables - utils tests - examples from modules Tree sitter grammar was stored in lib before, however config expects it to be stored in tree-sitter-daslang/ Fixes #2305 --- .github/workflows/build.yml | 25 +-- .github/workflows/extended_checks.yml | 180 ++++++++++++++++++++ CMakeLists.txt | 33 ++++ modules/dasLLVM/CMakeLists.txt | 5 + modules/dasPEG/CMakeLists.txt | 4 + modules/dasPEG/examples/csv.das | 10 -- modules/dasPEG/examples/declarations.das | 2 +- modules/dasPUGIXML/daslib/PUGIXML_boost.das | 2 +- modules/dasStbImage/CMakeLists.txt | 1 + utils/CMakeLists.txt | 33 ++++ utils/mcp/tools/ast_dump.das | 2 +- 11 files changed, 260 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/extended_checks.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 90fdb73631..5bbd5f5c87 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -288,19 +288,6 @@ jobs: # || (echo "Generated code changed! To reproduce use "./bin/daslang dasgen/gen_bind.das" or rebuild "daslang-dev" to regenerate aot files." && exit 1) # ;; # esac - - name: "Run formatter" - if: matrix.cmake_preset == 'Release' - run: | - set -eux - case "${{ matrix.target }}${{ matrix.architecture }}" in - windows*) - ./bin/"${{ matrix.cmake_preset }}"/daslang ./das-fmt/dasfmt.das -- --path ./ --verify - ;; - *) - ./bin/daslang ./das-fmt/dasfmt.das -- --path ./ --verify - ;; - esac - - name: "Test" run: | set -eux @@ -338,22 +325,12 @@ jobs: echo "Skipping AOT tests on 32-bit Windows" ;; windows*) - # Run single instance of daslang_static. It takes ~5 sec and - # one instance is enough to make sure it works. cd bin/"${{ matrix.cmake_preset }}" - ./daslang_static _dasroot_/dastest/dastest.das -- --color --failures-only --test ../../tests + ./test_aot -use-aot _dasroot_/dastest/dastest.das -- --use-aot --color --failures-only --timeout 900 --test ../../tests ;; *) cd bin ./test_aot -use-aot _dasroot_/dastest/dastest.das -- --use-aot --color --failures-only --timeout 900 --test ../tests - - # Run coverage only in Release since it is slow. - ./daslang _dasroot_/dastest/dastest.das -- --cov-path coverage.lcov --color --test ../tests --timeout 1800 - ./daslang _dasroot_/utils/dascov/main.das -- coverage.lcov --exclude tests/ - - # Run single instance of daslang_static. It takes ~5 sec and - # one instance is enough to make sure it works. - ./daslang_static _dasroot_/dastest/dastest.das -- --color --failures-only --test ../tests ;; esac diff --git a/.github/workflows/extended_checks.yml b/.github/workflows/extended_checks.yml new file mode 100644 index 0000000000..3e648638f8 --- /dev/null +++ b/.github/workflows/extended_checks.yml @@ -0,0 +1,180 @@ +name: extended checks + +on: + push: + branches: [master] + pull_request: + workflow_dispatch: +defaults: + run: + shell: bash + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + + ########################################################### + pre_job: + ########################################################### + runs-on: ubuntu-latest-fat + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@v5 + with: + concurrent_skipping: 'same_content' + do_not_skip: '["pull_request", "workflow_dispatch"]' + + ########################################################### + extended_checks: + ########################################################### + needs: pre_job + if: needs.pre_job.outputs.should_skip != 'true' + runs-on: ${{ matrix.runner }} + strategy: + fail-fast: false + matrix: + target: [linux, darwin15, windows] + architecture: [64, arm64] + + include: + - target: linux + runner: ubuntu-latest-fat + build_system: cmake + cmake_generator: Ninja + + - target: darwin15 + architecture: arm64 + runner: macos-15-xlarge + architecture_string: arm64 + build_system: cmake + cmake_generator: Ninja + + - target: windows + runner: windows-latest-fat + build_system: cmake + cmake_generator: Visual Studio 17 2022 + architecture_string: x64 + + exclude: + - target: linux + architecture: arm64 + - target: windows + architecture: arm64 + - target: darwin15 + architecture: 64 + + steps: + - name: "SCM Checkout" + uses: actions/checkout@v4 + + - name: "Install CMake and Ninja" + uses: lukka/get-cmake@latest + + - if: runner.os == 'Windows' + uses: ilammy/setup-nasm@v1 + + - name: "Install: Required Dev Packages" + run: | + set -eux + case "${{ matrix.target }}" in + darwin15) + brew install bison openssl + echo 'export PATH="/usr/local/opt/bison/bin:$PATH"' >> ~/.bash_profile + export LDFLAGS="-L/usr/local/opt/bison/lib -L$(brew --prefix openssl)/lib" + export CPPFLAGS="-I$(brew --prefix openssl)/include" + ;; + linux) + echo "MARCH=64" >> $GITHUB_ENV + sudo apt-get update -y + sudo apt-get install --no-install-recommends -y \ + mesa-common-dev \ + libx11-dev \ + libxrandr-dev \ + libxcursor-dev \ + libxinerama-dev \ + libxi-dev + ;; + esac + + - name: "Install openssl (Windows)" + if: runner.os == 'Windows' + run: | + git clone https://github.com/microsoft/vcpkg && ./vcpkg/bootstrap-vcpkg.sh + ./vcpkg/vcpkg install openssl:x64-windows --binarycaching + echo "VCPKG_ROOT=$(pwd)/vcpkg" >> $GITHUB_ENV + + - name: "Clone required repos" + uses: actions/checkout@v4 + with: + repository: profelis/das-fmt + path: das-fmt + + - name: "Build: Daslang (Release)" + run: | + set -eux + ACTIVE_MODULES=$(grep -v "^#" ci/release_modules.txt | cut -d':' -f2 | sed 's|^|-D|' | xargs) + case "${{ matrix.target }}" in + windows) + export PATH="/c/Strawberry/perl/bin:$PATH" + cmake --no-warn-unused-cli -B./build -G "${{ matrix.cmake_generator }}" -T host=x64 -A ${{ matrix.architecture_string }} \ + $ACTIVE_MODULES -DCMAKE_TOOLCHAIN_FILE="$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake" + cmake --build ./build --config Release --target daslang das-fmt daslang_static + ;; + *) + CC=clang CXX=clang++ cmake --no-warn-unused-cli -B./build \ + -DCMAKE_BUILD_TYPE:STRING=Release \ + -DCMAKE_OSX_ARCHITECTURES="${{ matrix.architecture_string }}" \ + -G "${{ matrix.cmake_generator }}" $ACTIVE_MODULES + cmake --build ./build --config Release --target daslang daslang_static + ;; + esac + + - name: "Install ast-grep" + run: npm install -g @ast-grep/cli + + - name: "Run examples from modules" + run: cmake --build ./build --config Release --target run_examples + + - name: "Run utils tests" + run: cmake --build ./build --config Release --target run_utils_tests + + - name: "Build standalone executables" + run: | + set -eux + cmake --build ./build --config Release --target all_utils_exe + case "${{ matrix.target }}" in + windows) BIN=./bin/Release/ ;; + *) BIN=./bin/ ;; + esac + $BIN/daslang -exe -output ./bin/das-fmt ./das-fmt/dasfmt.das + + - name: "Run formatter" + run: | + set -eux + case "${{ matrix.target }}" in + windows) BIN=./bin/Release/ ;; + *) BIN=./bin/ ;; + esac + $BIN/daslang ./das-fmt/dasfmt.das -- --path ./ --verify + $BIN/das-fmt.exe --path ./ --verify + + - name: "Test daslang_static" + run: | + set -eux + case "${{ matrix.target }}" in + windows) BIN=bin/Release TESTS=../../tests ;; + *) BIN=bin TESTS=../tests ;; + esac + cd $BIN + ./daslang_static _dasroot_/dastest/dastest.das -- --color --failures-only --test $TESTS + + - name: "Coverage" + if: matrix.target == 'linux' + run: | + cd bin + ./daslang _dasroot_/dastest/dastest.das -- --cov-path coverage.lcov --color --test ../tests --timeout 1800 + ./dascov.exe -- coverage.lcov --exclude tests/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 1dbcf96af7..9d1934ce91 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -300,6 +300,7 @@ SET(DAS_DYN_MODULES_LIBS) SET(DAS_MODULES_LIBS) SET(DAS_ALL_EXAMPLES) +SET(DAS_EXAMPLES_TO_RUN) FILE(GLOB _modules RELATIVE "${PROJECT_SOURCE_DIR}/modules" "modules/*") # Every dynamic module should pass through this macro. @@ -384,6 +385,14 @@ MACRO(ADD_EXAMPLE tgt) LIST(APPEND DAS_ALL_EXAMPLES ${tgt}) ENDMACRO() +# Register a .das file to be run as a headless example check. +# Modules call this from their CMakeLists.txt for examples that +# can run without GUI, audio, or user interaction. +MACRO(ADD_EXAMPLE_RUN das_file) + MESSAGE("EXAMPLE_RUN ${das_file}") + LIST(APPEND DAS_EXAMPLES_TO_RUN ${das_file}) +ENDMACRO() + FUNCTION(ADD_MODULE_CPP cpp) FILE(APPEND ${DAS_MODULES_NEED_INC}.temp "NEED_MODULE(Module_${cpp});\n") FILE(APPEND ${DAS_MODULES_DECLARE_INC}.temp "DECLARE_MODULE(Module_${cpp});\n") @@ -424,6 +433,24 @@ FOREACH(_example ${DAS_ALL_EXAMPLES}) ADD_DEPENDENCIES(${_example} ${DAS_MODULES_LIBS}) ENDFOREACH() +# run_examples — runs all .das files registered via ADD_EXAMPLE_RUN. +# Each example is executed with `daslang ` and must exit cleanly. +IF(DAS_EXAMPLES_TO_RUN) + SET(_run_example_commands) + FOREACH(_das ${DAS_EXAMPLES_TO_RUN}) + LIST(APPEND _run_example_commands + COMMAND ${CMAKE_COMMAND} -E echo "Running ${_das}" + COMMAND $ ${_das} + ) + ENDFOREACH() + ADD_CUSTOM_TARGET(run_examples + ${_run_example_commands} + DEPENDS daslang + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + COMMENT "Running headless module examples" + ) +ENDIF() + ADD_CUSTOM_COMMAND( DEPENDS ${DAS_MODULES_NEED_INC}.temp OUTPUT ${DAS_MODULES_NEED_INC} @@ -1599,6 +1626,12 @@ if(NOT ${DAS_TREE_SITTER_DISABLED}) C_STANDARD 11 PREFIX "" OUTPUT_NAME "daslang" + LIBRARY_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/tree-sitter-daslang" + RUNTIME_OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/tree-sitter-daslang" + RUNTIME_OUTPUT_DIRECTORY_DEBUG "${PROJECT_SOURCE_DIR}/tree-sitter-daslang" + RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${PROJECT_SOURCE_DIR}/tree-sitter-daslang" + RUNTIME_OUTPUT_DIRECTORY_RELEASE "${PROJECT_SOURCE_DIR}/tree-sitter-daslang" + RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${PROJECT_SOURCE_DIR}/tree-sitter-daslang" ) if(MSVC) target_compile_options(tree_sitter_daslang PRIVATE /W3) diff --git a/modules/dasLLVM/CMakeLists.txt b/modules/dasLLVM/CMakeLists.txt index 3e507873dd..62b1ce4957 100644 --- a/modules/dasLLVM/CMakeLists.txt +++ b/modules/dasLLVM/CMakeLists.txt @@ -98,4 +98,9 @@ IF ((NOT DAS_LLVM_INCLUDED) AND ((NOT ${DAS_LLVM_DISABLED}) OR (NOT DEFINED DAS_ install(FILES ${DASLLVM_BINDINGS} DESTINATION ${DAS_INSTALL_MODULESDIR}/dasLLVM/bindings) install(FILES ${DAS_LLVM_DIR}/.das_module DESTINATION ${DAS_INSTALL_MODULESDIR}/dasLLVM/) + ADD_EXAMPLE_RUN(modules/dasLLVM/examples/hello_jit.das) + ADD_EXAMPLE_RUN(modules/dasLLVM/examples/hello_llvm.das) + ADD_EXAMPLE_RUN(modules/dasLLVM/examples/hello_llvm_jit.das) + ADD_EXAMPLE_RUN(modules/dasLLVM/examples/hello_llvm_jit_function.das) + ENDIF() diff --git a/modules/dasPEG/CMakeLists.txt b/modules/dasPEG/CMakeLists.txt index 8093575224..459001bf47 100644 --- a/modules/dasPEG/CMakeLists.txt +++ b/modules/dasPEG/CMakeLists.txt @@ -15,4 +15,8 @@ IF(NOT DAS_PEG_INCLUDED) install(FILES ${PROJECT_SOURCE_DIR}/modules/dasPEG/.das_module DESTINATION ${DAS_INSTALL_MODULESDIR}/dasPEG ) + + ADD_EXAMPLE_RUN(modules/dasPEG/examples/csv.das) + ADD_EXAMPLE_RUN(modules/dasPEG/examples/declarations.das) + ENDIF() diff --git a/modules/dasPEG/examples/csv.das b/modules/dasPEG/examples/csv.das index 717c76e518..23e4919def 100644 --- a/modules/dasPEG/examples/csv.das +++ b/modules/dasPEG/examples/csv.das @@ -69,8 +69,6 @@ def parse_csv(CSV : string; blk : block<(val : array; err : array print - } - } - parse_csv(s3) <| $(c3; err) { print("c3 = {c3}\n") } diff --git a/modules/dasPEG/examples/declarations.das b/modules/dasPEG/examples/declarations.das index 75a278169f..5f5b937244 100644 --- a/modules/dasPEG/examples/declarations.das +++ b/modules/dasPEG/examples/declarations.das @@ -136,7 +136,7 @@ def two(prog : string; blk : block<(a : bool; err : array) : void> [export] def main { var input1 = "def main(argc, argv) \{" - var input2 = "def main(123, argv) \{" + var input2 = "def main(argv) \{" two(input1) <| $(val; err) { print("Success: {val}\n") diff --git a/modules/dasPUGIXML/daslib/PUGIXML_boost.das b/modules/dasPUGIXML/daslib/PUGIXML_boost.das index ff57ec48b9..c93175052c 100644 --- a/modules/dasPUGIXML/daslib/PUGIXML_boost.das +++ b/modules/dasPUGIXML/daslib/PUGIXML_boost.das @@ -551,7 +551,7 @@ def for_each_select(node : xml_node; xpath_query : string; blk : block<(xn : xpa [generic, template(ent), unused_argument(ent)] def from_XML(node : xml_node; ent : string; defV : string = "") : string { //! Reads the text content of *node* as a ``string``. - return as_string(node.text, defV) + return clone_string(as_string(node.text, defV)) } [generic, template(ent), unused_argument(ent)] diff --git a/modules/dasStbImage/CMakeLists.txt b/modules/dasStbImage/CMakeLists.txt index 147fa3d8d2..f7005a680b 100644 --- a/modules/dasStbImage/CMakeLists.txt +++ b/modules/dasStbImage/CMakeLists.txt @@ -52,4 +52,5 @@ IF ((NOT DAS_STBIMAGE_INCLUDED) AND (NOT ${DAS_STBIMAGE_DISABLED})) DESTINATION ${DAS_INSTALL_MODULESDIR}/dasStbImage ) + ADD_EXAMPLE_RUN(modules/dasStbImage/examples/ttf_render_test.das) ENDIF() diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 450a751b24..13e2542aae 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -34,7 +34,40 @@ foreach(util ${DAS_UTILS}) add_custom_target(${util}_exe DEPENDS ${UTIL_OUT}) endforeach() +SET(TEST_MAIN ${PROJECT_SOURCE_DIR}/dastest/dastest.das) +SET(TEST_OUT ${PROJECT_SOURCE_DIR}/bin/dastest.exe) + +add_custom_command( + OUTPUT ${TEST_OUT} + COMMAND daslang -exe -output ${PROJECT_SOURCE_DIR}/bin/dastest ${TEST_MAIN} + DEPENDS ${TEST_MAIN} daslang ${DASLIB_SOURCES} ${DASLLVM_DASLIB_SOURCES} + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + COMMENT "Building dastest executable (daslang -exe)" +) +add_custom_target(dastest_exe DEPENDS ${TEST_OUT}) + + add_custom_target(all_utils_exe) foreach(util ${DAS_UTILS}) add_dependencies(all_utils_exe ${util}_exe) endforeach() +add_dependencies(all_utils_exe dastest_exe) + +SET(DAS_UTILS_TO_TEST + dascov + mcp + perf_lint +) + +FOREACH(_das ${DAS_UTILS_TO_TEST}) + LIST(APPEND _run_utils_tests + COMMAND ${CMAKE_COMMAND} -E echo "Running tests ${_das}" + COMMAND daslang ${PROJECT_SOURCE_DIR}/dastest/dastest.das -- --test ${PROJECT_SOURCE_DIR}/utils/${_das} + DEPENDS das-fmt tree_sitter_daslang + ) +ENDFOREACH() +ADD_CUSTOM_TARGET(run_utils_tests + ${_run_utils_tests} + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} + COMMENT "Running utils tests" +) diff --git a/utils/mcp/tools/ast_dump.das b/utils/mcp/tools/ast_dump.das index 3f91f995be..0147b9b226 100644 --- a/utils/mcp/tools/ast_dump.das +++ b/utils/mcp/tools/ast_dump.das @@ -11,7 +11,7 @@ def do_ast_dump_expression(expression : string) : string { return make_tool_result("Cannot determine daslang executable path", true) } let script_path = make_temp_das_file() - let code = "options gen2\noptions rtti\nrequire ast\nrequire daslib/ast_boost\n\n[export]\ndef main() \{\n var inscope ed <- quote({expression})\n print(\"\{debug_expression(ed)\}\n\")\n\}\n" + let code = "options gen2\noptions rtti\nrequire daslib/ast\nrequire daslib/ast_boost\n\n[export]\ndef main() \{\n var inscope ed <- quote({expression})\n print(\"\{debug_expression(ed)\}\n\")\n\}\n" var write_ok = false fopen(script_path, "wb") <| $(fw) { if (fw == null) { From 4cd832527598139c3bf07c28bc0e15877b15a401 Mon Sep 17 00:00:00 2001 From: Boris Batkin Date: Tue, 24 Mar 2026 18:52:45 -0700 Subject: [PATCH 9/9] Mark target functions with [marker(no_coverage)] to fix coverage+qmatch crash Coverage instrumentation modifies function bodies, causing use-after-free when compile-time macros (find_module_function_via_rtti + qmatch_function) read those same bodies. Marking target functions no_coverage prevents the coverage visitor from injecting calls into them. Removes --cov-path skip from .das_test since no_coverage handles it. Removes temporary debug prints from ast_match.das. Co-Authored-By: Claude Opus 4.6 (1M context) --- tests/.das_test | 2 +- tests/ast_match/test_args_return.das | 6 +++--- tests/ast_match/test_block_folding.das | 20 ++++++++++---------- tests/ast_match/test_const_constructors.das | 2 +- tests/ast_match/test_const_types.das | 20 ++++++++++---------- tests/ast_match/test_generic_functions.das | 8 ++++---- tests/ast_match/test_qmatch_function.das | 4 ++-- 7 files changed, 31 insertions(+), 31 deletions(-) diff --git a/tests/.das_test b/tests/.das_test index 3158d979bf..1a1a8575df 100644 --- a/tests/.das_test +++ b/tests/.das_test @@ -34,7 +34,7 @@ def can_visit_folder(folder_name : string; var result : bool?) { if (folder_name == "ast_match") { let args <- get_command_line_arguments() for (arg in args) { - if (arg == "--use-aot" || arg == "-jit" || starts_with(arg, "--cov-path")) { + if (arg == "--use-aot" || arg == "-jit") { *result = false return } diff --git a/tests/ast_match/test_args_return.das b/tests/ast_match/test_args_return.das index 5c2bd149a3..f4801111b2 100644 --- a/tests/ast_match/test_args_return.das +++ b/tests/ast_match/test_args_return.das @@ -11,12 +11,12 @@ require dastest/testing_boost public // ── Target functions ───────────────────────────────────────────────────── -[export] +[export, marker(no_coverage)] def target_add(a, b : int) : int { return a + b } -[export] +[export, marker(no_coverage)] def target_three(x, y, z : float) : float { return x + y + z } @@ -167,7 +167,7 @@ def test_block_no_args_fails_when_target_has_args(t : T?) { // ── $a(var) — capture remaining arguments ──────────────────────────────── -[export] +[export, marker(no_coverage)] def target_five(a, b : int; c : float; d : string; e : bool) : int { return a } diff --git a/tests/ast_match/test_block_folding.das b/tests/ast_match/test_block_folding.das index f4d54d7473..8f08db046d 100644 --- a/tests/ast_match/test_block_folding.das +++ b/tests/ast_match/test_block_folding.das @@ -12,14 +12,14 @@ require dastest/testing_boost public // ── Target functions — these go through the full compiler/optimizer ── // BlockFolding: dead code after return is removed -[export] +[export, marker(no_coverage)] def fold_dead_code(a : int) : int { return a + 1 return a + 2 } // CondFolding: if/else return → ternary -[export] +[export, marker(no_coverage)] def fold_if_else_return(a, b, c : int) : int { if (a < 5) { return b @@ -29,7 +29,7 @@ def fold_if_else_return(a, b, c : int) : int { } // CondFolding: chain of if-return → nested ternary -[export] +[export, marker(no_coverage)] def fold_if_chain(a, b : int) : int { if (a == 1) { return 10 @@ -44,14 +44,14 @@ def fold_if_chain(a, b : int) : int { } // BlockFolding: trailing return on void function removed -[export] +[export, marker(no_coverage)] def fold_void_trailing_return() : void { print("hello\n") return } // BlockFolding: nested block flattened into parent -[export] +[export, marker(no_coverage)] def fold_nested_block(a : int) : int { { var x = a + 1 @@ -60,7 +60,7 @@ def fold_nested_block(a : int) : int { } // BlockFolding: dead code after terminating if/else -[export] +[export, marker(no_coverage)] def fold_dead_after_if_else(a, b : int) : int { if (a > 0) { return a @@ -71,7 +71,7 @@ def fold_dead_after_if_else(a, b : int) : int { } // CondFolding: if-break chain → if/else in for -[export] +[export, marker(no_coverage)] def fold_if_break(a : int) : int { var s = 0 for (i in range(10)) { @@ -84,7 +84,7 @@ def fold_if_break(a : int) : int { } // CondFolding: if-continue chain → if/else in for -[export] +[export, marker(no_coverage)] def fold_if_continue(a : int) : int { var s = 0 for (i in range(10)) { @@ -97,7 +97,7 @@ def fold_if_continue(a : int) : int { } // CondFolding: longer chain — 5 conditions -[export] +[export, marker(no_coverage)] def fold_if_chain_5(a : int) : int { if (a == 1) { return 10; } if (a == 2) { return 20; } @@ -108,7 +108,7 @@ def fold_if_chain_5(a : int) : int { } // CondFolding: if-return with computation before return -[export] +[export, marker(no_coverage)] def fold_if_with_work(a, b : int) : int { if (a > 0) { return a + b diff --git a/tests/ast_match/test_const_constructors.das b/tests/ast_match/test_const_constructors.das index 73fea00ab2..0c7955b945 100644 --- a/tests/ast_match/test_const_constructors.das +++ b/tests/ast_match/test_const_constructors.das @@ -7,7 +7,7 @@ require daslib/templates_boost require daslib/ast_match require dastest/testing_boost public -[export] +[export, marker(no_coverage)] def target_range13() : range { return range(13) } diff --git a/tests/ast_match/test_const_types.das b/tests/ast_match/test_const_types.das index 1d80ee16c7..4438f296e1 100644 --- a/tests/ast_match/test_const_types.das +++ b/tests/ast_match/test_const_types.das @@ -11,47 +11,47 @@ require dastest/testing_boost public // ── Target functions with various constant types ───────────────────────── -[export] +[export, marker(no_coverage)] def target_int64(x : int64) : int64 { return x + 100l } -[export] +[export, marker(no_coverage)] def target_uint(x : uint) : uint { return x + 0xFFu } -[export] +[export, marker(no_coverage)] def target_double(x : double) : double { return x + 3.14lf } -[export] +[export, marker(no_coverage)] def target_uint64(x : uint64) : uint64 { return x + 1000ul } -[export] +[export, marker(no_coverage)] def target_null_check(x : int?) : bool { return x == null } -[export] +[export, marker(no_coverage)] def target_range() : range { return range(1, 10) } -[export] +[export, marker(no_coverage)] def target_enum(x : Type) : Type { return x } -[export] +[export, marker(no_coverage)] def target_float2() : float2 { return float2(1.0, 2.0) } -[export] +[export, marker(no_coverage)] def target_int2() : int2 { return int2(3, 4) } @@ -289,7 +289,7 @@ def test_identity_enum(t : T?) { // ── Tag capture in constant constructors ───────────────────────────────── -[export] +[export, marker(no_coverage)] def target_float4() : float4 { return float4(1.0, 2.0, 3.0, 4.0) } diff --git a/tests/ast_match/test_generic_functions.das b/tests/ast_match/test_generic_functions.das index 9de807922f..f9f2b6779a 100644 --- a/tests/ast_match/test_generic_functions.das +++ b/tests/ast_match/test_generic_functions.das @@ -32,22 +32,22 @@ def generic_branch(a : auto; threshold : int) : auto { // ── Target functions that call generics ────────────────────────────────── -[export] +[export, marker(no_coverage)] def target_add_int(a, b : int) : int { return generic_add(a, b) } -[export] +[export, marker(no_coverage)] def target_add_float(a, b : float) : float { return generic_add(a, b) } -[export] +[export, marker(no_coverage)] def target_identity(x : int) : int { return generic_identity(x) } -[export] +[export, marker(no_coverage)] def target_branch(a : int; threshold : int) : int { return generic_branch(a, threshold) } diff --git a/tests/ast_match/test_qmatch_function.das b/tests/ast_match/test_qmatch_function.das index 821631e7b2..9e027c383f 100644 --- a/tests/ast_match/test_qmatch_function.das +++ b/tests/ast_match/test_qmatch_function.das @@ -11,12 +11,12 @@ require dastest/testing_boost public // ── Target functions (compiled with optimizations) ────────────────────── -[export] +[export, marker(no_coverage)] def target_simple(a, b : int) : int { return a + b } -[export] +[export, marker(no_coverage)] def target_if_return(a, b, c : int) : int { if (a < 5) { return b