Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 0 additions & 34 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -421,40 +421,6 @@ jobs:
with:
gcov: true

# Duplicates build-asan. Please keep in sync
build-cxx20:
name: c++20
# Make sure we can still build on older Ubuntu
runs-on: ubuntu-22.04
env:
CC: "gcc"
CXX: "g++"
steps:
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- uses: actions/checkout@v4
with:
submodules: true
- name: install ninja
run: sudo apt-get install ninja-build
- name: install v8
run: |
npm install jsvu -g
jsvu --os=default --engines=v8
- name: install Python dev dependencies
run: pip3 install -r requirements-dev.txt
- name: cmake
run: |
mkdir -p out
cmake -S . -B out -G Ninja -DCMAKE_INSTALL_PREFIX=out/install -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=20
- name: build
run: cmake --build out
- name: test
run: |
python check.py --binaryen-bin=out/bin lit
python check.py --binaryen-bin=out/bin gtest

# Ensures we can build in no-asserts mode (just building).
build-noasserts:
name: noasserts
Expand Down
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ full changeset diff at the end of each section.

Current Trunk
-------------
- The c api now has separate functions for `CallRef` and `ReturnCallRef` matching the semantics of `Call` and `ReturnCall`.
- The c api now has separate functions for `CallRef` and `ReturnCallRef`
matching the semantics of `Call` and `ReturnCall`.
- Binaryen now uses C++20, therefore requires a C++20 compliant compiler.

v125
----
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include(GNUInstallDirs)
# The C++ standard whose features are required to build Binaryen.
# Keep in sync with scripts/test/shared.py cxx_standard
# The if condition allows embedding in a project with a higher default C++ standard set
set(REQUIRED_CXX_STANDARD 17)
set(REQUIRED_CXX_STANDARD 20)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD ${REQUIRED_CXX_STANDARD})
elseif(CMAKE_CXX_STANDARD LESS ${REQUIRED_CXX_STANDARD})
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,9 @@ After that you can build with CMake:
cmake . && make
```

A C++17 compiler is required. On macOS, you need to install `cmake`, for example, via `brew install cmake`. Note that you can also use `ninja` as your generator: `cmake -G Ninja . && ninja`.
A C++20 compiler is required. On macOS, you need to install `cmake`, for
example, via `brew install cmake`. Note that you can also use `ninja` as your
generator: `cmake -G Ninja . && ninja`.

To avoid the gtest dependency, you can pass `-DBUILD_TESTS=OFF` to cmake.

Expand Down
2 changes: 1 addition & 1 deletion scripts/test/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

# The C++ standard whose features are required to build Binaryen.
# Keep in sync with CMakeLists.txt CXX_STANDARD
cxx_standard = 17
cxx_standard = 20


def parse_args(args):
Expand Down
20 changes: 10 additions & 10 deletions src/ir/module-splitting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,9 @@ void ModuleSplitter::classifyFunctions() {
// module since that would make them async when they may not have the JSPI
// wrapper. Exported JSPI functions can still benefit from splitting though
// since only the JSPI wrapper stub will remain in the primary module.
if (func->imported() || !configSecondaryFuncs.count(func->name) ||
if (func->imported() || !configSecondaryFuncs.contains(func->name) ||
(config.jspi && ExportUtils::isExported(primary, *func)) ||
segmentReferrers.count(func->name)) {
segmentReferrers.contains(func->name)) {
primaryFuncs.insert(func->name);
} else {
assert(func->name != primary.start && "The start function must be kept");
Expand Down Expand Up @@ -520,7 +520,7 @@ void ModuleSplitter::moveSecondaryFunctions() {
for (auto& funcNames : config.secondaryFuncs) {
auto secondary = initSecondary(primary);
for (auto funcName : funcNames) {
if (allSecondaryFuncs.count(funcName)) {
if (allSecondaryFuncs.contains(funcName)) {
auto* func = primary.getFunction(funcName);
ModuleUtils::copyFunction(func, *secondary);
primary.removeFunction(funcName);
Expand Down Expand Up @@ -567,7 +567,7 @@ void ModuleSplitter::thunkExportedSecondaryFunctions() {
Builder builder(primary);
for (auto& ex : primary.exports) {
if (ex->kind != ExternalKind::Function ||
!allSecondaryFuncs.count(*ex->getInternalName())) {
!allSecondaryFuncs.contains(*ex->getInternalName())) {
continue;
}
Name trampoline = getTrampoline(*ex->getInternalName());
Expand Down Expand Up @@ -609,7 +609,7 @@ void ModuleSplitter::indirectReferencesToSecondaryFunctions() {
// 1. ref.func's target func is in one of the secondary modules and
// 2. the current module is a different module (either the primary module
// or a different secondary module)
if (parent.allSecondaryFuncs.count(curr->func) &&
if (parent.allSecondaryFuncs.contains(curr->func) &&
(currModule == &parent.primary ||
parent.secondaries.at(parent.funcToSecondaryIndex.at(curr->func))
.get() != currModule)) {
Expand Down Expand Up @@ -645,7 +645,7 @@ void ModuleSplitter::indirectReferencesToSecondaryFunctions() {
std::vector<RefFunc*> relevantRefFuncs;
for (auto* refFunc : refFuncs) {
assert(refFunc->func == name);
if (!ignore.count(refFunc)) {
if (!ignore.contains(refFunc)) {
relevantRefFuncs.push_back(refFunc);
}
}
Expand All @@ -669,7 +669,7 @@ void ModuleSplitter::indirectCallsToSecondaryFunctions() {
CallIndirector(ModuleSplitter& parent) : parent(parent) {}
void visitCall(Call* curr) {
// Return if the call's target is not in one of the secondary module.
if (!parent.allSecondaryFuncs.count(curr->target)) {
if (!parent.allSecondaryFuncs.contains(curr->target)) {
return;
}
// Return if the current module is the same module as the call's target,
Expand Down Expand Up @@ -719,12 +719,12 @@ void ModuleSplitter::exportImportCalledPrimaryFunctions() {
: primaryFuncs(primaryFuncs),
calledPrimaryToModules(calledPrimaryToModules) {}
void visitCall(Call* curr) {
if (primaryFuncs.count(curr->target)) {
if (primaryFuncs.contains(curr->target)) {
calledPrimaryToModules[curr->target].insert(getModule());
}
}
void visitRefFunc(RefFunc* curr) {
if (primaryFuncs.count(curr->func)) {
if (primaryFuncs.contains(curr->func)) {
calledPrimaryToModules[curr->func].insert(getModule());
}
}
Expand Down Expand Up @@ -760,7 +760,7 @@ void ModuleSplitter::setupTablePatching() {
if (!ref) {
return;
}
if (!allSecondaryFuncs.count(ref->func)) {
if (!allSecondaryFuncs.contains(ref->func)) {
return;
}
assert(table == tableManager.activeTable->name);
Expand Down
Loading