Skip to content

Fix accounting of interpreter call depth not to double-count calls in… #3

Fix accounting of interpreter call depth not to double-count calls in…

Fix accounting of interpreter call depth not to double-count calls in… #3

# Part of the EDG Compiler Project, under the Apache License v2.0 with LLVM
# Exceptions.
# See https://edgcpp.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
# Configure and build the standard release and debug presets on GitHub-hosted
# runners. Linux GCC/Clang builds treat CPFE warnings as errors.
name: Strict Build Check
on:
push:
branches:
- main
pull_request:
jobs:
windows-msvc-release:
name: Windows MSVC release
runs-on: windows-latest
timeout-minutes: 120
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Install Ninja
run: choco install ninja -y
- name: Read SoftFloat commit pin
id: softfloat-pin
shell: bash
run: |
echo "commit=$(tr -d '[:space:]' < dev_tools/docker/softfloat/SOFTFLOAT_COMMIT)" \
>> "${GITHUB_OUTPUT}"
- name: Cache SoftFloat
id: cache-softfloat
uses: actions/cache@v6
with:
path: softfloat
key: softfloat-msvc-win-${{ steps.softfloat-pin.outputs.commit }}
- name: Set up MSVC developer environment
uses: ilammy/msvc-dev-cmd@v1
- name: Build SoftFloat (MSVC)
if: steps.cache-softfloat.outputs.cache-hit != 'true'
shell: bash
run: |
set -euo pipefail
commit="${{ steps.softfloat-pin.outputs.commit }}"
mkdir softfloat-src
git -C softfloat-src init
git -C softfloat-src remote add origin \
https://github.com/ucb-bar/berkeley-softfloat-3.git
git -C softfloat-src fetch --depth 1 origin "${commit}"
git -C softfloat-src checkout FETCH_HEAD
# EDG Windows SoftFloat build: cl + lib (not MinGW). Emit MSVC
# platform bits inline; derive sources.rsp from upstream's
# Win32-SSE2-MinGW Makefile (8086-SSE / non-FAST_INT64).
build_dir=softfloat-src/build/Win-MSVC
mkdir -p "${build_dir}"
cat > "${build_dir}/platform.h" <<'EOF'
/*============================================================================
MSVC platform header for SoftFloat. Keep free of GCC-only opts
(opts-GCC.h, SOFTFLOAT_BUILTIN_CLZ, SOFTFLOAT_INTRINSIC_INT128).
=============================================================================*/
#define LITTLEENDIAN 1
#ifdef _MSC_VER
#define INLINE static __inline
#else
#define INLINE static inline
#endif
EOF
# Strip the leading spaces YAML left in the heredoc body.
sed -i 's/^ //' "${build_dir}/platform.h"
cat > "${build_dir}/build.bat" <<'EOF'
REM In place of a Makefile, use this batch file to create softfloat.lib
REM Source paths live in sources.rsp to avoid CreateProcess length limits.
set LIB=softfloat.lib
set SOFTFLOAT_OPTS=-DSOFTFLOAT_ROUND_ODD -DINLINE_LEVEL=5 -DSOFTFLOAT_FAST_DIV32TO16 -DSOFTFLOAT_FAST_DIV64TO32
set SPECIALIZE_TYPE=8086-SSE
set SOURCE=..\..\source
set S=%SOURCE%\
set P=%SOURCE%\%SPECIALIZE_TYPE%\
del *.obj %LIB% 2>nul
cl -nologo -c -O2 -I. -I%S% -I%P% -I%S%include %SOFTFLOAT_OPTS% @sources.rsp
if errorlevel 1 exit /b 1
lib -nologo /out:%LIB% *.obj
if errorlevel 1 exit /b 1
EOF
sed -i 's/^ //' "${build_dir}/build.bat"
python - <<'PY'
import re
from pathlib import Path
makefile = Path(
'softfloat-src/build/Win32-SSE2-MinGW/Makefile'
).read_text()
def section(name):
match = re.search(
rf'{name}\s*=\s*((?:.*\\\n)*.*)', makefile
)
return re.findall(r'(\w+)\$\(OBJ\)', match.group(1))
paths = (
[fr'..\..\source\{n}.c' for n in section('OBJS_PRIMITIVES')]
+ [
fr'..\..\source\8086-SSE\{n}.c'
for n in section('OBJS_SPECIALIZE')
]
+ [fr'..\..\source\{n}.c' for n in section('OBJS_OTHERS')]
)
Path('softfloat-src/build/Win-MSVC/sources.rsp').write_text(
'\r\n'.join(paths) + '\r\n'
)
PY
cmd.exe //C "cd softfloat-src\\build\\Win-MSVC && build.bat"
mkdir -p softfloat/include softfloat/lib
cp softfloat-src/source/include/softfloat.h \
softfloat-src/source/include/softfloat_types.h \
softfloat/include/
cp softfloat-src/build/Win-MSVC/softfloat.lib softfloat/lib/
- name: Configure windows-msvc-release
env:
EDG_SOFTFLOAT_INCLUDE_PATH: ${{ github.workspace }}/softfloat/include
EDG_SOFTFLOAT_LIB_PATH: ${{ github.workspace }}/softfloat/lib/softfloat.lib
run: cmake --preset windows-msvc-release
- name: Build windows-msvc-release
env:
EDG_SOFTFLOAT_INCLUDE_PATH: ${{ github.workspace }}/softfloat/include
EDG_SOFTFLOAT_LIB_PATH: ${{ github.workspace }}/softfloat/lib/softfloat.lib
run: cmake --build build/msvc-release
linux-gcc-release:
name: Linux GCC release
runs-on: ubuntu-latest
timeout-minutes: 120
container:
image: docker.io/edgcpp/ci-runner:latest
defaults:
run:
shell: edg-container-exec "bash -eo pipefail {0}"
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Configure linux-gcc-release
env:
EDG_BASE: ${{ github.workspace }}/bases/docker/dev-env/gcc
run: >
cmake --preset linux-gcc-release
-DEDG_CPFE_WARNINGS_ARE_ERRORS=true
- name: Build linux-gcc-release
env:
EDG_BASE: ${{ github.workspace }}/bases/docker/dev-env/gcc
run: cmake --build build/gcc-release
linux-gcc-debug:
name: Linux GCC debug
runs-on: ubuntu-latest
timeout-minutes: 120
container:
image: docker.io/edgcpp/ci-runner:latest
defaults:
run:
shell: edg-container-exec "bash -eo pipefail {0}"
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Configure linux-gcc-debug
env:
EDG_BASE: ${{ github.workspace }}/bases/docker/dev-env/gcc
run: >
cmake --preset linux-gcc-debug
-DEDG_CPFE_WARNINGS_ARE_ERRORS=true
- name: Build linux-gcc-debug
env:
EDG_BASE: ${{ github.workspace }}/bases/docker/dev-env/gcc
run: cmake --build build/gcc
linux-clang-release:
name: Linux Clang release
runs-on: ubuntu-latest
timeout-minutes: 120
container:
image: docker.io/edgcpp/ci-runner:latest
defaults:
run:
shell: edg-container-exec "bash -eo pipefail {0}"
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Configure linux-clang-release
env:
EDG_BASE: ${{ github.workspace }}/bases/docker/dev-env/gcc
run: >
cmake --preset linux-clang-release
-DEDG_CPFE_WARNINGS_ARE_ERRORS=true
- name: Build linux-clang-release
env:
EDG_BASE: ${{ github.workspace }}/bases/docker/dev-env/gcc
run: cmake --build build/clang-release
linux-clang-debug:
name: Linux Clang debug
runs-on: ubuntu-latest
timeout-minutes: 120
container:
image: docker.io/edgcpp/ci-runner:latest
defaults:
run:
shell: edg-container-exec "bash -eo pipefail {0}"
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Configure linux-clang-debug
env:
EDG_BASE: ${{ github.workspace }}/bases/docker/dev-env/gcc
run: >
cmake --preset linux-clang-debug
-DEDG_CPFE_WARNINGS_ARE_ERRORS=true
- name: Build linux-clang-debug
env:
EDG_BASE: ${{ github.workspace }}/bases/docker/dev-env/gcc
run: cmake --build build/clang