From 589b8761e5d6022fdf0060c8a943e54105298de5 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 22 Nov 2025 23:20:56 +0000 Subject: [PATCH 01/60] update CMake presets for Visual Studio 2026 --- tsc/CMakePresets.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tsc/CMakePresets.json b/tsc/CMakePresets.json index c47310284..7fd7617b8 100644 --- a/tsc/CMakePresets.json +++ b/tsc/CMakePresets.json @@ -21,9 +21,9 @@ "name": "windows-msbuild", "hidden": true, "inherits": "default", - "generator": "Visual Studio 17 2022", - "displayName": "Visual Studio Professional 2022 - x86_amd64", - "description": "Using compilers for Visual Studio 17 2022 (x86_x64 architecture)", + "generator": "Visual Studio 18 2026", + "displayName": "Visual Studio Professional 2026 - x86_amd64", + "description": "Using compilers for Visual Studio 18 2026 (x86_x64 architecture)", "toolset": "host=x64", "architecture": "x64", "cacheVariables": { @@ -45,8 +45,8 @@ }, { "name": "windows-msbuild-debug", - "displayName": "Visual Studio Professional 2022 - x86_amd64 - Debug", - "description": "Using compilers for Visual Studio 17 2022 (x86_x64 architecture)", + "displayName": "Visual Studio Professional 2026 - x86_amd64 - Debug", + "description": "Using compilers for Visual Studio 18 2026 (x86_x64 architecture)", "inherits": "windows-msbuild", "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" @@ -54,8 +54,8 @@ }, { "name": "windows-msbuild-release", - "displayName": "Visual Studio Professional 2022 - x86_amd64 - Release", - "description": "Using compilers for Visual Studio 17 2022 (x86_x64 architecture)", + "displayName": "Visual Studio Professional 2026 - x86_amd64 - Release", + "description": "Using compilers for Visual Studio 18 2026 (x86_x64 architecture)", "inherits": "windows-msbuild", "cacheVariables": { "CMAKE_BUILD_TYPE": "Release" @@ -139,13 +139,13 @@ "buildPresets": [ { "name": "build-windows-msbuild-debug", - "displayName": "Visual Studio Professional 2022 - x86_amd64 - Debug", + "displayName": "Visual Studio Professional 2026 - x86_amd64 - Debug", "configurePreset": "windows-msbuild-debug", "configuration": "Debug" }, { "name": "build-windows-msbuild-release", - "displayName": "Visual Studio Professional 2022 - x86_amd64 - Release", + "displayName": "Visual Studio Professional 2026 - x86_amd64 - Release", "configurePreset": "windows-msbuild-release", "configuration": "Release" }, From bc3e564b8591e087a20d0a380f2200c0f48c9750 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sun, 23 Nov 2025 16:37:34 +0000 Subject: [PATCH 02/60] feat: Add CMakePresets.json for cross-platform build, configure, and test presets. --- tsc/CMakePresets.json | 56 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/tsc/CMakePresets.json b/tsc/CMakePresets.json index 7fd7617b8..3d844afa8 100644 --- a/tsc/CMakePresets.json +++ b/tsc/CMakePresets.json @@ -61,6 +61,62 @@ "CMAKE_BUILD_TYPE": "Release" } }, + { + "name": "windows-ninja", + "hidden": true, + "inherits": "default", + "generator": "Ninja Multi-Config", + "displayName": "Ninja Multi-Config", + "description": "Clang++ (current) x86_64-win32-gnu", + "cacheVariables": { + "CMAKE_EXPORT_COMPILE_COMMANDS": "1" + }, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "windows-ninja-debug", + "hidden": true, + "inherits": "windows-ninja", + "displayName": "Ninja Multi-Config - Debug", + "description": "Ninja Multi-Config - Debug", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "windows-ninja-release", + "hidden": true, + "inherits": "windows-ninja", + "displayName": "Ninja Multi-Config - Release", + "description": "Ninja Multi-Config - Release", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "windows-ninja-clang-debug", + "inherits": "windows-ninja-debug", + "displayName": "Clang (current) Debug", + "description": "Using compilers: C = clang, CXX = clang++", + "cacheVariables": { + "CMAKE_C_COMPILER": "clang", + "CMAKE_CXX_COMPILER": "clang++" + } + }, + { + "name": "windows-ninja-clang-release", + "inherits": "windows-ninja-release", + "displayName": "Clang (current) Release", + "description": "Using compilers: C = clang, CXX = clang++", + "cacheVariables": { + "CMAKE_C_COMPILER": "clang", + "CMAKE_CXX_COMPILER": "clang++" + } + }, { "name": "linux-ninja", "hidden": true, From 37b720ff71a62947cba5aee9b4b29cfbb3c2b61b Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sun, 23 Nov 2025 17:13:50 +0000 Subject: [PATCH 03/60] feat: Add CMake build system and VS Code debug configurations for the TypeScript compiler. --- tsc/CMakeLists.txt | 4 +- tsc/CMakePresets.json | 20 +++ tsc/tsc/.vscode/launch.json | 274 +++++++++++++++++++++++++++--------- 3 files changed, 226 insertions(+), 72 deletions(-) diff --git a/tsc/CMakeLists.txt b/tsc/CMakeLists.txt index de0e16d7c..5ec19237b 100644 --- a/tsc/CMakeLists.txt +++ b/tsc/CMakeLists.txt @@ -45,7 +45,7 @@ set(CMAKE_BUILD_TYPE "Debug") endif() if ("${MLIR_DIR}" STREQUAL "" OR "${MLIR_DIR}" STREQUAL "MLIR_DIR-NOTFOUND") - if (MSVC) + if (MSVC OR WIN32) #file(REAL_PATH "${CMAKE_SOURCE_DIR}/../3rdParty/llvm/${CMAKE_BUILD_TYPE}/lib/cmake/mlir" MLIR_DIR) get_filename_component(MLIR_DIR "${CMAKE_SOURCE_DIR}/../3rdParty/llvm/x64/${CMAKE_BUILD_TYPE}/lib/cmake/mlir" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") else() @@ -57,7 +57,7 @@ endif() message(STATUS "MLIR_DIR is ${MLIR_DIR}") if ("${Clang_DIR}" STREQUAL "" OR "${Clang_DIR}" STREQUAL "Clang_DIR-NOTFOUND") - if (MSVC) + if (MSVC OR WIN32) #file(REAL_PATH "${CMAKE_SOURCE_DIR}/../3rdParty/llvm/${CMAKE_BUILD_TYPE}/lib/cmake/clang" Clang_DIR) get_filename_component(Clang_DIR "${CMAKE_SOURCE_DIR}/../3rdParty/llvm/x64/${CMAKE_BUILD_TYPE}/lib/cmake/clang" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") else() diff --git a/tsc/CMakePresets.json b/tsc/CMakePresets.json index 3d844afa8..9a1e2a28a 100644 --- a/tsc/CMakePresets.json +++ b/tsc/CMakePresets.json @@ -97,6 +97,26 @@ "CMAKE_BUILD_TYPE": "Release" } }, + { + "name": "windows-ninja-clangcl-debug", + "inherits": "windows-ninja-debug", + "displayName": "ClangCL (current) Debug", + "description": "Using compilers: C = clang-cl, CXX = clang-cl", + "cacheVariables": { + "CMAKE_C_COMPILER": "clang-cl", + "CMAKE_CXX_COMPILER": "clang-cl" + } + }, + { + "name": "windows-ninja-clangcl-release", + "inherits": "windows-ninja-release", + "displayName": "ClangCL (current) Release", + "description": "Using compilers: C = clang-cl, CXX = clang-cl", + "cacheVariables": { + "CMAKE_C_COMPILER": "clang-cl", + "CMAKE_CXX_COMPILER": "clang-cl" + } + }, { "name": "windows-ninja-clang-debug", "inherits": "windows-ninja-debug", diff --git a/tsc/tsc/.vscode/launch.json b/tsc/tsc/.vscode/launch.json index 3115a0ce5..cacef08b4 100644 --- a/tsc/tsc/.vscode/launch.json +++ b/tsc/tsc/.vscode/launch.json @@ -49,7 +49,7 @@ ], "externalConsole": true, "MIMode": "gdb", - "miDebuggerPath": "/usr/bin/gdb", + "miDebuggerPath": "/usr/bin/gdb", "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], @@ -175,7 +175,7 @@ "environment": [], "console": "externalTerminal", "visualizerFile": "${workspaceFolder}/../tsc.natvis" - }, + }, { "name": "(Windows) tsc.exe - OBJ", "type": "cppvsdbg", @@ -193,7 +193,7 @@ "environment": [], "console": "externalTerminal", "visualizerFile": "${workspaceFolder}/../tsc.natvis" - }, + }, { "name": "(Windows) tsc.exe - ASM", "type": "cppvsdbg", @@ -212,7 +212,7 @@ "environment": [], "console": "externalTerminal", "visualizerFile": "${workspaceFolder}/../tsc.natvis" - }, + }, { "name": "(Windows) tsc.exe - EXE", "type": "cppvsdbg", @@ -229,14 +229,65 @@ "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [ - { "name": "DEFAULT_LIB_PATH", "value": "${workspaceFolder}/../../../TypeScriptCompilerDefaultLib/__build/release" }, - { "name": "GC_LIB_PATH", "value": "${workspaceFolder}/../../__build/gc/msbuild/x64/debug/Debug" }, - { "name": "LLVM_LIB_PATH", "value": "${workspaceFolder}/../../__build/llvm/msbuild/x64/debug/Debug/lib" }, - { "name": "TSC_LIB_PATH", "value": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/lib" }, + { + "name": "DEFAULT_LIB_PATH", + "value": "${workspaceFolder}/../../../TypeScriptCompilerDefaultLib/__build/release" + }, + { + "name": "GC_LIB_PATH", + "value": "${workspaceFolder}/../../__build/gc/msbuild/x64/debug/Debug" + }, + { + "name": "LLVM_LIB_PATH", + "value": "${workspaceFolder}/../../__build/llvm/msbuild/x64/debug/Debug/lib" + }, + { + "name": "TSC_LIB_PATH", + "value": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/lib" + }, ], "console": "externalTerminal", "visualizerFile": "${workspaceFolder}/../tsc.natvis" - }, + }, + { + "name": "(Windows) (ClangCL) tsc.exe - EXE", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/../../__build/tsc/windows-ninja-clangcl-debug/bin/tsc.exe", + "args": [ + "-emit=exe", + "-di", + "-lldb", + "-mlir-disable-threading", + "-debug-only=mlir", + "-mtriple=x86_64-pc-windows-msvc", + "I:/Playground/1.ts", + ], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [ + { + "name": "DEFAULT_LIB_PATH", + "value": "${workspaceFolder}/../../../TypeScriptCompilerDefaultLib/__build/release" + }, + { + "name": "GC_LIB_PATH", + "value": "${workspaceFolder}/../../__build/gc/msbuild/x64/debug/Debug" + }, + { + "name": "LLVM_LIB_PATH", + "value": "${workspaceFolder}/../../__build/llvm/msbuild/x64/debug/Debug/lib" + }, + { + "name": "TSC_LIB_PATH", + "value": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/lib" + }, + ], + "console": "externalTerminal", + "visualizerFile": "${workspaceFolder}/../tsc.natvis", + "MIMode": "gdb", + "MIDebuggerPath": "lldb.exe", + }, { "name": "(Windows) tsc.exe - EXE(DI) - NO DEFAULT", "type": "cppvsdbg", @@ -256,13 +307,22 @@ "stopAtEntry": false, "cwd": "I:/Playground", "environment": [ - { "name": "GC_LIB_PATH", "value": "${workspaceFolder}/../../__build/gc/msbuild/x64/debug/Debug" }, - { "name": "LLVM_LIB_PATH", "value": "${workspaceFolder}/../../__build/llvm/msbuild/x64/debug/Debug/lib" }, - { "name": "TSC_LIB_PATH", "value": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/lib" }, + { + "name": "GC_LIB_PATH", + "value": "${workspaceFolder}/../../__build/gc/msbuild/x64/debug/Debug" + }, + { + "name": "LLVM_LIB_PATH", + "value": "${workspaceFolder}/../../__build/llvm/msbuild/x64/debug/Debug/lib" + }, + { + "name": "TSC_LIB_PATH", + "value": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/lib" + }, ], "console": "externalTerminal", "visualizerFile": "${workspaceFolder}/../tsc.natvis" - }, + }, { "name": "(Windows) tsc.exe - EXE(OPT) - NO DEFAULT", "type": "cppvsdbg", @@ -282,13 +342,22 @@ "stopAtEntry": false, "cwd": "I:/Playground", "environment": [ - { "name": "GC_LIB_PATH", "value": "${workspaceFolder}/../../__build/gc/msbuild/x64/release/Release" }, - { "name": "LLVM_LIB_PATH", "value": "${workspaceFolder}/../../__build/llvm/msbuild/x64/release/Release/lib" }, - { "name": "TSC_LIB_PATH", "value": "${workspaceFolder}/../../__build/tsc/windows-msbuild-release/lib" }, + { + "name": "GC_LIB_PATH", + "value": "${workspaceFolder}/../../__build/gc/msbuild/x64/release/Release" + }, + { + "name": "LLVM_LIB_PATH", + "value": "${workspaceFolder}/../../__build/llvm/msbuild/x64/release/Release/lib" + }, + { + "name": "TSC_LIB_PATH", + "value": "${workspaceFolder}/../../__build/tsc/windows-msbuild-release/lib" + }, ], "console": "externalTerminal", "visualizerFile": "${workspaceFolder}/../tsc.natvis" - }, + }, { "name": "(Windows) tsc.exe - EXE(OPT) (Release EXE) - NO DEFAULT", "type": "cppvsdbg", @@ -307,13 +376,22 @@ "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [ - { "name": "GC_LIB_PATH", "value": "${workspaceFolder}/../../__build/gc/msbuild/x64/release/Release" }, - { "name": "LLVM_LIB_PATH", "value": "${workspaceFolder}/../../__build/llvm/msbuild/x64/release/Release/lib" }, - { "name": "TSC_LIB_PATH", "value": "${workspaceFolder}/../../__build/tsc/windows-msbuild-release/lib" }, + { + "name": "GC_LIB_PATH", + "value": "${workspaceFolder}/../../__build/gc/msbuild/x64/release/Release" + }, + { + "name": "LLVM_LIB_PATH", + "value": "${workspaceFolder}/../../__build/llvm/msbuild/x64/release/Release/lib" + }, + { + "name": "TSC_LIB_PATH", + "value": "${workspaceFolder}/../../__build/tsc/windows-msbuild-release/lib" + }, ], "console": "externalTerminal", "visualizerFile": "${workspaceFolder}/../tsc.natvis" - }, + }, { "name": "(Windows) tsc.exe - LLVM - NO DEFAULT", "type": "cppvsdbg", @@ -332,13 +410,22 @@ "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [ - { "name": "GC_LIB_PATH", "value": "${workspaceFolder}/../../__build/gc/msbuild/x64/debug/Debug" }, - { "name": "LLVM_LIB_PATH", "value": "${workspaceFolder}/../../__build/llvm/msbuild/x64/debug/Debug/lib" }, - { "name": "TSC_LIB_PATH", "value": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/lib" }, + { + "name": "GC_LIB_PATH", + "value": "${workspaceFolder}/../../__build/gc/msbuild/x64/debug/Debug" + }, + { + "name": "LLVM_LIB_PATH", + "value": "${workspaceFolder}/../../__build/llvm/msbuild/x64/debug/Debug/lib" + }, + { + "name": "TSC_LIB_PATH", + "value": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/lib" + }, ], "console": "externalTerminal", "visualizerFile": "${workspaceFolder}/../tsc.natvis" - }, + }, { "name": "(Windows) tsc.exe - DLL", "type": "cppvsdbg", @@ -348,7 +435,7 @@ "-emit=dll", "-opt", "-debug-only=tsc,llvm,pass", - "-mlir-disable-threading", + "-mlir-disable-threading", "--gctors-as-method", "-o=I:/Playground/export_vars.dll", "I:/Playground/export_vars.ts" @@ -356,13 +443,22 @@ "stopAtEntry": false, "cwd": "I:/Playground", "environment": [ - { "name": "GC_LIB_PATH", "value": "${workspaceFolder}/../../__build/gc/msbuild/x64/debug/Debug" }, - { "name": "LLVM_LIB_PATH", "value": "${workspaceFolder}/../../__build/llvm/msbuild/x64/debug/Debug/lib" }, - { "name": "TSC_LIB_PATH", "value": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/lib" }, + { + "name": "GC_LIB_PATH", + "value": "${workspaceFolder}/../../__build/gc/msbuild/x64/debug/Debug" + }, + { + "name": "LLVM_LIB_PATH", + "value": "${workspaceFolder}/../../__build/llvm/msbuild/x64/debug/Debug/lib" + }, + { + "name": "TSC_LIB_PATH", + "value": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/lib" + }, ], "console": "externalTerminal", "visualizerFile": "${workspaceFolder}/../tsc.natvis" - }, + }, { "name": "(Windows) tsc.exe - WASM", "type": "cppvsdbg", @@ -381,7 +477,7 @@ "environment": [], "console": "externalTerminal", "visualizerFile": "${workspaceFolder}/../tsc.natvis" - }, + }, { "name": "(Windows) tsc.exe - WASM - emscripten", "type": "cppvsdbg", @@ -390,7 +486,7 @@ "args": [ "-emit=exe", "-mlir-disable-threading", - "-debug-only=pass", + "-debug-only=pass", "--nogc", "-o=c:/temp/1.wasm", "-mtriple=wasm32-pc-emscripten", @@ -402,7 +498,7 @@ "environment": [], "console": "externalTerminal", "visualizerFile": "${workspaceFolder}/../tsc.natvis" - }, + }, { "name": "(Windows) tsc.exe - JIT", "type": "cppvsdbg", @@ -423,7 +519,7 @@ "environment": [], "console": "externalTerminal", "visualizerFile": "${workspaceFolder}/../tsc.natvis" - }, + }, { "name": "(Windows) tsc.exe - JIT (no default)", "type": "cppvsdbg", @@ -443,7 +539,7 @@ "environment": [], "console": "externalTerminal", "visualizerFile": "${workspaceFolder}/../tsc.natvis" - }, + }, { "name": "(Windows) tsc.exe - JIT-OBJ", "type": "cppvsdbg", @@ -476,11 +572,10 @@ ], "stopAtEntry": false, "cwd": "${workspaceFolder}", - "environment": [ - ], + "environment": [], "console": "externalTerminal", "visualizerFile": "${workspaceFolder}/../tsc.natvis" - }, + }, { "name": "(Linux) tsc - Compile (EXE - PIC)", "type": "cppdbg", @@ -496,13 +591,22 @@ "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [ - { "name": "GC_LIB_PATH", "value": "${workspaceFolder}/../../__build/gc/ninja/debug" }, - { "name": "LLVM_LIB_PATH", "value": "${workspaceFolder}/../../__build/llvm/ninja/debug/lib" }, - { "name": "TSC_LIB_PATH", "value": "${workspaceFolder}/../../__build/tsc/linux-ninja-gcc-debug/lib" } + { + "name": "GC_LIB_PATH", + "value": "${workspaceFolder}/../../__build/gc/ninja/debug" + }, + { + "name": "LLVM_LIB_PATH", + "value": "${workspaceFolder}/../../__build/llvm/ninja/debug/lib" + }, + { + "name": "TSC_LIB_PATH", + "value": "${workspaceFolder}/../../__build/tsc/linux-ninja-gcc-debug/lib" + } ], "console": "externalTerminal", "visualizerFile": "${workspaceFolder}/../tsc.natvis" - }, + }, { "name": "(Linux) tsc - Compile (EXE)", "type": "cppdbg", @@ -517,14 +621,26 @@ "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [ - { "name": "GC_LIB_PATH", "value": "${workspaceFolder}/../../__build/gc/ninja/debug" }, - { "name": "LLVM_LIB_PATH", "value": "${workspaceFolder}/../../__build/llvm/ninja/debug/lib" }, - { "name": "TSC_LIB_PATH", "value": "${workspaceFolder}/../../__build/tsc/linux-ninja-gcc-debug/lib" }, - { "name": "DEFAULT_LIB_PATH", "value": "${workspaceFolder}/../../../TypeScriptCompilerDefaultLib/__build/release" }, + { + "name": "GC_LIB_PATH", + "value": "${workspaceFolder}/../../__build/gc/ninja/debug" + }, + { + "name": "LLVM_LIB_PATH", + "value": "${workspaceFolder}/../../__build/llvm/ninja/debug/lib" + }, + { + "name": "TSC_LIB_PATH", + "value": "${workspaceFolder}/../../__build/tsc/linux-ninja-gcc-debug/lib" + }, + { + "name": "DEFAULT_LIB_PATH", + "value": "${workspaceFolder}/../../../TypeScriptCompilerDefaultLib/__build/release" + }, ], "console": "externalTerminal", "visualizerFile": "${workspaceFolder}/../tsc.natvis" - }, + }, { "name": "(Linux) tsc - Compile (DLL - PIC)", "type": "cppdbg", @@ -540,13 +656,22 @@ "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [ - { "name": "GC_LIB_PATH", "value": "${workspaceFolder}/../../__build/gc/ninja/debug" }, - { "name": "LLVM_LIB_PATH", "value": "${workspaceFolder}/../../__build/llvm/ninja/debug/lib" }, - { "name": "TSC_LIB_PATH", "value": "${workspaceFolder}/../../__build/tsc/linux-ninja-gcc-debug/lib" } + { + "name": "GC_LIB_PATH", + "value": "${workspaceFolder}/../../__build/gc/ninja/debug" + }, + { + "name": "LLVM_LIB_PATH", + "value": "${workspaceFolder}/../../__build/llvm/ninja/debug/lib" + }, + { + "name": "TSC_LIB_PATH", + "value": "${workspaceFolder}/../../__build/tsc/linux-ninja-gcc-debug/lib" + } ], "console": "externalTerminal", "visualizerFile": "${workspaceFolder}/../tsc.natvis" - }, + }, { "name": "(Linux) tsc - Compile (Default Lib - linux file)", "type": "cppdbg", @@ -561,13 +686,22 @@ "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [ - { "name": "GC_LIB_PATH", "value": "${workspaceFolder}/../../__build/gc/ninja/debug" }, - { "name": "LLVM_LIB_PATH", "value": "${workspaceFolder}/../../__build/llvm/ninja/debug/lib" }, - { "name": "TSC_LIB_PATH", "value": "${workspaceFolder}/../../__build/tsc/linux-ninja-gcc-debug/lib" } + { + "name": "GC_LIB_PATH", + "value": "${workspaceFolder}/../../__build/gc/ninja/debug" + }, + { + "name": "LLVM_LIB_PATH", + "value": "${workspaceFolder}/../../__build/llvm/ninja/debug/lib" + }, + { + "name": "TSC_LIB_PATH", + "value": "${workspaceFolder}/../../__build/tsc/linux-ninja-gcc-debug/lib" + } ], "console": "externalTerminal", "visualizerFile": "${workspaceFolder}/../tsc.natvis" - }, + }, { "name": "(Windows) tsc.exe - DefaultLib Compile (DLL)", "type": "cppvsdbg", @@ -576,7 +710,7 @@ "args": [ "-emit=dll", "-debug-only=mlir,llvm", - "-mlir-disable-threading", + "-mlir-disable-threading", "--no-default-lib", "-o=c:/temp/lib.dll", "${workspaceFolder}/../../../TypeScriptCompilerDefaultLib/src/lib.ts" @@ -586,7 +720,7 @@ "environment": [], "console": "externalTerminal", "visualizerFile": "${workspaceFolder}/../tsc.natvis" - }, + }, { "name": "(Windows) tsc.exe - DefaultLib Compile (MLIR)", "type": "cppvsdbg", @@ -595,7 +729,7 @@ "args": [ "-emit=mlir", "-debug-only=mlir,llvm", - "-mlir-disable-threading", + "-mlir-disable-threading", "--no-default-lib", "-o=c:/temp/lib.mlir", "${workspaceFolder}/../../../TypeScriptCompilerDefaultLib/src/lib.ts" @@ -605,7 +739,7 @@ "environment": [], "console": "externalTerminal", "visualizerFile": "${workspaceFolder}/../tsc.natvis" - }, + }, { "name": "(Windows) tsc.exe - DefaultLib Compile (DI) (OBJ)", "type": "cppvsdbg", @@ -616,7 +750,7 @@ "-debug-only=mlir,llvm", "-mlir-disable-threading", "--no-default-lib", - "--di", + "--di", "-o=c:/temp/lib.obj", "${workspaceFolder}/../../../TypeScriptCompilerDefaultLib/src/lib.ts" ], @@ -625,7 +759,7 @@ "environment": [], "console": "externalTerminal", "visualizerFile": "${workspaceFolder}/../tsc.natvis" - }, + }, { "name": "(Windows) tsc.exe - DefaultLib Compile (opt) (OBJ)", "type": "cppvsdbg", @@ -634,10 +768,10 @@ "args": [ "-emit=obj", "-debug-only=mlir,llvm", - "-mlir-disable-threading", + "-mlir-disable-threading", "--opt", - "--opt_level=3", - "--export=none", + "--opt_level=3", + "--export=none", "--no-default-lib", "--verbose", "-o=c:/temp/lib.win32.obj", @@ -648,7 +782,7 @@ "environment": [], "console": "externalTerminal", "visualizerFile": "${workspaceFolder}/../tsc.natvis" - }, + }, { "name": "(Linux) tsc - DefaultLib Compile (OBJ)", "type": "cppdbg", @@ -656,11 +790,11 @@ "program": "${workspaceFolder}/../../__build/tsc/linux-ninja-gcc-debug/bin/tsc", "args": [ "-emit=obj", - "--export=none", + "--export=none", "--no-default-lib", "--di", "--opt_level=0", - "-mlir-disable-threading", + "-mlir-disable-threading", "-o=/home/alex/dev/playground/lib.obj", "${workspaceFolder}/../../../TypeScriptCompilerDefaultLib/src/lib.ts" ], @@ -669,7 +803,7 @@ "environment": [], "console": "externalTerminal", "visualizerFile": "${workspaceFolder}/../tsc.natvis" - }, + }, { "name": "(Windows-cppvsdbg) (cmake_winapp) TypeScriptApp.exe", "type": "cppvsdbg", @@ -682,7 +816,7 @@ "logging": { "moduleLoad": true, "trace": true - }, + }, }, { "name": "(Windows) tsc.exe - new VSCode project", @@ -725,6 +859,6 @@ "cwd": "${workspaceFolder}", "environment": [], "visualizerFile": "${workspaceFolder}/../tsc.natvis" - } + } ] } \ No newline at end of file From 941d8dc5e4beff74c5955bf356fdbb2d46831fd6 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sun, 23 Nov 2025 23:15:04 +0000 Subject: [PATCH 04/60] feat: Update GC library references and version to 8.2.8 across build scripts and configurations --- prepare_3rdParty.bat | 17 +++++++++-------- scripts/build_gc_debug.sh | 2 +- scripts/build_gc_debug_ninja.bat | 2 +- scripts/build_gc_debug_vs.bat | 2 +- scripts/build_gc_release.sh | 2 +- scripts/build_gc_release_ninja.bat | 2 +- scripts/build_gc_release_vs.bat | 2 +- tsc/lib/TypeScriptRuntime/CMakeLists.txt | 4 ++-- tsc/test/tester/test-runner.cpp | 4 ++-- tsc/tsc/exe.cpp | 6 +++--- tsc/tsc/tsc.cpp | 2 +- 11 files changed, 23 insertions(+), 22 deletions(-) diff --git a/prepare_3rdParty.bat b/prepare_3rdParty.bat index c9bd0447c..a29708249 100644 --- a/prepare_3rdParty.bat +++ b/prepare_3rdParty.bat @@ -5,6 +5,9 @@ if not "%1"=="" ( set BUILD=%1 ) +set GC_VER=8.2.8 +set LIBATOMIC_OPS_VER=7.8.2 + set p=%cd% IF EXIST ".\3rdParty\llvm\x64\%BUILD%\bin" ( @@ -27,17 +30,15 @@ IF EXIST ".\3rdParty\gc\x64\%BUILD%\gc-lib.lib" ( ) ELSE ( cd %p% echo "Downloading BDWGC" - curl -o gc-8.0.4.tar.gz https://www.hboehm.info/gc/gc_source/gc-8.0.4.tar.gz + curl -o gc-%GC_VER%.tar.gz https://www.hboehm.info/gc/gc_source/gc-%GC_VER%.tar.gz echo "Opening TAR.GZ BDWGC" - tar -xvzf gc-8.0.4.tar.gz -C ./3rdParty/ + tar -xvzf gc-%GC_VER%.tar.gz -C ./3rdParty/ echo "Downloading Libatomic_ops" - curl -o libatomic_ops-7.6.10.tar.gz https://www.hboehm.info/gc/gc_source/libatomic_ops-7.6.10.tar.gz + curl -o libatomic_ops-%LIBATOMIC_OPS_VER%.tar.gz https://www.hboehm.info/gc/gc_source/libatomic_ops-%LIBATOMIC_OPS_VER%.tar.gz echo "Opening TAR.GZ Libatomic_ops" - tar -xvzf libatomic_ops-7.6.10.tar.gz -C ./3rdParty/ - echo "Copy to gc-/libatomic_ops" - xcopy /E /H /C /I /Y .\3rdParty\libatomic_ops-7.6.10\ .\3rdParty\gc-8.0.4\libatomic_ops\ - echo "Copy fixes" - xcopy /E /H /C /I /Y .\docs\fix\gc\ .\3rdParty\gc-8.0.4\ + tar -xvzf libatomic_ops-%LIBATOMIC_OPS_VER%.tar.gz -C ./3rdParty/ + echo "Copy to gc-%GC_VER%/libatomic_ops" + xcopy /E /H /C /I /Y .\3rdParty\libatomic_ops-%LIBATOMIC_OPS_VER%\ .\3rdParty\gc-%GC_VER%\libatomic_ops\ cd %p% @call scripts\build_gc_%BUILD%_%TOOL%.bat cd %p% diff --git a/scripts/build_gc_debug.sh b/scripts/build_gc_debug.sh index badd60ea9..5720e5faa 100755 --- a/scripts/build_gc_debug.sh +++ b/scripts/build_gc_debug.sh @@ -2,6 +2,6 @@ mkdir -p __build/gc/ninja/debug mkdir -p 3rdParty/gc/debug cd __build/gc/ninja/debug -cmake ../../../../3rdParty/gc-8.0.4 -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/debug -Denable_threads=ON -Denable_cplusplus=OFF +cmake ../../../../3rdParty/gc-8.2.8 -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/debug -Denable_threads=ON -Denable_cplusplus=OFF cmake --build . --config Debug -j 16 cp ./lib* ../../../../3rdParty/gc/debug/ diff --git a/scripts/build_gc_debug_ninja.bat b/scripts/build_gc_debug_ninja.bat index f62e39e29..c59bb6bce 100644 --- a/scripts/build_gc_debug_ninja.bat +++ b/scripts/build_gc_debug_ninja.bat @@ -1,6 +1,6 @@ pushd mkdir __build\gc\ninja\debug cd __build\gc\ninja\debug -cmake ../../../../3rdParty/gc-8.0.4 -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/debug -Denable_threads=ON -Denable_cplusplus=OFF +cmake ../../../../3rdParty/gc-8.2.8 -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/debug -Denable_threads=ON -Denable_cplusplus=OFF cmake --build . --config Debug -j 8 popd \ No newline at end of file diff --git a/scripts/build_gc_debug_vs.bat b/scripts/build_gc_debug_vs.bat index a40805df8..793bbd4ef 100644 --- a/scripts/build_gc_debug_vs.bat +++ b/scripts/build_gc_debug_vs.bat @@ -2,6 +2,6 @@ pushd mkdir __build\gc\msbuild\x64\debug cd __build\gc\msbuild\x64\debug if exist "C:/Program Files/Microsoft Visual Studio/2022/Professional" set EXTRA_PARAM=-DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/2022/Professional" -cmake ../../../../../3rdParty/gc-8.0.4 -G "Visual Studio 17 2022" -A x64 %EXTRA_PARAM% -DCMAKE_BUILD_TYPE=Debug -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/debug -Denable_threads=ON -Denable_cplusplus=OFF +cmake ../../../../../3rdParty/gc-8.2.8 -G "Visual Studio 17 2022" -A x64 %EXTRA_PARAM% -DCMAKE_BUILD_TYPE=Debug -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/debug -Denable_threads=ON -Denable_cplusplus=OFF cmake --build . --config Debug -j 8 popd \ No newline at end of file diff --git a/scripts/build_gc_release.sh b/scripts/build_gc_release.sh index 3430c2b38..b0ff5262e 100755 --- a/scripts/build_gc_release.sh +++ b/scripts/build_gc_release.sh @@ -2,6 +2,6 @@ mkdir -p __build/gc/ninja/release mkdir -p 3rdParty/gc/release cd __build/gc/ninja/release -cmake ../../../../3rdParty/gc-8.0.4 -G "Ninja" -DCMAKE_BUILD_TYPE=Release -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -Denable_threads=ON -Denable_cplusplus=OFF +cmake ../../../../3rdParty/gc-8.2.8 -G "Ninja" -DCMAKE_BUILD_TYPE=Release -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -Denable_threads=ON -Denable_cplusplus=OFF cmake --build . --config Release -j 16 cp ./lib* ../../../../3rdParty/gc/release/ \ No newline at end of file diff --git a/scripts/build_gc_release_ninja.bat b/scripts/build_gc_release_ninja.bat index b441b36c7..a837d57dc 100644 --- a/scripts/build_gc_release_ninja.bat +++ b/scripts/build_gc_release_ninja.bat @@ -1,7 +1,7 @@ pushd mkdir __build\gc\ninja\release cd __build\gc\ninja\release -cmake ../../../../3rdParty/gc-8.0.4 -G "Ninja" -DCMAKE_BUILD_TYPE=Release -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -Denable_threads=ON -Denable_cplusplus=OFF +cmake ../../../../3rdParty/gc-8.2.8 -G "Ninja" -DCMAKE_BUILD_TYPE=Release -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -Denable_threads=ON -Denable_cplusplus=OFF cmake --build . --config Release -j 8 cmake --install . --config Release popd \ No newline at end of file diff --git a/scripts/build_gc_release_vs.bat b/scripts/build_gc_release_vs.bat index 1cebaa89c..c614666f3 100644 --- a/scripts/build_gc_release_vs.bat +++ b/scripts/build_gc_release_vs.bat @@ -2,7 +2,7 @@ pushd mkdir __build\gc\msbuild\x64\release cd __build\gc\msbuild\x64\release if exist "C:/Program Files/Microsoft Visual Studio/2022/Professional" set EXTRA_PARAM=-DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/2022/Professional" -cmake ../../../../../3rdParty/gc-8.0.4 -G "Visual Studio 17 2022" -A x64 %EXTRA_PARAM% -DCMAKE_BUILD_TYPE=Release -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/release -Denable_threads=ON -Denable_cplusplus=OFF +cmake ../../../../../3rdParty/gc-8.2.8 -G "Visual Studio 17 2022" -A x64 %EXTRA_PARAM% -DCMAKE_BUILD_TYPE=Release -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/release -Denable_threads=ON -Denable_cplusplus=OFF cmake --build . --config Release -j 8 cmake --install . --config Release popd \ No newline at end of file diff --git a/tsc/lib/TypeScriptRuntime/CMakeLists.txt b/tsc/lib/TypeScriptRuntime/CMakeLists.txt index 8b1ce8dd1..21e82684b 100644 --- a/tsc/lib/TypeScriptRuntime/CMakeLists.txt +++ b/tsc/lib/TypeScriptRuntime/CMakeLists.txt @@ -1,4 +1,4 @@ -include_directories("${PROJECT_SOURCE_DIR}/../3rdParty/gc-8.0.4/include/") +include_directories("${PROJECT_SOURCE_DIR}/../3rdParty/gc-8.2.8/include/") string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWERCASE) if(MSVC) @@ -25,5 +25,5 @@ add_mlir_library(TypeScriptRuntime EXCLUDE_FROM_LIBMLIR LINK_LIBS PRIVATE - gcmt-lib + gc ) diff --git a/tsc/test/tester/test-runner.cpp b/tsc/test/tester/test-runner.cpp index b6de8490f..c0ac13f11 100644 --- a/tsc/test/tester/test-runner.cpp +++ b/tsc/test/tester/test-runner.cpp @@ -1,9 +1,9 @@ #include "helper.h" #if WIN32 -#define GC_LIB "gcmt-lib.lib " +#define GC_LIB "gc.lib " #else -#define GC_LIB "-lgcmt-lib " +#define GC_LIB "-lgc " #endif #ifdef WIN32 #define TYPESCRIPT_LIB "TypeScriptAsyncRuntime.lib " diff --git a/tsc/tsc/exe.cpp b/tsc/tsc/exe.cpp index c17c46068..135d62125 100644 --- a/tsc/tsc/exe.cpp +++ b/tsc/tsc/exe.cpp @@ -115,9 +115,9 @@ bool checkFileExistsAtPath(std::string path, std::string fileName) void checkGCLibPath(std::string path) { #ifdef WIN32 - const auto libName = "gcmt-lib.lib"; + const auto libName = "gc.lib"; #else - const auto libName = "libgcmt-lib.a"; + const auto libName = "libgc.a"; #endif checkFileExistsAtPath(path, libName); } @@ -465,7 +465,7 @@ int buildExe(int argc, char **argv, std::string objFileName, std::string additio // tsc libs if (!disableGC) { - args.push_back("-lgcmt-lib"); + args.push_back("-lgc"); } if (isTscLibNeeded) diff --git a/tsc/tsc/tsc.cpp b/tsc/tsc/tsc.cpp index 45cd34cc8..baa811768 100644 --- a/tsc/tsc/tsc.cpp +++ b/tsc/tsc/tsc.cpp @@ -114,7 +114,7 @@ cl::opt exportAction("export", cl::desc("Export Symbols. (Useful t cl::opt embedExportDeclarationsAction("embed-declarations", cl::desc("Embed declarations as member __decls_lib_XXXX. (Needed in 'import' statement)"), cl::init(true), cl::cat(TypeScriptCompilerCategory)); cl::opt defaultlibpath("default-lib-path", cl::desc("JS library path. Should point to folder/directory with subfolder '" DEFAULT_LIB_DIR "' or DEFAULT_LIB_PATH environmental variable"), cl::value_desc("defaultlibpath"), cl::cat(TypeScriptCompilerBuildCategory)); -cl::opt gclibpath("gc-lib-path", cl::desc("GC library path. Should point to file 'gcmt-lib.lib' or GC_LIB_PATH environmental variable"), cl::value_desc("gclibpath"), cl::cat(TypeScriptCompilerBuildCategory)); +cl::opt gclibpath("gc-lib-path", cl::desc("GC library path. Should point to file 'gc.lib' or GC_LIB_PATH environmental variable"), cl::value_desc("gclibpath"), cl::cat(TypeScriptCompilerBuildCategory)); cl::opt llvmlibpath("llvm-lib-path", cl::desc("LLVM library path. Should point to file 'LLVMSupport.lib' and 'LLVMDemangle' in linux or LLVM_LIB_PATH environmental variable"), cl::value_desc("llvmlibpath"), cl::cat(TypeScriptCompilerBuildCategory)); cl::opt tsclibpath("tsc-lib-path", cl::desc("TypeScript Compiler Runtime library path. Should point to file 'TypeScriptAsyncRuntime.lib' or TSC_LIB_PATH environmental variable"), cl::value_desc("tsclibpath"), cl::cat(TypeScriptCompilerBuildCategory)); cl::opt emsdksysrootpath("emsdk-sysroot-path", cl::desc("TypeScript Compiler Runtime library path. Should point to dir '<...>/emsdk/upstream/emscripten/cache/sysroot' or EMSDK_SYSROOT_PATH environmental variable. (used when '-mtriple=wasm32-pc-emscripten')"), cl::value_desc("emsdksysrootpath"), cl::cat(TypeScriptCompilerBuildCategory)); From 11a42d12746c06ba38ec7973734b4fffed0015a3 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sun, 23 Nov 2025 23:35:03 +0000 Subject: [PATCH 05/60] fix: Add missing parentheses in while loop conditions for parser decorators and modifiers --- tsc/tsc-new-parser/parser.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tsc/tsc-new-parser/parser.cpp b/tsc/tsc-new-parser/parser.cpp index 47984db2a..ac654f7f3 100644 --- a/tsc/tsc-new-parser/parser.cpp +++ b/tsc/tsc-new-parser/parser.cpp @@ -7731,13 +7731,13 @@ struct Parser // parse leading decorators if (allowDecorators && token() == SyntaxKind::AtToken) { - while (decorator = tryParseDecorator()) { + while ((decorator = tryParseDecorator())) { list = append(list, decorator); } } // parse leading modifiers - while (modifier = tryParseModifier(hasSeenStaticModifier, permitConstAsModifier, stopOnStartOfClassStaticBlock)) { + while ((modifier = tryParseModifier(hasSeenStaticModifier, permitConstAsModifier, stopOnStartOfClassStaticBlock))) { if (modifier == SyntaxKind::StaticKeyword) hasSeenStaticModifier = true; list = append(list, modifier); hasLeadingModifier = true; @@ -7745,7 +7745,7 @@ struct Parser // parse trailing decorators, but only if we parsed any leading modifiers if (hasLeadingModifier && allowDecorators && token() == SyntaxKind::AtToken) { - while (decorator = tryParseDecorator()) { + while ((decorator = tryParseDecorator())) { list = append(list, decorator); hasTrailingDecorator = true; } @@ -7753,7 +7753,7 @@ struct Parser // parse trailing modifiers, but only if we parsed any trailing decorators if (hasTrailingDecorator) { - while (modifier = tryParseModifier(hasSeenStaticModifier, permitConstAsModifier, stopOnStartOfClassStaticBlock)) { + while ((modifier = tryParseModifier(hasSeenStaticModifier, permitConstAsModifier, stopOnStartOfClassStaticBlock))) { if (modifier == SyntaxKind::StaticKeyword) hasSeenStaticModifier = true; list = append(list, modifier); } From f109c84487bc9fe8deabbe81de565ec7784eb6cd Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Mon, 24 Nov 2025 00:20:17 +0000 Subject: [PATCH 06/60] feat: Update CMake presets for Visual Studio 2022 and 2026 with new configurations --- tsc/CMakePresets.json | 85 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 70 insertions(+), 15 deletions(-) diff --git a/tsc/CMakePresets.json b/tsc/CMakePresets.json index 9a1e2a28a..ab7227efd 100644 --- a/tsc/CMakePresets.json +++ b/tsc/CMakePresets.json @@ -21,9 +21,6 @@ "name": "windows-msbuild", "hidden": true, "inherits": "default", - "generator": "Visual Studio 18 2026", - "displayName": "Visual Studio Professional 2026 - x86_amd64", - "description": "Using compilers for Visual Studio 18 2026 (x86_x64 architecture)", "toolset": "host=x64", "architecture": "x64", "cacheVariables": { @@ -44,19 +41,53 @@ } }, { - "name": "windows-msbuild-debug", + "name": "windows-msbuild-2022", + "hidden": true, + "inherits": "windows-msbuild", + "generator": "Visual Studio 17 2022", + "displayName": "Visual Studio Professional 2022 - x86_amd64", + "description": "Using compilers for Visual Studio 17 2022 (x86_x64 architecture)" + }, + { + "name": "windows-msbuild-2022-debug", + "displayName": "Visual Studio Professional 2022 - x86_amd64 - Debug", + "description": "Using compilers for Visual Studio 17 2022 (x86_x64 architecture)", + "inherits": "windows-msbuild-2022", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "windows-msbuild-2022-release", + "displayName": "Visual Studio Professional 2022 - x86_amd64 - Release", + "description": "Using compilers for Visual Studio 17 2022 (x86_x64 architecture)", + "inherits": "windows-msbuild-2022", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "windows-msbuild-2026", + "hidden": true, + "inherits": "windows-msbuild", + "generator": "Visual Studio 18 2026", + "displayName": "Visual Studio Professional 2026 - x86_amd64", + "description": "Using compilers for Visual Studio 18 2026 (x86_x64 architecture)" + }, + { + "name": "windows-msbuild-2026-debug", "displayName": "Visual Studio Professional 2026 - x86_amd64 - Debug", "description": "Using compilers for Visual Studio 18 2026 (x86_x64 architecture)", - "inherits": "windows-msbuild", + "inherits": "windows-msbuild-2026", "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" } }, { - "name": "windows-msbuild-release", + "name": "windows-msbuild-2026-release", "displayName": "Visual Studio Professional 2026 - x86_amd64 - Release", "description": "Using compilers for Visual Studio 18 2026 (x86_x64 architecture)", - "inherits": "windows-msbuild", + "inherits": "windows-msbuild-2026", "cacheVariables": { "CMAKE_BUILD_TYPE": "Release" } @@ -214,15 +245,27 @@ ], "buildPresets": [ { - "name": "build-windows-msbuild-debug", + "name": "build-windows-msbuild-2022-debug", + "displayName": "Visual Studio Professional 2022 - x86_amd64 - Debug", + "configurePreset": "windows-msbuild-2022-debug", + "configuration": "Debug" + }, + { + "name": "build-windows-msbuild-2022-release", + "displayName": "Visual Studio Professional 2022 - x86_amd64 - Release", + "configurePreset": "windows-msbuild-2022-release", + "configuration": "Release" + }, + { + "name": "build-windows-msbuild-2026-debug", "displayName": "Visual Studio Professional 2026 - x86_amd64 - Debug", - "configurePreset": "windows-msbuild-debug", + "configurePreset": "windows-msbuild-2026-debug", "configuration": "Debug" }, { - "name": "build-windows-msbuild-release", + "name": "build-windows-msbuild-2026-release", "displayName": "Visual Studio Professional 2026 - x86_amd64 - Release", - "configurePreset": "windows-msbuild-release", + "configurePreset": "windows-msbuild-2026-release", "configuration": "Release" }, { @@ -276,14 +319,26 @@ } }, { - "name": "test-windows-msbuild-debug", - "configurePreset": "windows-msbuild-debug", + "name": "test-windows-msbuild-2022-debug", + "configurePreset": "windows-msbuild-2022-debug", + "configuration": "Debug", + "inherits": "test-default" + }, + { + "name": "test-windows-msbuild-2022-release", + "configurePreset": "windows-msbuild-2022-release", + "configuration": "Release", + "inherits": "test-default" + }, + { + "name": "test-windows-msbuild-2026-debug", + "configurePreset": "windows-msbuild-2026-debug", "configuration": "Debug", "inherits": "test-default" }, { - "name": "test-windows-msbuild-release", - "configurePreset": "windows-msbuild-release", + "name": "test-windows-msbuild-2026-release", + "configurePreset": "windows-msbuild-2026-release", "configuration": "Release", "inherits": "test-default" }, From fc730fbf587c616de1962d96bb18d250add7c568 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Mon, 24 Nov 2025 00:26:14 +0000 Subject: [PATCH 07/60] chore: Update subproject commit for llvm-project to latest version --- 3rdParty/llvm-project | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdParty/llvm-project b/3rdParty/llvm-project index ab51eccf8..a832a5222 160000 --- a/3rdParty/llvm-project +++ b/3rdParty/llvm-project @@ -1 +1 @@ -Subproject commit ab51eccf88f5321e7c60591c5546b254b6afab99 +Subproject commit a832a5222e489298337fbb5876f8dcaf072c5cca From a0a07b3099d544ea2a9211fa0875b94f4874dc5f Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Mon, 24 Nov 2025 00:43:06 +0000 Subject: [PATCH 08/60] fix: Update description for Clang++ generator in CMake presets --- tsc/CMakePresets.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsc/CMakePresets.json b/tsc/CMakePresets.json index ab7227efd..9a53fafbf 100644 --- a/tsc/CMakePresets.json +++ b/tsc/CMakePresets.json @@ -98,7 +98,7 @@ "inherits": "default", "generator": "Ninja Multi-Config", "displayName": "Ninja Multi-Config", - "description": "Clang++ (current) x86_64-win32-gnu", + "description": "Clang++ (current) x86_64-pc-windows-msvc", "cacheVariables": { "CMAKE_EXPORT_COMPILE_COMMANDS": "1" }, From df4864b873c0a30ebc7d1309c97faee66bb1cfba Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Mon, 24 Nov 2025 09:04:41 +0000 Subject: [PATCH 09/60] feat: Update build scripts for Visual Studio 2026 compatibility and add missing configurations --- 3rdParty/llvm-project | 2 +- scripts/build_gc_debug_vs.bat | 4 ++-- scripts/build_gc_debug_vs17.bat | 7 +++++++ scripts/config_llvm_debug_vs.bat | 4 ++-- scripts/config_llvm_debug_vs17.bat | 7 +++++++ 5 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 scripts/build_gc_debug_vs17.bat create mode 100644 scripts/config_llvm_debug_vs17.bat diff --git a/3rdParty/llvm-project b/3rdParty/llvm-project index a832a5222..87f0227cb 160000 --- a/3rdParty/llvm-project +++ b/3rdParty/llvm-project @@ -1 +1 @@ -Subproject commit a832a5222e489298337fbb5876f8dcaf072c5cca +Subproject commit 87f0227cb60147a26a1eeb4fb06e3b505e9c7261 diff --git a/scripts/build_gc_debug_vs.bat b/scripts/build_gc_debug_vs.bat index 793bbd4ef..1b5173d00 100644 --- a/scripts/build_gc_debug_vs.bat +++ b/scripts/build_gc_debug_vs.bat @@ -1,7 +1,7 @@ pushd mkdir __build\gc\msbuild\x64\debug cd __build\gc\msbuild\x64\debug -if exist "C:/Program Files/Microsoft Visual Studio/2022/Professional" set EXTRA_PARAM=-DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/2022/Professional" -cmake ../../../../../3rdParty/gc-8.2.8 -G "Visual Studio 17 2022" -A x64 %EXTRA_PARAM% -DCMAKE_BUILD_TYPE=Debug -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/debug -Denable_threads=ON -Denable_cplusplus=OFF +if exist "C:/Program Files/Microsoft Visual Studio/18/Professional" set EXTRA_PARAM=-DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/18/Professional" +cmake ../../../../../3rdParty/gc-8.2.8 -G "Visual Studio 18 2026" -A x64 %EXTRA_PARAM% -DCMAKE_BUILD_TYPE=Debug -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/debug -Denable_threads=ON -Denable_cplusplus=OFF cmake --build . --config Debug -j 8 popd \ No newline at end of file diff --git a/scripts/build_gc_debug_vs17.bat b/scripts/build_gc_debug_vs17.bat new file mode 100644 index 000000000..793bbd4ef --- /dev/null +++ b/scripts/build_gc_debug_vs17.bat @@ -0,0 +1,7 @@ +pushd +mkdir __build\gc\msbuild\x64\debug +cd __build\gc\msbuild\x64\debug +if exist "C:/Program Files/Microsoft Visual Studio/2022/Professional" set EXTRA_PARAM=-DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/2022/Professional" +cmake ../../../../../3rdParty/gc-8.2.8 -G "Visual Studio 17 2022" -A x64 %EXTRA_PARAM% -DCMAKE_BUILD_TYPE=Debug -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/debug -Denable_threads=ON -Denable_cplusplus=OFF +cmake --build . --config Debug -j 8 +popd \ No newline at end of file diff --git a/scripts/config_llvm_debug_vs.bat b/scripts/config_llvm_debug_vs.bat index 1822cff2c..a2add03fb 100644 --- a/scripts/config_llvm_debug_vs.bat +++ b/scripts/config_llvm_debug_vs.bat @@ -1,7 +1,7 @@ pushd mkdir __build\llvm\msbuild\x64\debug cd __build\llvm\msbuild\x64\debug -if exist "C:/Program Files/Microsoft Visual Studio/2022/Professional" set EXTRA_PARAM=-DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/2022/Professional" -cmake ..\..\..\..\..\3rdParty\llvm-project\llvm -G "Visual Studio 17 2022" -A x64 %EXTRA_PARAM% -DLLVM_TARGETS_TO_BUILD="host;ARM;AArch64" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly" -DCMAKE_BUILD_TYPE=Debug -Thost=x64 -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/llvm/x64/debug -DLLVM_INSTALL_UTILS=ON -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PLUGINS=ON -DLLVM_ENABLE_PROJECTS="clang;lld;mlir" -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_REQUIRES_RTTI=ON -DLLVM_ENABLE_PIC=ON -Wno-dev +if exist "C:/Program Files/Microsoft Visual Studio/18/Professional" set EXTRA_PARAM=-DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/18/Professional" +cmake ..\..\..\..\..\3rdParty\llvm-project\llvm -G "Visual Studio 18 2026" -A x64 %EXTRA_PARAM% -DLLVM_TARGETS_TO_BUILD="host;ARM;AArch64" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly" -DCMAKE_BUILD_TYPE=Debug -Thost=x64 -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/llvm/x64/debug -DLLVM_INSTALL_UTILS=ON -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PLUGINS=ON -DLLVM_ENABLE_PROJECTS="clang;lld;mlir" -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_REQUIRES_RTTI=ON -DLLVM_ENABLE_PIC=ON -Wno-dev popd diff --git a/scripts/config_llvm_debug_vs17.bat b/scripts/config_llvm_debug_vs17.bat new file mode 100644 index 000000000..1822cff2c --- /dev/null +++ b/scripts/config_llvm_debug_vs17.bat @@ -0,0 +1,7 @@ +pushd +mkdir __build\llvm\msbuild\x64\debug +cd __build\llvm\msbuild\x64\debug +if exist "C:/Program Files/Microsoft Visual Studio/2022/Professional" set EXTRA_PARAM=-DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/2022/Professional" +cmake ..\..\..\..\..\3rdParty\llvm-project\llvm -G "Visual Studio 17 2022" -A x64 %EXTRA_PARAM% -DLLVM_TARGETS_TO_BUILD="host;ARM;AArch64" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly" -DCMAKE_BUILD_TYPE=Debug -Thost=x64 -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/llvm/x64/debug -DLLVM_INSTALL_UTILS=ON -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PLUGINS=ON -DLLVM_ENABLE_PROJECTS="clang;lld;mlir" -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_REQUIRES_RTTI=ON -DLLVM_ENABLE_PIC=ON -Wno-dev +popd + From c6537083ed3edd1bc4151ff661dc039c44f604e7 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Mon, 24 Nov 2025 09:21:07 +0000 Subject: [PATCH 10/60] chore: Update subproject commit for llvm-project to latest version --- 3rdParty/llvm-project | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdParty/llvm-project b/3rdParty/llvm-project index 87f0227cb..cd708029e 160000 --- a/3rdParty/llvm-project +++ b/3rdParty/llvm-project @@ -1 +1 @@ -Subproject commit 87f0227cb60147a26a1eeb4fb06e3b505e9c7261 +Subproject commit cd708029e0b2869e80abe31ddb175f7c35361f90 From 6bef74b69b464a4551d123b25887f00ba6e1a026 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Mon, 24 Nov 2025 11:52:29 +0000 Subject: [PATCH 11/60] feat: Update build scripts to disable shared libraries for Visual Studio and Ninja configurations --- scripts/build_gc_debug_vs.bat | 2 +- scripts/build_gc_debug_vs17.bat | 2 +- scripts/build_gc_release.sh | 2 +- scripts/build_gc_release_ninja.bat | 2 +- scripts/build_gc_release_vs.bat | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/build_gc_debug_vs.bat b/scripts/build_gc_debug_vs.bat index 1b5173d00..f6c589db1 100644 --- a/scripts/build_gc_debug_vs.bat +++ b/scripts/build_gc_debug_vs.bat @@ -2,6 +2,6 @@ pushd mkdir __build\gc\msbuild\x64\debug cd __build\gc\msbuild\x64\debug if exist "C:/Program Files/Microsoft Visual Studio/18/Professional" set EXTRA_PARAM=-DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/18/Professional" -cmake ../../../../../3rdParty/gc-8.2.8 -G "Visual Studio 18 2026" -A x64 %EXTRA_PARAM% -DCMAKE_BUILD_TYPE=Debug -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/debug -Denable_threads=ON -Denable_cplusplus=OFF +cmake ../../../../../3rdParty/gc-8.2.8 -G "Visual Studio 18 2026" -A x64 %EXTRA_PARAM% -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/debug -Denable_threads=ON -Denable_cplusplus=OFF cmake --build . --config Debug -j 8 popd \ No newline at end of file diff --git a/scripts/build_gc_debug_vs17.bat b/scripts/build_gc_debug_vs17.bat index 793bbd4ef..d440030ed 100644 --- a/scripts/build_gc_debug_vs17.bat +++ b/scripts/build_gc_debug_vs17.bat @@ -2,6 +2,6 @@ pushd mkdir __build\gc\msbuild\x64\debug cd __build\gc\msbuild\x64\debug if exist "C:/Program Files/Microsoft Visual Studio/2022/Professional" set EXTRA_PARAM=-DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/2022/Professional" -cmake ../../../../../3rdParty/gc-8.2.8 -G "Visual Studio 17 2022" -A x64 %EXTRA_PARAM% -DCMAKE_BUILD_TYPE=Debug -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/debug -Denable_threads=ON -Denable_cplusplus=OFF +cmake ../../../../../3rdParty/gc-8.2.8 -G "Visual Studio 17 2022" -A x64 %EXTRA_PARAM% -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/debug -Denable_threads=ON -Denable_cplusplus=OFF cmake --build . --config Debug -j 8 popd \ No newline at end of file diff --git a/scripts/build_gc_release.sh b/scripts/build_gc_release.sh index b0ff5262e..9040b2cfc 100755 --- a/scripts/build_gc_release.sh +++ b/scripts/build_gc_release.sh @@ -2,6 +2,6 @@ mkdir -p __build/gc/ninja/release mkdir -p 3rdParty/gc/release cd __build/gc/ninja/release -cmake ../../../../3rdParty/gc-8.2.8 -G "Ninja" -DCMAKE_BUILD_TYPE=Release -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -Denable_threads=ON -Denable_cplusplus=OFF +cmake ../../../../3rdParty/gc-8.2.8 -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -Denable_threads=ON -Denable_cplusplus=OFF cmake --build . --config Release -j 16 cp ./lib* ../../../../3rdParty/gc/release/ \ No newline at end of file diff --git a/scripts/build_gc_release_ninja.bat b/scripts/build_gc_release_ninja.bat index a837d57dc..5dabb840d 100644 --- a/scripts/build_gc_release_ninja.bat +++ b/scripts/build_gc_release_ninja.bat @@ -1,7 +1,7 @@ pushd mkdir __build\gc\ninja\release cd __build\gc\ninja\release -cmake ../../../../3rdParty/gc-8.2.8 -G "Ninja" -DCMAKE_BUILD_TYPE=Release -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -Denable_threads=ON -Denable_cplusplus=OFF +cmake ../../../../3rdParty/gc-8.2.8 -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -Denable_threads=ON -Denable_cplusplus=OFF cmake --build . --config Release -j 8 cmake --install . --config Release popd \ No newline at end of file diff --git a/scripts/build_gc_release_vs.bat b/scripts/build_gc_release_vs.bat index c614666f3..49a8fe4cd 100644 --- a/scripts/build_gc_release_vs.bat +++ b/scripts/build_gc_release_vs.bat @@ -2,7 +2,7 @@ pushd mkdir __build\gc\msbuild\x64\release cd __build\gc\msbuild\x64\release if exist "C:/Program Files/Microsoft Visual Studio/2022/Professional" set EXTRA_PARAM=-DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/2022/Professional" -cmake ../../../../../3rdParty/gc-8.2.8 -G "Visual Studio 17 2022" -A x64 %EXTRA_PARAM% -DCMAKE_BUILD_TYPE=Release -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/release -Denable_threads=ON -Denable_cplusplus=OFF +cmake ../../../../../3rdParty/gc-8.2.8 -G "Visual Studio 17 2022" -A x64 %EXTRA_PARAM% -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/release -Denable_threads=ON -Denable_cplusplus=OFF cmake --build . --config Release -j 8 cmake --install . --config Release popd \ No newline at end of file From d09b121bd228c2ef9781af80512f783d9691597d Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Mon, 24 Nov 2025 13:00:33 +0000 Subject: [PATCH 12/60] feat: Update GC and libatomic_ops versions in preparation scripts to 8.2.8 and 7.8.2 --- prepare_3rdParty_debug.sh | 11 +++++------ prepare_3rdParty_release.sh | 11 +++++------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/prepare_3rdParty_debug.sh b/prepare_3rdParty_debug.sh index 0bb8c8664..2d3772165 100755 --- a/prepare_3rdParty_debug.sh +++ b/prepare_3rdParty_debug.sh @@ -6,12 +6,11 @@ echo "Configuring LLVM (Debug)" echo "Building LLVM (Debug)" ./scripts/build_llvm_debug.sh echo "Building GC (Debug)" -curl -o gc-8.0.4.tar.gz https://www.hboehm.info/gc/gc_source/gc-8.0.4.tar.gz -curl -o libatomic_ops-7.6.10.tar.gz https://www.hboehm.info/gc/gc_source/libatomic_ops-7.6.10.tar.gz -tar -xvzf gc-8.0.4.tar.gz -C ./3rdParty/ -tar -xvzf libatomic_ops-7.6.10.tar.gz -C ./3rdParty/ -cp -a ./3rdParty/libatomic_ops-7.6.10/ ./3rdParty/gc-8.0.4/libatomic_ops/ -cp -ar ./docs/fix/gc/* ./3rdParty/gc-8.0.4/ +curl -o gc-8.2.8.tar.gz https://www.hboehm.info/gc/gc_source/gc-8.2.8.tar.gz +curl -o libatomic_ops-7.8.2.tar.gz https://www.hboehm.info/gc/gc_source/libatomic_ops-7.8.2.tar.gz +tar -xvzf gc-8.2.8.tar.gz -C ./3rdParty/ +tar -xvzf libatomic_ops-7.8.2.tar.gz -C ./3rdParty/ +cp -a ./3rdParty/libatomic_ops-7.8.2/ ./3rdParty/gc-8.2.8/libatomic_ops/ ./scripts/build_gc_debug.sh diff --git a/prepare_3rdParty_release.sh b/prepare_3rdParty_release.sh index 6b380e21a..5e480f083 100755 --- a/prepare_3rdParty_release.sh +++ b/prepare_3rdParty_release.sh @@ -6,12 +6,11 @@ echo "Configuring LLVM (Release)" echo "Building LLVM (Release)" ./scripts/build_llvm_release.sh echo "Building GC (Release)" -curl -o gc-8.0.4.tar.gz https://www.hboehm.info/gc/gc_source/gc-8.0.4.tar.gz -curl -o libatomic_ops-7.6.10.tar.gz https://www.hboehm.info/gc/gc_source/libatomic_ops-7.6.10.tar.gz -tar -xvzf gc-8.0.4.tar.gz -C ./3rdParty/ -tar -xvzf libatomic_ops-7.6.10.tar.gz -C ./3rdParty/ -cp -a ./3rdParty/libatomic_ops-7.6.10/ ./3rdParty/gc-8.0.4/libatomic_ops/ -cp -ar ./docs/fix/gc/* ./3rdParty/gc-8.0.4/ +curl -o gc-8.2.8.tar.gz https://www.hboehm.info/gc/gc_source/gc-8.2.8.tar.gz +curl -o libatomic_ops-7.8.2.tar.gz https://www.hboehm.info/gc/gc_source/libatomic_ops-7.8.2.tar.gz +tar -xvzf gc-8.2.8.tar.gz -C ./3rdParty/ +tar -xvzf libatomic_ops-7.8.2.tar.gz -C ./3rdParty/ +cp -a ./3rdParty/libatomic_ops-7.8.2/ ./3rdParty/gc-8.2.8/libatomic_ops/ ./scripts/build_gc_release.sh From 1bbee7add0abbf0a9a571d8f828ad61dc5d9ed7b Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Mon, 24 Nov 2025 13:12:29 +0000 Subject: [PATCH 13/60] chore: Update subproject commit for llvm-project to latest version --- 3rdParty/llvm-project | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdParty/llvm-project b/3rdParty/llvm-project index cd708029e..ab51eccf8 160000 --- a/3rdParty/llvm-project +++ b/3rdParty/llvm-project @@ -1 +1 @@ -Subproject commit cd708029e0b2869e80abe31ddb175f7c35361f90 +Subproject commit ab51eccf88f5321e7c60591c5546b254b6afab99 From 5f7b97f72ede6eba7d675bff1cab85a8f1174298 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Mon, 24 Nov 2025 22:54:10 +0000 Subject: [PATCH 14/60] feat: Update CMake configuration for Visual Studio 2026 compatibility and adjust runtime library settings --- scripts/config_llvm_debug_vs.bat | 2 +- scripts/config_llvm_release_vs.bat | 2 +- tsc/CMakeLists.txt | 12 +++++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/config_llvm_debug_vs.bat b/scripts/config_llvm_debug_vs.bat index a2add03fb..ab3648969 100644 --- a/scripts/config_llvm_debug_vs.bat +++ b/scripts/config_llvm_debug_vs.bat @@ -2,6 +2,6 @@ pushd mkdir __build\llvm\msbuild\x64\debug cd __build\llvm\msbuild\x64\debug if exist "C:/Program Files/Microsoft Visual Studio/18/Professional" set EXTRA_PARAM=-DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/18/Professional" -cmake ..\..\..\..\..\3rdParty\llvm-project\llvm -G "Visual Studio 18 2026" -A x64 %EXTRA_PARAM% -DLLVM_TARGETS_TO_BUILD="host;ARM;AArch64" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly" -DCMAKE_BUILD_TYPE=Debug -Thost=x64 -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/llvm/x64/debug -DLLVM_INSTALL_UTILS=ON -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PLUGINS=ON -DLLVM_ENABLE_PROJECTS="clang;lld;mlir" -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_REQUIRES_RTTI=ON -DLLVM_ENABLE_PIC=ON -Wno-dev +cmake ..\..\..\..\..\3rdParty\llvm-project\llvm -G "Visual Studio 18 2026" -A x64 %EXTRA_PARAM% -DLLVM_TARGETS_TO_BUILD="host;ARM;AArch64" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug -Thost=x64 -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/llvm/x64/debug -DLLVM_INSTALL_UTILS=ON -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PLUGINS=ON -DLLVM_ENABLE_PROJECTS="clang;lld;mlir" -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_REQUIRES_RTTI=ON -DLLVM_ENABLE_PIC=ON -Wno-dev popd diff --git a/scripts/config_llvm_release_vs.bat b/scripts/config_llvm_release_vs.bat index 9bf1bf728..fdcc7e5e7 100644 --- a/scripts/config_llvm_release_vs.bat +++ b/scripts/config_llvm_release_vs.bat @@ -2,5 +2,5 @@ pushd mkdir __build\llvm\msbuild\x64\release cd __build\llvm\msbuild\x64\release if exist "C:/Program Files/Microsoft Visual Studio/2022/Professional" set EXTRA_PARAM=-DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/2022/Professional" -cmake ..\..\..\..\..\3rdParty\llvm-project\llvm -G "Visual Studio 17 2022" -A x64 %EXTRA_PARAM% -DLLVM_TARGETS_TO_BUILD="host;ARM;AArch64" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly" -DCMAKE_BUILD_TYPE=Release -Thost=x64 -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/llvm/x64/release -DLLVM_INSTALL_UTILS=ON -DLLVM_ENABLE_ASSERTIONS=OFF -DLLVM_ENABLE_PLUGINS=ON -DLLVM_ENABLE_PROJECTS="clang;lld;mlir" -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_REQUIRES_RTTI=ON -DLLVM_ENABLE_PIC=ON +cmake ..\..\..\..\..\3rdParty\llvm-project\llvm -G "Visual Studio 17 2022" -A x64 %EXTRA_PARAM% -DLLVM_TARGETS_TO_BUILD="host;ARM;AArch64" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly" -DCMAKE_BUILD_TYPE=Release -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -Thost=x64 -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/llvm/x64/release -DLLVM_INSTALL_UTILS=ON -DLLVM_ENABLE_ASSERTIONS=OFF -DLLVM_ENABLE_PLUGINS=ON -DLLVM_ENABLE_PROJECTS="clang;lld;mlir" -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_REQUIRES_RTTI=ON -DLLVM_ENABLE_PIC=ON popd diff --git a/tsc/CMakeLists.txt b/tsc/CMakeLists.txt index 5ec19237b..4402f66ed 100644 --- a/tsc/CMakeLists.txt +++ b/tsc/CMakeLists.txt @@ -72,7 +72,7 @@ if ("${PYTHON_EXECUTABLE}" STREQUAL "" OR "${PYTHON_EXECUTABLE}" STREQUAL "PYTHO set(PYTHON_EXECUTABLE "python.exe") endif() -message(STATUS "CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE was ${CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE} and set to x64") +message(STATUS "CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE was [${CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE}], set to x64") set(CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE "x64") find_package(MLIR REQUIRED CONFIG) @@ -101,6 +101,16 @@ set(LLVM_ENABLE_PIC "ON") # clang fix set(CMAKE_BUILD_WITH_INSTALL_RPATH "ON") +if(MSVC) + # FIXME: In fact, sanitizers should support both /MT and /MD, see PR20214. +if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release") + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded") +else() + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDebug") +endif() + + message(STATUS "CMAKE_MSVC_RUNTIME_LIBRARY is ${CMAKE_MSVC_RUNTIME_LIBRARY}") +endif() list(APPEND CMAKE_MODULE_PATH "${MLIR_CMAKE_DIR}") list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}") From f25a300bb067a43c3e5cba827f64153879ef1b39 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Tue, 25 Nov 2025 00:10:06 +0000 Subject: [PATCH 15/60] feat: Update launch configuration for Visual Studio 2026 compatibility --- tsc/tsc/.vscode/launch.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tsc/tsc/.vscode/launch.json b/tsc/tsc/.vscode/launch.json index cacef08b4..03d90335e 100644 --- a/tsc/tsc/.vscode/launch.json +++ b/tsc/tsc/.vscode/launch.json @@ -503,7 +503,7 @@ "name": "(Windows) tsc.exe - JIT", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/bin/tsc.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/tsc.exe", "args": [ "-emit=jit", "I:/Playground/1.ts", @@ -511,7 +511,7 @@ "-mlir-disable-threading", "-di", "--default-lib-path=I:/TypeScriptCompilerDefaultLib/__build/debug", - "--shared-libs=${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/bin/TypeScriptRuntime.dll", + "--shared-libs=${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/TypeScriptRuntime.dll", "--shared-libs=I:/Playground/export_enum.dll" ], "stopAtEntry": false, @@ -524,7 +524,7 @@ "name": "(Windows) tsc.exe - JIT (no default)", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/bin/tsc.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/tsc.exe", "args": [ "-emit=jit", "I:/Playground/1.ts", @@ -532,7 +532,7 @@ "-mlir-disable-threading", "-di", "--no-default-lib", - "--shared-libs=${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/bin/TypeScriptRuntime.dll" + "--shared-libs=${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/TypeScriptRuntime.dll" ], "stopAtEntry": false, "cwd": "I:/Playground", From 7b42f9cccba6ebc1a88c97f10be1543202f5d12a Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Wed, 26 Nov 2025 01:02:59 +0000 Subject: [PATCH 16/60] feat: Enhance debugging support with CRT leak checking in debug mode --- tsc/include/TypeScript/Config.h | 6 ++++++ tsc/tsc/.vscode/launch.json | 3 +-- tsc/tsc/jit.cpp | 10 ++++++++++ tsc/tsc/tsc.cpp | 14 ++++++++++++++ 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/tsc/include/TypeScript/Config.h b/tsc/include/TypeScript/Config.h index 111341730..978c62c21 100644 --- a/tsc/include/TypeScript/Config.h +++ b/tsc/include/TypeScript/Config.h @@ -5,6 +5,12 @@ #pragma warning(disable : 4062) #pragma warning(disable : 4834) #pragma warning(disable : 4996) + +// CRT debug +#ifdef _DEBUG + #define _CRTDBG_MAP_ALLOC +#endif // _DEBUG + #endif //#define GC_ENABLE 1 diff --git a/tsc/tsc/.vscode/launch.json b/tsc/tsc/.vscode/launch.json index 03d90335e..35f73b16c 100644 --- a/tsc/tsc/.vscode/launch.json +++ b/tsc/tsc/.vscode/launch.json @@ -511,8 +511,7 @@ "-mlir-disable-threading", "-di", "--default-lib-path=I:/TypeScriptCompilerDefaultLib/__build/debug", - "--shared-libs=${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/TypeScriptRuntime.dll", - "--shared-libs=I:/Playground/export_enum.dll" + "--shared-libs=${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/TypeScriptRuntime.dll" ], "stopAtEntry": false, "cwd": "${workspaceFolder}", diff --git a/tsc/tsc/jit.cpp b/tsc/tsc/jit.cpp index 4653f14c6..4c6ba7b7d 100644 --- a/tsc/tsc/jit.cpp +++ b/tsc/tsc/jit.cpp @@ -86,8 +86,15 @@ int loadLibrary(mlir::SmallString<256> &libPath, llvm::StringMap &export int runJit(int argc, char **argv, mlir::ModuleOp module, CompileOptions &compileOptions) { +#if !_DEBUG + // to avoid false positive memory leak reports in release builds // Print a stack trace if we signal out. llvm::sys::PrintStackTraceOnErrorSignal(argv[0]); +#endif + + // TODO: remove it + _CrtDumpMemoryLeaks(); + llvm::PrettyStackTraceProgram X(argc, argv); llvm::setBugReportMsg("PLEASE submit a bug report to https://github.com/ASDAlexander77/TypeScriptCompiler/issues and include the crash backtrace."); @@ -101,6 +108,9 @@ int runJit(int argc, char **argv, mlir::ModuleOp module, CompileOptions &compile auto optPipeline = getTransformer(enableOpt, optLevel, sizeLevel, compileOptions); + // TODO: remove it + //_CrtDumpMemoryLeaks(); + // If shared library implements custom mlir-runner library init and destroy // functions, we'll use them to register the library with the execution // engine. Otherwise we'll pass library directly to the execution engine. diff --git a/tsc/tsc/tsc.cpp b/tsc/tsc/tsc.cpp index baa811768..da6b0ea4a 100644 --- a/tsc/tsc/tsc.cpp +++ b/tsc/tsc/tsc.cpp @@ -227,6 +227,20 @@ bool prepareDefaultLib(CompileOptions &compileOptions) int main(int argc, char **argv) { +#if _MSC_VER && _DEBUG + // Get current flag + int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ); + + // Turn on leak-checking bit. + tmpFlag |= _CRTDBG_LEAK_CHECK_DF; + + // Turn off CRT block checking bit. + tmpFlag &= ~_CRTDBG_CHECK_CRT_DF; + + // Set flag to the new value. + _CrtSetDbgFlag( tmpFlag ); +#endif + // version printer cl::SetVersionPrinter(TscPrintVersion); From af2c809bb824b2729365c3328e426a661c4edf8d Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Wed, 26 Nov 2025 01:09:30 +0000 Subject: [PATCH 17/60] chore: Remove memory leak dump call from JIT execution --- tsc/tsc/jit.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/tsc/tsc/jit.cpp b/tsc/tsc/jit.cpp index 4c6ba7b7d..f6d77aba3 100644 --- a/tsc/tsc/jit.cpp +++ b/tsc/tsc/jit.cpp @@ -92,9 +92,6 @@ int runJit(int argc, char **argv, mlir::ModuleOp module, CompileOptions &compile llvm::sys::PrintStackTraceOnErrorSignal(argv[0]); #endif - // TODO: remove it - _CrtDumpMemoryLeaks(); - llvm::PrettyStackTraceProgram X(argc, argv); llvm::setBugReportMsg("PLEASE submit a bug report to https://github.com/ASDAlexander77/TypeScriptCompiler/issues and include the crash backtrace."); From 8a76f8005b3a5f0abbd6191fe9b70a197deb4efb Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Wed, 26 Nov 2025 12:01:11 +0000 Subject: [PATCH 18/60] feat: Add memory leak prevention comment and remove unused memory leak dump call in JIT execution --- tsc/tsc/jit.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tsc/tsc/jit.cpp b/tsc/tsc/jit.cpp index f6d77aba3..ca1938121 100644 --- a/tsc/tsc/jit.cpp +++ b/tsc/tsc/jit.cpp @@ -97,6 +97,8 @@ int runJit(int argc, char **argv, mlir::ModuleOp module, CompileOptions &compile llvm::llvm_shutdown_obj Y; // Call llvm_shutdown() on exit. + // No leaks until here + registerMLIRDialects(module); // Initialize LLVM targets. @@ -105,9 +107,6 @@ int runJit(int argc, char **argv, mlir::ModuleOp module, CompileOptions &compile auto optPipeline = getTransformer(enableOpt, optLevel, sizeLevel, compileOptions); - // TODO: remove it - //_CrtDumpMemoryLeaks(); - // If shared library implements custom mlir-runner library init and destroy // functions, we'll use them to register the library with the execution // engine. Otherwise we'll pass library directly to the execution engine. From 8e7953ac37619d879cf6836f9b0c76eb004ca524 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Wed, 26 Nov 2025 12:55:42 +0000 Subject: [PATCH 19/60] feat: Update debug memory leak checking configuration in main function --- tsc/tsc/tsc.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tsc/tsc/tsc.cpp b/tsc/tsc/tsc.cpp index da6b0ea4a..b65672955 100644 --- a/tsc/tsc/tsc.cpp +++ b/tsc/tsc/tsc.cpp @@ -230,15 +230,11 @@ int main(int argc, char **argv) #if _MSC_VER && _DEBUG // Get current flag int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG ); - - // Turn on leak-checking bit. tmpFlag |= _CRTDBG_LEAK_CHECK_DF; - - // Turn off CRT block checking bit. - tmpFlag &= ~_CRTDBG_CHECK_CRT_DF; - // Set flag to the new value. _CrtSetDbgFlag( tmpFlag ); + //_CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_DEBUG); + _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR ); #endif // version printer From bdbc62580df2807d5d4b0a216ea0fe5b81ab95e3 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Wed, 26 Nov 2025 23:55:12 +0000 Subject: [PATCH 20/60] fix: Prevent false positive memory leak reports in release builds by enabling stack trace printing --- tsc/tsc/jit.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/tsc/tsc/jit.cpp b/tsc/tsc/jit.cpp index ca1938121..37720ea80 100644 --- a/tsc/tsc/jit.cpp +++ b/tsc/tsc/jit.cpp @@ -86,11 +86,9 @@ int loadLibrary(mlir::SmallString<256> &libPath, llvm::StringMap &export int runJit(int argc, char **argv, mlir::ModuleOp module, CompileOptions &compileOptions) { -#if !_DEBUG // to avoid false positive memory leak reports in release builds // Print a stack trace if we signal out. llvm::sys::PrintStackTraceOnErrorSignal(argv[0]); -#endif llvm::PrettyStackTraceProgram X(argc, argv); llvm::setBugReportMsg("PLEASE submit a bug report to https://github.com/ASDAlexander77/TypeScriptCompiler/issues and include the crash backtrace."); From 1a509725ebfb50156adee5a8a12f7ca1f645c819 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Wed, 24 Jun 2026 18:38:54 +0100 Subject: [PATCH 21/60] fixes to test runner --- tsc/test/.vscode/c_cpp_properties.json | 2 +- tsc/test/.vscode/launch.json | 18 +++++++++--------- tsc/test/tester/helper.h | 2 +- tsc/test/tester/test-runner.cpp | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tsc/test/.vscode/c_cpp_properties.json b/tsc/test/.vscode/c_cpp_properties.json index 5c736af74..3f18d42bb 100644 --- a/tsc/test/.vscode/c_cpp_properties.json +++ b/tsc/test/.vscode/c_cpp_properties.json @@ -6,7 +6,7 @@ "${workspaceFolder}/**", "${workspaceFolder}/../include", "${workspaceFolder}/../../3rdParty/llvm/x64/debug/include", - "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/include", + "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/include", "${workspaceFolder}/../tsc-new-parser" ], "defines": [ diff --git a/tsc/test/.vscode/launch.json b/tsc/test/.vscode/launch.json index 2d7431677..ea3c25a2d 100644 --- a/tsc/test/.vscode/launch.json +++ b/tsc/test/.vscode/launch.json @@ -8,10 +8,10 @@ "name": "(Windows) test-runner.exe - Launch (JIT - Shared)", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/test/tester/Debug/test-runner.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/test/tester/Debug/test-runner.exe", "args": ["-shared", "-jit", "${workspaceFolder}/../../tsc/test/tester/tests/use_shared.ts", "${workspaceFolder}/../../tsc/test/tester/tests/shared.ts"], "stopAtEntry": false, - "cwd": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/test/tester/Debug/", + "cwd": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/test/tester/Debug/", "environment": [], "externalConsole": true, "visualizerFile": "${workspaceFolder}/../tsc.natvis" @@ -20,10 +20,10 @@ "name": "(Windows) test-runner.exe - Launch (Compile - Shared)", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/test/tester/Debug/test-runner.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/test/tester/Debug/test-runner.exe", "args": ["-shared", "${workspaceFolder}/../../tsc/test/tester/tests/emit_class.ts", "${workspaceFolder}/../../tsc/test/tester/tests/decl_class.ts"], "stopAtEntry": false, - "cwd": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/test/tester/Debug/", + "cwd": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/test/tester/Debug/", "environment": [], "externalConsole": true, "visualizerFile": "${workspaceFolder}/../tsc.natvis" @@ -32,10 +32,10 @@ "name": "(Windows) test-runner.exe - Launch (Compile - Shared - Gctors-as-method)", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/test/tester/Debug/test-runner.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/test/tester/Debug/test-runner.exe", "args": ["-shared", "-gctors-as-method", "${workspaceFolder}/../../tsc/test/tester/tests/import_object_literal_with_interface.ts ", "${workspaceFolder}/../../tsc/test/tester/tests/export_object_literal_with_interface.ts"], "stopAtEntry": false, - "cwd": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/test/tester/Debug/", + "cwd": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/test/tester/Debug/", "environment": [], "externalConsole": true, "visualizerFile": "${workspaceFolder}/../tsc.natvis" @@ -44,10 +44,10 @@ "name": "(Windows) test-runner.exe - Launch (Compile-Time)", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/test/tester/Debug/test-runner.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/test/tester/Debug/test-runner.exe", "args": ["-shared", "-compile-time", "${workspaceFolder}/../../tsc/test/tester/tests/emit_compiletime_class.ts", "${workspaceFolder}/../../tsc/test/tester/tests/decl_class.ts"], "stopAtEntry": false, - "cwd": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/test/tester/Debug/", + "cwd": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/test/tester/Debug/", "environment": [], "externalConsole": true, "visualizerFile": "${workspaceFolder}/../tsc.natvis" @@ -56,7 +56,7 @@ "name": "(Windows) printer-tester.exe - Launch", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/test/print-tester/Debug/printer-tester.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/test/print-tester/Debug/printer-tester.exe", "args": ["c:\\temp\\dll.ts", "declare"], "stopAtEntry": false, "cwd": "${workspaceFolder}", diff --git a/tsc/test/tester/helper.h b/tsc/test/tester/helper.h index 75f1876be..e171ba7a5 100644 --- a/tsc/test/tester/helper.h +++ b/tsc/test/tester/helper.h @@ -145,7 +145,7 @@ std::string exec(std::string cmd) { if (retry <= 1) { - std::cerr << "Error: return code is not 0, code: " << code << " cmd: " << cmd << " output: " << result << std::endl; + std::cerr << "Error: return code is not 0, code: " << code << " cmd: " << cmd << " path: " << fs::current_path() << " output: " << result << std::endl; } else { diff --git a/tsc/test/tester/test-runner.cpp b/tsc/test/tester/test-runner.cpp index c0ac13f11..b02b684c3 100644 --- a/tsc/test/tester/test-runner.cpp +++ b/tsc/test/tester/test-runner.cpp @@ -66,7 +66,7 @@ #endif #if WIN32 -#define RUN_CMD "" +#define RUN_CMD ".\\" #define BAT_NAME ".bat" #else #define RUN_CMD "/bin/sh -f ./" From 661d7efb82c20e23e9817e68ee218b4cf367f0e8 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Wed, 24 Jun 2026 21:00:27 +0100 Subject: [PATCH 22/60] update build scripts --- scripts/build_gc_debug_vs.bat | 1 - scripts/build_gc_release_vs.bat | 3 +-- scripts/config_llvm_debug_vs.bat | 1 - scripts/config_llvm_debug_vs17.bat | 7 ------- scripts/config_llvm_debug_vs_clangcl.bat | 3 +-- scripts/config_llvm_debug_vs_intel.bat | 3 +-- scripts/config_llvm_release_vs.bat | 3 +-- scripts/config_llvm_wasm_debug.bat | 3 +-- scripts/config_llvm_wasm_release.bat | 3 +-- tsc/config_tsc_debug.bat | 3 +-- tsc/config_tsc_release.bat | 3 +-- 11 files changed, 8 insertions(+), 25 deletions(-) delete mode 100644 scripts/config_llvm_debug_vs17.bat diff --git a/scripts/build_gc_debug_vs.bat b/scripts/build_gc_debug_vs.bat index f6c589db1..5d693bb3c 100644 --- a/scripts/build_gc_debug_vs.bat +++ b/scripts/build_gc_debug_vs.bat @@ -1,7 +1,6 @@ pushd mkdir __build\gc\msbuild\x64\debug cd __build\gc\msbuild\x64\debug -if exist "C:/Program Files/Microsoft Visual Studio/18/Professional" set EXTRA_PARAM=-DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/18/Professional" cmake ../../../../../3rdParty/gc-8.2.8 -G "Visual Studio 18 2026" -A x64 %EXTRA_PARAM% -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/debug -Denable_threads=ON -Denable_cplusplus=OFF cmake --build . --config Debug -j 8 popd \ No newline at end of file diff --git a/scripts/build_gc_release_vs.bat b/scripts/build_gc_release_vs.bat index 49a8fe4cd..7a07ddf02 100644 --- a/scripts/build_gc_release_vs.bat +++ b/scripts/build_gc_release_vs.bat @@ -1,8 +1,7 @@ pushd mkdir __build\gc\msbuild\x64\release cd __build\gc\msbuild\x64\release -if exist "C:/Program Files/Microsoft Visual Studio/2022/Professional" set EXTRA_PARAM=-DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/2022/Professional" -cmake ../../../../../3rdParty/gc-8.2.8 -G "Visual Studio 17 2022" -A x64 %EXTRA_PARAM% -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/release -Denable_threads=ON -Denable_cplusplus=OFF +cmake ../../../../../3rdParty/gc-8.2.8 -G "Visual Studio 18 2026" -A x64 %EXTRA_PARAM% -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/release -Denable_threads=ON -Denable_cplusplus=OFF cmake --build . --config Release -j 8 cmake --install . --config Release popd \ No newline at end of file diff --git a/scripts/config_llvm_debug_vs.bat b/scripts/config_llvm_debug_vs.bat index ab3648969..80faf44cf 100644 --- a/scripts/config_llvm_debug_vs.bat +++ b/scripts/config_llvm_debug_vs.bat @@ -1,7 +1,6 @@ pushd mkdir __build\llvm\msbuild\x64\debug cd __build\llvm\msbuild\x64\debug -if exist "C:/Program Files/Microsoft Visual Studio/18/Professional" set EXTRA_PARAM=-DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/18/Professional" cmake ..\..\..\..\..\3rdParty\llvm-project\llvm -G "Visual Studio 18 2026" -A x64 %EXTRA_PARAM% -DLLVM_TARGETS_TO_BUILD="host;ARM;AArch64" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug -Thost=x64 -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/llvm/x64/debug -DLLVM_INSTALL_UTILS=ON -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PLUGINS=ON -DLLVM_ENABLE_PROJECTS="clang;lld;mlir" -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_REQUIRES_RTTI=ON -DLLVM_ENABLE_PIC=ON -Wno-dev popd diff --git a/scripts/config_llvm_debug_vs17.bat b/scripts/config_llvm_debug_vs17.bat deleted file mode 100644 index 1822cff2c..000000000 --- a/scripts/config_llvm_debug_vs17.bat +++ /dev/null @@ -1,7 +0,0 @@ -pushd -mkdir __build\llvm\msbuild\x64\debug -cd __build\llvm\msbuild\x64\debug -if exist "C:/Program Files/Microsoft Visual Studio/2022/Professional" set EXTRA_PARAM=-DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/2022/Professional" -cmake ..\..\..\..\..\3rdParty\llvm-project\llvm -G "Visual Studio 17 2022" -A x64 %EXTRA_PARAM% -DLLVM_TARGETS_TO_BUILD="host;ARM;AArch64" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly" -DCMAKE_BUILD_TYPE=Debug -Thost=x64 -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/llvm/x64/debug -DLLVM_INSTALL_UTILS=ON -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PLUGINS=ON -DLLVM_ENABLE_PROJECTS="clang;lld;mlir" -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_REQUIRES_RTTI=ON -DLLVM_ENABLE_PIC=ON -Wno-dev -popd - diff --git a/scripts/config_llvm_debug_vs_clangcl.bat b/scripts/config_llvm_debug_vs_clangcl.bat index 307f1e5a4..3ae3d8c22 100644 --- a/scripts/config_llvm_debug_vs_clangcl.bat +++ b/scripts/config_llvm_debug_vs_clangcl.bat @@ -1,7 +1,6 @@ pushd mkdir __build\llvm\msbuild\x64\debug cd __build\llvm\msbuild\x64\debug -if exist "C:/Program Files/Microsoft Visual Studio/2022/Professional" set EXTRA_PARAM=-DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/2022/Professional" -cmake ..\..\..\..\..\3rdParty\llvm-project\llvm -G "Visual Studio 17 2022" -A x64 %EXTRA_PARAM% -DLLVM_TARGETS_TO_BUILD="host;ARM;AArch64" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly" -DCMAKE_BUILD_TYPE=Debug -T="ClangCL" -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/llvm/x64/debug -DLLVM_INSTALL_UTILS=ON -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PLUGINS=ON -DLLVM_ENABLE_PROJECTS="clang;lld;mlir" -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_REQUIRES_RTTI=ON -DLLVM_ENABLE_PIC=ON +cmake ..\..\..\..\..\3rdParty\llvm-project\llvm -G "Visual Studio 18 2026" -A x64 %EXTRA_PARAM% -DLLVM_TARGETS_TO_BUILD="host;ARM;AArch64" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly" -DCMAKE_BUILD_TYPE=Debug -T="ClangCL" -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/llvm/x64/debug -DLLVM_INSTALL_UTILS=ON -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PLUGINS=ON -DLLVM_ENABLE_PROJECTS="clang;lld;mlir" -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_REQUIRES_RTTI=ON -DLLVM_ENABLE_PIC=ON popd diff --git a/scripts/config_llvm_debug_vs_intel.bat b/scripts/config_llvm_debug_vs_intel.bat index ce8266d71..4c838aa51 100644 --- a/scripts/config_llvm_debug_vs_intel.bat +++ b/scripts/config_llvm_debug_vs_intel.bat @@ -1,7 +1,6 @@ pushd mkdir __build\llvm\msbuild\x64\debug cd __build\llvm\msbuild\x64\debug -if exist "C:/Program Files/Microsoft Visual Studio/2022/Professional" set EXTRA_PARAM=-DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/2022/Professional" -cmake ..\..\..\..\..\3rdParty\llvm-project\llvm -G "Visual Studio 17 2022" -A x64 %EXTRA_PARAM% -DLLVM_TARGETS_TO_BUILD="host;ARM;AArch64" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly" -DCMAKE_BUILD_TYPE=Debug -T="Intel C++ Compiler 2024" -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/llvm/x64/debug -DLLVM_INSTALL_UTILS=ON -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PLUGINS=ON -DLLVM_ENABLE_PROJECTS="clang;lld;mlir" -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_REQUIRES_RTTI=ON -DLLVM_ENABLE_PIC=ON +cmake ..\..\..\..\..\3rdParty\llvm-project\llvm -G "Visual Studio 18 2026" -A x64 %EXTRA_PARAM% -DLLVM_TARGETS_TO_BUILD="host;ARM;AArch64" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly" -DCMAKE_BUILD_TYPE=Debug -T="Intel C++ Compiler 2024" -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/llvm/x64/debug -DLLVM_INSTALL_UTILS=ON -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PLUGINS=ON -DLLVM_ENABLE_PROJECTS="clang;lld;mlir" -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_REQUIRES_RTTI=ON -DLLVM_ENABLE_PIC=ON popd diff --git a/scripts/config_llvm_release_vs.bat b/scripts/config_llvm_release_vs.bat index fdcc7e5e7..29f074833 100644 --- a/scripts/config_llvm_release_vs.bat +++ b/scripts/config_llvm_release_vs.bat @@ -1,6 +1,5 @@ pushd mkdir __build\llvm\msbuild\x64\release cd __build\llvm\msbuild\x64\release -if exist "C:/Program Files/Microsoft Visual Studio/2022/Professional" set EXTRA_PARAM=-DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/2022/Professional" -cmake ..\..\..\..\..\3rdParty\llvm-project\llvm -G "Visual Studio 17 2022" -A x64 %EXTRA_PARAM% -DLLVM_TARGETS_TO_BUILD="host;ARM;AArch64" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly" -DCMAKE_BUILD_TYPE=Release -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -Thost=x64 -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/llvm/x64/release -DLLVM_INSTALL_UTILS=ON -DLLVM_ENABLE_ASSERTIONS=OFF -DLLVM_ENABLE_PLUGINS=ON -DLLVM_ENABLE_PROJECTS="clang;lld;mlir" -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_REQUIRES_RTTI=ON -DLLVM_ENABLE_PIC=ON +cmake ..\..\..\..\..\3rdParty\llvm-project\llvm -G "Visual Studio 18 2026" -A x64 %EXTRA_PARAM% -DLLVM_TARGETS_TO_BUILD="host;ARM;AArch64" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly" -DCMAKE_BUILD_TYPE=Release -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -Thost=x64 -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/llvm/x64/release -DLLVM_INSTALL_UTILS=ON -DLLVM_ENABLE_ASSERTIONS=OFF -DLLVM_ENABLE_PLUGINS=ON -DLLVM_ENABLE_PROJECTS="clang;lld;mlir" -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_REQUIRES_RTTI=ON -DLLVM_ENABLE_PIC=ON popd diff --git a/scripts/config_llvm_wasm_debug.bat b/scripts/config_llvm_wasm_debug.bat index 9fb1547b2..85b28b955 100644 --- a/scripts/config_llvm_wasm_debug.bat +++ b/scripts/config_llvm_wasm_debug.bat @@ -1,7 +1,6 @@ pushd mkdir __build\llvm\msbuild\wasm\debug cd __build\llvm\msbuild\wasm\debug -if exist "C:/Program Files/Microsoft Visual Studio/2022/Professional" set EXTRA_PARAM=-DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/2022/Professional" -emcmake cmake ..\..\..\..\..\3rdParty\llvm-project\llvm -G "Visual Studio 17 2022" -A x64 -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly" -DCMAKE_BUILD_TYPE=Debug -Thost=x64 -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/llvm/wasm/debug -DLLVM_INSTALL_UTILS=ON -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PLUGINS=ON -DLLVM_ENABLE_PROJECTS="mlir" -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_REQUIRES_RTTI=ON -DLLVM_ENABLE_PIC=ON +emcmake cmake ..\..\..\..\..\3rdParty\llvm-project\llvm -G "Visual Studio 18 2026" -A x64 -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly" -DCMAKE_BUILD_TYPE=Debug -Thost=x64 -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/llvm/wasm/debug -DLLVM_INSTALL_UTILS=ON -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PLUGINS=ON -DLLVM_ENABLE_PROJECTS="mlir" -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_REQUIRES_RTTI=ON -DLLVM_ENABLE_PIC=ON popd diff --git a/scripts/config_llvm_wasm_release.bat b/scripts/config_llvm_wasm_release.bat index 761e72a74..493529394 100644 --- a/scripts/config_llvm_wasm_release.bat +++ b/scripts/config_llvm_wasm_release.bat @@ -1,7 +1,6 @@ pushd mkdir __build\llvm\msbuild\wasm\release cd __build\llvm\msbuild\wasm\release -if exist "C:/Program Files/Microsoft Visual Studio/2022/Professional" set EXTRA_PARAM=-DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/2022/Professional" -emcmake cmake ..\..\..\..\..\3rdParty\llvm-project\llvm -G "Visual Studio 17 2022" -A x64 -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly" -DCMAKE_BUILD_TYPE=Release -Thost=x64 -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/llvm/wasm/release -DLLVM_INSTALL_UTILS=ON -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PLUGINS=ON -DLLVM_ENABLE_PROJECTS="mlir" -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_REQUIRES_RTTI=ON -DLLVM_ENABLE_PIC=ON +emcmake cmake ..\..\..\..\..\3rdParty\llvm-project\llvm -G "Visual Studio 18 2026" -A x64 -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly" -DCMAKE_BUILD_TYPE=Release -Thost=x64 -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/llvm/wasm/release -DLLVM_INSTALL_UTILS=ON -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PLUGINS=ON -DLLVM_ENABLE_PROJECTS="mlir" -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_REQUIRES_RTTI=ON -DLLVM_ENABLE_PIC=ON popd diff --git a/tsc/config_tsc_debug.bat b/tsc/config_tsc_debug.bat index 099ad0214..59e754fc6 100644 --- a/tsc/config_tsc_debug.bat +++ b/tsc/config_tsc_debug.bat @@ -1,6 +1,5 @@ pushd mkdir "../__build/tsc/msbuild/x64/debug" cd "../__build/tsc/msbuild/x64/debug" -if exist "C:/Program Files/Microsoft Visual Studio/2022/Professional" set EXTRA_PARAM=-DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/2022/Professional" -cmake ../../../../../tsc -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Debug -DTSC_PACKAGE_VERSION:STRING=1.2.3 -DTYPESCRIPT_INCLUDE_TESTS=any -Wno-dev %EXTRA_PARAM% +cmake ../../../../../tsc -G "Visual Studio 18 2026" -A x64 -DCMAKE_BUILD_TYPE=Debug -DTSC_PACKAGE_VERSION:STRING=1.2.3 -DTYPESCRIPT_INCLUDE_TESTS=any -Wno-dev %EXTRA_PARAM% popd diff --git a/tsc/config_tsc_release.bat b/tsc/config_tsc_release.bat index 774034e7d..936b422b3 100644 --- a/tsc/config_tsc_release.bat +++ b/tsc/config_tsc_release.bat @@ -1,6 +1,5 @@ pushd mkdir "../__build/tsc/msbuild/x64/release" cd "../__build/tsc/msbuild/x64/release" -if exist "C:/Program Files/Microsoft Visual Studio/2022/Professional" set EXTRA_PARAM=-DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/2022/Professional" -cmake ../../../../../tsc -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release -Wno-dev %EXTRA_PARAM% +cmake ../../../../../tsc -G "Visual Studio 18 2026" -A x64 -DCMAKE_BUILD_TYPE=Release -Wno-dev %EXTRA_PARAM% popd From 4ed9d943b14b08bd13db276fb16f7763321cdc73 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Wed, 24 Jun 2026 21:04:34 +0100 Subject: [PATCH 23/60] script update --- tsc/build_tsc_debug-test.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsc/build_tsc_debug-test.bat b/tsc/build_tsc_debug-test.bat index c0c085685..462b1735f 100644 --- a/tsc/build_tsc_debug-test.bat +++ b/tsc/build_tsc_debug-test.bat @@ -1,5 +1,5 @@ pushd -cd ../__build/tsc/windows-msbuild-debug +cd ../__build/tsc/msbuild/x64/debug set CTEST_OUTPUT_ON_FAILURE=TRUE set CTEST_PARALLEL_LEVEL=16 cmake --build . --target RUN_TESTS --config Debug --parallel From 01aed26ad16924528b97c02bd795a019e46c7311 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Wed, 24 Jun 2026 22:13:03 +0100 Subject: [PATCH 24/60] more build scripts update --- tsc/build_tsc_defaultlib_debug.bat | 6 +++--- tsc/build_tsc_defaultlib_release.bat | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 tsc/build_tsc_defaultlib_release.bat diff --git a/tsc/build_tsc_defaultlib_debug.bat b/tsc/build_tsc_defaultlib_debug.bat index 528beff83..594d982d3 100644 --- a/tsc/build_tsc_defaultlib_debug.bat +++ b/tsc/build_tsc_defaultlib_debug.bat @@ -2,8 +2,8 @@ pushd cd ../../TypeScriptCompilerDefaultLib/ call build.bat -xcopy dll\*.* "../TypeScriptCompiler/__build/tsc/windows-msbuild-debug/bin/defaultlib/dll/" /i /y -xcopy lib\*.* "../TypeScriptCompiler/__build/tsc/windows-msbuild-debug/bin/defaultlib/lib/" /i /y -xcopy src\*.d.ts "../TypeScriptCompiler/__build/tsc/windows-msbuild-debug/bin/defaultlib/" /i /y +xcopy dll\*.* "../TypeScriptCompiler/__build/tsc/windows-msbuild-2026-debug/bin/defaultlib/dll/" /i /y +xcopy lib\*.* "../TypeScriptCompiler/__build/tsc/windows-msbuild-2026-debug/bin/defaultlib/lib/" /i /y +xcopy src\*.d.ts "../TypeScriptCompiler/__build/tsc/windows-msbuild-2026-debug/bin/defaultlib/" /i /y popd diff --git a/tsc/build_tsc_defaultlib_release.bat b/tsc/build_tsc_defaultlib_release.bat new file mode 100644 index 000000000..7e93297fb --- /dev/null +++ b/tsc/build_tsc_defaultlib_release.bat @@ -0,0 +1,9 @@ +pushd +cd ../../TypeScriptCompilerDefaultLib/ +call build.bat + +xcopy dll\*.* "../TypeScriptCompiler/__build/tsc/windows-msbuild-2026-release/bin/defaultlib/dll/" /i /y +xcopy lib\*.* "../TypeScriptCompiler/__build/tsc/windows-msbuild-2026-release/bin/defaultlib/lib/" /i /y +xcopy src\*.d.ts "../TypeScriptCompiler/__build/tsc/windows-msbuild-2026-release/bin/defaultlib/" /i /y + +popd From 218e015a409becbc990c15427be5465917f601fb Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Wed, 24 Jun 2026 23:27:27 +0100 Subject: [PATCH 25/60] fix for test --- tsc/test/tester/test-runner.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tsc/test/tester/test-runner.cpp b/tsc/test/tester/test-runner.cpp index b02b684c3..31f6ff3fa 100644 --- a/tsc/test/tester/test-runner.cpp +++ b/tsc/test/tester/test-runner.cpp @@ -158,7 +158,7 @@ void createCompileBatchFile() << " /libpath:%LIBPATH% /libpath:%SDKPATH% /libpath:%UCRTPATH%" << std::endl; batFile << "del %FILENAME%.obj" << std::endl; - batFile << "call %FILENAME%.exe 1> %FILENAME%.txt 2> %FILENAME%.err" << std::endl; + batFile << "call " RUN_CMD "%FILENAME%.exe 1> %FILENAME%.txt 2> %FILENAME%.err" << std::endl; batFile << "del %FILENAME%.exe" << std::endl; batFile << "if exist %FILENAME%.lib (del %FILENAME%.lib)" << std::endl; batFile << "if exist %FILENAME%.dll (del %FILENAME%.dll)" << std::endl; @@ -355,7 +355,7 @@ void createMultiCompileBatchFile(std::string tempOutputFileNameNoExt, std::vecto << std::endl; batFile << "del " << objs.str() << std::endl; - batFile << "call %FILENAME%.exe 1> %FILENAME%.txt 2> %FILENAME%.err" << std::endl; + batFile << "call " RUN_CMD "%FILENAME%.exe 1> %FILENAME%.txt 2> %FILENAME%.err" << std::endl; batFile << "del %FILENAME%.exe" << std::endl; batFile << "if exist %FILENAME%.lib (del %FILENAME%.lib)" << std::endl; batFile << "if exist %FILENAME%.dll (del %FILENAME%.dll)" << std::endl; @@ -480,7 +480,7 @@ void createSharedMultiBatchFile(std::string tempOutputFileNameNoExt, std::vector batFile << "del " << exec_objs.str() << std::endl; - batFile << "call %FILENAME%.exe 1> %FILENAME%.txt 2> %FILENAME%.err" << std::endl; + batFile << "call " RUN_CMD "%FILENAME%.exe 1> %FILENAME%.txt 2> %FILENAME%.err" << std::endl; batFile << "echo off" << std::endl; batFile << "del " << shared_libs.str() << std::endl; From cf5159b5a2c2afd525b5ff85e157c964f1a71e6f Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Thu, 25 Jun 2026 00:08:57 +0100 Subject: [PATCH 26/60] update launch configurations for VS 2026 build paths and fix bug with not init local variable --- tsc/lib/TypeScript/MLIRGen.cpp | 27 ++++++++++++------ tsc/tsc/.vscode/launch.json | 52 +++++++++++++++++----------------- 2 files changed, 45 insertions(+), 34 deletions(-) diff --git a/tsc/lib/TypeScript/MLIRGen.cpp b/tsc/lib/TypeScript/MLIRGen.cpp index 34fe5759c..d2d0f1057 100644 --- a/tsc/lib/TypeScript/MLIRGen.cpp +++ b/tsc/lib/TypeScript/MLIRGen.cpp @@ -22593,19 +22593,30 @@ genContext); for (auto [index, typeParam] : enumerate(typeParams)) { auto isDefault = false; - auto type = index < argsCount - ? getType(typeArgs[index], genContext) - : (isDefault = true, typeParam->hasDefault() - ? getType(typeParam->getDefault(), genContext) - : typeParam->hasConstraint() - ? getType(typeParam->getConstraint(), genContext) - : mlir::Type()); + mlir::Type type; + if (index < argsCount) + { + type = getType(typeArgs[index], genContext); + } + else + { + isDefault = true; + if (typeParam->hasDefault()) + { + type = getType(typeParam->getDefault(), genContext); + } + else if (typeParam->hasConstraint()) + { + type = getType(typeParam->getConstraint(), genContext); + } + } + if (!type) { if (isDefault && !typeParam->hasDefault() && argsCount == 0) { // seems creating instance without TypeParams, can be used instance with the same name - // scuh as Point and Point + // such as Point and Point return {mlir::failure(), IsGeneric::NoDefaults}; } diff --git a/tsc/tsc/.vscode/launch.json b/tsc/tsc/.vscode/launch.json index 35f73b16c..4979b5b30 100644 --- a/tsc/tsc/.vscode/launch.json +++ b/tsc/tsc/.vscode/launch.json @@ -8,7 +8,7 @@ "name": "(Windows) tsc.exe - DUMP", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/bin/tsc.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/tsc.exe", "args": [ "-emit=ast", "C:/temp/1.ts" @@ -23,7 +23,7 @@ "name": "(Windows) tsc.exe - MLIR", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/bin/tsc.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/tsc.exe", "args": [ "-emit=mlir", "-debug-only=mlir", @@ -59,7 +59,7 @@ "name": "(Windows) tsc.exe - MLIR-AFFINE", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/bin/tsc.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/tsc.exe", "args": [ "-emit=mlir-affine", "--opt", @@ -95,7 +95,7 @@ "name": "(Windows) tsc.exe - MLIR-LLVM", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/bin/tsc.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/tsc.exe", "args": [ "-emit=mlir-llvm", "-debug-only=affine,llvm", @@ -127,7 +127,7 @@ "name": "(Windows) tsc.exe - LLVM", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/bin/tsc.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/tsc.exe", "args": [ "-emit=llvm", "-mlir-disable-threading", @@ -163,7 +163,7 @@ "name": "(Windows) tsc.exe - BC", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/bin/tsc.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/tsc.exe", "args": [ "-emit=bc", "-opt", @@ -198,7 +198,7 @@ "name": "(Windows) tsc.exe - ASM", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/bin/tsc.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/tsc.exe", "args": [ "-emit=asm", "-opt", @@ -217,7 +217,7 @@ "name": "(Windows) tsc.exe - EXE", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/bin/tsc.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/tsc.exe", "args": [ "-emit=exe", "-di", @@ -243,7 +243,7 @@ }, { "name": "TSC_LIB_PATH", - "value": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/lib" + "value": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/lib" }, ], "console": "externalTerminal", @@ -280,7 +280,7 @@ }, { "name": "TSC_LIB_PATH", - "value": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/lib" + "value": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/lib" }, ], "console": "externalTerminal", @@ -292,7 +292,7 @@ "name": "(Windows) tsc.exe - EXE(DI) - NO DEFAULT", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/bin/tsc.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/tsc.exe", "args": [ "-emit=exe", "--di", @@ -317,7 +317,7 @@ }, { "name": "TSC_LIB_PATH", - "value": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/lib" + "value": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/lib" }, ], "console": "externalTerminal", @@ -327,7 +327,7 @@ "name": "(Windows) tsc.exe - EXE(OPT) - NO DEFAULT", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/bin/tsc.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/tsc.exe", "args": [ "-emit=exe", "--opt", @@ -396,7 +396,7 @@ "name": "(Windows) tsc.exe - LLVM - NO DEFAULT", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/bin/tsc.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/tsc.exe", "args": [ "-emit=llvm", "-di", @@ -420,7 +420,7 @@ }, { "name": "TSC_LIB_PATH", - "value": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/lib" + "value": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/lib" }, ], "console": "externalTerminal", @@ -430,7 +430,7 @@ "name": "(Windows) tsc.exe - DLL", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/bin/tsc.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/tsc.exe", "args": [ "-emit=dll", "-opt", @@ -453,7 +453,7 @@ }, { "name": "TSC_LIB_PATH", - "value": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/lib" + "value": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/lib" }, ], "console": "externalTerminal", @@ -463,7 +463,7 @@ "name": "(Windows) tsc.exe - WASM", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/bin/tsc.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/tsc.exe", "args": [ "-emit=exe", "-opt", @@ -482,7 +482,7 @@ "name": "(Windows) tsc.exe - WASM - emscripten", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/bin/tsc.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/tsc.exe", "args": [ "-emit=exe", "-mlir-disable-threading", @@ -543,7 +543,7 @@ "name": "(Windows) tsc.exe - JIT-OBJ", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/bin/tsc.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/tsc.exe", "args": [ "-emit=jit", "-nogc", @@ -705,7 +705,7 @@ "name": "(Windows) tsc.exe - DefaultLib Compile (DLL)", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/bin/tsc.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/tsc.exe", "args": [ "-emit=dll", "-debug-only=mlir,llvm", @@ -724,7 +724,7 @@ "name": "(Windows) tsc.exe - DefaultLib Compile (MLIR)", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/bin/tsc.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/tsc.exe", "args": [ "-emit=mlir", "-debug-only=mlir,llvm", @@ -743,7 +743,7 @@ "name": "(Windows) tsc.exe - DefaultLib Compile (DI) (OBJ)", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/bin/tsc.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/tsc.exe", "args": [ "-emit=obj", "-debug-only=mlir,llvm", @@ -763,7 +763,7 @@ "name": "(Windows) tsc.exe - DefaultLib Compile (opt) (OBJ)", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/bin/tsc.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/tsc.exe", "args": [ "-emit=obj", "-debug-only=mlir,llvm", @@ -821,7 +821,7 @@ "name": "(Windows) tsc.exe - new VSCode project", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/bin/tsc.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/tsc.exe", "args": [ "--new", "Test1" @@ -836,7 +836,7 @@ "name": "(Windows) tsc.exe - Install Default lib", "type": "cppvsdbg", "request": "launch", - "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-debug/bin/tsc.exe", + "program": "${workspaceFolder}/../../__build/tsc/windows-msbuild-2026-debug/bin/tsc.exe", "args": [ "--install-default-lib" ], From b3a5a9eed7c3660c469d1a905e1991107bb7b6f3 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Thu, 25 Jun 2026 01:06:24 +0100 Subject: [PATCH 27/60] Add C linkage for GC wrappers and export runtime symbols for JIT integration --- tsc/include/TypeScript/gcwrapper.h | 8 +++ tsc/lib/TypeScriptRuntime/CMakeLists.txt | 8 +++ .../TypeScriptRuntime/TypeScriptRuntime.def | 56 +++++++++++++++++++ tsc/lib/TypeScriptRuntime/gc.cpp | 4 ++ tsc/lib/TypeScriptRuntime/mlir_init.cpp | 48 +++------------- 5 files changed, 84 insertions(+), 40 deletions(-) create mode 100644 tsc/lib/TypeScriptRuntime/TypeScriptRuntime.def diff --git a/tsc/include/TypeScript/gcwrapper.h b/tsc/include/TypeScript/gcwrapper.h index 2c73a93ac..3759a48b3 100644 --- a/tsc/include/TypeScript/gcwrapper.h +++ b/tsc/include/TypeScript/gcwrapper.h @@ -1,6 +1,10 @@ #include #include +#ifdef __cplusplus +extern "C" { +#endif + void _mlir__GC_init(); void *_mlir__GC_malloc(size_t size); @@ -20,3 +24,7 @@ void _mlir__GC_win32_free_heap(); void *_mlir__GC_malloc_explicitly_typed(size_t size, int64_t descr); int64_t _mlir__GC_make_descriptor(const int64_t *descr, size_t size); + +#ifdef __cplusplus +} +#endif diff --git a/tsc/lib/TypeScriptRuntime/CMakeLists.txt b/tsc/lib/TypeScriptRuntime/CMakeLists.txt index 21e82684b..f5637688c 100644 --- a/tsc/lib/TypeScriptRuntime/CMakeLists.txt +++ b/tsc/lib/TypeScriptRuntime/CMakeLists.txt @@ -27,3 +27,11 @@ add_mlir_library(TypeScriptRuntime LINK_LIBS PRIVATE gc ) + +if(MSVC) + # Export the runtime symbols under the names JIT-compiled code expects so the + # MLIR ExecutionEngine resolves them via the JITDylib path (no init callback, + # no cross-heap free of the symbol StringMap). See TypeScriptRuntime.def. + target_link_options(TypeScriptRuntime PRIVATE + "/DEF:${CMAKE_CURRENT_SOURCE_DIR}/TypeScriptRuntime.def") +endif() diff --git a/tsc/lib/TypeScriptRuntime/TypeScriptRuntime.def b/tsc/lib/TypeScriptRuntime/TypeScriptRuntime.def new file mode 100644 index 000000000..c5affeea3 --- /dev/null +++ b/tsc/lib/TypeScriptRuntime/TypeScriptRuntime.def @@ -0,0 +1,56 @@ +; Exports for TypeScriptRuntime.dll under the names JIT-compiled code expects. +; The MLIR ExecutionEngine resolves these directly from the DLL export table +; (JITDylib path) instead of through the '__mlir_execution_engine_init' hook, +; which avoids a cross-heap free of the symbol StringMap under the static CRT. +; +; Syntax 'EXPORTNAME=internal_symbol' re-exports an internal symbol under the +; name the generated code calls. + +EXPORTS + ; --- GC runtime (gc.cpp, extern "C" via gcwrapper.h) --- + GC_init=_mlir__GC_init + GC_malloc=_mlir__GC_malloc + GC_malloc_atomic=_mlir__GC_malloc_atomic + GC_memalign=_mlir__GC_memalign + GC_realloc=_mlir__GC_realloc + GC_free=_mlir__GC_free + GC_get_heap_size=_mlir__GC_get_heap_size + GC_malloc_explicitly_typed=_mlir__GC_malloc_explicitly_typed + GC_make_descriptor=_mlir__GC_make_descriptor + + ; --- memory runtime (MemRuntime.cpp, extern "C") --- + _mlir_alloc=Alloc + _mlir_aligned_alloc=AlignedAlloc + _mlir_free=Free + _mlir_aligned_free=AlignedFree + aligned_alloc=AlignedAlloc + aligned_free=AlignedFree + + ; --- dynamic-library runtime (DynamicRuntime.cpp, extern "C") --- + LLVMLoadLibraryPermanently=LoadLibraryPermanently + LLVMSearchForAddressOfSymbol=SearchForAddressOfSymbol + + ; --- async runtime (AsyncRuntime.cpp, extern "C", names already match) --- + mlirAsyncRuntimeAddRef + mlirAsyncRuntimeDropRef + mlirAsyncRuntimeExecute + mlirAsyncRuntimeGetValueStorage + mlirAsyncRuntimeCreateToken + mlirAsyncRuntimeCreateValue + mlirAsyncRuntimeEmplaceToken + mlirAsyncRuntimeEmplaceValue + mlirAsyncRuntimeSetTokenError + mlirAsyncRuntimeSetValueError + mlirAsyncRuntimeIsTokenError + mlirAsyncRuntimeIsValueError + mlirAsyncRuntimeIsGroupError + mlirAsyncRuntimeAwaitToken + mlirAsyncRuntimeAwaitValue + mlirAsyncRuntimeAwaitTokenAndExecute + mlirAsyncRuntimeAwaitValueAndExecute + mlirAsyncRuntimeCreateGroup + mlirAsyncRuntimeAddTokenToGroup + mlirAsyncRuntimeAwaitAllInGroup + mlirAsyncRuntimeAwaitAllInGroupAndExecute + mlirAsyncRuntimGetNumWorkerThreads + mlirAsyncRuntimePrintCurrentThreadId diff --git a/tsc/lib/TypeScriptRuntime/gc.cpp b/tsc/lib/TypeScriptRuntime/gc.cpp index d2b29248c..9e5fd9a42 100644 --- a/tsc/lib/TypeScriptRuntime/gc.cpp +++ b/tsc/lib/TypeScriptRuntime/gc.cpp @@ -19,6 +19,10 @@ #include "gc.h" #include "gc_typed.h" +// give the wrappers C linkage so they are exported under clean, unmangled +// names (see TypeScriptRuntime.def, used by the JIT to resolve runtime symbols) +#include "TypeScript/gcwrapper.h" + void _mlir__GC_init() { GC_INIT(); diff --git a/tsc/lib/TypeScriptRuntime/mlir_init.cpp b/tsc/lib/TypeScriptRuntime/mlir_init.cpp index 3d6b1e266..cf7b52fc4 100644 --- a/tsc/lib/TypeScriptRuntime/mlir_init.cpp +++ b/tsc/lib/TypeScriptRuntime/mlir_init.cpp @@ -1,45 +1,13 @@ -#include "llvm/ADT/StringMap.h" - #include -#ifdef _WIN32 -#pragma comment(linker, "/EXPORT:??_7type_info@@6B@") -#endif - -void init_gcruntime(llvm::StringMap &exportSymbols); -void destroy_gcruntime(); - -void init_memruntime(llvm::StringMap &exportSymbols); -//void destroy_memruntime(); +// The runtime symbols required by JIT-compiled code are exported under their +// JIT names via TypeScriptRuntime.def. We deliberately do NOT export the MLIR +// '__mlir_execution_engine_init/destroy' callbacks: when those are absent, the +// MLIR ExecutionEngine loads this library as a plain JITDylib and resolves +// symbols directly from its export table. That avoids the cross-heap free that +// happens when the DLL populates a StringMap owned (and later freed) by the EXE +// while both link the static CRT (separate heaps). -void init_asyncruntime(llvm::StringMap &exportSymbols); -void destroy_asyncruntime(); - -void init_dynamicruntime(llvm::StringMap &exportSymbols); -void destroy_dynamicruntime(); - -// Export symbols for the MLIR runner integration. All other symbols are hidden. #ifdef _WIN32 -#define API __declspec(dllexport) -#else -#define API __attribute__((visibility("default"))) +#pragma comment(linker, "/EXPORT:??_7type_info@@6B@") #endif - -extern "C" API void __mlir_execution_engine_init(llvm::StringMap &exportSymbols); - -// to support shared_libs -void __mlir_execution_engine_init(llvm::StringMap &exportSymbols) -{ - init_gcruntime(exportSymbols); - init_memruntime(exportSymbols); - init_asyncruntime(exportSymbols); - init_dynamicruntime(exportSymbols); -} - -extern "C" API void __mlir_execution_engine_destroy() -{ - destroy_gcruntime(); - //destory_memruntime(); - destroy_asyncruntime(); - destroy_dynamicruntime(); -} \ No newline at end of file From f83e1141f942d94ee8a15fbaa2b0621ac7d16ca0 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Fri, 26 Jun 2026 09:28:08 +0100 Subject: [PATCH 28/60] Update build scripts for LLVM integration and enhance JIT error handling --- scripts/config_llvm_debug_vs.bat | 6 +++- scripts/config_llvm_release_vs.bat | 6 +++- tsc/tsc/jit.cpp | 49 +++++++++++++++++++++++++++++- 3 files changed, 58 insertions(+), 3 deletions(-) diff --git a/scripts/config_llvm_debug_vs.bat b/scripts/config_llvm_debug_vs.bat index 80faf44cf..1496236d6 100644 --- a/scripts/config_llvm_debug_vs.bat +++ b/scripts/config_llvm_debug_vs.bat @@ -1,6 +1,10 @@ pushd +rem capture repo root (cwd at script start) so the install prefix is absolute. +rem a relative CMAKE_INSTALL_PREFIX is resolved to an empty path by 'cmake --install' +rem and installs LLVM to the drive root (e.g. I:\bin, I:\lib) instead of 3rdParty. +set "LLVM_INSTALL_ROOT=%CD%" mkdir __build\llvm\msbuild\x64\debug cd __build\llvm\msbuild\x64\debug -cmake ..\..\..\..\..\3rdParty\llvm-project\llvm -G "Visual Studio 18 2026" -A x64 %EXTRA_PARAM% -DLLVM_TARGETS_TO_BUILD="host;ARM;AArch64" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug -Thost=x64 -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/llvm/x64/debug -DLLVM_INSTALL_UTILS=ON -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PLUGINS=ON -DLLVM_ENABLE_PROJECTS="clang;lld;mlir" -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_REQUIRES_RTTI=ON -DLLVM_ENABLE_PIC=ON -Wno-dev +cmake ..\..\..\..\..\3rdParty\llvm-project\llvm -G "Visual Studio 18 2026" -A x64 %EXTRA_PARAM% -DLLVM_TARGETS_TO_BUILD="host;ARM;AArch64" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug -Thost=x64 -DCMAKE_INSTALL_PREFIX="%LLVM_INSTALL_ROOT%\3rdParty\llvm\x64\debug" -DLLVM_INSTALL_UTILS=ON -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PLUGINS=ON -DLLVM_ENABLE_PROJECTS="clang;lld;mlir" -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_REQUIRES_RTTI=ON -DLLVM_ENABLE_PIC=ON -Wno-dev popd diff --git a/scripts/config_llvm_release_vs.bat b/scripts/config_llvm_release_vs.bat index 29f074833..9e8820fe7 100644 --- a/scripts/config_llvm_release_vs.bat +++ b/scripts/config_llvm_release_vs.bat @@ -1,5 +1,9 @@ pushd +rem capture repo root (cwd at script start) so the install prefix is absolute. +rem a relative CMAKE_INSTALL_PREFIX is resolved to an empty path by 'cmake --install' +rem and installs LLVM to the drive root (e.g. I:\bin, I:\lib) instead of 3rdParty. +set "LLVM_INSTALL_ROOT=%CD%" mkdir __build\llvm\msbuild\x64\release cd __build\llvm\msbuild\x64\release -cmake ..\..\..\..\..\3rdParty\llvm-project\llvm -G "Visual Studio 18 2026" -A x64 %EXTRA_PARAM% -DLLVM_TARGETS_TO_BUILD="host;ARM;AArch64" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly" -DCMAKE_BUILD_TYPE=Release -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -Thost=x64 -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/llvm/x64/release -DLLVM_INSTALL_UTILS=ON -DLLVM_ENABLE_ASSERTIONS=OFF -DLLVM_ENABLE_PLUGINS=ON -DLLVM_ENABLE_PROJECTS="clang;lld;mlir" -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_REQUIRES_RTTI=ON -DLLVM_ENABLE_PIC=ON +cmake ..\..\..\..\..\3rdParty\llvm-project\llvm -G "Visual Studio 18 2026" -A x64 %EXTRA_PARAM% -DLLVM_TARGETS_TO_BUILD="host;ARM;AArch64" -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly" -DCMAKE_BUILD_TYPE=Release -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -Thost=x64 -DCMAKE_INSTALL_PREFIX="%LLVM_INSTALL_ROOT%\3rdParty\llvm\x64\release" -DLLVM_INSTALL_UTILS=ON -DLLVM_ENABLE_ASSERTIONS=OFF -DLLVM_ENABLE_PLUGINS=ON -DLLVM_ENABLE_PROJECTS="clang;lld;mlir" -DLLVM_ENABLE_EH=ON -DLLVM_ENABLE_RTTI=ON -DLLVM_REQUIRES_RTTI=ON -DLLVM_ENABLE_PIC=ON popd diff --git a/tsc/tsc/jit.cpp b/tsc/tsc/jit.cpp index 37720ea80..b106323ea 100644 --- a/tsc/tsc/jit.cpp +++ b/tsc/tsc/jit.cpp @@ -3,6 +3,15 @@ #include "mlir/ExecutionEngine/ExecutionEngine.h" #include "mlir/IR/BuiltinOps.h" +#include "llvm/ExecutionEngine/Orc/Core.h" +#include "llvm/ExecutionEngine/Orc/Mangling.h" +#include "llvm/ExecutionEngine/Orc/Shared/ExecutorSymbolDef.h" + +#include +#ifdef _WIN32 +#include +#endif + #include "llvm/TargetParser/Host.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/TargetSelect.h" @@ -170,9 +179,38 @@ int runJit(int argc, char **argv, mlir::ModuleOp module, CompileOptions &compile } auto maybeEngine = mlir::ExecutionEngine::create(module, engineOptions); - assert(maybeEngine && "failed to construct an execution engine"); + if (!maybeEngine) + { + llvm::WithColor::error(llvm::errs(), "tsc") << "failed to construct an execution engine, error: " << maybeEngine.takeError() << "\n"; + return -1; + } auto &engine = maybeEngine.get(); +#ifdef _WIN32 + // tsc.exe links the CRT statically (/MT[d]), so its libc symbols are not in + // any DLL export table. The JIT's process-symbol resolver would otherwise bind + // libc calls (puts/printf/malloc/...) to a *different* CRT instance loaded as a + // DLL (ucrtbase.dll), giving JIT'd code a separate stdout buffer and heap from + // tsc.exe. That mismatch loses output and corrupts state on teardown. Bind these + // to this module's own CRT so JIT'd code shares our stdout/heap. + engine->registerSymbols([&](llvm::orc::MangleAndInterner interner) { + llvm::orc::SymbolMap symbolMap; + auto add = [&](const char *name, void *addr) { + symbolMap[interner(name)] = { llvm::orc::ExecutorAddr::fromPtr(addr), + llvm::JITSymbolFlags::Exported | llvm::JITSymbolFlags::Absolute }; + }; + add("puts", (void*)&puts); + add("printf", (void*)&printf); + add("malloc", (void*)&malloc); + add("free", (void*)&free); + add("realloc", (void*)&realloc); + add("calloc", (void*)&calloc); + add("memset", (void*)&memset); + add("memcpy", (void*)&memcpy); + return symbolMap; + }); +#endif + if (dumpObjectFile) { auto expectedFPtr = engine->lookup(mainFuncName); @@ -215,5 +253,14 @@ int runJit(int argc, char **argv, mlir::ModuleOp module, CompileOptions &compile return -1; } + // The JIT program has finished. On Windows/COFF the MLIR/ORC LLJIT platform + // registers process-level atexit glue that faults during teardown, so the + // normal CRT exit path crashes after a successful run. Flush stdio and exit + // the process directly, bypassing the CRT atexit handlers. + fflush(stdout); + fflush(stderr); +#ifdef _WIN32 + ExitProcess(0); +#endif return 0; } From f2e591fd9ebb60bbc6df15f5589f388aba1123e5 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Fri, 26 Jun 2026 09:52:14 +0100 Subject: [PATCH 29/60] Refactor JIT symbol registration to use DynamicLibrary for CRT entry points --- tsc/tsc/jit.cpp | 57 +++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/tsc/tsc/jit.cpp b/tsc/tsc/jit.cpp index b106323ea..c7759facd 100644 --- a/tsc/tsc/jit.cpp +++ b/tsc/tsc/jit.cpp @@ -3,9 +3,7 @@ #include "mlir/ExecutionEngine/ExecutionEngine.h" #include "mlir/IR/BuiltinOps.h" -#include "llvm/ExecutionEngine/Orc/Core.h" -#include "llvm/ExecutionEngine/Orc/Mangling.h" -#include "llvm/ExecutionEngine/Orc/Shared/ExecutorSymbolDef.h" +#include "llvm/Support/DynamicLibrary.h" #include #ifdef _WIN32 @@ -178,39 +176,42 @@ int runJit(int argc, char **argv, mlir::ModuleOp module, CompileOptions &compile engineOptions.jitCodeGenOptLevel = (llvm::CodeGenOptLevel) optLevel.getValue(); } - auto maybeEngine = mlir::ExecutionEngine::create(module, engineOptions); - if (!maybeEngine) - { - llvm::WithColor::error(llvm::errs(), "tsc") << "failed to construct an execution engine, error: " << maybeEngine.takeError() << "\n"; - return -1; - } - auto &engine = maybeEngine.get(); - #ifdef _WIN32 // tsc.exe links the CRT statically (/MT[d]), so its libc symbols are not in // any DLL export table. The JIT's process-symbol resolver would otherwise bind // libc calls (puts/printf/malloc/...) to a *different* CRT instance loaded as a // DLL (ucrtbase.dll), giving JIT'd code a separate stdout buffer and heap from - // tsc.exe. That mismatch loses output and corrupts state on teardown. Bind these - // to this module's own CRT so JIT'd code shares our stdout/heap. - engine->registerSymbols([&](llvm::orc::MangleAndInterner interner) { - llvm::orc::SymbolMap symbolMap; - auto add = [&](const char *name, void *addr) { - symbolMap[interner(name)] = { llvm::orc::ExecutorAddr::fromPtr(addr), - llvm::JITSymbolFlags::Exported | llvm::JITSymbolFlags::Absolute }; + // tsc.exe. That mismatch loses output and corrupts state on teardown. + // + // Add our own CRT entry points to the process symbol table *before* creating + // the engine: the JIT's GetForCurrentProcess generator consults this table + // (SearchForAddressOfSymbol checks explicitly-added symbols first) only for + // unresolved symbols, so it overrides ucrtbase without an ORC JITDylib + // "duplicate definition" conflict, and it is in place before create() eagerly + // materializes any global constructors that reference these symbols. + { + auto addSym = [](const char *name, void *addr) { + llvm::sys::DynamicLibrary::AddSymbol(name, addr); }; - add("puts", (void*)&puts); - add("printf", (void*)&printf); - add("malloc", (void*)&malloc); - add("free", (void*)&free); - add("realloc", (void*)&realloc); - add("calloc", (void*)&calloc); - add("memset", (void*)&memset); - add("memcpy", (void*)&memcpy); - return symbolMap; - }); + addSym("puts", (void*)&puts); + addSym("printf", (void*)&printf); + addSym("malloc", (void*)&malloc); + addSym("free", (void*)&free); + addSym("realloc", (void*)&realloc); + addSym("calloc", (void*)&calloc); + addSym("memset", (void*)&memset); + addSym("memcpy", (void*)&memcpy); + } #endif + auto maybeEngine = mlir::ExecutionEngine::create(module, engineOptions); + if (!maybeEngine) + { + llvm::WithColor::error(llvm::errs(), "tsc") << "failed to construct an execution engine, error: " << maybeEngine.takeError() << "\n"; + return -1; + } + auto &engine = maybeEngine.get(); + if (dumpObjectFile) { auto expectedFPtr = engine->lookup(mainFuncName); From e3c0601d29f5dfbd6d96a9701186a806ee146185 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Fri, 26 Jun 2026 13:01:27 +0100 Subject: [PATCH 30/60] Enhance build scripts for Visual Studio 2026 integration and update library linking for static CRT compatibility --- scripts/build_gc_debug_vs.bat | 6 +++++- scripts/build_gc_release_vs.bat | 4 +++- tsc/test/tester/test-runner.cpp | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/build_gc_debug_vs.bat b/scripts/build_gc_debug_vs.bat index 5d693bb3c..67df5daa3 100644 --- a/scripts/build_gc_debug_vs.bat +++ b/scripts/build_gc_debug_vs.bat @@ -1,6 +1,10 @@ pushd mkdir __build\gc\msbuild\x64\debug cd __build\gc\msbuild\x64\debug -cmake ../../../../../3rdParty/gc-8.2.8 -G "Visual Studio 18 2026" -A x64 %EXTRA_PARAM% -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/debug -Denable_threads=ON -Denable_cplusplus=OFF +cmake ../../../../../3rdParty/gc-8.2.8 -G "Visual Studio 18 2026" -A x64 %EXTRA_PARAM% -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/debug -Denable_threads=ON -Denable_cplusplus=OFF -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug cmake --build . --config Debug -j 8 +cmake --install . --config Debug +rem the project links gc against the install root (GC_LIB_PATH), but install puts libs in lib\ - mirror them up +copy /Y ..\..\..\..\..\3rdParty\gc\x64\debug\lib\*.lib ..\..\..\..\..\3rdParty\gc\x64\debug\ +copy /Y ..\..\..\..\..\3rdParty\gc\x64\debug\lib\*.pdb ..\..\..\..\..\3rdParty\gc\x64\debug\ popd \ No newline at end of file diff --git a/scripts/build_gc_release_vs.bat b/scripts/build_gc_release_vs.bat index 7a07ddf02..4e09f3a41 100644 --- a/scripts/build_gc_release_vs.bat +++ b/scripts/build_gc_release_vs.bat @@ -1,7 +1,9 @@ pushd mkdir __build\gc\msbuild\x64\release cd __build\gc\msbuild\x64\release -cmake ../../../../../3rdParty/gc-8.2.8 -G "Visual Studio 18 2026" -A x64 %EXTRA_PARAM% -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/release -Denable_threads=ON -Denable_cplusplus=OFF +cmake ../../../../../3rdParty/gc-8.2.8 -G "Visual Studio 18 2026" -A x64 %EXTRA_PARAM% -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/release -Denable_threads=ON -Denable_cplusplus=OFF -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded cmake --build . --config Release -j 8 cmake --install . --config Release +rem the project links gc against the install root (GC_LIB_PATH), but install puts libs in lib\ - mirror them up +copy /Y ..\..\..\..\..\3rdParty\gc\x64\release\lib\*.lib ..\..\..\..\..\3rdParty\gc\x64\release\ popd \ No newline at end of file diff --git a/tsc/test/tester/test-runner.cpp b/tsc/test/tester/test-runner.cpp index 31f6ff3fa..eb2f3eae6 100644 --- a/tsc/test/tester/test-runner.cpp +++ b/tsc/test/tester/test-runner.cpp @@ -9,7 +9,8 @@ #define TYPESCRIPT_LIB "TypeScriptAsyncRuntime.lib " #define LLVM_LIBS "LLVMSupport.lib " //#define LIBS "msvcrt" _D_ ".lib ucrt" _D_ ".lib " -#define LIBS "msvcrt" _D_ ".lib ucrt" _D_ ".lib ntdll.lib " +// static CRT (/MT[d]) to match LLVM/TypeScript runtime libs and gc.lib; mixing static+dynamic CRT crashes at startup +#define LIBS "libcmt" _D_ ".lib libvcruntime" _D_ ".lib libucrt" _D_ ".lib ntdll.lib " #else // for Ubuntu 20.04 add -ldl and optionally -rdynamic #define LIBS "-frtti -fexceptions -lstdc++ -lrt -ldl -lpthread -lm -ltinfo" From 34ff7fe059fdbd700ac4cf647c680bd63fd0f265 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Fri, 26 Jun 2026 13:15:42 +0100 Subject: [PATCH 31/60] Adjust GlobalConstructorOp priority to prevent crashes during CRT initialization --- tsc/lib/TypeScript/MLIRGen.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tsc/lib/TypeScript/MLIRGen.cpp b/tsc/lib/TypeScript/MLIRGen.cpp index d2d0f1057..cfb4545fa 100644 --- a/tsc/lib/TypeScript/MLIRGen.cpp +++ b/tsc/lib/TypeScript/MLIRGen.cpp @@ -1075,9 +1075,17 @@ class MLIRGenImpl builder.setInsertionPointToStart(parentModule.getBody()); mclh.seekLastOp(parentModule.getBody()); - // priority is lowest to load as first dependencies + // The shared-lib load + symbol resolution call into LLVM's + // sys::DynamicLibrary, which uses std::vector. In debug builds STL + // iterators take a global lock that the CRT only initializes via its + // own '_Init_locks'/'initlocks' dynamic initializer (in .CRT$XCU). + // FIRST_GLOBAL_CONSTRUCTOR_PRIORITY (100) places this ctor BEFORE that + // CRT init -> entering an uninitialized CRITICAL_SECTION -> crash. + // Use the same band as the per-symbol __cctors (LAST) so it runs after + // 'initlocks'; it is emitted before them, so it still loads the library + // before any LLVMSearchForAddressOfSymbol runs. builder.create( - location, mlir::FlatSymbolRefAttr::get(builder.getContext(), fullInitGlobalFuncName), builder.getIndexAttr(FIRST_GLOBAL_CONSTRUCTOR_PRIORITY)); + location, mlir::FlatSymbolRefAttr::get(builder.getContext(), fullInitGlobalFuncName), builder.getIndexAttr(LAST_GLOBAL_CONSTRUCTOR_PRIORITY)); } for (auto declSymbol : symbols) From dd07eb57477455da5912d2688a2afa1712ff0b9a Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Fri, 26 Jun 2026 17:10:21 +0000 Subject: [PATCH 32/60] Update build scripts for GC and TSC to set executable permissions and adjust library copy paths --- scripts/build_gc_debug.sh | 2 +- scripts/build_gc_release.sh | 2 +- tsc/build_tsc_debug.sh | 0 tsc/build_tsc_release-test.sh | 0 tsc/build_tsc_release.sh | 0 tsc/config_tsc_debug.sh | 0 tsc/config_tsc_release.sh | 0 7 files changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 tsc/build_tsc_debug.sh mode change 100644 => 100755 tsc/build_tsc_release-test.sh mode change 100644 => 100755 tsc/build_tsc_release.sh mode change 100644 => 100755 tsc/config_tsc_debug.sh mode change 100644 => 100755 tsc/config_tsc_release.sh diff --git a/scripts/build_gc_debug.sh b/scripts/build_gc_debug.sh index 5720e5faa..fddb11c6a 100755 --- a/scripts/build_gc_debug.sh +++ b/scripts/build_gc_debug.sh @@ -4,4 +4,4 @@ mkdir -p 3rdParty/gc/debug cd __build/gc/ninja/debug cmake ../../../../3rdParty/gc-8.2.8 -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/debug -Denable_threads=ON -Denable_cplusplus=OFF cmake --build . --config Debug -j 16 -cp ./lib* ../../../../3rdParty/gc/debug/ +cp ./libgc-lib.a ../../../../3rdParty/gc/debug/libgc.a diff --git a/scripts/build_gc_release.sh b/scripts/build_gc_release.sh index 9040b2cfc..5b0c782cb 100755 --- a/scripts/build_gc_release.sh +++ b/scripts/build_gc_release.sh @@ -4,4 +4,4 @@ mkdir -p 3rdParty/gc/release cd __build/gc/ninja/release cmake ../../../../3rdParty/gc-8.2.8 -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -Denable_threads=ON -Denable_cplusplus=OFF cmake --build . --config Release -j 16 -cp ./lib* ../../../../3rdParty/gc/release/ \ No newline at end of file +cp ./libgc-lib.a ../../../../3rdParty/gc/release/libgc.a \ No newline at end of file diff --git a/tsc/build_tsc_debug.sh b/tsc/build_tsc_debug.sh old mode 100644 new mode 100755 diff --git a/tsc/build_tsc_release-test.sh b/tsc/build_tsc_release-test.sh old mode 100644 new mode 100755 diff --git a/tsc/build_tsc_release.sh b/tsc/build_tsc_release.sh old mode 100644 new mode 100755 diff --git a/tsc/config_tsc_debug.sh b/tsc/config_tsc_debug.sh old mode 100644 new mode 100755 diff --git a/tsc/config_tsc_release.sh b/tsc/config_tsc_release.sh old mode 100644 new mode 100755 From af4bbabd9e395b645d31ccd0e9604cb8fd949e31 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Fri, 26 Jun 2026 18:14:37 +0000 Subject: [PATCH 33/60] Prefix temporary object/shared-lib filenames to avoid conflicts during parallel test execution --- tsc/test/tester/test-runner.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tsc/test/tester/test-runner.cpp b/tsc/test/tester/test-runner.cpp index eb2f3eae6..5e82a0836 100644 --- a/tsc/test/tester/test-runner.cpp +++ b/tsc/test/tester/test-runner.cpp @@ -375,7 +375,8 @@ void createMultiCompileBatchFile(std::string tempOutputFileNameNoExt, std::vecto auto isFirst = true; for (auto &file : files) { - auto fileNameWithoutExt = fs::path(file).stem().string(); + // prefix with the unique temp name so parallel tests reusing the same source files don't stomp each other's object files + auto fileNameWithoutExt = tempOutputFileNameNoExt + "_" + fs::path(file).stem().string(); objs << fileNameWithoutExt << ".o "; batFile << "$TSCEXEPATH/tsc --emit=obj " << tsc_opt << " " << (isFirst ? "" : tsc_opt_ext) << " " << file << " -relocation-model=pic -o=" << fileNameWithoutExt << ".o" << std::endl; isFirst = false; @@ -511,7 +512,8 @@ void createSharedMultiBatchFile(std::string tempOutputFileNameNoExt, std::vector std::stringstream sharedBat; for (auto &file : files) { - auto fileNameWithoutExt = fs::path(file).stem().string(); + // prefix with the unique temp name so parallel tests reusing the same source files don't stomp each other's object/shared-lib files + auto fileNameWithoutExt = tempOutputFileNameNoExt + "_" + fs::path(file).stem().string(); if (first) { exec_objs << fileNameWithoutExt << ".o "; @@ -540,7 +542,7 @@ void createSharedMultiBatchFile(std::string tempOutputFileNameNoExt, std::vector { batFile << "$TSCEXEPATH/tsc --emit=jit " << tsc_opt << " --shared-libs=../../lib/libTypeScriptRuntime.so " << *files.begin() << " 1> $FILENAME.txt 2> $FILENAME.err" << std::endl; - batFile << "rm -f lib$FILENAME.so" << std::endl; + batFile << "rm -f lib" << shared_filenameNoExt << ".so" << std::endl; } else { @@ -560,7 +562,7 @@ void createSharedMultiBatchFile(std::string tempOutputFileNameNoExt, std::vector batFile << "./$FILENAME 1> $FILENAME.txt 2> $FILENAME.err" << std::endl; batFile << "rm -f $FILENAME" << std::endl; - batFile << "rm -f lib$FILENAME.so" << std::endl; + batFile << "rm -f lib" << shared_filenameNoExt << ".so" << std::endl; } batFile.close(); From 1bd728755aab117fb8bb31c010d33d2928caa9b4 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Fri, 26 Jun 2026 18:23:52 +0000 Subject: [PATCH 34/60] Include process ID in temporary output file names to prevent collisions during parallel test execution --- tsc/test/tester/test-runner.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tsc/test/tester/test-runner.cpp b/tsc/test/tester/test-runner.cpp index 5e82a0836..eae560c02 100644 --- a/tsc/test/tester/test-runner.cpp +++ b/tsc/test/tester/test-runner.cpp @@ -1,5 +1,9 @@ #include "helper.h" +#ifndef WIN32 +#include // for getpid +#endif + #if WIN32 #define GC_LIB "gc.lib " #else @@ -273,7 +277,15 @@ std::string getTempOutputFileNameNoExt(std::string file) std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()); std::string fileNameNoExt = fs::path(file).stem().string(); - auto fileNameNoExtWithMs = fileNameNoExt + "-" + std::to_string(ms.count()) + "-" + std::to_string(rand()); + // include the process id: rand() is never seeded, so every test-runner process yields the same first value and + // uniqueness would otherwise rely solely on the millisecond timestamp - same-stem tests (e.g. compile + jit + // variants) launched within the same millisecond under parallel ctest would collide on temp file names. +#ifdef WIN32 + auto pid = static_cast(GetCurrentProcessId()); +#else + auto pid = static_cast(getpid()); +#endif + auto fileNameNoExtWithMs = fileNameNoExt + "-" + std::to_string(ms.count()) + "-" + std::to_string(pid) + "-" + std::to_string(rand()); std::cout << "Test file: " << fileNameNoExtWithMs << " path: " << file << std::endl; From de076b01106d6169c80d7447c311530884079012 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 27 Jun 2026 00:32:37 +0100 Subject: [PATCH 35/60] Update GC and libatomic_ops versions in CI workflows for consistency --- .../workflows/cmake-test-release-linux.yml | 16 +++--- .github/workflows/cmake-test-release-win.yml | 18 ++++--- .github/workflows/create-release.yml | 50 ++++++++++--------- 3 files changed, 45 insertions(+), 39 deletions(-) diff --git a/.github/workflows/cmake-test-release-linux.yml b/.github/workflows/cmake-test-release-linux.yml index a6ff4d1d6..817da90f6 100644 --- a/.github/workflows/cmake-test-release-linux.yml +++ b/.github/workflows/cmake-test-release-linux.yml @@ -16,6 +16,8 @@ env: CACHE_VERSION: v8 LLVM_VERSION: 19 LLVM_TARGZFILE: "https://www.dropbox.com/scl/fi/l9xrfupdbwqbnckr5g36p/llvm_19_1_3_release.tgz?rlkey=xubw01vl6ey3xszbph32xqfip&st=okz2ghqx&dl=1" + GC_VERSION: "8.2.8" + LIBATOMIC_OPS_VERSION: "7.8.2" jobs: build: @@ -81,32 +83,32 @@ jobs: - name: Download 3rd party source - GC continue-on-error: true shell: sh - run: curl --insecure -L https://www.hboehm.info/gc/gc_source/gc-8.0.4.tar.gz --output gc-8.0.4.tar.gz + run: curl --insecure -L https://www.hboehm.info/gc/gc_source/gc-${{ env.GC_VERSION }}.tar.gz --output gc-${{ env.GC_VERSION }}.tar.gz - name: Download 3rd party source - GC:Atomic_ops continue-on-error: true shell: sh - run: curl --insecure -L https://www.hboehm.info/gc/gc_source/libatomic_ops-7.6.10.tar.gz --output libatomic_ops-7.6.10.tar.gz + run: curl --insecure -L https://www.hboehm.info/gc/gc_source/libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}.tar.gz --output libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}.tar.gz - name: UnZip 3rd party source - GC continue-on-error: false shell: sh - run: tar -xvzf gc-8.0.4.tar.gz -C ./3rdParty/ + run: tar -xvzf gc-${{ env.GC_VERSION }}.tar.gz -C ./3rdParty/ - name: UnZip 3rd party source - GC:Atomic_ops continue-on-error: false shell: sh - run: tar -xvzf libatomic_ops-7.6.10.tar.gz -C ./3rdParty/ + run: tar -xvzf libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}.tar.gz -C ./3rdParty/ - name: Copy Atomic_ops to GC continue-on-error: false shell: sh - run: cp -a ./3rdParty/libatomic_ops-7.6.10/ ./3rdParty/gc-8.0.4/libatomic_ops/ + run: cp -a ./3rdParty/libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}/ ./3rdParty/gc-${{ env.GC_VERSION }}/libatomic_ops/ - name: Copy fixes to GC continue-on-error: false shell: sh - run: cp -ar ./docs/fix/gc/* ./3rdParty/gc-8.0.4/ + run: cp -ar ./docs/fix/gc/* ./3rdParty/gc-${{ env.GC_VERSION }}/ - name: Install Ninja continue-on-error: false @@ -122,7 +124,7 @@ jobs: continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/ninja/release shell: sh - run: cmake ../../../../3rdParty/gc-8.0.4 -G "Ninja" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -Denable_threads=ON -Denable_cplusplus=OFF + run: cmake ../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Ninja" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -Denable_threads=ON -Denable_cplusplus=OFF - name: Build GC continue-on-error: false diff --git a/.github/workflows/cmake-test-release-win.yml b/.github/workflows/cmake-test-release-win.yml index 05a59e49c..0fff6fc90 100644 --- a/.github/workflows/cmake-test-release-win.yml +++ b/.github/workflows/cmake-test-release-win.yml @@ -15,7 +15,9 @@ env: BUILD_TYPE: Release CACHE_VERSION: v8 LLVM_VERSION: 19 - LLVM_ZIPFILE: "https://www.dropbox.com/scl/fi/xdcj15hlzpod06x4wpls1/llvm_19_1_3_release.zip?rlkey=x38yiyfw3y6bv15z5j3oi84lb&st=bz3u5xkv&dl=1" + LLVM_ZIPFILE: "https://www.dropbox.com/scl/fi/map5fet7x19bm8ztsr4ma/llvm_19_1_3_release_vs2026.zip?rlkey=iwae4mz45lf7nycawa7d61g3r&st=4ee1dfug&dl=1" + GC_VERSION: "8.2.8" + LIBATOMIC_OPS_VERSION: "7.8.2" jobs: build: @@ -75,37 +77,37 @@ jobs: - name: Download 3rd party source - GC continue-on-error: true shell: pwsh - run: Invoke-WebRequest -SkipCertificateCheck -Uri "https://www.hboehm.info/gc/gc_source/gc-8.0.4.tar.gz" -OutFile "gc-8.0.4.tar.gz" + run: Invoke-WebRequest -SkipCertificateCheck -Uri "https://www.hboehm.info/gc/gc_source/gc-${{ env.GC_VERSION }}.tar.gz" -OutFile "gc-${{ env.GC_VERSION }}.tar.gz" - name: Download 3rd party source - GC:Atomic_ops continue-on-error: true shell: pwsh - run: Invoke-WebRequest -SkipCertificateCheck -Uri "https://www.hboehm.info/gc/gc_source/libatomic_ops-7.6.10.tar.gz" -OutFile "libatomic_ops-7.6.10.tar.gz" + run: Invoke-WebRequest -SkipCertificateCheck -Uri "https://www.hboehm.info/gc/gc_source/libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}.tar.gz" -OutFile "libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}.tar.gz" - name: UnZip 3rd party source - GC continue-on-error: false - run: tar -xvzf gc-8.0.4.tar.gz -C ./3rdParty/ + run: tar -xvzf gc-${{ env.GC_VERSION }}.tar.gz -C ./3rdParty/ shell: pwsh - name: UnZip 3rd party source - GC:Atomic_ops continue-on-error: false - run: tar -xvzf libatomic_ops-7.6.10.tar.gz -C ./3rdParty/ + run: tar -xvzf libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}.tar.gz -C ./3rdParty/ shell: pwsh - name: Copy Atomic_ops to GC continue-on-error: false - run: xcopy /E /H /C /I /Y ".\3rdParty\libatomic_ops-7.6.10" ".\3rdParty\gc-8.0.4\libatomic_ops" + run: xcopy /E /H /C /I /Y ".\3rdParty\libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}" ".\3rdParty\gc-${{ env.GC_VERSION }}\libatomic_ops" shell: pwsh - name: Copy fixes to GC continue-on-error: false - run: xcopy /E /H /C /I /Y ".\docs\fix\gc" ".\3rdParty\gc-8.0.4" + run: xcopy /E /H /C /I /Y ".\docs\fix\gc" ".\3rdParty\gc-${{ env.GC_VERSION }}" shell: pwsh - name: Configure GC continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/msbuild/x64/release - run: cmake ../../../../../3rdParty/gc-8.0.4 -G "Visual Studio 17 2022" -A x64 -Wno-dev -Denable_threads=ON -Denable_cplusplus=OFF + run: cmake ../../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Visual Studio 17 2022" -A x64 -Wno-dev -Denable_threads=ON -Denable_cplusplus=OFF shell: pwsh - name: Build GC diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 9bd685072..144617be3 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -11,9 +11,11 @@ env: BUILD_TYPE: Release CACHE_VERSION: v8 LLVM_VERSION: 19 - LLVM_ZIPFILE: "https://www.dropbox.com/scl/fi/xdcj15hlzpod06x4wpls1/llvm_19_1_3_release.zip?rlkey=x38yiyfw3y6bv15z5j3oi84lb&st=bz3u5xkv&dl=1" + LLVM_ZIPFILE: "https://www.dropbox.com/scl/fi/map5fet7x19bm8ztsr4ma/llvm_19_1_3_release_vs2026.zip?rlkey=iwae4mz45lf7nycawa7d61g3r&st=4ee1dfug&dl=1" LLVM_TARGZFILE: "https://www.dropbox.com/scl/fi/l9xrfupdbwqbnckr5g36p/llvm_19_1_3_release.tgz?rlkey=xubw01vl6ey3xszbph32xqfip&st=okz2ghqx&dl=1" LLVM_UB20_TARGZFILE: "https://www.dropbox.com/scl/fi/jfs77u2moymjo57ca4r0s/llvm_19_1_3_release_UB20.tgz?rlkey=tia0bdfa07gaeidepumb1e1fy&st=np5mcrox&dl=1" + GC_VERSION: "8.2.8" + LIBATOMIC_OPS_VERSION: "7.8.2" jobs: build_on_windows: @@ -75,41 +77,41 @@ jobs: - name: Download 3rd party source - GC continue-on-error: true shell: pwsh - run: Invoke-WebRequest -SkipCertificateCheck -Uri "https://www.hboehm.info/gc/gc_source/gc-8.0.4.tar.gz" -OutFile "gc-8.0.4.tar.gz" + run: Invoke-WebRequest -SkipCertificateCheck -Uri "https://www.hboehm.info/gc/gc_source/gc-${{ env.GC_VERSION }}.tar.gz" -OutFile "gc-${{ env.GC_VERSION }}.tar.gz" - name: Download 3rd party source - GC:Atomic_ops continue-on-error: true shell: pwsh - run: Invoke-WebRequest -SkipCertificateCheck -Uri "https://www.hboehm.info/gc/gc_source/libatomic_ops-7.6.10.tar.gz" -OutFile "libatomic_ops-7.6.10.tar.gz" + run: Invoke-WebRequest -SkipCertificateCheck -Uri "https://www.hboehm.info/gc/gc_source/libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}.tar.gz" -OutFile "libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}.tar.gz" - name: UnZip 3rd party source - GC continue-on-error: false - run: tar -xvzf gc-8.0.4.tar.gz -C ./3rdParty/ + run: tar -xvzf gc-${{ env.GC_VERSION }}.tar.gz -C ./3rdParty/ shell: pwsh - name: UnZip 3rd party source - GC:Atomic_ops continue-on-error: false - run: tar -xvzf libatomic_ops-7.6.10.tar.gz -C ./3rdParty/ + run: tar -xvzf libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}.tar.gz -C ./3rdParty/ shell: pwsh - - name: Create gc-8.0.4\libatomic_ops Folders - run: if (!(Test-Path -Path ".\3rdParty\gc-8.0.4\libatomic_ops")) { New-Item -ItemType Directory -Force -Path ".\3rdParty\gc-8.0.4\libatomic_ops" }; + - name: Create gc-${{ env.GC_VERSION }}\libatomic_ops Folders + run: if (!(Test-Path -Path ".\3rdParty\gc-${{ env.GC_VERSION }}\libatomic_ops")) { New-Item -ItemType Directory -Force -Path ".\3rdParty\gc-${{ env.GC_VERSION }}\libatomic_ops" }; shell: pwsh - name: Copy Atomic_ops to GC continue-on-error: false - run: xcopy /E /H /C /I /Y ".\3rdParty\libatomic_ops-7.6.10" ".\3rdParty\gc-8.0.4\libatomic_ops" + run: xcopy /E /H /C /I /Y ".\3rdParty\libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}" ".\3rdParty\gc-${{ env.GC_VERSION }}\libatomic_ops" shell: pwsh - name: Copy fixes to GC continue-on-error: false - run: xcopy /E /H /C /I /Y ".\docs\fix\gc" ".\3rdParty\gc-8.0.4" + run: xcopy /E /H /C /I /Y ".\docs\fix\gc" ".\3rdParty\gc-${{ env.GC_VERSION }}" shell: pwsh - name: Configure GC continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/msbuild/x64/release - run: cmake ../../../../../3rdParty/gc-8.0.4 -G "Visual Studio 17 2022" -A x64 -Wno-dev -Denable_threads=ON -Denable_cplusplus=OFF + run: cmake ../../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Visual Studio 17 2022" -A x64 -Wno-dev -Denable_threads=ON -Denable_cplusplus=OFF shell: pwsh - name: Build GC @@ -220,32 +222,32 @@ jobs: - name: Download 3rd party source - GC continue-on-error: true shell: sh - run: curl --insecure -L https://www.hboehm.info/gc/gc_source/gc-8.0.4.tar.gz --output gc-8.0.4.tar.gz + run: curl --insecure -L https://www.hboehm.info/gc/gc_source/gc-${{ env.GC_VERSION }}.tar.gz --output gc-${{ env.GC_VERSION }}.tar.gz - name: Download 3rd party source - GC:Atomic_ops continue-on-error: true shell: sh - run: curl --insecure -L https://www.hboehm.info/gc/gc_source/libatomic_ops-7.6.10.tar.gz --output libatomic_ops-7.6.10.tar.gz + run: curl --insecure -L https://www.hboehm.info/gc/gc_source/libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}.tar.gz --output libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}.tar.gz - name: UnZip 3rd party source - GC continue-on-error: false shell: sh - run: tar -xvzf gc-8.0.4.tar.gz -C ./3rdParty/ + run: tar -xvzf gc-${{ env.GC_VERSION }}.tar.gz -C ./3rdParty/ - name: UnZip 3rd party source - GC:Atomic_ops continue-on-error: false shell: sh - run: tar -xvzf libatomic_ops-7.6.10.tar.gz -C ./3rdParty/ + run: tar -xvzf libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}.tar.gz -C ./3rdParty/ - name: Copy Atomic_ops to GC continue-on-error: false shell: sh - run: cp -a ./3rdParty/libatomic_ops-7.6.10/ ./3rdParty/gc-8.0.4/libatomic_ops/ + run: cp -a ./3rdParty/libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}/ ./3rdParty/gc-${{ env.GC_VERSION }}/libatomic_ops/ - name: Copy fixes to GC continue-on-error: false shell: sh - run: cp -ar ./docs/fix/gc/* ./3rdParty/gc-8.0.4/ + run: cp -ar ./docs/fix/gc/* ./3rdParty/gc-${{ env.GC_VERSION }}/ - name: Install Ninja continue-on-error: false @@ -261,7 +263,7 @@ jobs: continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/ninja/release shell: sh - run: cmake ../../../../3rdParty/gc-8.0.4 -G "Ninja" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -Denable_threads=ON -Denable_cplusplus=OFF + run: cmake ../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Ninja" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -Denable_threads=ON -Denable_cplusplus=OFF - name: Build GC continue-on-error: false @@ -374,32 +376,32 @@ jobs: - name: Download 3rd party source - GC continue-on-error: true shell: sh - run: curl --insecure -L https://www.hboehm.info/gc/gc_source/gc-8.0.4.tar.gz --output gc-8.0.4.tar.gz + run: curl --insecure -L https://www.hboehm.info/gc/gc_source/gc-${{ env.GC_VERSION }}.tar.gz --output gc-${{ env.GC_VERSION }}.tar.gz - name: Download 3rd party source - GC:Atomic_ops continue-on-error: true shell: sh - run: curl --insecure -L https://www.hboehm.info/gc/gc_source/libatomic_ops-7.6.10.tar.gz --output libatomic_ops-7.6.10.tar.gz + run: curl --insecure -L https://www.hboehm.info/gc/gc_source/libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}.tar.gz --output libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}.tar.gz - name: UnZip 3rd party source - GC continue-on-error: false shell: sh - run: tar -xvzf gc-8.0.4.tar.gz -C ./3rdParty/ + run: tar -xvzf gc-${{ env.GC_VERSION }}.tar.gz -C ./3rdParty/ - name: UnZip 3rd party source - GC:Atomic_ops continue-on-error: false shell: sh - run: tar -xvzf libatomic_ops-7.6.10.tar.gz -C ./3rdParty/ + run: tar -xvzf libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}.tar.gz -C ./3rdParty/ - name: Copy Atomic_ops to GC continue-on-error: false shell: sh - run: cp -a ./3rdParty/libatomic_ops-7.6.10/ ./3rdParty/gc-8.0.4/libatomic_ops/ + run: cp -a ./3rdParty/libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}/ ./3rdParty/gc-${{ env.GC_VERSION }}/libatomic_ops/ - name: Copy fixes to GC continue-on-error: false shell: sh - run: cp -ar ./docs/fix/gc/* ./3rdParty/gc-8.0.4/ + run: cp -ar ./docs/fix/gc/* ./3rdParty/gc-${{ env.GC_VERSION }}/ - name: Install Ninja continue-on-error: false @@ -415,7 +417,7 @@ jobs: continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/ninja/release shell: sh - run: cmake ../../../../3rdParty/gc-8.0.4 -G "Ninja" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -Denable_threads=ON -Denable_cplusplus=OFF + run: cmake ../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Ninja" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -Denable_threads=ON -Denable_cplusplus=OFF - name: Build GC continue-on-error: false From 689a018e644a44ee0b61cfa268b1fa6d7779f8dd Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 27 Jun 2026 00:40:49 +0100 Subject: [PATCH 36/60] Update build scripts to use cmake install command for better package management --- scripts/build_gc_debug.sh | 3 ++- scripts/build_gc_debug_ninja.bat | 1 + scripts/build_gc_debug_vs.bat | 3 --- scripts/build_gc_debug_vs17.bat | 1 + scripts/build_gc_release.sh | 3 ++- scripts/build_gc_release_vs.bat | 2 -- 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/build_gc_debug.sh b/scripts/build_gc_debug.sh index fddb11c6a..6ced6f8b2 100755 --- a/scripts/build_gc_debug.sh +++ b/scripts/build_gc_debug.sh @@ -4,4 +4,5 @@ mkdir -p 3rdParty/gc/debug cd __build/gc/ninja/debug cmake ../../../../3rdParty/gc-8.2.8 -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/debug -Denable_threads=ON -Denable_cplusplus=OFF cmake --build . --config Debug -j 16 -cp ./libgc-lib.a ../../../../3rdParty/gc/debug/libgc.a +cmake --install . --config Debug +popd \ No newline at end of file diff --git a/scripts/build_gc_debug_ninja.bat b/scripts/build_gc_debug_ninja.bat index c59bb6bce..f97fc87b2 100644 --- a/scripts/build_gc_debug_ninja.bat +++ b/scripts/build_gc_debug_ninja.bat @@ -3,4 +3,5 @@ mkdir __build\gc\ninja\debug cd __build\gc\ninja\debug cmake ../../../../3rdParty/gc-8.2.8 -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/debug -Denable_threads=ON -Denable_cplusplus=OFF cmake --build . --config Debug -j 8 +cmake --install . --config Debug popd \ No newline at end of file diff --git a/scripts/build_gc_debug_vs.bat b/scripts/build_gc_debug_vs.bat index 67df5daa3..99eb53de4 100644 --- a/scripts/build_gc_debug_vs.bat +++ b/scripts/build_gc_debug_vs.bat @@ -4,7 +4,4 @@ cd __build\gc\msbuild\x64\debug cmake ../../../../../3rdParty/gc-8.2.8 -G "Visual Studio 18 2026" -A x64 %EXTRA_PARAM% -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/debug -Denable_threads=ON -Denable_cplusplus=OFF -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug cmake --build . --config Debug -j 8 cmake --install . --config Debug -rem the project links gc against the install root (GC_LIB_PATH), but install puts libs in lib\ - mirror them up -copy /Y ..\..\..\..\..\3rdParty\gc\x64\debug\lib\*.lib ..\..\..\..\..\3rdParty\gc\x64\debug\ -copy /Y ..\..\..\..\..\3rdParty\gc\x64\debug\lib\*.pdb ..\..\..\..\..\3rdParty\gc\x64\debug\ popd \ No newline at end of file diff --git a/scripts/build_gc_debug_vs17.bat b/scripts/build_gc_debug_vs17.bat index d440030ed..59371c946 100644 --- a/scripts/build_gc_debug_vs17.bat +++ b/scripts/build_gc_debug_vs17.bat @@ -4,4 +4,5 @@ cd __build\gc\msbuild\x64\debug if exist "C:/Program Files/Microsoft Visual Studio/2022/Professional" set EXTRA_PARAM=-DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/2022/Professional" cmake ../../../../../3rdParty/gc-8.2.8 -G "Visual Studio 17 2022" -A x64 %EXTRA_PARAM% -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/debug -Denable_threads=ON -Denable_cplusplus=OFF cmake --build . --config Debug -j 8 +cmake --install . --config Debug popd \ No newline at end of file diff --git a/scripts/build_gc_release.sh b/scripts/build_gc_release.sh index 5b0c782cb..183848d18 100755 --- a/scripts/build_gc_release.sh +++ b/scripts/build_gc_release.sh @@ -4,4 +4,5 @@ mkdir -p 3rdParty/gc/release cd __build/gc/ninja/release cmake ../../../../3rdParty/gc-8.2.8 -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -Denable_threads=ON -Denable_cplusplus=OFF cmake --build . --config Release -j 16 -cp ./libgc-lib.a ../../../../3rdParty/gc/release/libgc.a \ No newline at end of file +cmake --install . --config Release +popd \ No newline at end of file diff --git a/scripts/build_gc_release_vs.bat b/scripts/build_gc_release_vs.bat index 4e09f3a41..ba57a2fb4 100644 --- a/scripts/build_gc_release_vs.bat +++ b/scripts/build_gc_release_vs.bat @@ -4,6 +4,4 @@ cd __build\gc\msbuild\x64\release cmake ../../../../../3rdParty/gc-8.2.8 -G "Visual Studio 18 2026" -A x64 %EXTRA_PARAM% -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/release -Denable_threads=ON -Denable_cplusplus=OFF -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded cmake --build . --config Release -j 8 cmake --install . --config Release -rem the project links gc against the install root (GC_LIB_PATH), but install puts libs in lib\ - mirror them up -copy /Y ..\..\..\..\..\3rdParty\gc\x64\release\lib\*.lib ..\..\..\..\..\3rdParty\gc\x64\release\ popd \ No newline at end of file From a16523be3739cf430f435cf8bffc3d8ad12ff58a Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 27 Jun 2026 00:51:27 +0100 Subject: [PATCH 37/60] Refactor GC linking logic in buildExe function to differentiate between platforms --- scripts/build_gc_debug.sh | 1 - scripts/build_gc_release.sh | 1 - tsc/tsc/exe.cpp | 9 ++++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/build_gc_debug.sh b/scripts/build_gc_debug.sh index 6ced6f8b2..53c95532c 100755 --- a/scripts/build_gc_debug.sh +++ b/scripts/build_gc_debug.sh @@ -5,4 +5,3 @@ cd __build/gc/ninja/debug cmake ../../../../3rdParty/gc-8.2.8 -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/debug -Denable_threads=ON -Denable_cplusplus=OFF cmake --build . --config Debug -j 16 cmake --install . --config Debug -popd \ No newline at end of file diff --git a/scripts/build_gc_release.sh b/scripts/build_gc_release.sh index 183848d18..450fe04c6 100755 --- a/scripts/build_gc_release.sh +++ b/scripts/build_gc_release.sh @@ -5,4 +5,3 @@ cd __build/gc/ninja/release cmake ../../../../3rdParty/gc-8.2.8 -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -Denable_threads=ON -Denable_cplusplus=OFF cmake --build . --config Release -j 16 cmake --install . --config Release -popd \ No newline at end of file diff --git a/tsc/tsc/exe.cpp b/tsc/tsc/exe.cpp index 135d62125..5fe1ced0a 100644 --- a/tsc/tsc/exe.cpp +++ b/tsc/tsc/exe.cpp @@ -465,7 +465,14 @@ int buildExe(int argc, char **argv, std::string objFileName, std::string additio // tsc libs if (!disableGC) { - args.push_back("-lgc"); + if (!win && !wasm) + { + args.push_back("-lgc-lib"); + } + else + { + args.push_back("-lgc"); + } } if (isTscLibNeeded) From b036560738c3144af6a72b3fbc2f67ebd804d879 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 27 Jun 2026 00:55:49 +0100 Subject: [PATCH 38/60] Refactor GC library linking to use variable for better platform compatibility --- tsc/lib/TypeScriptRuntime/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tsc/lib/TypeScriptRuntime/CMakeLists.txt b/tsc/lib/TypeScriptRuntime/CMakeLists.txt index f5637688c..4e0aa0365 100644 --- a/tsc/lib/TypeScriptRuntime/CMakeLists.txt +++ b/tsc/lib/TypeScriptRuntime/CMakeLists.txt @@ -13,6 +13,12 @@ else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frtti") endif() +if(MSVC) + set(GC_LIB "${GC_LIB} gc") +else() + set(GC_LIB "${GC_LIB} gc-lib") +endif() + add_mlir_library(TypeScriptRuntime SHARED TypeScriptGC.cpp @@ -25,7 +31,7 @@ add_mlir_library(TypeScriptRuntime EXCLUDE_FROM_LIBMLIR LINK_LIBS PRIVATE - gc + ${GC_LIB} ) if(MSVC) From f322ad95a6abda2239987d4f3c99f702f1a5fbde Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 27 Jun 2026 00:02:19 +0000 Subject: [PATCH 39/60] Refactor GC library linking to simplify logic and ensure consistent usage --- tsc/lib/TypeScriptRuntime/CMakeLists.txt | 8 +------- tsc/tsc/exe.cpp | 9 +-------- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/tsc/lib/TypeScriptRuntime/CMakeLists.txt b/tsc/lib/TypeScriptRuntime/CMakeLists.txt index 4e0aa0365..f5637688c 100644 --- a/tsc/lib/TypeScriptRuntime/CMakeLists.txt +++ b/tsc/lib/TypeScriptRuntime/CMakeLists.txt @@ -13,12 +13,6 @@ else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frtti") endif() -if(MSVC) - set(GC_LIB "${GC_LIB} gc") -else() - set(GC_LIB "${GC_LIB} gc-lib") -endif() - add_mlir_library(TypeScriptRuntime SHARED TypeScriptGC.cpp @@ -31,7 +25,7 @@ add_mlir_library(TypeScriptRuntime EXCLUDE_FROM_LIBMLIR LINK_LIBS PRIVATE - ${GC_LIB} + gc ) if(MSVC) diff --git a/tsc/tsc/exe.cpp b/tsc/tsc/exe.cpp index 5fe1ced0a..135d62125 100644 --- a/tsc/tsc/exe.cpp +++ b/tsc/tsc/exe.cpp @@ -465,14 +465,7 @@ int buildExe(int argc, char **argv, std::string objFileName, std::string additio // tsc libs if (!disableGC) { - if (!win && !wasm) - { - args.push_back("-lgc-lib"); - } - else - { - args.push_back("-lgc"); - } + args.push_back("-lgc"); } if (isTscLibNeeded) From e921dbb2763259088d740cc5aec8897ce4cae597 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 27 Jun 2026 00:25:36 +0000 Subject: [PATCH 40/60] Fix CMake configuration for GC library path and message output --- scripts/build_gc_debug.sh | 2 +- tsc/lib/TypeScriptRuntime/CMakeLists.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/build_gc_debug.sh b/scripts/build_gc_debug.sh index 53c95532c..190633be4 100755 --- a/scripts/build_gc_debug.sh +++ b/scripts/build_gc_debug.sh @@ -2,6 +2,6 @@ mkdir -p __build/gc/ninja/debug mkdir -p 3rdParty/gc/debug cd __build/gc/ninja/debug -cmake ../../../../3rdParty/gc-8.2.8 -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/debug -Denable_threads=ON -Denable_cplusplus=OFF +cmake ../../../../3rdParty/gc-8.2.8 -G "Ninja" -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/debug -Denable_threads=ON -Denable_cplusplus=OFF cmake --build . --config Debug -j 16 cmake --install . --config Debug diff --git a/tsc/lib/TypeScriptRuntime/CMakeLists.txt b/tsc/lib/TypeScriptRuntime/CMakeLists.txt index f5637688c..52fa3496a 100644 --- a/tsc/lib/TypeScriptRuntime/CMakeLists.txt +++ b/tsc/lib/TypeScriptRuntime/CMakeLists.txt @@ -7,9 +7,9 @@ if(MSVC) link_directories("${PROJECT_SOURCE_DIR}/../3rdParty/gc/x64/${CMAKE_BUILD_TYPE_LOWERCASE}/") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR") else() - message(STATUS "Using GC Lib: ${PROJECT_SOURCE_DIR}/../3rdParty/gc/${CMAKE_BUILD_TYPE_LOWERCASE}/") + message(STATUS "Using GC Lib: ${PROJECT_SOURCE_DIR}/../3rdParty/gc/${CMAKE_BUILD_TYPE_LOWERCASE}/lib/") - link_directories("${PROJECT_SOURCE_DIR}/../3rdParty/gc/${CMAKE_BUILD_TYPE_LOWERCASE}/") + link_directories("${PROJECT_SOURCE_DIR}/../3rdParty/gc/${CMAKE_BUILD_TYPE_LOWERCASE}/lib/") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frtti") endif() From d42d17e117d75affd293cb2d2deb103061f41f13 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 27 Jun 2026 10:13:17 +0000 Subject: [PATCH 41/60] added test file for debug build --- tsc/build_tsc_debug-test.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 tsc/build_tsc_debug-test.sh diff --git a/tsc/build_tsc_debug-test.sh b/tsc/build_tsc_debug-test.sh new file mode 100755 index 000000000..1a51b3208 --- /dev/null +++ b/tsc/build_tsc_debug-test.sh @@ -0,0 +1,3 @@ +#!/bin/sh +cd ../__build/tsc/ninja/debug +ctest -j18 -C Debug -T test --output-on-failure -T test --output-on-failure \ No newline at end of file From e67164c7b9052e19cc8b890679838f168ef22e4c Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 27 Jun 2026 10:37:01 +0000 Subject: [PATCH 42/60] Update test runner paths for shared libraries in batch file generation --- tsc/test/tester/CMakeLists.txt | 2 +- tsc/test/tester/test-runner.cpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tsc/test/tester/CMakeLists.txt b/tsc/test/tester/CMakeLists.txt index 839ab6ab6..1218c6704 100644 --- a/tsc/test/tester/CMakeLists.txt +++ b/tsc/test/tester/CMakeLists.txt @@ -87,7 +87,7 @@ if (WIN32) target_compile_definitions(test-runner PUBLIC "TEST_LLVM_EXEPATH=\"${PROJECT_SOURCE_DIR}/../3rdParty/llvm/x64/${CMAKE_BUILD_TYPE_LOWERCASE}/bin\"") target_compile_definitions(test-runner PUBLIC "TEST_LLVM_LIBPATH=\"${PROJECT_SOURCE_DIR}/../3rdParty/llvm/x64/${CMAKE_BUILD_TYPE_LOWERCASE}/lib\"") else() - target_compile_definitions(test-runner PUBLIC "TEST_GCPATH=\"${PROJECT_SOURCE_DIR}/../3rdParty/gc/${CMAKE_BUILD_TYPE_LOWERCASE}\"") + target_compile_definitions(test-runner PUBLIC "TEST_GCPATH=\"${PROJECT_SOURCE_DIR}/../3rdParty/gc/${CMAKE_BUILD_TYPE_LOWERCASE}/lib\"") target_compile_definitions(test-runner PUBLIC "TEST_TSC_EXEPATH=\"${CMAKE_BINARY_DIR}/bin\"") target_compile_definitions(test-runner PUBLIC "TEST_TSC_LIBPATH=\"${CMAKE_BINARY_DIR}/lib\"") target_compile_definitions(test-runner PUBLIC "TEST_LLVM_EXEPATH=\"${PROJECT_SOURCE_DIR}/../3rdParty/llvm/${CMAKE_BUILD_TYPE_LOWERCASE}/bin\"") diff --git a/tsc/test/tester/test-runner.cpp b/tsc/test/tester/test-runner.cpp index eae560c02..7ac5bcc5b 100644 --- a/tsc/test/tester/test-runner.cpp +++ b/tsc/test/tester/test-runner.cpp @@ -552,7 +552,7 @@ void createSharedMultiBatchFile(std::string tempOutputFileNameNoExt, std::vector if (jitRun) { - batFile << "$TSCEXEPATH/tsc --emit=jit " << tsc_opt << " --shared-libs=../../lib/libTypeScriptRuntime.so " << *files.begin() << " 1> $FILENAME.txt 2> $FILENAME.err" + batFile << "$TSCEXEPATH/tsc --emit=jit " << tsc_opt << " --shared-libs=../../lib/libTypeScriptRuntime.so --shared-libs=./lib" << shared_filenameNoExt << ".so " << *files.begin() << " 1> $FILENAME.txt 2> $FILENAME.err" << std::endl; batFile << "rm -f lib" << shared_filenameNoExt << ".so" << std::endl; } @@ -561,11 +561,12 @@ void createSharedMultiBatchFile(std::string tempOutputFileNameNoExt, std::vector batFile << execBat.str(); batFile << TEST_COMPILER << " -o $FILENAME " << exec_objs.str() << " "; batFile << "-L$LLVM_LIBPATH -L$GC_LIB_PATH -L$TSC_LIB_PATH "; - if (sharedLibCompileTime) + if (sharedLib) { + // dynamics and compile-time shared modes both link the produced shared lib; // we need "-Wl,-rpath=" to embed path for compiled shared lib path batFile << "-L`pwd` -Wl,-rpath=`pwd` -l" << shared_filenameNoExt << " "; - } + } batFile << TYPESCRIPT_LIB << GC_LIB << LLVM_LIBS << LIBS << std::endl; From 914ea59d3595b0306f6102648553c610b370d874 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 27 Jun 2026 10:56:30 +0000 Subject: [PATCH 43/60] Update shared library filename handling in createSharedMultiBatchFile --- tsc/test/tester/test-runner.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tsc/test/tester/test-runner.cpp b/tsc/test/tester/test-runner.cpp index 7ac5bcc5b..b63638ad2 100644 --- a/tsc/test/tester/test-runner.cpp +++ b/tsc/test/tester/test-runner.cpp @@ -535,11 +535,13 @@ void createSharedMultiBatchFile(std::string tempOutputFileNameNoExt, std::vector shared_objs << fileNameWithoutExt << ".o "; if (shared_filenameNoExt.empty()) { - shared_filenameNoExt = fileNameWithoutExt; + // the shared lib must keep its real (unprefixed) stem so that `import './'` + // resolves to lib.so instead of falling back to recompiling the source + shared_filenameNoExt = fs::path(file).stem().string(); } } - (first ? execBat : sharedBat) << "$TSCEXEPATH/tsc --emit=obj " << tsc_opt << " " << (first ? "" : tsc_opt) << " " << file << " -relocation-model=pic -o=" << fileNameWithoutExt << ".o" << std::endl; + (first ? execBat : sharedBat) << "$TSCEXEPATH/tsc --emit=obj " << tsc_opt << " " << (first ? "" : tsc_opt_ext) << " " << file << " -relocation-model=pic -o=" << fileNameWithoutExt << ".o" << std::endl; first = false; } From 26a4884e92483a228002a4f341a6ad0557326d5f Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 27 Jun 2026 11:43:51 +0000 Subject: [PATCH 44/60] Enhance createSharedMultiBatchFile to isolate test execution in unique working directories and adjust output paths for better parallel test handling --- tsc/test/tester/test-runner.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/tsc/test/tester/test-runner.cpp b/tsc/test/tester/test-runner.cpp index b63638ad2..7e4739ec5 100644 --- a/tsc/test/tester/test-runner.cpp +++ b/tsc/test/tester/test-runner.cpp @@ -546,22 +546,29 @@ void createSharedMultiBatchFile(std::string tempOutputFileNameNoExt, std::vector first = false; } + // run everything inside a unique per-test working directory: the shared lib must keep its + // real name (lib.so) for `import './'` to resolve, but that name is not unique + // across tests reusing the same source file - isolating the cwd avoids parallel collisions. + // Output (.txt/.err) is written to the parent dir where the runner reads it from. + batFile << "WORKDIR=" << tempOutputFileNameNoExt << "_wd" << std::endl; + batFile << "rm -rf $WORKDIR && mkdir -p $WORKDIR && cd $WORKDIR" << std::endl; + batFile << sharedBat.str(); - batFile << TEST_COMPILER << " " << linker_opt << " -o lib" << shared_filenameNoExt << ".so " << shared_objs.str() + batFile << TEST_COMPILER << " " << linker_opt << " -o lib" << shared_filenameNoExt << ".so " << shared_objs.str() << "-L$LLVM_LIBPATH -L$GC_LIB_PATH -L$TSC_LIB_PATH " << TYPESCRIPT_LIB << GC_LIB << LLVM_LIBS << LIBS << std::endl; batFile << "rm -f " << shared_objs.str() << std::endl; if (jitRun) { - batFile << "$TSCEXEPATH/tsc --emit=jit " << tsc_opt << " --shared-libs=../../lib/libTypeScriptRuntime.so --shared-libs=./lib" << shared_filenameNoExt << ".so " << *files.begin() << " 1> $FILENAME.txt 2> $FILENAME.err" + // one extra "../" because we run from the per-test working directory + batFile << "$TSCEXEPATH/tsc --emit=jit " << tsc_opt << " --shared-libs=../../../lib/libTypeScriptRuntime.so --shared-libs=./lib" << shared_filenameNoExt << ".so " << *files.begin() << " 1> ../$FILENAME.txt 2> ../$FILENAME.err" << std::endl; - batFile << "rm -f lib" << shared_filenameNoExt << ".so" << std::endl; } else { batFile << execBat.str(); - batFile << TEST_COMPILER << " -o $FILENAME " << exec_objs.str() << " "; + batFile << TEST_COMPILER << " -o $FILENAME " << exec_objs.str() << " "; batFile << "-L$LLVM_LIBPATH -L$GC_LIB_PATH -L$TSC_LIB_PATH "; if (sharedLib) { @@ -574,12 +581,12 @@ void createSharedMultiBatchFile(std::string tempOutputFileNameNoExt, std::vector batFile << "rm -f " << exec_objs.str() << std::endl; - batFile << "./$FILENAME 1> $FILENAME.txt 2> $FILENAME.err" << std::endl; - - batFile << "rm -f $FILENAME" << std::endl; - batFile << "rm -f lib" << shared_filenameNoExt << ".so" << std::endl; + batFile << "./$FILENAME 1> ../$FILENAME.txt 2> ../$FILENAME.err" << std::endl; } + // leave and remove the per-test working directory (with the shared lib, exe, etc.) + batFile << "cd .. && rm -rf $WORKDIR" << std::endl; + batFile.close(); #endif } From 1d8f3fa062a08224b779d3c989f037e9828dcc10 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 27 Jun 2026 12:32:17 +0000 Subject: [PATCH 45/60] Enhance LLVMCodeHelper to set function linkage as internal and improve debug info handling for global variables --- .../TypeScript/LowerToLLVM/LLVMCodeHelper.h | 8 +++++++ tsc/lib/TypeScript/LowerToLLVM.cpp | 21 +++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/tsc/include/TypeScript/LowerToLLVM/LLVMCodeHelper.h b/tsc/include/TypeScript/LowerToLLVM/LLVMCodeHelper.h index cf02798db..ca1f03c36 100644 --- a/tsc/include/TypeScript/LowerToLLVM/LLVMCodeHelper.h +++ b/tsc/include/TypeScript/LowerToLLVM/LLVMCodeHelper.h @@ -240,6 +240,14 @@ class LLVMCodeHelper : public LLVMCodeHelperBase // TODO: finish it auto newFuncOp = rewriter.create( location, name, mlir::FunctionType::get(rewriter.getContext(), llvm::ArrayRef(), llvm::ArrayRef())); + // the per-symbol "__cctor" is only ever called from this module's own global ctors / __mlir_gctors. + // keep it internal so it is not exported - otherwise an executable and a shared lib that both + // define e.g. "A.Origin__cctor" interpose each other (ELF gives the executable's copy priority), + // and the shared lib's __mlir_gctors ends up calling the executable's cctor, leaving the shared + // lib's globals uninitialized (null deref at runtime in -shared/-gctors-as-method builds). + newFuncOp.setPrivate(); + newFuncOp->setAttr("llvm.linkage", + LLVM::LinkageAttr::get(rewriter.getContext(), LLVM::Linkage::Internal)); if (!initRegion.empty()) { OpBuilder::InsertionGuard insertGuard(rewriter); diff --git a/tsc/lib/TypeScript/LowerToLLVM.cpp b/tsc/lib/TypeScript/LowerToLLVM.cpp index 3bda408fe..d163efa93 100644 --- a/tsc/lib/TypeScript/LowerToLLVM.cpp +++ b/tsc/lib/TypeScript/LowerToLLVM.cpp @@ -6167,6 +6167,7 @@ static LogicalResult preserveTypesForDebugInfo(mlir::ModuleOp &module, LLVMTypeC mlir::Type dataType; auto argIndex = 0; auto isGlobal = false; + auto isGlobalDefined = true; mlir::StringAttr linkageNameAttr; if (auto variableOp = dyn_cast(op)) { @@ -6183,6 +6184,22 @@ static LogicalResult preserveTypesForDebugInfo(mlir::ModuleOp &module, LLVMTypeC dataType = globalOp.getType(); linkageNameAttr = globalOp.getSymNameAttr(); isGlobal = true; + // an external declaration (no initializer value and empty initializer region) is not + // defined here - marking it as defined makes the debug info emit a dangling address + // relocation to a symbol that never gets emitted (e.g. static members of a class + // expression used only as a default-parameter type). + auto &initRegion = globalOp.getInitializerRegion(); + isGlobalDefined = globalOp.getValueAttr() != nullptr || + (!initRegion.empty() && !initRegion.front().empty()); + + // skip debug info for external declarations - attaching a global-variable + // expression to a declaration global makes LLVM emit a DW_OP_addr relocation to + // a symbol that never gets defined (link error). This happens for static members + // of a class expression used only as a default-parameter type. + if (!isGlobalDefined) + { + continue; + } } // TODO: finish the DI logic @@ -6203,8 +6220,8 @@ static LogicalResult preserveTypesForDebugInfo(mlir::ModuleOp &module, LLVMTypeC { // recreate globalVar later to set correct LinkageAttr and isDefined auto varInfo = LLVM::DIGlobalVariableAttr::get( - location.getContext(), scope, name, linkageNameAttr, - file, line, diType, false, true, alignInBits); + location.getContext(), scope, name, linkageNameAttr, + file, line, diType, false, isGlobalDefined, alignInBits); op->setLoc(mlir::FusedLoc::get(location.getContext(), {location}, varInfo)); } else From d03f19762f53f3363cb2aaef0590655bc45d9f67 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 27 Jun 2026 14:51:41 +0100 Subject: [PATCH 46/60] Update CMakeLists.txt to use static CRT for MSVC configurations and ensure consistency across all targets --- tsc/CMakeLists.txt | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/tsc/CMakeLists.txt b/tsc/CMakeLists.txt index 4402f66ed..e9366043a 100644 --- a/tsc/CMakeLists.txt +++ b/tsc/CMakeLists.txt @@ -103,11 +103,18 @@ set(CMAKE_BUILD_WITH_INSTALL_RPATH "ON") if(MSVC) # FIXME: In fact, sanitizers should support both /MT and /MD, see PR20214. -if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release") - set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded") -else() - set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDebug") -endif() + # Use the static CRT (/MT, /MTd) to match the prebuilt static LLVM/MLIR libs. + # Use a generator expression so it is correct for multi-config generators + # (e.g. Visual Studio), where CMAKE_BUILD_TYPE is not meaningful at configure time. + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + + # HandleLLVMOptions (included below) otherwise forces the dynamic CRT default and + # would override CMAKE_MSVC_RUNTIME_LIBRARY. These tell it to select the static CRT + # for every configuration so all targets (including unittests/gtest) match. + set(LLVM_USE_CRT_DEBUG MTd) + set(LLVM_USE_CRT_RELEASE MT) + set(LLVM_USE_CRT_RELWITHDEBINFO MT) + set(LLVM_USE_CRT_MINSIZEREL MT) message(STATUS "CMAKE_MSVC_RUNTIME_LIBRARY is ${CMAKE_MSVC_RUNTIME_LIBRARY}") endif() From 72d9a194255e1cb0249919c4e9814441dcaed0d7 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 27 Jun 2026 15:06:11 +0100 Subject: [PATCH 47/60] Update CMakeLists.txt to correct GC library path for MSVC and test runner --- tsc/lib/TypeScriptRuntime/CMakeLists.txt | 4 ++-- tsc/test/tester/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tsc/lib/TypeScriptRuntime/CMakeLists.txt b/tsc/lib/TypeScriptRuntime/CMakeLists.txt index 52fa3496a..88b887df7 100644 --- a/tsc/lib/TypeScriptRuntime/CMakeLists.txt +++ b/tsc/lib/TypeScriptRuntime/CMakeLists.txt @@ -2,9 +2,9 @@ include_directories("${PROJECT_SOURCE_DIR}/../3rdParty/gc-8.2.8/include/") string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWERCASE) if(MSVC) - message(STATUS "Using GC Lib: ${PROJECT_SOURCE_DIR}/../3rdParty/gc/x64/${CMAKE_BUILD_TYPE_LOWERCASE}/") + message(STATUS "Using GC Lib: ${PROJECT_SOURCE_DIR}/../3rdParty/gc/x64/${CMAKE_BUILD_TYPE_LOWERCASE}/lib/") - link_directories("${PROJECT_SOURCE_DIR}/../3rdParty/gc/x64/${CMAKE_BUILD_TYPE_LOWERCASE}/") + link_directories("${PROJECT_SOURCE_DIR}/../3rdParty/gc/x64/${CMAKE_BUILD_TYPE_LOWERCASE}/lib/") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR") else() message(STATUS "Using GC Lib: ${PROJECT_SOURCE_DIR}/../3rdParty/gc/${CMAKE_BUILD_TYPE_LOWERCASE}/lib/") diff --git a/tsc/test/tester/CMakeLists.txt b/tsc/test/tester/CMakeLists.txt index 1218c6704..202d39420 100644 --- a/tsc/test/tester/CMakeLists.txt +++ b/tsc/test/tester/CMakeLists.txt @@ -81,7 +81,7 @@ if (WIN32) target_compile_definitions(test-runner PUBLIC "TEST_SDKPATH=\"${WINDOWS_KITS_DIR_LIB}\"") target_compile_definitions(test-runner PUBLIC "TEST_UCRTPATH=\"${WINDOWS_KITS_DIR_UCRT_LIB}\"") target_compile_definitions(test-runner PUBLIC "CMAKE_C_STANDARD_LIBRARIES=\"${CMAKE_C_STANDARD_LIBRARIES}\"") - target_compile_definitions(test-runner PUBLIC "TEST_GCPATH=\"${PROJECT_SOURCE_DIR}/../3rdParty/gc/x64/${CMAKE_BUILD_TYPE_LOWERCASE}\"") + target_compile_definitions(test-runner PUBLIC "TEST_GCPATH=\"${PROJECT_SOURCE_DIR}/../3rdParty/gc/x64/${CMAKE_BUILD_TYPE_LOWERCASE}/lib\"") target_compile_definitions(test-runner PUBLIC "TEST_TSC_EXEPATH=\"${CMAKE_BINARY_DIR}/bin\"") target_compile_definitions(test-runner PUBLIC "TEST_TSC_LIBPATH=\"${CMAKE_BINARY_DIR}/lib\"") target_compile_definitions(test-runner PUBLIC "TEST_LLVM_EXEPATH=\"${PROJECT_SOURCE_DIR}/../3rdParty/llvm/x64/${CMAKE_BUILD_TYPE_LOWERCASE}/bin\"") From f748ac7dab7dc35df9968ff8b81a3cd6d261f091 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 27 Jun 2026 15:15:11 +0100 Subject: [PATCH 48/60] Fix GC library path check and remove redundant copy commands in prepare_3rdParty.bat --- prepare_3rdParty.bat | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/prepare_3rdParty.bat b/prepare_3rdParty.bat index a29708249..daf494b54 100644 --- a/prepare_3rdParty.bat +++ b/prepare_3rdParty.bat @@ -25,7 +25,7 @@ IF EXIST ".\3rdParty\llvm\x64\%BUILD%\bin" ( @call scripts\build_llvm_%BUILD%_%TOOL%.bat ) -IF EXIST ".\3rdParty\gc\x64\%BUILD%\gc-lib.lib" ( +IF EXIST ".\3rdParty\gc\x64\%BUILD%\lib\gc.lib" ( echo "No need to build GC (%BUILD%)" ) ELSE ( cd %p% @@ -41,7 +41,6 @@ IF EXIST ".\3rdParty\gc\x64\%BUILD%\gc-lib.lib" ( xcopy /E /H /C /I /Y .\3rdParty\libatomic_ops-%LIBATOMIC_OPS_VER%\ .\3rdParty\gc-%GC_VER%\libatomic_ops\ cd %p% @call scripts\build_gc_%BUILD%_%TOOL%.bat - cd %p% - if "%BUILD%"=="debug" ( xcopy /E /H /C /I /Y .\__build\gc\msbuild\x64\%BUILD%\Debug\ .\3rdParty\gc\x64\debug\ ) - if "%BUILD%"=="release" ( xcopy /E /H /C /I /Y .\__build\gc\msbuild\x64\%BUILD%\Release\ .\3rdParty\gc\x64\release\ ) + rem build_gc_*_vs.bat runs "cmake --install" which installs the libs to + rem 3rdParty\gc\x64\%BUILD%\lib (where tsc now links from) - no extra copy needed ) \ No newline at end of file From 457f888d662b7a6966f4f1b401a7fa1fa9f1fdda Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 27 Jun 2026 16:03:18 +0100 Subject: [PATCH 49/60] Refactor CMake configuration to utilize BDWgc package for garbage collector integration and update test-runner paths for improved compatibility --- tsc/CMakeLists.txt | 17 +++++++++++++++++ tsc/lib/TypeScriptRuntime/CMakeLists.txt | 13 +++---------- tsc/lib/TypeScriptRuntime/gc.cpp | 2 +- tsc/test/tester/CMakeLists.txt | 18 +++++++++++++++--- 4 files changed, 36 insertions(+), 14 deletions(-) diff --git a/tsc/CMakeLists.txt b/tsc/CMakeLists.txt index e9366043a..f2f9fbebf 100644 --- a/tsc/CMakeLists.txt +++ b/tsc/CMakeLists.txt @@ -68,6 +68,16 @@ if ("${Clang_DIR}" STREQUAL "" OR "${Clang_DIR}" STREQUAL "Clang_DIR-NOTFOUND") endif() message(STATUS "Clang_DIR is ${Clang_DIR}") +if ("${BDWgc_DIR}" STREQUAL "" OR "${BDWgc_DIR}" STREQUAL "BDWgc_DIR-NOTFOUND") + string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWERCASE) + if (MSVC OR WIN32) + get_filename_component(BDWgc_DIR "${CMAKE_SOURCE_DIR}/../3rdParty/gc/x64/${CMAKE_BUILD_TYPE_LOWERCASE}/lib/cmake/bdwgc" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") + else() + get_filename_component(BDWgc_DIR "${CMAKE_SOURCE_DIR}/../3rdParty/gc/${CMAKE_BUILD_TYPE_LOWERCASE}/lib/cmake/bdwgc" REALPATH BASE_DIR "${CMAKE_SOURCE_DIR}") + endif() +endif() +message(STATUS "BDWgc_DIR is ${BDWgc_DIR}") + if ("${PYTHON_EXECUTABLE}" STREQUAL "" OR "${PYTHON_EXECUTABLE}" STREQUAL "PYTHON_EXECUTABLE-NOTFOUND") set(PYTHON_EXECUTABLE "python.exe") endif() @@ -85,6 +95,13 @@ if (NOT Clang_FOUND) message(FATAL_ERROR "Failed to find Clang") endif() +# bdwgc ships a CMake package (BDWgc::gc / BDWgc::cord imported targets) that +# carries the include dir and the per-config static lib location. +find_package(BDWgc REQUIRED CONFIG) +if (NOT BDWgc_FOUND) + message(FATAL_ERROR "Failed to find BDWgc (garbage collector)") +endif() + message(STATUS "Using MLIRConfig.cmake in: ${MLIR_CMAKE_DIR}") message(STATUS "Using LLVMConfig.cmake in: ${LLVM_CMAKE_DIR}") message(STATUS "Using ClangConfig.cmake in: ${CLANG_CMAKE_DIR}") diff --git a/tsc/lib/TypeScriptRuntime/CMakeLists.txt b/tsc/lib/TypeScriptRuntime/CMakeLists.txt index 88b887df7..858ccbeee 100644 --- a/tsc/lib/TypeScriptRuntime/CMakeLists.txt +++ b/tsc/lib/TypeScriptRuntime/CMakeLists.txt @@ -1,15 +1,8 @@ -include_directories("${PROJECT_SOURCE_DIR}/../3rdParty/gc-8.2.8/include/") - -string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWERCASE) +# Include dir + lib location come from the BDWgc::gc imported target (find_package +# in the top-level CMakeLists), so no hardcoded include_directories/link_directories. if(MSVC) - message(STATUS "Using GC Lib: ${PROJECT_SOURCE_DIR}/../3rdParty/gc/x64/${CMAKE_BUILD_TYPE_LOWERCASE}/lib/") - - link_directories("${PROJECT_SOURCE_DIR}/../3rdParty/gc/x64/${CMAKE_BUILD_TYPE_LOWERCASE}/lib/") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR") else() - message(STATUS "Using GC Lib: ${PROJECT_SOURCE_DIR}/../3rdParty/gc/${CMAKE_BUILD_TYPE_LOWERCASE}/lib/") - - link_directories("${PROJECT_SOURCE_DIR}/../3rdParty/gc/${CMAKE_BUILD_TYPE_LOWERCASE}/lib/") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -frtti") endif() @@ -25,7 +18,7 @@ add_mlir_library(TypeScriptRuntime EXCLUDE_FROM_LIBMLIR LINK_LIBS PRIVATE - gc + BDWgc::gc ) if(MSVC) diff --git a/tsc/lib/TypeScriptRuntime/gc.cpp b/tsc/lib/TypeScriptRuntime/gc.cpp index 9e5fd9a42..4bb539f6a 100644 --- a/tsc/lib/TypeScriptRuntime/gc.cpp +++ b/tsc/lib/TypeScriptRuntime/gc.cpp @@ -17,7 +17,7 @@ #endif #include "gc.h" -#include "gc_typed.h" +#include "gc/gc_typed.h" // give the wrappers C linkage so they are exported under clean, unmangled // names (see TypeScriptRuntime.def, used by the JIT to resolve runtime symbols) diff --git a/tsc/test/tester/CMakeLists.txt b/tsc/test/tester/CMakeLists.txt index 202d39420..ad4e93ee6 100644 --- a/tsc/test/tester/CMakeLists.txt +++ b/tsc/test/tester/CMakeLists.txt @@ -76,18 +76,20 @@ endif() add_executable(test-runner test-runner.cpp) target_link_libraries(test-runner PRIVATE ${LIBS}) string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWERCASE) +# GC lib dir derived from the BDWgc package (BDWgc_DIR=/lib/cmake/bdwgc) +get_filename_component(TEST_GC_LIBDIR "${BDWgc_DIR}/../.." ABSOLUTE) if (WIN32) target_compile_definitions(test-runner PUBLIC "TEST_LIBPATH=\"${VC_LIB_DIR}\"") target_compile_definitions(test-runner PUBLIC "TEST_SDKPATH=\"${WINDOWS_KITS_DIR_LIB}\"") target_compile_definitions(test-runner PUBLIC "TEST_UCRTPATH=\"${WINDOWS_KITS_DIR_UCRT_LIB}\"") target_compile_definitions(test-runner PUBLIC "CMAKE_C_STANDARD_LIBRARIES=\"${CMAKE_C_STANDARD_LIBRARIES}\"") - target_compile_definitions(test-runner PUBLIC "TEST_GCPATH=\"${PROJECT_SOURCE_DIR}/../3rdParty/gc/x64/${CMAKE_BUILD_TYPE_LOWERCASE}/lib\"") + target_compile_definitions(test-runner PUBLIC "TEST_GCPATH=\"${TEST_GC_LIBDIR}\"") target_compile_definitions(test-runner PUBLIC "TEST_TSC_EXEPATH=\"${CMAKE_BINARY_DIR}/bin\"") target_compile_definitions(test-runner PUBLIC "TEST_TSC_LIBPATH=\"${CMAKE_BINARY_DIR}/lib\"") target_compile_definitions(test-runner PUBLIC "TEST_LLVM_EXEPATH=\"${PROJECT_SOURCE_DIR}/../3rdParty/llvm/x64/${CMAKE_BUILD_TYPE_LOWERCASE}/bin\"") target_compile_definitions(test-runner PUBLIC "TEST_LLVM_LIBPATH=\"${PROJECT_SOURCE_DIR}/../3rdParty/llvm/x64/${CMAKE_BUILD_TYPE_LOWERCASE}/lib\"") else() - target_compile_definitions(test-runner PUBLIC "TEST_GCPATH=\"${PROJECT_SOURCE_DIR}/../3rdParty/gc/${CMAKE_BUILD_TYPE_LOWERCASE}/lib\"") + target_compile_definitions(test-runner PUBLIC "TEST_GCPATH=\"${TEST_GC_LIBDIR}\"") target_compile_definitions(test-runner PUBLIC "TEST_TSC_EXEPATH=\"${CMAKE_BINARY_DIR}/bin\"") target_compile_definitions(test-runner PUBLIC "TEST_TSC_LIBPATH=\"${CMAKE_BINARY_DIR}/lib\"") target_compile_definitions(test-runner PUBLIC "TEST_LLVM_EXEPATH=\"${PROJECT_SOURCE_DIR}/../3rdParty/llvm/${CMAKE_BUILD_TYPE_LOWERCASE}/bin\"") @@ -95,7 +97,17 @@ else() target_compile_definitions(test-runner PUBLIC "TEST_COMPILER=\"${CMAKE_CXX_COMPILER}\"") endif() -######## enable testing ############ +# test-runner caches the per-mode link scripts (compile/jit[d].bat|.sh) via an +# exists() guard and reuses them across runs, so they retain stale lib paths +# (e.g. GC_LIB_PATH) after a path-affecting reconfigure. Remove them on every +# (re)configure so they regenerate with the current TEST_* definitions above. +file(REMOVE + "${CMAKE_CURRENT_BINARY_DIR}/compile.bat" "${CMAKE_CURRENT_BINARY_DIR}/jit.bat" + "${CMAKE_CURRENT_BINARY_DIR}/compiled.bat" "${CMAKE_CURRENT_BINARY_DIR}/jitd.bat" + "${CMAKE_CURRENT_BINARY_DIR}/compile.sh" "${CMAKE_CURRENT_BINARY_DIR}/jit.sh" + "${CMAKE_CURRENT_BINARY_DIR}/compiled.sh" "${CMAKE_CURRENT_BINARY_DIR}/jitd.sh") + +######## enable testing ############ # open __build\tsc # ctest.exe -j4 -C Release -T test --output-on-failure add_test(NAME test-compile-00-print COMMAND test-runner "${PROJECT_SOURCE_DIR}/test/tester/tests/00print.ts") From 01202070f9c51be0c6227e9374dccdf7ca68cbe8 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 27 Jun 2026 18:06:32 +0100 Subject: [PATCH 50/60] Update README.md to enhance structure, clarify build instructions, and improve formatting for code examples --- README.md | 163 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 119 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index ab0143831..452e3ed41 100644 --- a/README.md +++ b/README.md @@ -3,33 +3,54 @@ [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/donate/?hosted_button_id=BBJ4SQYLA6D2L) -# Build +A native ahead-of-time (AOT) and JIT compiler for **TypeScript**, built on **LLVM/MLIR**. +It compiles `.ts` files directly to native executables, WebAssembly, or runs them +on the fly via a built-in JIT — no Node.js or JavaScript runtime required. + +## CI Status [![Test Build (Windows)](https://github.com/ASDAlexander77/TypeScriptCompiler/actions/workflows/cmake-test-release-win.yml/badge.svg)](https://github.com/ASDAlexander77/TypeScriptCompiler/actions/workflows/cmake-test-release-win.yml) [![Test Build (Linux)](https://github.com/ASDAlexander77/TypeScriptCompiler/actions/workflows/cmake-test-release-linux.yml/badge.svg)](https://github.com/ASDAlexander77/TypeScriptCompiler/actions/workflows/cmake-test-release-linux.yml) -# What's new +## Contents + +- [What's new](#whats-new) +- [Roadmap](#roadmap) +- [Demo](#demo) +- [Try it online](#try-it) +- [Example](#example) +- [Running your code](#run-as-jit) + - [As JIT](#run-as-jit) + - [As a native executable](#compile-as-binary-executable) + - [As WebAssembly](#compiling-as-wasm) +- [Building from source](#build) +- [Community](#chat-room) +- [License](#license) + +## What's new + +- Migrated to **Visual Studio 2026** (Windows build chain) - JavaScript Built-in objects library [[Default Library repo](https://github.com/ASDAlexander77/TypeScriptCompilerDefaultLib/)] - Visual Studio Code project -```cmd +```bat tsc --new Test1 ``` - Strict null checks -```TypeScript +```typescript let sn: string | null = null; // Ok let s: string = null; // error ``` -- improved `Template Literal Types` -```TypeScript +- Improved `Template Literal Types` +```typescript type Color = "red" | "green" | "blue"; type HexColor = `#${string}`; ``` - Public, private, and protected modifiers -```TypeScript +```typescript class Point { private x: number; #y: number; @@ -41,7 +62,7 @@ p.#y // error ``` - Class from Tuple -```TypeScript +```typescript class Point { x: number; y: number; @@ -55,7 +76,7 @@ const l = new Line({ x: 0, y: 1 }, { x: 1.0, y: 2.0 }); ``` - Compile-time `if`s -```TypeScript +```typescript function isArray(value: T): value is T { return true; } @@ -76,38 +97,41 @@ const v2 = gen([]); // result: 0 - Migrated to LLVM 19.1.3 -- improved ```generating debug information``` more info here: [Wiki:How-To](https://github.com/ASDAlexander77/TypeScriptCompiler/wiki/How-To#compile-and-debug-with-visual-studio-code) -```cmd +- Improved `generating debug information` — more info here: [Wiki:How-To](https://github.com/ASDAlexander77/TypeScriptCompiler/wiki/How-To#compile-and-debug-with-visual-studio-code) +```bat tsc --di --opt_level=0 --emit=exe example.ts ``` - [more...](https://github.com/ASDAlexander77/TypeScriptCompiler/wiki/What's-new) -# Planning +## Roadmap + - [x] Migrating to LLVM 19.1.3 - [x] Shared libraries -- [ ] JavaScript Built-in classes library +- [x] JavaScript Built-in classes library + +## Demo -# Demo [(click here)](https://github.com/ASDAlexander77/TypeScriptCompiler/releases/) [![Demo](https://raw.githubusercontent.com/ASDAlexander77/ASDAlexander77.github.io/main/img/tsc_emit.gif)](https://github.com/ASDAlexander77/TypeScriptCompiler/releases/) -# Try it +## Try it + [(click here)](https://godbolt.org/#z:OYLghAFBqd5TKALEBjA9gEwKYFFMCWALugE4A0BIEAZgQDbYB2AhgLbYgDkAjF%2BTXRMiAZVQtGIHgA4BQogFUAztgAKAD24AGfgCsp5eiyagiATwAO2JalIELRcisaoiBIdWaYAwunoBXNiYQACZyLwAZAiZsADlAgCNsUhAAZh5yC3QlYncmXwCg0Mzs3KEomPi2JJT0p2wXNyERIhZSIgLA4LDnbFc8lraiCrjE5LSMpVb2zqKe6eHo0erx9IBKJ3R/UlROLhYEqdIWVwBqVCMlJVOAEWwLIY5hU4BSAHYAIRetAEFT//OQiO/lcZAgFn8CXoBFQp1YHBApyO0WAa1en3eN2%2BP2xANOFjswli7GwEDWiIAbugCJh0V9fni8QTokQIC8QiE7g92k8iHCSYj2SFXiEPqciEgCEoAHTw7BrF6pel/AGY7G4gEHI4nPnM4QAWWw2DcJjJlOpmEVYoA9NbTmx/FNTklTgQ2BZGLzsLToqccHYKd7zpcVEp1W8sb9sRcWFdTj9UBh/MIUVzHsw%2Bdh1EQvNc0zyM3SNf8MExgaDSGSiwzGf8lP4rJWhQmkymTKdjLSfv5CCbgEKFUrTrbAWWiKQQSRSNdff6CIHaTGrtZ7Y6%2BeJ6PQkQ3kmTi%2BjIzia/89URDcaUWbTlSadWVbXT2yOQAVJDYeOJrZt4C3e7p54cMa1zYCcSCnPqQiYCwZgdnyPBaOw0oDla%2B5qlGx6nMAzDJCwOYAEr3GQRBKFeN60u8yq1iehKskKADi2HHH2HafsmzGkIR7QytKSEcoOlGqhG4aHtiNDJv0Qj2iw0RVhR%2B6MHyODckQvKIvmKkZlaw52ugADW4roOcHG4e%2BLCnBxNDJMwuwGR2TAdoc446uKljYPuSn/nyio3HC2AAO4fq2fbqbye5DiOem2bYIE5nZtKxjkwD2WZTBCAAtFqTlnPWCRLmGGEeQWwjSqexIcGFAn/IVGnFae559hV%2B62tVvLSlhMRMdgBFZFxFXaacySkGQiItYWUpwugfLoDQLlWIFX7BX%2BRWOOcxipXyJy7HG7U4fhnHEcJXAbPQ3AAKz8MEXA6OQ6DcM%2BrliHYDinMSbiBkiWw7O%2B7LpPwRDaEdGy6WkqTSqk4MQ5DkMAGyGNwAAs/BsCAbzw2DqTSJjqTw/DbzQ1oWjw%2BQl3XbdXD8EoIBaOQ/1XUd5BwLAKBZn0/hTpQ1BtMASiqMYDQiEg6B%2BZdfDkBg7oMLheS8zE9AC0LJP8OLFgMOMxGoAA%2BloWsa6kp0a8AqBi%2BgEuMKQZV7ErJsq2bADybPy8LAPhOofQ/KQ3PcPwLOoC0hCXfwgjCGIEicDwRNB4oKgaM7%2BgZEYJggOYVg2E9jjQoc8AbOgDh5JT5M3YGpB2DglOQBsSifbsBhTP7Mv84LTu8PwfnHBY3B8MdZ0Xc7ZO4K7qBs2Qpz3VYj32Hyr3zu%2Bvim8kpxaNKi8EtgeunAAUgAks%2BpwQHR3hohAo/YOPz1T4G5CnPgxDDz9PBrH9ANrBsb4sP61Bd1wiPkMjISndK0NoY8GAdDU6p0QipAAJyQKAcTXuXsnBUxpk/IGaR/4Yz1uAngeNIHYLeG8OGXBUg9zpjdBBtMdAbEZsgNA1tVYUCoBAZW9Ck42B1trPWBsjY4ApDCbAAA1Ag/lbZWBFoHBgOZpzUASM7BI0Q2hmA7vwORrBSBmFtgkXQfRaai3FryW2TB6CKNITgBI/hgDeAkPQfOoscBsGMMASQJiCAcX6IGfO10fZsz2KLFkDRnYZ2OGo3wOBnbjjdEojYNAjDc0EcI0RSi5DBw3GHCO8hlBqE0KQuOhgHFJ1cqnCehgCCZ3LjdXOQIEHoCLiXawWd6iNDyJ4JgPg/BdAMJEJYVQagGCyDkJo%2BQ2lFAyH0soTARjdPGJMBo2iBgLFmMEaZjTmgLAmWMFIkx5lDMWU4VZXT1lSArlXMOn9zpwNIWTEeD1bATxelLd6s8bbz0XsvDia8t47z3gfXe18pwinWI/Omz9yCv3fmScgwN0jShCNIdI4d4bSEgajRFWhZAnS/iQ0mCDKbUwofTahEAUAuI5kwuhZsLZ3WuWnO5b0Z5kueUvEqbzTob23rvfeD9wi9jIDSAwkcQ6SHDkkqOmTY41xmRJYIEAvALI6S0tZKwNklH6XkWVIzSgDIVT0pZsyVlDDVQ03VTBBjtC1VM3Z%2Brtk1z2ZUA598aYcWwLyrQpzMX8DJhECI/D9SnE3nhU4cS/Lz2PqfSe9y6Vz1IAvRlK93lsq%2BYfX5t8IEZFOI8%2Bh/z76Asoag8G6MoYFtSIQ7%2BisyEFxxcgoFn8QhurLdmwG5Ai45A8PDIAA%3D%3D) [![Compiler Explorer](https://asdalexander77.github.io/img/god_bolt_tsc_native.jpg)](https://godbolt.org/#z:OYLghAFBqd5TKALEBjA9gEwKYFFMCWALugE4A0BIEAZgQDbYB2AhgLbYgDkAjF%2BTXRMiAZVQtGIHgA4BQogFUAztgAKAD24AGfgCsp5eiyagiATwAO2JalIELRcisaoiBIdWaYAwunoBXNiYQACZyLwAZAiZsADlAgCNsUhAAZh5yC3QlYncmXwCg0Mzs3KEomPi2JJT0p2wXNyERIhZSIgLA4LDnbFc8lraiCrjE5LSMpVb2zqKe6eHo0erx9IBKJ3R/UlROLhYEqdIWVwBqVCMlJVOAEWwLIY5hU4BSAHYAIRetAEFT//OQiO/lcZAgFn8CXoBFQp1YHBApyO0WAa1en3eN2%2BP2xANOFjswli7GwEDWiIAbugCJh0V9fni8QTokQIC8QiE7g92k8iHCSYj2SFXiEPqciEgCEoAHTw7BrF6pel/AGY7G4gEHI4nPnM4QAWWw2DcJjJlOpmEVYoA9NbTmx/FNTklTgQ2BZGLzsLToqccHYKd7zpcVEp1W8sb9sRcWFdTj9UBh/MIUVzHsw%2Bdh1EQvNc0zyM3SNf8MExgaDSGSiwzGf8lP4rJWhQmkymTKdjLSfv5CCbgEKFUrTrbAWWiKQQSRSNdff6CIHaTGrtZ7Y6%2BeJ6PQkQ3kmTi%2BjIzia/89URDcaUWbTlSadWVbXT2yOQAVJDYeOJrZt4C3e7p54cMa1zYCcSCnPqQiYCwZgdnyPBaOw0oDla%2B5qlGx6nMAzDJCwOYAEr3GQRBKFeN60u8yq1iehKskKADi2HHH2HafsmzGkIR7QytKSEcoOlGqhG4aHtiNDJv0Qj2iw0RVhR%2B6MHyODckQvKIvmKkZlaw52ugADW4roOcHG4e%2BLCnBxNDJMwuwGR2TAdoc446uKljYPuSn/nyio3HC2AAO4fq2fbqbye5DiOem2bYIE5nZtKxjkwD2WZTBCAAtFqTlnPWCRLmGGEeQWwjSqexIcGFAn/IVGnFae559hV%2B62tVvLSlhMRMdgBFZFxFXaacySkGQiItYWUpwugfLoDQLlWIFX7BX%2BRWOOcxipXyJy7HG7U4fhnHEcJXAbPQ3AAKz8MEXA6OQ6DcM%2BrliHYDinMSbiBkiWw7O%2B7LpPwRDaEdGy6WkqTSqk4MQ5DkMAGyGNwAAs/BsCAbzw2DqTSJjqTw/DbzQ1oWjw%2BQl3XbdXD8EoIBaOQ/1XUd5BwLAKBZn0/hTpQ1BtMASiqMYDQiEg6B%2BZdfDkBg7oMLheS8zE9AC0LJP8OLFgMOMxGoAA%2BloWsa6kp0a8AqBi%2BgEuMKQZV7ErJsq2bADybPy8LAPhOofQ/KQ3PcPwLOoC0hCXfwgjCGIEicDwRNB4oKgaM7%2BgZEYJggOYVg2E9jjQoc8AbOgDh5JT5M3YGpB2DglOQBsSifbsBhTP7Mv84LTu8PwfnHBY3B8MdZ0Xc7ZO4K7qBs2Qpz3VYj32Hyr3zu%2Bvim8kpxaNKi8EtgeunAAUgAks%2BpwQHR3hohAo/YOPz1T4G5CnPgxDDz9PBrH9ANrBsb4sP61Bd1wiPkMjISndK0NoY8GAdDU6p0QipAAJyQKAcTXuXsnBUxpk/IGaR/4Yz1uAngeNIHYLeG8OGXBUg9zpjdBBtMdAbEZsgNA1tVYUCoBAZW9Ck42B1trPWBsjY4ApDCbAAA1Ag/lbZWBFoHBgOZpzUASM7BI0Q2hmA7vwORrBSBmFtgkXQfRaai3FryW2TB6CKNITgBI/hgDeAkPQfOoscBsGMMASQJiCAcX6IGfO10fZsz2KLFkDRnYZ2OGo3wOBnbjjdEojYNAjDc0EcI0RSi5DBw3GHCO8hlBqE0KQuOhgHFJ1cqnCehgCCZ3LjdXOQIEHoCLiXawWd6iNDyJ4JgPg/BdAMJEJYVQagGCyDkJo%2BQ2lFAyH0soTARjdPGJMBo2iBgLFmMEaZjTmgLAmWMFIkx5lDMWU4VZXT1lSArlXMOn9zpwNIWTEeD1bATxelLd6s8bbz0XsvDia8t47z3gfXe18pwinWI/Omz9yCv3fmScgwN0jShCNIdI4d4bSEgajRFWhZAnS/iQ0mCDKbUwofTahEAUAuI5kwuhZsLZ3WuWnO5b0Z5kueUvEqbzTob23rvfeD9wi9jIDSAwkcQ6SHDkkqOmTY41xmRJYIEAvALI6S0tZKwNklH6XkWVIzSgDIVT0pZsyVlDDVQ03VTBBjtC1VM3Z%2Brtk1z2ZUA598aYcWwLyrQpzMX8DJhECI/D9SnE3nhU4cS/Lz2PqfSe9y6Vz1IAvRlK93lsq%2BYfX5t8IEZFOI8%2Bh/z76Asoag8G6MoYFtSIQ7%2BisyEFxxcgoFn8QhurLdmwG5Ai45A8PDIAA%3D%3D) -Chat Room ---------- +## Chat Room Want to chat with other members of the TypeScriptCompiler community? -[![Join the chat at https://gitter.im/ASDAlexander77/TypeScriptCompiler](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ASDAlexander77/TypeScriptCompiler?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +- [GitHub Discussions](https://github.com/ASDAlexander77/TypeScriptCompiler/discussions) (preferred) +- [![Join the chat at https://gitter.im/ASDAlexander77/TypeScriptCompiler](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ASDAlexander77/TypeScriptCompiler?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) (legacy) -# Example +## Example -```TypeScript +```typescript abstract class Department { constructor(public name: string) {} @@ -142,12 +166,14 @@ function main() { ``` Run -```cmd + +```bat tsc --emit=jit --opt --shared-libs=TypeScriptRuntime.dll example.ts ``` Result -``` + +```text Department name: Accounting and Auditing The Accounting Department meets each Monday at 10am. ``` @@ -155,33 +181,51 @@ The Accounting Department meets each Monday at 10am. ## Run as JIT - with Garbage collection -```cmd + +```bat tsc --emit=jit --opt --shared-libs=TypeScriptRuntime.dll hello.ts ``` - without Garbage collection -```cmd + +```bat tsc --emit=jit --nogc hello.ts ``` File ``hello.ts`` -```TypeScript +```typescript function main() { print("Hello World!"); } ``` + Result -``` + +```text Hello World! ``` ## Compile as Binary Executable +> Make sure you have [built `tsc` from source](#build) first. + +The compile scripts below set a few environment variables so the linker can find the +runtime libraries, then invoke `tsc` with `--emit=exe`. **Edit the paths to match your +checkout** — the `C:\dev\...` / `~/dev/...` values are only examples. + +| Variable | Points to | +| --- | --- | +| `GC_LIB_PATH` | Boehm GC library (the garbage collector) | +| `LLVM_LIB_PATH` | LLVM/MLIR libraries | +| `TSC_LIB_PATH` | TSC runtime library | +| `TSCEXEPATH` | Folder containing the `tsc` executable | + ### On Windows File ``tsc-compile.bat`` -```cmd + +```bat set FILENAME=%1 set GC_LIB_PATH=C:\dev\TypeScriptCompiler\__build\gc\msbuild\x64\release\Release set LLVM_LIB_PATH=C:\dev\TypeScriptCompiler\__build\llvm\msbuild\x64\release\Release\lib @@ -189,24 +233,29 @@ set TSC_LIB_PATH=C:\dev\TypeScriptCompiler\__build\tsc\windows-msbuild-release\l set TSCEXEPATH=C:\dev\TypeScriptCompiler\__build\tsc\windows-msbuild-release\bin %TSCEXEPATH%\tsc.exe --opt --emit=exe %FILENAME%.ts ``` -Compile -```cmd + +Compile + +```bat tsc-compile.bat hello ``` Run -``` + +```text hello.exe ``` Result -``` + +```text Hello World! ``` ### On Linux (Ubuntu 20.04 and 22.04) File ``tsc-compile.sh`` + ```bash FILENAME=$1 export TSC_LIB_PATH=~/dev/TypeScriptCompiler/__build/tsc/linux-ninja-gcc-release/lib @@ -215,37 +264,49 @@ export GC_LIB_PATH=~/dev/TypeScriptCompiler/3rdParty/gc/release TSCEXEPATH=~/dev/TypeScriptCompiler/__build/tsc/linux-ninja-gcc-release/bin $TSCEXEPATH/tsc --emit=exe $FILENAME.ts --relocation-model=pic ``` -Compile + +Compile + ```bash sh -f tsc-compile.sh hello ``` Run -``` + +```text ./hello ``` Result -``` + +```text Hello World! ``` -### Compiling as WASM +## Compiling as WASM + ### On Windows + File ``tsc-compile-wasm.bat`` -```cmd + +```bat set FILENAME=%1 set GC_LIB_PATH=C:\dev\TypeScriptCompiler\__build\gc\msbuild\x64\release\Release set LLVM_LIB_PATH=C:\dev\TypeScriptCompiler\__build\llvm\msbuild\x64\release\Release\lib set TSC_LIB_PATH=C:\dev\TypeScriptCompiler\__build\tsc\windows-msbuild-release\lib C:\dev\TypeScriptCompiler\__build\tsc\windows-msbuild-release\bin\tsc.exe --emit=exe --nogc -mtriple=wasm32-unknown-unknown %FILENAME%.ts ``` -Compile -```cmd +Compile + +```bat tsc-compile-wasm.bat hello ``` Run ``run.html`` + +
+Click to expand the full run.html WebAssembly loader + ```html @@ -384,38 +445,42 @@ Run ``run.html`` ``` +
+ ## Build ### On Windows #### Requirements: -- ``Visual Studio 2022`` -- 512GB of free space on disk +- ``Visual Studio 2026`` +- ~50 GB of free disk space (LLVM/MLIR build dominates this) +> The hardcoded `C:\dev\...` paths in the scripts below are examples — adjust them to your checkout location. First, precompile dependencies -```cmd +```bat cd TypeScriptCompiler -prepare_3rdParty.bat +prepare_3rdParty.bat ``` To build ``TSC`` binaries: -```cmd +```bat cd TypeScriptCompiler\tsc config_tsc_release.bat build_tsc_release.bat ``` ### On Linux (Ubuntu 20.04 and 22.04) + #### Requirements: - `gcc` or `clang` - `cmake` - `ninja-build` -- 512GB of free space on disk +- ~50 GB of free disk space (LLVM/MLIR build dominates this) - sudo apt-get install ``libtinfo-dev`` First, precompile dependencies @@ -434,3 +499,13 @@ chmod +x *.sh ./config_tsc_release.sh ./build_tsc_release.sh ``` + +## License + +This project is licensed under the **MIT License** — see the [LICENSE](LICENSE) file for details. + +## Contributing + +Issues and pull requests are welcome. See the +[Wiki](https://github.com/ASDAlexander77/TypeScriptCompiler/wiki) for documentation, +build notes, and how-to guides. From e9cf656ba6359a7cf18fb76becb4376eea2df006 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 27 Jun 2026 18:57:35 +0100 Subject: [PATCH 51/60] Update CMake configuration to disable documentation generation during GC build and installation --- .../workflows/cmake-test-release-linux.yml | 8 ++++--- .github/workflows/cmake-test-release-win.yml | 8 ++++--- .github/workflows/create-release.yml | 24 ++++++++++++------- 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/.github/workflows/cmake-test-release-linux.yml b/.github/workflows/cmake-test-release-linux.yml index 817da90f6..d678917b1 100644 --- a/.github/workflows/cmake-test-release-linux.yml +++ b/.github/workflows/cmake-test-release-linux.yml @@ -124,7 +124,7 @@ jobs: continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/ninja/release shell: sh - run: cmake ../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Ninja" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -Denable_threads=ON -Denable_cplusplus=OFF + run: cmake ../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Ninja" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF - name: Build GC continue-on-error: false @@ -132,11 +132,13 @@ jobs: shell: sh run: cmake --build . --config ${{ env.BUILD_TYPE }} -j 8 - - name: Copy GC + - name: Install GC continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/ninja/release shell: sh - run: mkdir -p ../../../../3rdParty/gc/release/; cp ./lib* ../../../../3rdParty/gc/release/ + # Generates the BDWgc CMake package files (lib/cmake/bdwgc/BDWgcConfig.cmake) + # that the tsc build looks up via find_package(BDWgc CONFIG). + run: cmake --install . --config ${{ env.BUILD_TYPE }} - name: List GC files continue-on-error: false diff --git a/.github/workflows/cmake-test-release-win.yml b/.github/workflows/cmake-test-release-win.yml index 0fff6fc90..cf413a038 100644 --- a/.github/workflows/cmake-test-release-win.yml +++ b/.github/workflows/cmake-test-release-win.yml @@ -107,7 +107,7 @@ jobs: - name: Configure GC continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/msbuild/x64/release - run: cmake ../../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Visual Studio 17 2022" -A x64 -Wno-dev -Denable_threads=ON -Denable_cplusplus=OFF + run: cmake ../../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Visual Studio 17 2022" -A x64 -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/release -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF shell: pwsh - name: Build GC @@ -116,10 +116,12 @@ jobs: run: cmake --build . --config ${{ env.BUILD_TYPE }} -j 8 shell: pwsh - - name: Copy GC + - name: Install GC continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/msbuild/x64/release - run: xcopy /E /H /C /I /Y .\${{ env.BUILD_TYPE }}\ ..\..\..\..\..\3rdParty\gc\x64\release\ + # Generates the BDWgc CMake package files (lib/cmake/bdwgc/BDWgcConfig.cmake) + # that the tsc build looks up via find_package(BDWgc CONFIG). + run: cmake --install . --config ${{ env.BUILD_TYPE }} shell: pwsh - name: List GC files diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 144617be3..6dc6c45a5 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -111,7 +111,7 @@ jobs: - name: Configure GC continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/msbuild/x64/release - run: cmake ../../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Visual Studio 17 2022" -A x64 -Wno-dev -Denable_threads=ON -Denable_cplusplus=OFF + run: cmake ../../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Visual Studio 17 2022" -A x64 -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/release -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF shell: pwsh - name: Build GC @@ -120,10 +120,12 @@ jobs: run: cmake --build . --config ${{ env.BUILD_TYPE }} -j 8 shell: pwsh - - name: Copy GC + - name: Install GC continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/msbuild/x64/release - run: xcopy /E /H /C /I /Y .\${{ env.BUILD_TYPE }}\ ..\..\..\..\..\3rdParty\gc\x64\release\ + # Generates the BDWgc CMake package files (lib/cmake/bdwgc/BDWgcConfig.cmake) + # that the tsc build looks up via find_package(BDWgc CONFIG). + run: cmake --install . --config ${{ env.BUILD_TYPE }} shell: pwsh - name: Configure @@ -263,7 +265,7 @@ jobs: continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/ninja/release shell: sh - run: cmake ../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Ninja" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -Denable_threads=ON -Denable_cplusplus=OFF + run: cmake ../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Ninja" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF - name: Build GC continue-on-error: false @@ -271,11 +273,13 @@ jobs: shell: sh run: cmake --build . --config ${{ env.BUILD_TYPE }} -j 8 - - name: Copy GC + - name: Install GC continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/ninja/release shell: sh - run: mkdir -p ../../../../3rdParty/gc/release/; cp ./lib* ../../../../3rdParty/gc/release/ + # Generates the BDWgc CMake package files (lib/cmake/bdwgc/BDWgcConfig.cmake) + # that the tsc build looks up via find_package(BDWgc CONFIG). + run: cmake --install . --config ${{ env.BUILD_TYPE }} - name: Configure continue-on-error: false @@ -417,7 +421,7 @@ jobs: continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/ninja/release shell: sh - run: cmake ../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Ninja" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -Denable_threads=ON -Denable_cplusplus=OFF + run: cmake ../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Ninja" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF - name: Build GC continue-on-error: false @@ -425,11 +429,13 @@ jobs: shell: sh run: cmake --build . --config ${{ env.BUILD_TYPE }} -j 8 - - name: Copy GC + - name: Install GC continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/ninja/release shell: sh - run: mkdir -p ../../../../3rdParty/gc/release/; cp ./lib* ../../../../3rdParty/gc/release/ + # Generates the BDWgc CMake package files (lib/cmake/bdwgc/BDWgcConfig.cmake) + # that the tsc build looks up via find_package(BDWgc CONFIG). + run: cmake --install . --config ${{ env.BUILD_TYPE }} - name: Configure continue-on-error: false From 1254e604cbb4a2ce93a2ddd7d00a5bf2c0f07f9c Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 27 Jun 2026 18:59:18 +0100 Subject: [PATCH 52/60] Update CI workflows to use Windows-latest and target Visual Studio 2026 for GC configuration --- .github/workflows/cmake-test-release-win.yml | 4 ++-- .github/workflows/create-release.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cmake-test-release-win.yml b/.github/workflows/cmake-test-release-win.yml index cf413a038..3050c80a6 100644 --- a/.github/workflows/cmake-test-release-win.yml +++ b/.github/workflows/cmake-test-release-win.yml @@ -25,7 +25,7 @@ jobs: # well on Windows or Mac. You can convert this to a matrix build if you need # cross-platform coverage. # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix - runs-on: windows-2022 + runs-on: windows-latest steps: # - name: check disk space @@ -107,7 +107,7 @@ jobs: - name: Configure GC continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/msbuild/x64/release - run: cmake ../../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Visual Studio 17 2022" -A x64 -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/release -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF + run: cmake ../../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Visual Studio 18 2026" -A x64 -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/release -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF shell: pwsh - name: Build GC diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 6dc6c45a5..8c4613283 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -20,7 +20,7 @@ env: jobs: build_on_windows: name: Create/Upload Release Asset (Windows) - runs-on: windows-2022 + runs-on: windows-latest steps: - name: Checkout code uses: actions/checkout@v4 @@ -111,7 +111,7 @@ jobs: - name: Configure GC continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/msbuild/x64/release - run: cmake ../../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Visual Studio 17 2022" -A x64 -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/release -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF + run: cmake ../../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Visual Studio 18 2026" -A x64 -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/release -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF shell: pwsh - name: Build GC From 9a38af104b7a830b2a33fb4f29ee941dc1b007ae Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 27 Jun 2026 19:12:27 +0100 Subject: [PATCH 53/60] Refactor CI workflows to remove redundant copy commands and disable shared library builds for GC --- .../workflows/cmake-test-release-linux.yml | 7 +---- .github/workflows/cmake-test-release-win.yml | 7 +---- .github/workflows/create-release.yml | 27 +++++-------------- 3 files changed, 8 insertions(+), 33 deletions(-) diff --git a/.github/workflows/cmake-test-release-linux.yml b/.github/workflows/cmake-test-release-linux.yml index d678917b1..84597e991 100644 --- a/.github/workflows/cmake-test-release-linux.yml +++ b/.github/workflows/cmake-test-release-linux.yml @@ -105,11 +105,6 @@ jobs: shell: sh run: cp -a ./3rdParty/libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}/ ./3rdParty/gc-${{ env.GC_VERSION }}/libatomic_ops/ - - name: Copy fixes to GC - continue-on-error: false - shell: sh - run: cp -ar ./docs/fix/gc/* ./3rdParty/gc-${{ env.GC_VERSION }}/ - - name: Install Ninja continue-on-error: false shell: sh @@ -124,7 +119,7 @@ jobs: continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/ninja/release shell: sh - run: cmake ../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Ninja" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF + run: cmake ../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Ninja" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -DBUILD_SHARED_LIBS=OFF -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF - name: Build GC continue-on-error: false diff --git a/.github/workflows/cmake-test-release-win.yml b/.github/workflows/cmake-test-release-win.yml index 3050c80a6..f1581d2dd 100644 --- a/.github/workflows/cmake-test-release-win.yml +++ b/.github/workflows/cmake-test-release-win.yml @@ -99,15 +99,10 @@ jobs: run: xcopy /E /H /C /I /Y ".\3rdParty\libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}" ".\3rdParty\gc-${{ env.GC_VERSION }}\libatomic_ops" shell: pwsh - - name: Copy fixes to GC - continue-on-error: false - run: xcopy /E /H /C /I /Y ".\docs\fix\gc" ".\3rdParty\gc-${{ env.GC_VERSION }}" - shell: pwsh - - name: Configure GC continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/msbuild/x64/release - run: cmake ../../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Visual Studio 18 2026" -A x64 -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/release -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF + run: cmake ../../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Visual Studio 18 2026" -A x64 -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/release -DBUILD_SHARED_LIBS=OFF -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF shell: pwsh - name: Build GC diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 8c4613283..2ca9c1c4e 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -103,15 +103,10 @@ jobs: run: xcopy /E /H /C /I /Y ".\3rdParty\libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}" ".\3rdParty\gc-${{ env.GC_VERSION }}\libatomic_ops" shell: pwsh - - name: Copy fixes to GC - continue-on-error: false - run: xcopy /E /H /C /I /Y ".\docs\fix\gc" ".\3rdParty\gc-${{ env.GC_VERSION }}" - shell: pwsh - - name: Configure GC continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/msbuild/x64/release - run: cmake ../../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Visual Studio 18 2026" -A x64 -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/release -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF + run: cmake ../../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Visual Studio 18 2026" -A x64 -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/release -DBUILD_SHARED_LIBS=OFF -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF shell: pwsh - name: Build GC @@ -149,7 +144,7 @@ jobs: - name: Create Zip of Windows Asset working-directory: ${{github.workspace}}/__build - run: Get-ChildItem -Path .\tsc\msbuild\x64\release\bin\tsc.exe, .\tsc\msbuild\x64\release\bin\TypeScriptRuntime.dll, .\gc\msbuild\x64\release\${{ env.BUILD_TYPE }}\gcmt-lib.lib, .\tsc\msbuild\x64\release\lib\TypeScriptAsyncRuntime.lib, ..\3rdParty\llvm\x64\release\lib\LLVMSupport.lib, ..\3rdParty\llvm\x64\release\bin\wasm-ld.exe | Compress-Archive -DestinationPath ..\tsc.zip + run: Get-ChildItem -Path .\tsc\msbuild\x64\release\bin\tsc.exe, .\tsc\msbuild\x64\release\bin\TypeScriptRuntime.dll, .\gc\msbuild\x64\release\${{ env.BUILD_TYPE }}\gc.lib, .\tsc\msbuild\x64\release\lib\TypeScriptAsyncRuntime.lib, ..\3rdParty\llvm\x64\release\lib\LLVMSupport.lib, ..\3rdParty\llvm\x64\release\bin\wasm-ld.exe | Compress-Archive -DestinationPath ..\tsc.zip shell: pwsh - name: Archive Zip of Windows Asset @@ -246,11 +241,6 @@ jobs: shell: sh run: cp -a ./3rdParty/libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}/ ./3rdParty/gc-${{ env.GC_VERSION }}/libatomic_ops/ - - name: Copy fixes to GC - continue-on-error: false - shell: sh - run: cp -ar ./docs/fix/gc/* ./3rdParty/gc-${{ env.GC_VERSION }}/ - - name: Install Ninja continue-on-error: false shell: sh @@ -265,7 +255,7 @@ jobs: continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/ninja/release shell: sh - run: cmake ../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Ninja" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF + run: cmake ../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Ninja" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -DBUILD_SHARED_LIBS=OFF -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF - name: Build GC continue-on-error: false @@ -306,7 +296,7 @@ jobs: - name: Create Tar.GZ of Linux Asset working-directory: ${{github.workspace}}/__build shell: sh - run: tar -czvhf ../tsc.tar.gz ./tsc/ninja/release/bin/tsc ./tsc/ninja/release/lib/libTypeScriptRuntime.so ./gc/ninja/release/libgcmt-lib.a ./tsc/ninja/release/lib/libTypeScriptAsyncRuntime.a ../3rdParty/llvm/release/bin/wasm-ld ../3rdParty/llvm/release/lib/libLLVMSupport.a ../3rdParty/llvm/release/lib/libLLVMDemangle.a + run: tar -czvhf ../tsc.tar.gz ./tsc/ninja/release/bin/tsc ./tsc/ninja/release/lib/libTypeScriptRuntime.so ./gc/ninja/release/libgc.a ./tsc/ninja/release/lib/libTypeScriptAsyncRuntime.a ../3rdParty/llvm/release/bin/wasm-ld ../3rdParty/llvm/release/lib/libLLVMSupport.a ../3rdParty/llvm/release/lib/libLLVMDemangle.a - name: Archive Tar.GZ of Linux Asset uses: actions/upload-artifact@v4 @@ -402,11 +392,6 @@ jobs: shell: sh run: cp -a ./3rdParty/libatomic_ops-${{ env.LIBATOMIC_OPS_VERSION }}/ ./3rdParty/gc-${{ env.GC_VERSION }}/libatomic_ops/ - - name: Copy fixes to GC - continue-on-error: false - shell: sh - run: cp -ar ./docs/fix/gc/* ./3rdParty/gc-${{ env.GC_VERSION }}/ - - name: Install Ninja continue-on-error: false shell: sh @@ -421,7 +406,7 @@ jobs: continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/ninja/release shell: sh - run: cmake ../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Ninja" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF + run: cmake ../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Ninja" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -DBUILD_SHARED_LIBS=OFF -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF - name: Build GC continue-on-error: false @@ -462,7 +447,7 @@ jobs: - name: Create Tar.GZ of Linux Asset working-directory: ${{github.workspace}}/__build shell: sh - run: tar -czvhf ../tsc-ub20.tar.gz ./tsc/ninja/release/bin/tsc ./tsc/ninja/release/lib/libTypeScriptRuntime.so ./gc/ninja/release/libgcmt-lib.a ./tsc/ninja/release/lib/libTypeScriptAsyncRuntime.a ../3rdParty/llvm/release/bin/wasm-ld ../3rdParty/llvm/release/lib/libLLVMSupport.a ../3rdParty/llvm/release/lib/libLLVMDemangle.a + run: tar -czvhf ../tsc-ub20.tar.gz ./tsc/ninja/release/bin/tsc ./tsc/ninja/release/lib/libTypeScriptRuntime.so ./gc/ninja/release/libgc.a ./tsc/ninja/release/lib/libTypeScriptAsyncRuntime.a ../3rdParty/llvm/release/bin/wasm-ld ../3rdParty/llvm/release/lib/libLLVMSupport.a ../3rdParty/llvm/release/lib/libLLVMDemangle.a - name: Archive Tar.GZ of Linux Asset uses: actions/upload-artifact@v4 From 3925ac1d413573ba82c224923ff0a6580d12b568 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 27 Jun 2026 19:39:01 +0100 Subject: [PATCH 54/60] fixes to vs version --- docs/fix/gc/CMakeLists.txt | 263 ------------------------------- docs/fix/gc/tests/CMakeLists.txt | 47 ------ 2 files changed, 310 deletions(-) delete mode 100644 docs/fix/gc/CMakeLists.txt delete mode 100644 docs/fix/gc/tests/CMakeLists.txt diff --git a/docs/fix/gc/CMakeLists.txt b/docs/fix/gc/CMakeLists.txt deleted file mode 100644 index 9eb9dd2a8..000000000 --- a/docs/fix/gc/CMakeLists.txt +++ /dev/null @@ -1,263 +0,0 @@ -# -# Copyright (c) 1994 by Xerox Corporation. All rights reserved. -# Copyright (c) 1996 by Silicon Graphics. All rights reserved. -# Copyright (c) 1998 by Fergus Henderson. All rights reserved. -# Copyright (c) 2000-2010 by Hewlett-Packard Company. All rights reserved. -## -# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED -# OR IMPLIED. ANY USE IS AT YOUR OWN RISK. -## -# Permission is hereby granted to use or copy this program -# for any purpose, provided the above notices are retained on all copies. -# Permission to modify the code and to distribute modified code is granted, -# provided the above notices are retained, and a notice that the code was -# modified is included with the above copyright notice. -## - -# -# get cmake and run: -# cmake -G "Visual Studio 8 2005" -# in the same dir as this file -# this will generate gc.sln -# - -SET(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required - -PROJECT(gc) - -INCLUDE(CTest) - -CMAKE_MINIMUM_REQUIRED(VERSION 2.6) - -ADD_DEFINITIONS("-D_CRT_SECURE_NO_DEPRECATE - -DALL_INTERIOR_POINTERS -DNO_EXECUTE_PERMISSION") - -IF(APPLE) - IF("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "") - SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;x86_64" CACHE STRING "Build architectures for Mac OS X" FORCE) - ENDIF() -ENDIF(APPLE) - -#LIBATOMIC #TODO -#ADD_LIBRARY(atomic_ops STATIC ) -#SET_TARGET_PROPERTIES(atomic_ops PROPERTIES COMPILE_FLAGS -DNO_DEBUGGING) - - -#LIBGC - -INCLUDE_DIRECTORIES(include) -INCLUDE_DIRECTORIES(libatomic_ops/src) - -SET(SRC alloc.c reclaim.c allchblk.c misc.c mach_dep.c os_dep.c - mark_rts.c headers.c mark.c obj_map.c blacklst.c finalize.c - new_hblk.c dbg_mlc.c malloc.c dyn_load.c typd_mlc.c ptr_chck.c - mallocx.c) -SET(LIBS) -OPTION(enable_threads "TODO" NO) -IF(enable_threads) - FIND_PACKAGE(Threads REQUIRED) - MESSAGE("Thread Model: ${CMAKE_THREAD_LIBS_INIT}" ) - INCLUDE_DIRECTORIES(${Threads_INCLUDE_DIR}) - SET(LIBS ${LIBS} ${Threads_LIBRARIES}) -ENDIF(enable_threads) - -OPTION(enable_handle_fork "Attempt to ensure a usable collector after fork()" ON) - -OPTION(enable_thread_local_alloc "Turn on thread-local allocation optimization" ON) - -OPTION(enable_parallel_mark "Parallelize marking and free list construction" ON) - -#IF(Threads_FOUND) -# ADD_DEFINITIONS("") -#ELSE -# MESSAGE("Parallel mark requires enable_threads ON" ) -#ENDIF(Threads_FOUND) - -OPTION(enable_cplusplus "install C++ support" ON) -IF(enable_cplusplus) - SET(SRC ${SRC} gc_cpp.cc) -ENDIF(enable_cplusplus) - -SET(_HOST ${CMAKE_HOST_SYSTEM_PROCESSOR}--${CMAKE_SYSTEM}) #FIXME missing the vendor field. -STRING(TOLOWER ${_HOST} HOST) -MESSAGE("HOST = ${HOST}") - -# Thread Detection. Relying on cmake for lib and includes. -#TODO check cmake detection -IF(CMAKE_USE_PTHREADS_INIT) - SET(SRC ${SRC} pthread_start.c pthread_support.c pthread_stop_world.c) - # Common defines for most POSIX platforms. - IF( HOST MATCHES .*-.*-aix.*|.*-.*-android.*|.*-.*-cygwin.*|.*-.*-darwin.*|.*-.*-.*freebsd.*|.*-.*-haiku.*|.*-.*-gnu.*|.*-.*-hpux11.*|.*-.*-irix.*|.*-.*-.*linux.*|.*-.*-nacl.*|.*-.*-netbsd.*|.*-.*-openbsd.*|.*-.*-osf.*|.*-.*-solaris.*) - ADD_DEFINITIONS("-DGC_THREADS -D_REENTRANT") - IF(enable_parallel_mark) - ADD_DEFINITIONS("-DPARALLEL_MARK") - ENDIF(enable_parallel_mark) - IF(enable_thread_local_alloc) - ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") - SET(SRC ${SRC} thread_local_alloc.c) - ENDIF(enable_thread_local_alloc) - MESSAGE("Explicit GC_INIT() calls may be required.") - ENDIF() - IF ( HOST MATCHES .*-.*-hpux11.*) - MESSAGE("Only HP/UX 11 POSIX threads are supported.") - ADD_DEFINITIONS("-D_POSIX_C_SOURCE=199506L") #TODO test -DVAR=value. Alternative is COMPILE_DEFINITIONS property - ENDIF() - IF ( HOST MATCHES .*-.*-hpux10.*) - MESSAGE("HP/UX 10 POSIX threads are not supported.") - ENDIF() - IF ( HOST MATCHES .*-.*-netbsd.*) - MESSAGE("Only on NetBSD 2.0 or later.") - ADD_DEFINITIONS("-D_PTHREADS") - ENDIF() - IF( HOST MATCHES .*-.*-android.*) - # Android NDK does not provide pthread_atfork. - ELSEIF( HOST MATCHES .*-.*-aix.*|.*-.*-cygwin.*|.*-.*-freebsd.*|.*-.*-haiku.*|.*-.*-hpux11.*|.*-.*-irix.*|.*-.*-kfreebsd.*-gnu|.*-.*-.*linux.*|.*-.*-netbsd.*|.*-.*-openbsd.*|.*-.*-osf.*|.*-.*-solaris.*) - IF(enable_handle_fork) - ADD_DEFINITIONS("-DHANDLE_FORK") - ENDIF(enable_handle_fork) - ENDIF() - IF ( HOST MATCHES .*-.*-cygwin.*) - SET(SRC ${SRC} win32_threads.c) - ENDIF() - IF ( HOST MATCHES .*-.*-darwin.*) - IF(enable_handle_fork) - # The incremental mode conflicts with fork handling. - IF(enable_parallel_mark) - ADD_DEFINITIONS("-DHANDLE_FORK") - ENDIF(enable_parallel_mark) - ENDIF(enable_handle_fork) - SET(SRC ${SRC} darwin_stop_world.c) - #TODO - #darwin_threads=true - ENDIF() -ENDIF(CMAKE_USE_PTHREADS_INIT) - -IF(CMAKE_USE_WIN32_THREADS_INIT) - ADD_DEFINITIONS("-DGC_THREADS") - IF(enable_parallel_mark) - ADD_DEFINITIONS("-DPARALLEL_MARK") - IF(enable_thread_local_alloc) - ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") - SET(SRC ${SRC} thread_local_alloc.c) - ENDIF(enable_thread_local_alloc) - ENDIF() - ADD_DEFINITIONS("-DEMPTY_GETENV_RESULTS") #TODO test - SET(SRC ${SRC} win32_threads.c) -ENDIF(CMAKE_USE_WIN32_THREADS_INIT) - -OPTION(enable_gcj_support "Support for gcj" ON) -IF(enable_gcj_support) - ADD_DEFINITIONS("-DGC_GCJ_SUPPORT") - IF(enable_threads) - ADD_DEFINITIONS("-DGC_ENABLE_SUSPEND_THREAD") - ENDIF(enable_threads) - SET(SRC ${SRC} gcj_mlc.c) -ENDIF(enable_gcj_support) - -OPTION(enable_disclaim "Support alternative finalization interface" ON) -IF(enable_disclaim) - ADD_DEFINITIONS("-DENABLE_DISCLAIM") - SET(SRC ${SRC} fnlz_mlc.c) -ENDIF(enable_disclaim) - -OPTION(enable_java_finalization "Support for java finalization" ON) -IF(enable_java_finalization) - ADD_DEFINITIONS("-DJAVA_FINALIZATION") -ENDIF(enable_java_finalization) - -OPTION(enable_atomic_uncollectable "Support for atomic uncollectible allocation" ON) -IF(enable_atomic_uncollectable) - ADD_DEFINITIONS("-DGC_ATOMIC_UNCOLLECTABLE") -ENDIF(enable_atomic_uncollectable) - -OPTION(enable_gc_debug "Support for pointer back-tracing" NO) -IF(enable_gc_debug) - ADD_DEFINITIONS("-DDBG_HDRS_ALL -DKEEP_BACK_PTRS") - IF (HOST MATCHES ia64-.*-linux.*|i586-.*-linux.*|i686-.*-linux.*|x86-.*-linux.*|x86_64-.*-linux.*) - ADD_DEFINITIONS("-DMAKE_BACK_GRAPH") - ADD_DEFINITIONS("-DSAVE_CALL_COUNT=8") - SET(SRC ${SRC} backgraph.c) - ENDIF() - IF (HOST MATCHES i.86-.*-dgux.*) - ADD_DEFINITIONS("-DMAKE_BACK_GRAPH") - SET(SRC ${SRC} backgraph.c) - ENDIF() -ENDIF(enable_gc_debug) - -OPTION(enable_redirect_malloc "Redirect malloc and friends to GC routines" NO) -IF(enable_redirect_malloc) - IF(enable_gc_debug) - ADD_DEFINITIONS("-DREDIRECT_MALLOC=GC_debug_malloc_replacement") - ADD_DEFINITIONS("-DREDIRECT_REALLOC=GC_debug_realloc_replacement") - ADD_DEFINITIONS("-DREDIRECT_FREE=GC_debug_free") - ELSE(enable_gc_debug) - ADD_DEFINITIONS("-DREDIRECT_MALLOC=GC_malloc") - ENDIF(enable_gc_debug) - ADD_DEFINITIONS("-DGC_USE_DLOPEN_WRAP") -ENDIF(enable_redirect_malloc) - -OPTION(enable_mmap "Use mmap instead of sbrk to expand the heap" NO) - -OPTION(enable_munmap "Return page to the OS if empty for N collections" ON) -IF(enable_munmap) - ADD_DEFINITIONS("-DUSE_MMAP -DUSE_MUNMAP") -ELSEIF(enable_mmap) - ADD_DEFINITIONS("-DUSE_MMAP") -ENDIF() - -OPTION(enable_dynamic_loading "Enable tracing of dynamic library data roots" ON) -IF(NOT enable_dynamic_loading) - ADD_DEFINITIONS("-DIGNORE_DYNAMIC_LOADING") -ENDIF() - -OPTION(enable_register_main_static_data "Perform the initial guess of data root sets" ON) -IF(NOT enable_register_main_static_data) - ADD_DEFINITIONS("-DGC_DONT_REGISTER_MAIN_STATIC_DATA") -ENDIF() - -OPTION(enable_large_config "Optimize for large heap or root set" NO) -IF(enable_large_config) - ADD_DEFINITIONS("-DLARGE_CONFIG") -ENDIF(enable_large_config) - -OPTION(enable_gc_assertions "Enable collector-internal assertion checking" NO) -IF(enable_gc_assertions) - ADD_DEFINITIONS("-DGC_ASSERTIONS") -ENDIF(enable_gc_assertions) - -OPTION(enable_threads_discovery "Enable threads discovery in GC" ON) -IF(NOT enable_threads_discovery) - ADD_DEFINITIONS("-DGC_NO_THREADS_DISCOVERY") -ENDIF() - -OPTION(enable_checksums "Report erroneously cleared dirty bits" NO) -IF(enable_checksums) - IF(enable_munmap OR enable_threads) - MESSAGE("CHECKSUMS not compatible with USE_MUNMAP or threads") - ENDIF() - ADD_DEFINITIONS("-DCHECKSUMS") - SET(SRC ${SRC} checksums.c) -ENDIF(enable_checksums) - -ADD_LIBRARY( gc-lib STATIC ${SRC}) -SET_TARGET_PROPERTIES(gc-lib PROPERTIES - COMPILE_DEFINITIONS GC_NOT_DLL) -#TODO TARGET_LINK_LIBRARIES(... ... ${LIBS}) - -ADD_LIBRARY( gcmt-lib STATIC ${SRC}) -SET_TARGET_PROPERTIES(gcmt-lib PROPERTIES - COMPILE_DEFINITIONS GC_NOT_DLL) - -ADD_LIBRARY( gcmt-dll SHARED ${SRC}) - -IF(WIN32) - ADD_EXECUTABLE(cord cord/cordbscs.c cord/cordxtra.c - cord/tests/de.c cord/tests/de_win.c) - SET_TARGET_PROPERTIES(cord PROPERTIES WIN32_EXECUTABLE TRUE) - SET_TARGET_PROPERTIES(cord PROPERTIES - COMPILE_DEFINITIONS GC_NOT_DLL) - TARGET_LINK_LIBRARIES(cord gc-lib) - TARGET_LINK_LIBRARIES(cord gdi32) -ENDIF(WIN32) - -ADD_SUBDIRECTORY(tests) diff --git a/docs/fix/gc/tests/CMakeLists.txt b/docs/fix/gc/tests/CMakeLists.txt deleted file mode 100644 index 5e4363128..000000000 --- a/docs/fix/gc/tests/CMakeLists.txt +++ /dev/null @@ -1,47 +0,0 @@ -# -# Copyright (c) 1994 by Xerox Corporation. All rights reserved. -# Copyright (c) 1996 by Silicon Graphics. All rights reserved. -# Copyright (c) 1998 by Fergus Henderson. All rights reserved. -# Copyright (c) 2000-2010 by Hewlett-Packard Company. All rights reserved. -## -# THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED -# OR IMPLIED. ANY USE IS AT YOUR OWN RISK. -## -# Permission is hereby granted to use or copy this program -# for any purpose, provided the above notices are retained on all copies. -# Permission to modify the code and to distribute modified code is granted, -# provided the above notices are retained, and a notice that the code was -# modified is included with the above copyright notice. -## - -ADD_DEFINITIONS(-DGC_NOT_DLL) - -# Compile some tests as C++ to test extern "C" in header files. -SET_SOURCE_FILES_PROPERTIES( - leak_test.c - test.c - PROPERTIES LANGUAGE CXX) - -ADD_EXECUTABLE(gctest WIN32 test.c) -TARGET_LINK_LIBRARIES(gctest gc-lib "${CMAKE_THREAD_LIBS_INIT}") -ADD_TEST(NAME gctest COMMAND gctest) - -ADD_EXECUTABLE(hugetest huge_test.c) -TARGET_LINK_LIBRARIES(hugetest gc-lib "${CMAKE_THREAD_LIBS_INIT}") -ADD_TEST(NAME hugetest COMMAND hugetest) - -ADD_EXECUTABLE(leaktest leak_test.c) -TARGET_LINK_LIBRARIES(leaktest gc-lib "${CMAKE_THREAD_LIBS_INIT}") -ADD_TEST(NAME leaktest COMMAND leaktest) - -ADD_EXECUTABLE(middletest middle.c) -TARGET_LINK_LIBRARIES(middletest gc-lib "${CMAKE_THREAD_LIBS_INIT}") -ADD_TEST(NAME middletest COMMAND middletest) - -ADD_EXECUTABLE(realloc_test realloc_test.c) -TARGET_LINK_LIBRARIES(realloc_test gc-lib "${CMAKE_THREAD_LIBS_INIT}") -ADD_TEST(NAME realloc_test COMMAND realloc_test) - -ADD_EXECUTABLE(smashtest smash_test.c) -TARGET_LINK_LIBRARIES(smashtest gc-lib "${CMAKE_THREAD_LIBS_INIT}") -ADD_TEST(NAME smashtest COMMAND smashtest) From 9f13d6d133c383e4e6ebdc9f028d71bf48583f56 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 27 Jun 2026 19:39:06 +0100 Subject: [PATCH 55/60] update release workflow to use vs2026 --- .github/workflows/cmake-test-release-win.yml | 2 +- .github/workflows/create-release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake-test-release-win.yml b/.github/workflows/cmake-test-release-win.yml index f1581d2dd..064109c5f 100644 --- a/.github/workflows/cmake-test-release-win.yml +++ b/.github/workflows/cmake-test-release-win.yml @@ -128,7 +128,7 @@ jobs: - name: Configure continue-on-error: false working-directory: ${{github.workspace}}/__build/tsc/msbuild/x64/release - run: cmake ../../../../../tsc -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev + run: cmake ../../../../../tsc -G "Visual Studio 18 2026" -A x64 -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev shell: pwsh - name: Build diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 2ca9c1c4e..4dc5eb312 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -126,7 +126,7 @@ jobs: - name: Configure continue-on-error: false working-directory: ${{github.workspace}}/__build/tsc/msbuild/x64/release - run: cmake ../../../../../tsc -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DTSC_PACKAGE_VERSION:STRING="${{ steps.version.outputs.TAG_NAME }}" -Wno-dev + run: cmake ../../../../../tsc -G "Visual Studio 18 2026" -A x64 -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DTSC_PACKAGE_VERSION:STRING="${{ steps.version.outputs.TAG_NAME }}" -Wno-dev shell: pwsh - name: Build From 28c01769921d6cc62968d2c002c6f924a14257bb Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 27 Jun 2026 19:50:52 +0100 Subject: [PATCH 56/60] Update CMake configuration to use GitHub workspace for installation paths --- .github/workflows/cmake-test-release-linux.yml | 2 +- .github/workflows/cmake-test-release-win.yml | 2 +- .github/workflows/create-release.yml | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cmake-test-release-linux.yml b/.github/workflows/cmake-test-release-linux.yml index 84597e991..5c7394493 100644 --- a/.github/workflows/cmake-test-release-linux.yml +++ b/.github/workflows/cmake-test-release-linux.yml @@ -119,7 +119,7 @@ jobs: continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/ninja/release shell: sh - run: cmake ../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Ninja" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -DBUILD_SHARED_LIBS=OFF -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF + run: cmake ../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Ninja" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/3rdParty/gc/release -DBUILD_SHARED_LIBS=OFF -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF - name: Build GC continue-on-error: false diff --git a/.github/workflows/cmake-test-release-win.yml b/.github/workflows/cmake-test-release-win.yml index 064109c5f..4618e1843 100644 --- a/.github/workflows/cmake-test-release-win.yml +++ b/.github/workflows/cmake-test-release-win.yml @@ -102,7 +102,7 @@ jobs: - name: Configure GC continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/msbuild/x64/release - run: cmake ../../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Visual Studio 18 2026" -A x64 -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/release -DBUILD_SHARED_LIBS=OFF -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF + run: cmake ../../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Visual Studio 18 2026" -A x64 -Wno-dev -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/3rdParty/gc/x64/release -DBUILD_SHARED_LIBS=OFF -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF shell: pwsh - name: Build GC diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 4dc5eb312..c3c75ba71 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -106,7 +106,7 @@ jobs: - name: Configure GC continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/msbuild/x64/release - run: cmake ../../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Visual Studio 18 2026" -A x64 -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/release -DBUILD_SHARED_LIBS=OFF -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF + run: cmake ../../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Visual Studio 18 2026" -A x64 -Wno-dev -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/3rdParty/gc/x64/release -DBUILD_SHARED_LIBS=OFF -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF shell: pwsh - name: Build GC @@ -255,7 +255,7 @@ jobs: continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/ninja/release shell: sh - run: cmake ../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Ninja" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -DBUILD_SHARED_LIBS=OFF -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF + run: cmake ../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Ninja" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/3rdParty/gc/release -DBUILD_SHARED_LIBS=OFF -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF - name: Build GC continue-on-error: false @@ -406,7 +406,7 @@ jobs: continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/ninja/release shell: sh - run: cmake ../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Ninja" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=../../../../3rdParty/gc/release -DBUILD_SHARED_LIBS=OFF -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF + run: cmake ../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Ninja" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -Wno-dev -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/3rdParty/gc/release -DBUILD_SHARED_LIBS=OFF -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF - name: Build GC continue-on-error: false From 034600ab4e59c4820fee7de0878b276da210e960 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 27 Jun 2026 21:14:35 +0100 Subject: [PATCH 57/60] Update CACHE_VERSION to v9 in CI workflows and remove redundant copy commands --- .github/workflows/cmake-test-release-linux.yml | 2 +- .github/workflows/cmake-test-release-win.yml | 2 +- .github/workflows/create-release.yml | 2 +- prepare_3rdParty.bat | 3 --- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cmake-test-release-linux.yml b/.github/workflows/cmake-test-release-linux.yml index 5c7394493..7f528850e 100644 --- a/.github/workflows/cmake-test-release-linux.yml +++ b/.github/workflows/cmake-test-release-linux.yml @@ -13,7 +13,7 @@ on: env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) BUILD_TYPE: Release - CACHE_VERSION: v8 + CACHE_VERSION: v9 LLVM_VERSION: 19 LLVM_TARGZFILE: "https://www.dropbox.com/scl/fi/l9xrfupdbwqbnckr5g36p/llvm_19_1_3_release.tgz?rlkey=xubw01vl6ey3xszbph32xqfip&st=okz2ghqx&dl=1" GC_VERSION: "8.2.8" diff --git a/.github/workflows/cmake-test-release-win.yml b/.github/workflows/cmake-test-release-win.yml index 4618e1843..c64629149 100644 --- a/.github/workflows/cmake-test-release-win.yml +++ b/.github/workflows/cmake-test-release-win.yml @@ -13,7 +13,7 @@ on: env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) BUILD_TYPE: Release - CACHE_VERSION: v8 + CACHE_VERSION: v9 LLVM_VERSION: 19 LLVM_ZIPFILE: "https://www.dropbox.com/scl/fi/map5fet7x19bm8ztsr4ma/llvm_19_1_3_release_vs2026.zip?rlkey=iwae4mz45lf7nycawa7d61g3r&st=4ee1dfug&dl=1" GC_VERSION: "8.2.8" diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index c3c75ba71..715938b48 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -9,7 +9,7 @@ on: env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) BUILD_TYPE: Release - CACHE_VERSION: v8 + CACHE_VERSION: v9 LLVM_VERSION: 19 LLVM_ZIPFILE: "https://www.dropbox.com/scl/fi/map5fet7x19bm8ztsr4ma/llvm_19_1_3_release_vs2026.zip?rlkey=iwae4mz45lf7nycawa7d61g3r&st=4ee1dfug&dl=1" LLVM_TARGZFILE: "https://www.dropbox.com/scl/fi/l9xrfupdbwqbnckr5g36p/llvm_19_1_3_release.tgz?rlkey=xubw01vl6ey3xszbph32xqfip&st=okz2ghqx&dl=1" diff --git a/prepare_3rdParty.bat b/prepare_3rdParty.bat index daf494b54..cf8ecf28d 100644 --- a/prepare_3rdParty.bat +++ b/prepare_3rdParty.bat @@ -16,7 +16,6 @@ IF EXIST ".\3rdParty\llvm\x64\%BUILD%\bin" ( cd %p% echo "Downloading LLVM" git submodule update --init --recursive - rem copy /Y .\docs\fix\AddCompilerRT.cmake .\3rdParty\llvm-project\compiler-rt\cmake\Modules\ echo "Configuring LLVM (%BUILD%)" cd %p% @call scripts\config_llvm_%BUILD%_%TOOL%.bat @@ -41,6 +40,4 @@ IF EXIST ".\3rdParty\gc\x64\%BUILD%\lib\gc.lib" ( xcopy /E /H /C /I /Y .\3rdParty\libatomic_ops-%LIBATOMIC_OPS_VER%\ .\3rdParty\gc-%GC_VER%\libatomic_ops\ cd %p% @call scripts\build_gc_%BUILD%_%TOOL%.bat - rem build_gc_*_vs.bat runs "cmake --install" which installs the libs to - rem 3rdParty\gc\x64\%BUILD%\lib (where tsc now links from) - no extra copy needed ) \ No newline at end of file From 62ceaa8ed345962fe4315caf5abe68b028a95870 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 27 Jun 2026 21:48:49 +0100 Subject: [PATCH 58/60] Update CMake configuration for GC to set default policy and runtime library --- .github/workflows/cmake-test-release-win.yml | 2 +- .github/workflows/create-release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cmake-test-release-win.yml b/.github/workflows/cmake-test-release-win.yml index c64629149..7348256fc 100644 --- a/.github/workflows/cmake-test-release-win.yml +++ b/.github/workflows/cmake-test-release-win.yml @@ -102,7 +102,7 @@ jobs: - name: Configure GC continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/msbuild/x64/release - run: cmake ../../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Visual Studio 18 2026" -A x64 -Wno-dev -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/3rdParty/gc/x64/release -DBUILD_SHARED_LIBS=OFF -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF + run: cmake ../../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Visual Studio 18 2026" -A x64 -Wno-dev -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/3rdParty/gc/x64/release -DBUILD_SHARED_LIBS=OFF -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded shell: pwsh - name: Build GC diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 715938b48..4084a1ee1 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -106,7 +106,7 @@ jobs: - name: Configure GC continue-on-error: false working-directory: ${{github.workspace}}/__build/gc/msbuild/x64/release - run: cmake ../../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Visual Studio 18 2026" -A x64 -Wno-dev -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/3rdParty/gc/x64/release -DBUILD_SHARED_LIBS=OFF -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF + run: cmake ../../../../../3rdParty/gc-${{ env.GC_VERSION }} -G "Visual Studio 18 2026" -A x64 -Wno-dev -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/3rdParty/gc/x64/release -DBUILD_SHARED_LIBS=OFF -Denable_threads=ON -Denable_cplusplus=OFF -Denable_docs=OFF -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded shell: pwsh - name: Build GC From 59b6a86378b3655d47bdb535d571fbc9663c4a36 Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sat, 27 Jun 2026 23:42:39 +0100 Subject: [PATCH 59/60] Refactor reference handling: introduce Ref and Deref types, update MLIR methods, and add tests --- tsc/include/TypeScript/MLIRLogic/MLIRCodeLogic.h | 16 ++++++++-------- tsc/include/TypeScript/VSCodeTemplate/Files.h | 11 ++++++++--- tsc/lib/TypeScript/MLIRGen.cpp | 6 ++++-- tsc/test/tester/tests/00reference_ref_deref.ts | 11 +++++++++++ 4 files changed, 31 insertions(+), 13 deletions(-) create mode 100644 tsc/test/tester/tests/00reference_ref_deref.ts diff --git a/tsc/include/TypeScript/MLIRLogic/MLIRCodeLogic.h b/tsc/include/TypeScript/MLIRLogic/MLIRCodeLogic.h index d7ff1aa50..8410ba1d1 100644 --- a/tsc/include/TypeScript/MLIRLogic/MLIRCodeLogic.h +++ b/tsc/include/TypeScript/MLIRLogic/MLIRCodeLogic.h @@ -367,17 +367,17 @@ class MLIRCustomMethods { static std::map m { {"print", true}, {"convertf", true}, {"assert", true}, {"parseInt", true}, {"parseFloat", true}, {"isNaN", true}, {"sizeof", true}, {GENERATOR_SWITCHSTATE, true}, - {"LoadLibraryPermanently", true}, { "SearchForAddressOfSymbol", true }, { "LoadReference", true }, { "ReferenceOf", true }, + {"LoadLibraryPermanently", true}, { "SearchForAddressOfSymbol", true }, { "LoadReference", true }, { "ReferenceOf", true }, { "Deref", true }, { "Ref", true }, {"atomicrmw", true}, {"cmpxchg", true}, {"fence", true}, {"inline_asm", true}, {"call_intrinsic", true}, {"linker_options", true} }; - return m[functionName.str()]; - } + return m[functionName.str()]; + } static bool isInternalFunctionNameNoBuiltin (StringRef functionName) { - static std::map m { - {"print", true}, {"convertf", true}, {"assert", true}, {"sizeof", true}, {GENERATOR_SWITCHSTATE, true}, - {"LoadLibraryPermanently", true}, { "SearchForAddressOfSymbol", true }, { "LoadReference", true }, { "ReferenceOf", true }, + static std::map m { + {"print", true}, {"convertf", true}, {"assert", true}, {"sizeof", true}, {GENERATOR_SWITCHSTATE, true}, + {"LoadLibraryPermanently", true}, { "SearchForAddressOfSymbol", true }, { "LoadReference", true }, { "ReferenceOf", true }, { "Deref", true }, { "Ref", true }, {"atomicrmw", true}, {"cmpxchg", true}, {"fence", true}, {"inline_asm", true}, {"call_intrinsic", true}, {"linker_options", true} }; return m[functionName.str()]; @@ -454,11 +454,11 @@ class MLIRCustomMethods { return mlirGenSearchForAddressOfSymbol(location, operands, castFn, genContext); } - else if (functionName == "LoadReference") + else if (functionName == "LoadReference" || functionName == "Deref") { return mlirGenLoadReference(location, operands, castFn, genContext); } - else if (functionName == "ReferenceOf") + else if (functionName == "ReferenceOf" || functionName == "Ref") { return mlirGenReferenceOf(location, operands); } diff --git a/tsc/include/TypeScript/VSCodeTemplate/Files.h b/tsc/include/TypeScript/VSCodeTemplate/Files.h index 3c710a2dc..f35df0930 100644 --- a/tsc/include/TypeScript/VSCodeTemplate/Files.h +++ b/tsc/include/TypeScript/VSCodeTemplate/Files.h @@ -57,10 +57,15 @@ declare type float = any; declare type double = any; declare type Opaque = any; -type Reference = any +type Ref = any +type Reference = Ref // deprecated alias of Ref -declare function ReferenceOf(r: T): Reference; -declare function LoadReference(r: Reference): T; +declare function Ref(r: T): Ref; +declare function Deref(r: Ref): T; + +// deprecated aliases of Ref / Deref +declare function ReferenceOf(r: T): Ref; +declare function LoadReference(r: Ref): T; declare function sizeof(v?: T): index; )raw"; diff --git a/tsc/lib/TypeScript/MLIRGen.cpp b/tsc/lib/TypeScript/MLIRGen.cpp index cfb4545fa..7f5caeb52 100644 --- a/tsc/lib/TypeScript/MLIRGen.cpp +++ b/tsc/lib/TypeScript/MLIRGen.cpp @@ -23044,6 +23044,7 @@ genContext); {"TypeOf", true }, {"Opaque", true }, // to support void* {"Reference", true }, // to support dll import + {"Ref", true }, // alias of Reference {"Readonly", true }, {"Partial", true }, {"Required", true }, @@ -23131,6 +23132,7 @@ genContext); {"TypeOf", true }, {"Opaque", true }, // to support void* {"Reference", true }, // to support dll import + {"Ref", true }, // alias of Reference {"ThisType", true }, //{"Array", true } }; @@ -23293,7 +23295,7 @@ genContext); type = mth.wideStorageType(type); return type; }) - .Case("Reference", [&] (auto typeArguments, auto genContext) { + .Cases("Reference", "Ref", [&] (auto typeArguments, auto genContext) { auto type = getFirstTypeFromTypeArguments(typeArguments, genContext); if (!type) { @@ -23442,7 +23444,7 @@ genContext); type = mth.wideStorageType(type); return type; }) - .Case("Reference", [&] (auto typeArguments, auto genContext) { + .Cases("Reference", "Ref", [&] (auto typeArguments, auto genContext) { auto type = getFirstTypeFromTypeArguments(typeArguments, genContext); return mlir_ts::RefType::get(type); }) diff --git a/tsc/test/tester/tests/00reference_ref_deref.ts b/tsc/test/tester/tests/00reference_ref_deref.ts new file mode 100644 index 000000000..4da7f3646 --- /dev/null +++ b/tsc/test/tester/tests/00reference_ref_deref.ts @@ -0,0 +1,11 @@ +// @strict-null false + +let a = [1, 2, 3]; + +const pa: Ref> = Ref(a[0]); + +assert(Deref(pa[0]) == 1); +assert(Deref(pa[1]) == 2); +assert(Deref(pa[2]) == 3); + +print("done."); From 9dc73c3ec2f965907d3d2c60748084b398eced9d Mon Sep 17 00:00:00 2001 From: ASDAlexander77 Date: Sun, 28 Jun 2026 00:58:23 +0100 Subject: [PATCH 60/60] Increase parallel build jobs to 20 for debug and release scripts, and remove deprecated Visual Studio 2022 build script --- scripts/build_gc_debug_vs.bat | 2 +- scripts/build_gc_debug_vs17.bat | 8 -------- scripts/build_llvm_debug_vs.bat | 2 +- scripts/build_llvm_release_vs.bat | 2 +- 4 files changed, 3 insertions(+), 11 deletions(-) delete mode 100644 scripts/build_gc_debug_vs17.bat diff --git a/scripts/build_gc_debug_vs.bat b/scripts/build_gc_debug_vs.bat index 99eb53de4..494c6bfbc 100644 --- a/scripts/build_gc_debug_vs.bat +++ b/scripts/build_gc_debug_vs.bat @@ -2,6 +2,6 @@ pushd mkdir __build\gc\msbuild\x64\debug cd __build\gc\msbuild\x64\debug cmake ../../../../../3rdParty/gc-8.2.8 -G "Visual Studio 18 2026" -A x64 %EXTRA_PARAM% -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/debug -Denable_threads=ON -Denable_cplusplus=OFF -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreadedDebug -cmake --build . --config Debug -j 8 +cmake --build . --config Debug -j 20 cmake --install . --config Debug popd \ No newline at end of file diff --git a/scripts/build_gc_debug_vs17.bat b/scripts/build_gc_debug_vs17.bat deleted file mode 100644 index 59371c946..000000000 --- a/scripts/build_gc_debug_vs17.bat +++ /dev/null @@ -1,8 +0,0 @@ -pushd -mkdir __build\gc\msbuild\x64\debug -cd __build\gc\msbuild\x64\debug -if exist "C:/Program Files/Microsoft Visual Studio/2022/Professional" set EXTRA_PARAM=-DCMAKE_GENERATOR_INSTANCE="C:/Program Files/Microsoft Visual Studio/2022/Professional" -cmake ../../../../../3rdParty/gc-8.2.8 -G "Visual Studio 17 2022" -A x64 %EXTRA_PARAM% -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF -Wno-dev -DCMAKE_INSTALL_PREFIX=../../../../../3rdParty/gc/x64/debug -Denable_threads=ON -Denable_cplusplus=OFF -cmake --build . --config Debug -j 8 -cmake --install . --config Debug -popd \ No newline at end of file diff --git a/scripts/build_llvm_debug_vs.bat b/scripts/build_llvm_debug_vs.bat index aca3dd719..b5d70113e 100644 --- a/scripts/build_llvm_debug_vs.bat +++ b/scripts/build_llvm_debug_vs.bat @@ -1,5 +1,5 @@ pushd cd __build\llvm\msbuild\x64\debug -cmake --build . --config Debug --target install +cmake --build . --config Debug --target install -j 20 cmake --install . --config Debug popd \ No newline at end of file diff --git a/scripts/build_llvm_release_vs.bat b/scripts/build_llvm_release_vs.bat index 24d135850..805069f94 100644 --- a/scripts/build_llvm_release_vs.bat +++ b/scripts/build_llvm_release_vs.bat @@ -1,5 +1,5 @@ pushd cd __build\llvm\msbuild\x64\release -cmake --build . --config Release --target install -j 8 +cmake --build . --config Release --target install -j 20 cmake --install . --config Release popd \ No newline at end of file